gmb_tools_sysinfo_get

Get system info.

Description

(string) gmb_tools_sysinfo_get(); 

Returns (string)

$return A string containing the info to output


Usage

  1. if ( !function_exists( 'gmb_tools_sysinfo_get' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/includes/admin/system-info.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gmb_tools_sysinfo_get(); 
  7.  

Defined (2)

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

/includes/admin/system-info.php  
  1. function gmb_tools_sysinfo_get() { 
  2. global $wpdb, $gmb_options; 
  3.  
  4. if ( ! class_exists( 'Browser' ) ) { 
  5. require_once GMB_PLUGIN_PATH . 'includes/libraries/browser.php'; 
  6.  
  7. $browser = new Browser(); 
  8.  
  9. // Get theme info 
  10. if ( get_bloginfo( 'version' ) < '3.4' ) { 
  11. $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); 
  12. $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; 
  13. } else { 
  14. $theme_data = wp_get_theme(); 
  15. $theme = $theme_data->Name . ' ' . $theme_data->Version; 
  16.  
  17. // Try to identify the hosting provider 
  18. $host = gmb_get_host(); 
  19.  
  20. $return = '### Begin System Info ###' . "\n\n"; 
  21.  
  22. // Start with the basics... 
  23. $return .= '-- Site Info' . "\n\n"; 
  24. $return .= 'Site URL: ' . site_url() . "\n"; 
  25. $return .= 'Home URL: ' . home_url() . "\n"; 
  26. $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; 
  27.  
  28. $return = apply_filters( 'gmb_sysinfo_after_site_info', $return ); 
  29.  
  30. // Can we determine the site's host? 
  31. if ( $host ) { 
  32. $return .= "\n" . '-- Hosting Provider' . "\n\n"; 
  33. $return .= 'Host: ' . $host . "\n"; 
  34.  
  35. $return = apply_filters( 'gmb_sysinfo_after_host_info', $return ); 
  36.  
  37. // The local users'browserinformation, handled by the Browser class 
  38. $return .= "\n" . '-- User Browser' . "\n\n"; 
  39. $return .= $browser; 
  40.  
  41. $return = apply_filters( 'gmb_sysinfo_after_user_browser', $return ); 
  42.  
  43. // WordPress configuration 
  44. $return .= "\n" . '-- WordPress Configuration' . "\n\n"; 
  45. $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; 
  46. $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; 
  47. $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; 
  48. $return .= 'Active Theme: ' . $theme . "\n"; 
  49. $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; 
  50.  
  51. // Only show page specs if frontpage is set to 'page' 
  52. if ( get_option( 'show_on_front' ) == 'page' ) { 
  53. $front_page_id = get_option( 'page_on_front' ); 
  54. $blog_page_id = get_option( 'page_for_posts' ); 
  55.  
  56. $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; 
  57. $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; 
  58.  
  59. // Make sure wp_remote_post() is working 
  60. $request['cmd'] = '_notify-validate'; 
  61.  
  62. $params = array( 
  63. 'sslverify' => false,  
  64. 'timeout' => 60,  
  65. 'user-agent' => 'Maps Builder/' . GMB_VERSION,  
  66. 'body' => $request 
  67. ); 
  68.  
  69. $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); 
  70.  
  71. if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { 
  72. $WP_REMOTE_POST = 'wp_remote_post() works'; 
  73. } else { 
  74. $WP_REMOTE_POST = 'wp_remote_post() does not work'; 
  75.  
  76. $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; 
  77. $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? ERROR Too long' : 'Acceptable' ) . "\n"; 
  78. $return .= 'Admin AJAX: ' . ( gmb_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; 
  79. $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; 
  80. $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; 
  81. $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; 
  82.  
  83. $return = apply_filters( 'gmb_sysinfo_after_wordpress_config', $return ); 
  84.  
  85. // GMB configuration 
  86. $return .= "\n" . '-- Maps Builder Configuration' . "\n\n"; 
  87. $return .= 'Version: ' . GMB_VERSION . "\n"; 
  88. $return .= 'Upgraded From: ' . get_option( 'gmb_version_upgraded_from', 'None' ) . "\n"; 
  89.  
  90. $return = apply_filters( 'gmb_sysinfo_after_gmb_config', $return ); 
  91.  
  92.  
  93. // Must-use plugins 
  94. $muplugins = get_mu_plugins(); 
  95. if ( count( $muplugins > 0 ) ) { 
  96. $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; 
  97.  
  98. foreach ( $muplugins as $plugin => $plugin_data ) { 
  99. $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; 
  100.  
  101. $return = apply_filters( 'gmb_sysinfo_after_wordpress_mu_plugins', $return ); 
  102.  
  103. // WordPress active plugins 
  104. $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; 
  105.  
  106. $plugins = get_plugins(); 
  107. $active_plugins = get_option( 'active_plugins', array() ); 
  108.  
  109. foreach ( $plugins as $plugin_path => $plugin ) { 
  110. if ( ! in_array( $plugin_path, $active_plugins ) ) { 
  111. continue; 
  112.  
  113. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  114.  
  115. $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins', $return ); 
  116.  
  117. // WordPress inactive plugins 
  118. $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; 
  119.  
  120. foreach ( $plugins as $plugin_path => $plugin ) { 
  121. if ( in_array( $plugin_path, $active_plugins ) ) { 
  122. continue; 
  123.  
  124. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  125.  
  126. $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins_inactive', $return ); 
  127.  
  128. if ( is_multisite() ) { 
  129. // WordPress Multisite active plugins 
  130. $return .= "\n" . '-- Network Active Plugins' . "\n\n"; 
  131.  
  132. $plugins = wp_get_active_network_plugins(); 
  133. $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); 
  134.  
  135. foreach ( $plugins as $plugin_path ) { 
  136. $plugin_base = plugin_basename( $plugin_path ); 
  137.  
  138. if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { 
  139. continue; 
  140.  
  141. $plugin = get_plugin_data( $plugin_path ); 
  142. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  143.  
  144. $return = apply_filters( 'gmb_sysinfo_after_wordpress_ms_plugins', $return ); 
  145.  
  146. // Server configuration (really just versioning) 
  147. $return .= "\n" . '-- Webserver Configuration' . "\n\n"; 
  148. $return .= 'PHP Version: ' . PHP_VERSION . "\n"; 
  149. $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; 
  150. $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; 
  151.  
  152. $return = apply_filters( 'gmb_sysinfo_after_webserver_config', $return ); 
  153.  
  154. // PHP configs... now we're getting to the important stuff 
  155. $return .= "\n" . '-- PHP Configuration' . "\n\n"; 
  156. $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); 
  157. $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; 
  158. $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; 
  159. $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; 
  160. $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; 
  161. $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; 
  162. $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; 
  163. $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; 
  164.  
  165. $return = apply_filters( 'gmb_sysinfo_after_php_config', $return ); 
  166.  
  167. // PHP extensions and such 
  168. $return .= "\n" . '-- PHP Extensions' . "\n\n"; 
  169. $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; 
  170. $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; 
  171. $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; 
  172. $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; 
  173.  
  174. $return = apply_filters( 'gmb_sysinfo_after_php_ext', $return ); 
  175.  
  176.  
  177. // The rest of this is only relevant is session is enabled 
  178. if ( isset( $_SESSION ) ) { 
  179. $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; 
  180. $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; 
  181. $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; 
  182. $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; 
  183. $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; 
  184.  
  185. $return = apply_filters( 'gmb_sysinfo_after_session_config', $return ); 
  186.  
  187. $return .= "\n" . '### End System Info ###'; 
  188.  
  189. return $return; 
/vendor/wordimpress/maps-builder-core/includes/admin/system-info.php  
  1. function gmb_tools_sysinfo_get() { 
  2. global $wpdb, $gmb_options; 
  3.  
  4. if ( ! class_exists( 'Browser' ) ) { 
  5. require_once GMB_CORE_PATH . 'includes/libraries/browser.php'; 
  6.  
  7. $browser = new Browser(); 
  8.  
  9. // Get theme info 
  10. if ( get_bloginfo( 'version' ) < '3.4' ) { 
  11. $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); 
  12. $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; 
  13. } else { 
  14. $theme_data = wp_get_theme(); 
  15. $theme = $theme_data->Name . ' ' . $theme_data->Version; 
  16.  
  17. // Try to identify the hosting provider 
  18. $host = gmb_get_host(); 
  19.  
  20. $return = '### Begin System Info ###' . "\n\n"; 
  21.  
  22. // Start with the basics... 
  23. $return .= '-- Site Info' . "\n\n"; 
  24. $return .= 'Site URL: ' . site_url() . "\n"; 
  25. $return .= 'Home URL: ' . home_url() . "\n"; 
  26. $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; 
  27.  
  28. $return = apply_filters( 'gmb_sysinfo_after_site_info', $return ); 
  29.  
  30. // Can we determine the site's host? 
  31. if ( $host ) { 
  32. $return .= "\n" . '-- Hosting Provider' . "\n\n"; 
  33. $return .= 'Host: ' . $host . "\n"; 
  34.  
  35. $return = apply_filters( 'gmb_sysinfo_after_host_info', $return ); 
  36.  
  37. // The local users'browserinformation, handled by the Browser class 
  38. $return .= "\n" . '-- User Browser' . "\n\n"; 
  39. $return .= $browser; 
  40.  
  41. $return = apply_filters( 'gmb_sysinfo_after_user_browser', $return ); 
  42.  
  43. // WordPress configuration 
  44. $return .= "\n" . '-- WordPress Configuration' . "\n\n"; 
  45. $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; 
  46. $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; 
  47. $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; 
  48. $return .= 'Active Theme: ' . $theme . "\n"; 
  49. $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; 
  50.  
  51. // Only show page specs if frontpage is set to 'page' 
  52. if ( get_option( 'show_on_front' ) == 'page' ) { 
  53. $front_page_id = get_option( 'page_on_front' ); 
  54. $blog_page_id = get_option( 'page_for_posts' ); 
  55.  
  56. $return .= 'Page On Front: ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; 
  57. $return .= 'Page For Posts: ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; 
  58.  
  59. // Make sure wp_remote_post() is working 
  60. $request['cmd'] = '_notify-validate'; 
  61.  
  62. $params = array( 
  63. 'sslverify' => false,  
  64. 'timeout' => 60,  
  65. 'user-agent' => 'Maps Builder/' . GMB_VERSION,  
  66. 'body' => $request 
  67. ); 
  68.  
  69. $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); 
  70.  
  71. if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { 
  72. $WP_REMOTE_POST = 'wp_remote_post() works'; 
  73. } else { 
  74. $WP_REMOTE_POST = 'wp_remote_post() does not work'; 
  75.  
  76. $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; 
  77. $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? ERROR Too long' : 'Acceptable' ) . "\n"; 
  78. $return .= 'Admin AJAX: ' . ( gmb_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n"; 
  79. $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; 
  80. $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; 
  81. $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; 
  82.  
  83. $return = apply_filters( 'gmb_sysinfo_after_wordpress_config', $return ); 
  84.  
  85. // GMB configuration 
  86. $return .= "\n" . '-- Maps Builder Configuration' . "\n\n"; 
  87. $return .= 'Version: ' . GMB_VERSION . "\n"; 
  88. $return .= 'Upgraded From: ' . get_option( 'gmb_version_upgraded_from', 'None' ) . "\n"; 
  89.  
  90. $return = apply_filters( 'gmb_sysinfo_after_gmb_config', $return ); 
  91.  
  92.  
  93. // Must-use plugins 
  94. $muplugins = get_mu_plugins(); 
  95. if ( count( $muplugins > 0 ) ) { 
  96. $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; 
  97.  
  98. foreach ( $muplugins as $plugin => $plugin_data ) { 
  99. $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; 
  100.  
  101. $return = apply_filters( 'gmb_sysinfo_after_wordpress_mu_plugins', $return ); 
  102.  
  103. // WordPress active plugins 
  104. $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; 
  105.  
  106. $plugins = get_plugins(); 
  107. $active_plugins = get_option( 'active_plugins', array() ); 
  108.  
  109. foreach ( $plugins as $plugin_path => $plugin ) { 
  110. if ( ! in_array( $plugin_path, $active_plugins ) ) { 
  111. continue; 
  112.  
  113. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  114.  
  115. $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins', $return ); 
  116.  
  117. // WordPress inactive plugins 
  118. $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; 
  119.  
  120. foreach ( $plugins as $plugin_path => $plugin ) { 
  121. if ( in_array( $plugin_path, $active_plugins ) ) { 
  122. continue; 
  123.  
  124. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  125.  
  126. $return = apply_filters( 'gmb_sysinfo_after_wordpress_plugins_inactive', $return ); 
  127.  
  128. if ( is_multisite() ) { 
  129. // WordPress Multisite active plugins 
  130. $return .= "\n" . '-- Network Active Plugins' . "\n\n"; 
  131.  
  132. $plugins = wp_get_active_network_plugins(); 
  133. $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); 
  134.  
  135. foreach ( $plugins as $plugin_path ) { 
  136. $plugin_base = plugin_basename( $plugin_path ); 
  137.  
  138. if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { 
  139. continue; 
  140.  
  141. $plugin = get_plugin_data( $plugin_path ); 
  142. $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; 
  143.  
  144. $return = apply_filters( 'gmb_sysinfo_after_wordpress_ms_plugins', $return ); 
  145.  
  146. // Server configuration (really just versioning) 
  147. $return .= "\n" . '-- Webserver Configuration' . "\n\n"; 
  148. $return .= 'PHP Version: ' . PHP_VERSION . "\n"; 
  149. $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; 
  150. $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; 
  151.  
  152. $return = apply_filters( 'gmb_sysinfo_after_webserver_config', $return ); 
  153.  
  154. // PHP configs... now we're getting to the important stuff 
  155. $return .= "\n" . '-- PHP Configuration' . "\n\n"; 
  156. $return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); 
  157. $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; 
  158. $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; 
  159. $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; 
  160. $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; 
  161. $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; 
  162. $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; 
  163. $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; 
  164.  
  165. $return = apply_filters( 'gmb_sysinfo_after_php_config', $return ); 
  166.  
  167. // PHP extensions and such 
  168. $return .= "\n" . '-- PHP Extensions' . "\n\n"; 
  169. $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; 
  170. $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; 
  171. $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n"; 
  172. $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; 
  173.  
  174. $return = apply_filters( 'gmb_sysinfo_after_php_ext', $return ); 
  175.  
  176.  
  177. // The rest of this is only relevant is session is enabled 
  178. if ( isset( $_SESSION ) ) { 
  179. $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; 
  180. $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; 
  181. $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; 
  182. $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; 
  183. $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; 
  184.  
  185. $return = apply_filters( 'gmb_sysinfo_after_session_config', $return ); 
  186.  
  187. $return .= "\n" . '### End System Info ###'; 
  188.  
  189. return $return;