NF_Admin_Menus_SystemStatus

The Ninja Forms NF Admin Menus SystemStatus class.

Defined (1)

The class is defined in the following location(s).

/includes/Admin/Menus/SystemStatus.php  
  1. final class NF_Admin_Menus_SystemStatus extends NF_Abstracts_Submenu 
  2. public $parent_slug = 'ninja-forms'; 
  3.  
  4. public $menu_slug = 'nf-system-status'; 
  5.  
  6. public $priority = 12; 
  7.  
  8. public function __construct() 
  9. parent::__construct(); 
  10.  
  11. public function get_page_title() 
  12. return __( 'Get Help', 'ninja-forms' ); 
  13.  
  14. public function get_capability() 
  15. return apply_filters( 'ninja_forms_admin_status_capabilities', $this->capability ); 
  16.  
  17. public function display() 
  18. /** @global wpdb $wpdb */ 
  19. global $wpdb; 
  20.  
  21. wp_enqueue_style( 'nf-admin-system-status', Ninja_Forms::$url . 'assets/css/admin-system-status.css' ); 
  22. wp_enqueue_script( 'nf-admin-system-status-script', Ninja_Forms::$url . 'assets/js/admin-system-status.js', array( 'jquery' ) ); 
  23. //PHP locale 
  24. $locale = localeconv(); 
  25.  
  26. if ( is_multisite() ) { 
  27. $multisite = __( 'Yes', 'ninja-forms' ); 
  28. } else { 
  29. $multisite = __( 'No', 'ninja-forms' ); 
  30.  
  31. //TODO: Possible refactor 
  32. foreach( $locale as $key => $val ) { 
  33. if( is_string( $val ) ) { 
  34. $data = $key . ': ' . $val . '</br>'; 
  35.  
  36. //TODO: Ask if this check is need 
  37. //if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() ); 
  38.  
  39. //WP_DEBUG 
  40. if ( defined('WP_DEBUG') && WP_DEBUG ) { 
  41. $debug = __( 'Yes', 'ninja-forms' ); 
  42. } else { 
  43. $debug = __( 'No', 'ninja-forms' ); 
  44.  
  45. //WPLANG 
  46. if ( defined( 'WPLANG' ) && WPLANG ) { 
  47. $lang = WPLANG; 
  48. } else { 
  49. $lang = __( 'Default', 'ninja-forms' ); 
  50.  
  51. //TODO: Ask if this long list of ini_get checks are need? 
  52.  
  53. // if( function_exists( 'ini_get' ) ) { 
  54. // $get_ini = size_format( ini_get('post_max_size') ); 
  55. // } 
  56.  
  57. //SUHOSIN 
  58. if ( extension_loaded( 'suhosin' ) ) { 
  59. $suhosin = __( 'Yes', 'ninja-forms' ); 
  60. } else { 
  61. $suhosin = __( 'No', 'ninja-forms' ); 
  62.  
  63.  
  64. //Time Zone Check 
  65. //TODO: May need refactored 
  66. $default_timezone = get_option( 'timezone_string' ); 
  67.  
  68. //Check for active plugins 
  69. $active_plugins = (array) get_option( 'active_plugins', array() ); 
  70.  
  71. if ( is_multisite() ) { 
  72. $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); 
  73.  
  74. $all_plugins = array(); 
  75.  
  76. foreach ( $active_plugins as $plugin ) { 
  77. $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 
  78. $dirname = dirname( $plugin ); 
  79. $version_string = ''; 
  80.  
  81. if ( ! empty( $plugin_data['Name'] ) ) { 
  82.  
  83. // link the plugin name to the plugin url if available 
  84. $plugin_name = $plugin_data['Name']; 
  85. if ( ! empty( $plugin_data['PluginURI'] ) ) { 
  86. $plugin_name = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin homepage' , 'ninja-forms' ) . '">' . $plugin_name . '</a>'; 
  87.  
  88. $all_plugins[] = $plugin_name . ' ' . __( 'by', 'ninja-forms' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'ninja-forms' ) . ' ' . $plugin_data['Version'] . $version_string; 
  89.  
  90. if ( sizeof( $all_plugins ) == 0 ) { 
  91. $site_wide_plugins = '-'; 
  92. } else { 
  93. $site_wide_plugins = implode( ', <br/>', $all_plugins ); 
  94.  
  95. $server_ip = ''; 
  96. if( array_key_exists( 'SERVER_ADDR', $_SERVER ) ) 
  97. $server_ip = $_SERVER[ 'SERVER_ADDR' ]; 
  98. elseif( array_key_exists( 'LOCAL_ADDR', $_SERVER ) ) 
  99. $server_ip = $_SERVER[ 'LOCAL_ADDR' ]; 
  100. $host_name = gethostbyaddr( $server_ip ); 
  101.  
  102. $tls = WPN_Helper::get_tls(); 
  103. if ( ! $tls ) $tls = 'unknown'; 
  104.  
  105. //Output array 
  106. $environment = array( 
  107. __( 'Home URL', 'ninja-forms' ) => home_url(),  
  108. __( 'Site URL', 'ninja-forms' ) => site_url(),  
  109. __( 'Ninja Forms Version', 'ninja-forms' ) => esc_html( Ninja_Forms::VERSION ),  
  110. __( 'WP Version', 'ninja-forms' ) => get_bloginfo('version'),  
  111. __( 'WP Multisite Enabled', 'ninja-forms' ) => $multisite,  
  112. __( 'Web Server Info', 'ninja-forms' ) => esc_html( $_SERVER['SERVER_SOFTWARE'] ),  
  113. __( 'TLS Version', 'ninja-forms' ) => $tls,  
  114. __( 'PHP Version', 'ninja-forms' ) => esc_html( phpversion() ),  
  115. //TODO: Possibly Refactor with Ninja forms global $_db? 
  116. __( 'MySQL Version', 'ninja-forms' ) => $wpdb->db_version(),  
  117. __( 'PHP Locale', 'ninja-forms' ) => $data,  
  118. //TODO: Possibly move the ninja_forms_letters_to_numbers function over. 
  119. __( 'WP Memory Limit', 'ninja-forms' ) => WP_MEMORY_LIMIT,  
  120. __( 'WP Debug Mode', 'ninja-forms' ) => $debug,  
  121. __( 'WP Language', 'ninja-forms' ) => $lang,  
  122. __( 'WP Max Upload Size', 'ninja-forms' ) => size_format( wp_max_upload_size() ),  
  123. __('PHP Post Max Size', 'ninja-forms' ) => ini_get( 'post_max_size' ),  
  124. __('Max Input Nesting Level', 'ninja-forms' ) => ini_get('max_input_nesting_level'),  
  125. __('PHP Time Limit', 'ninja-forms' ) => ini_get('max_execution_time'),  
  126. __( 'PHP Max Input Vars', 'ninja-forms' ) => ini_get('max_input_vars'),  
  127. __( 'SUHOSIN Installed', 'ninja-forms' ) => $suhosin,  
  128. __( 'Server IP Address', 'ninja-forms' ) => $server_ip,  
  129. __( 'Host Name', 'ninja-forms' ) => $host_name,  
  130. __( 'SMTP', 'ninja-forms' ) => ini_get('SMTP'),  
  131. __( 'smtp_port', 'ninja-forms' ) => ini_get('smtp_port'),  
  132. __( 'Default Timezone', 'ninja-forms' ) => $default_timezone,  
  133. ); 
  134.  
  135. Ninja_Forms::template( 'admin-menu-system-status.html.php', compact( 'environment', 'site_wide_plugins' ) ); 
  136. } // End Class NF_Admin_SystemStatus