public function get_plugins($site_type, $filtered = true) { $cache_key = 'plugins-' . $filtered . '-' . $site_type; if (isset($this->cache[$cache_key])) { return $this->cache[$cache_key]; } $args = array('website_type' => $site_type); $plugins = $this->make_api_call('plugins', One_And_One_Transience_Manager::CATALOG_PLUGINS . '_' . $site_type, $args); if ($plugins && $filtered) { $plugins_keys = array_keys((array) $plugins); $active_plugins = (array) get_option('active_plugins', array()); $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; foreach ($active_plugins as $plugin) { $parts = explode('/', $plugin); if (in_array($parts[0], $plugins_keys)) { unset($plugins->{$parts}[0]); } } if ($network_plugins) { foreach ($network_plugins as $plugin) { $parts = explode('/', $plugin); if (in_array($parts[0], $plugins_keys)) { unset($plugins->{$parts}[0]); } } } } // Store in cache so we don't need to do all this logic the next time $this->cache[$cache_key] = $plugins; return $plugins; }
/** * Determines whether or not BuddyPress is installed. * * @package s2Member\Utilities * @since 110720 * * @param bool $query_active_plugins Optional. If true, this conditional will query active plugins too. Defaults to true if {@link s2Member\WS_PLUGIN__S2MEMBER_ONLY} is true, else false. * @return bool True if BuddyPress is installed, else false. */ public static function bp_is_installed($query_active_plugins = NULL) { if (defined("BP_VERSION") && did_action("bp_core_loaded")) { return true; } /* Quickest/easiest way to determine. */ /**/ $s2o = defined("WS_PLUGIN__S2MEMBER_ONLY") && WS_PLUGIN__S2MEMBER_ONLY ? true : false; /**/ if ($query_active_plugins = !isset($query_active_plugins) && $s2o ? true : $query_active_plugins) { $buddypress = "buddypress/bp-loader.php"; /* BuddyPress. */ /**/ $active_plugins = is_multisite() ? wp_get_active_network_plugins() : array(); $active_plugins = array_unique(array_merge($active_plugins, wp_get_active_and_valid_plugins())); /**/ foreach ($active_plugins as $active_plugin) { /* Search. */ if (plugin_basename($active_plugin) === $buddypress) { return true; } } /* BuddyPress active. */ } return false; /* Default return false. */ }
/** * Get list of active plugins with a given prefix in the plugin folder path. * * @param string|array $prefix Prefixes you want to retrieve. * * @return array List of plugins with prefix in path. */ public static function get_plugins_with_prefix($prefix) { $full_list = wp_get_active_and_valid_plugins(); if (is_multisite()) { $full_list = array_merge($full_list, wp_get_active_network_plugins()); } $filtered_list = array(); foreach ($full_list as $plugin) { $base = plugin_basename($plugin); if (0 === Tribe__Utils__Array::strpos($base, $prefix)) { $filtered_list[] = $plugin; } } return $filtered_list; }
function wp_get_active_and_valid_plugins() { $plugins = array(); $active_plugins = (array) get_option('active_plugins', array()); // Check for hacks file if the option is enabled if (get_option('hack_file') && file_exists(ABSPATH . 'my-hacks.php')) { _deprecated_file('my-hacks.php', '1.5'); array_unshift($plugins, ABSPATH . 'my-hacks.php'); } if (empty($active_plugins) || wp_installing()) { return $plugins; } $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; foreach ($active_plugins as $plugin) { if (!validate_file($plugin) && '.php' == substr($plugin, -4) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) && (!$network_plugins || !in_array(WP_PLUGIN_DIR . '/' . $plugin, $network_plugins))) { $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } } return $plugins; }
/** * Lists any multisite network plugins. * * @return array */ static function get_network_plugins() { $network_plugins = array(); if (is_multisite() && function_exists('get_plugin_data')) { $plugins_raw = wp_get_active_network_plugins(); foreach ($plugins_raw as $k => $v) { $plugin_details = get_plugin_data($v); $plugin = $plugin_details['Name']; if (!empty($plugin_details['Version'])) { $plugin .= sprintf(' version %s', $plugin_details['Version']); } if (!empty($plugin_details['Author'])) { $plugin .= sprintf(' by %s', $plugin_details['Author']); } if (!empty($plugin_details['AuthorURI'])) { $plugin .= sprintf('(%s)', $plugin_details['AuthorURI']); } $network_plugins[] = $plugin; } } return $network_plugins; }
public static function is_yoast_enabled() { // Assume it's not enabled unless we can prove otherwise... $enabled = false; // Is Yoast WordPress SEO plugin is enabled this single site? (not network-wide) $active_plugins = get_option('active_plugins'); if (in_array("wordpress-seo/wp-seo.php", $active_plugins)) { return true; } if (function_exists('wp_get_active_network_plugins')) { // Is Yoast WordPress SEO plugin is enabled Network-wide? $plugins = wp_get_active_network_plugins(); foreach ($plugins as $key => $plugin) { // cut the last 24 char off each plugin $plugin_name = substr($plugin, -24); // check if it's Yoast plugin if ($plugin_name == 'wordpress-seo/wp-seo.php') { $enabled = true; } } } return $enabled; }
/** * Get the information about this wordpress install * * @access public * @return string $output The HTMl output. */ function msa_get_system_info() { global $wp_version; if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); } else { $theme_data = wp_get_theme(); } $white_space = ' '; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); $inactive_plugins_data = array(); $active_plugins_data = array(); $network_activated_plugins_data = array(); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins, true)) { $inactive_plugins_data[] = $plugin['Name'] . ': ' . $plugin['Version']; } else { $active_plugins_data[] = $plugin['Name'] . ': ' . $plugin['Version']; } } if (is_multisite()) { $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); $network_activated_plugins_data[] = $plugin['Name'] . ' :' . $plugin['Version']; } } $web_server_info = ''; if (isset($_SERVER['SERVER_SOFTWARE'])) { // Input var okay. $web_server_info = sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'])); // Input var okay. } return array(array(array('name' => 'Site URL', 'value' => site_url()), array('name' => 'Home URL', 'value' => home_url()), array('name' => 'Admin URL', 'value' => admin_url())), array(array('name' => 'WordPress Version', 'value' => $wp_version), array('name' => 'Permalink Structure', 'value' => get_option('permalink_structure')), array('name' => 'WP_DEBUG', 'value' => defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set'), array('name' => 'Registered Post Stati', 'value' => implode("\n" . $white_space, get_post_stati())), array('name' => 'Active Plugins', 'value' => implode("\n" . $white_space, $active_plugins_data)), array('name' => 'Inactive Plugins', 'value' => implode("\n" . $white_space, $inactive_plugins_data)), array('name' => 'Network Activated Plugins', 'value' => implode("\n" . $white_space, $network_activated_plugins_data))), array(array('name' => 'My Site Audit Version', 'value' => MY_SITE_AUDIT_VERSION)), array(array('name' => 'PHP Version', 'value' => PHP_VERSION), array('name' => 'Web Server Info', 'value' => $web_server_info), array('name' => 'WordPress Memory Limit', 'value' => WP_MEMORY_LIMIT), array('name' => 'PHP Safe Mode', 'value' => ini_get('safe_mode') ? __('Yes', 'msa') : __('No', 'msa')), array('name' => 'PHP Memory Limit', 'value' => ini_get('memory_limit')), array('name' => 'PHP Upload Max Size', 'value' => ini_get('upload_max_filesize')), array('name' => 'PHP Post Max Size', 'value' => ini_get('post_max_size')), array('name' => 'PHP Upload Max File-size', 'value' => ini_get('upload_max_filesize')), array('name' => 'PHP Time Limit', 'value' => ini_get('max_execution_time')), array('name' => 'PHP Max Input Vars', 'value' => ini_get('max_input_vars')), array('name' => 'PHP Arg Separator', 'value' => ini_get('arg_separator.output')), array('name' => 'PHP Allow URL File Open', 'value' => ini_get('allow_url_fopen') ? __('Yes', 'msa') : __('No', 'msa')))); }
private function _getNetworkActivePlugins() { if (!is_multisite()) { return ''; } $_aPluginList = array(); $_aActivePlugins = get_site_option('active_sitewide_plugins', array()); foreach (wp_get_active_network_plugins() as $_sPluginPath) { if (!array_key_exists(plugin_basename($_sPluginPath), $_aActivePlugins)) { continue; } $_aPlugin = get_plugin_data($_sPluginPath); $_aPluginList[] = ' ' . $_aPlugin['Name'] . ' :' . $_aPlugin['Version']; } return implode(PHP_EOL, $_aPluginList); }
<?php $diagnostic = new wfDiagnostic(); $plugins = get_plugins(); $activePlugins = array_flip(get_option('active_plugins')); $activeNetworkPlugins = is_multisite() ? array_flip(wp_get_active_network_plugins()) : array(); $muPlugins = get_mu_plugins(); $themes = wp_get_themes(); $currentTheme = wp_get_theme(); $cols = 3; $w = new wfConfig(); ?> <div class="wrap wordfence"> <?php require 'menuHeader.php'; ?> <h2 id="wfHeading"> Diagnostics </h2> <br clear="both"/> <?php $rightRail = new wfView('marketing/rightrail', array('additionalClasses' => 'wordfenceRightRailDiagnostics')); echo $rightRail; ?> <form id="wfConfigForm"> <table class="wf-table"<?php echo !empty($inEmail) ? ' border=1' : ''; ?>
continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . ' ' . $plugin['Author'] . ' ' . $plugin['PluginURI'] . "\n"; } // WordPress inactive plugins echo "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . ' ' . $plugin['Author'] . ' ' . $plugin['PluginURI'] . "\n"; } if (is_multisite()) { // WordPress Multisite active plugins echo "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ': ' . $plugin['Version'] . ' ' . $plugin['Author'] . ' ' . $plugin['PluginURI'] . "\n"; } } ?> ## Server Environment ## Server Info: <?php
if (is_multisite()) { require ABSPATH . WPINC . '/ms-functions.php'; require ABSPATH . WPINC . '/ms-default-filters.php'; require ABSPATH . WPINC . '/ms-deprecated.php'; } // Define constants that rely on the API to obtain the default value. // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. wp_plugin_directory_constants(); // Load must-use plugins. foreach (wp_get_mu_plugins() as $mu_plugin) { include_once $mu_plugin; } unset($mu_plugin); // Load network activated plugins. if (is_multisite()) { foreach (wp_get_active_network_plugins() as $network_plugin) { include_once $network_plugin; } unset($network_plugin); } do_action('muplugins_loaded'); if (is_multisite()) { ms_cookie_constants(); } // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). wp_cookie_constants(); // Define and enforce our SSL constants wp_ssl_constants(); // Create common globals. require ABSPATH . WPINC . '/vars.php'; // Make taxonomies and posts available to plugins and themes.
function tc_config_infos() { global $wpdb; ?> <div class="wrap"> <h3><?php _e('System Informations', 'customizr'); ?> </h3> <h4 style="text-align: left"><?php _e('Please include the following informations when posting support requests', 'customizr'); ?> </h4> <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="tc-sysinfo" title="<?php _e('To copy the system infos, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'customizr'); ?> " style="width: 800px;min-height: 800px;font-family: Menlo,Monaco,monospace;background: 0 0;white-space: pre;overflow: auto;display:block;"> <?php do_action('__system_config_before'); ?> # SITE_URL: <?php echo site_url() . "\n"; ?> # HOME_URL: <?php echo home_url() . "\n"; ?> # IS MULTISITE : <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> # THEME | VERSION : <?php printf('%1$s | v%2$s', TC___::$theme_name, CUSTOMIZR_VER) . "\n"; ?> # WP VERSION : <?php echo get_bloginfo('version') . "\n"; ?> # PERMALINK STRUCTURE : <?php echo get_option('permalink_structure') . "\n"; ?> # ACTIVE PLUGINS : <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (is_multisite()) { ?> # NETWORK ACTIVE PLUGINS: <?php $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); // If the plugin isn't active, don't show it. if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n"; } } //GET MYSQL VERSION global $wpdb; $mysql_ver = !empty($wpdb->use_mysqli) && $wpdb->use_mysqli ? @mysqli_get_server_info($wpdb->dbh) : @mysql_get_server_info(); ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo $mysql_ver . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> WordPress Memory Limit: <?php echo $this->tc_let_to_num(WP_MEMORY_LIMIT) / 1024 . "MB"; echo "\n"; ?> PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?> PHP Memory Limit: <?php echo ini_get('memory_limit') . "\n"; ?> PHP Upload Max Size: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Post Max Size: <?php echo ini_get('post_max_size') . "\n"; ?> PHP Upload Max Filesize: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Time Limit: <?php echo ini_get('max_execution_time') . "\n"; ?> PHP Max Input Vars: <?php echo ini_get('max_input_vars') . "\n"; ?> PHP Arg Separator: <?php echo ini_get('arg_separator.output') . "\n"; ?> PHP Allow URL File Open: <?php echo ini_get('allow_url_fopen') ? "Yes" : "No\n"; ?> WP_DEBUG: <?php echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> Page For Posts: <?php $id = get_option('page_for_posts'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; do_action('__system_config_after'); ?> </textarea> </div> </div> <?php }
/** * Generate the debug information content. * * @since 1.2.0 * * @return string */ private function system_status() { if (!current_user_can('manage_options')) { return ''; } global $wpdb; $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; ob_start(); ?> ### Begin Custom Post Type UI Debug Info ### Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> SITE_URL: <?php echo site_url() . "\n"; ?> HOME_URL: <?php echo home_url() . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> Permalink Structure: <?php echo get_option('permalink_structure') . "\n"; ?> Active Theme: <?php echo $theme . "\n"; ?> Registered Post Types: <?php echo implode(', ', get_post_types('', 'names')) . "\n"; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> Page For Posts: <?php $id = get_option('page_for_posts'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> WordPress Memory Limit: <?php echo $this->num_convt(WP_MEMORY_LIMIT) / 1024 . 'MB'; echo "\n"; ?> <?php $plugins = get_plugins(); $pg_count = count($plugins); echo 'TOTAL PLUGINS: ' . $pg_count . "\n\n"; // MU plugins. $mu_plugins = get_mu_plugins(); if ($mu_plugins) { echo "\t\t" . 'MU PLUGINS: (' . count($mu_plugins) . ')' . "\n\n"; foreach ($mu_plugins as $mu_path => $mu_plugin) { echo "\t\t" . $mu_plugin['Name'] . ': ' . $mu_plugin['Version'] . "\n"; } } // Standard plugins - active. echo "\n"; $active = get_option('active_plugins', array()); $ac_count = count($active); $ic_count = $pg_count - $ac_count; echo "\t\t" . 'ACTIVE PLUGINS: (' . $ac_count . ')' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active)) { continue; } echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } // Standard plugins - inactive. echo "\n"; echo "\t\t", 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, show it here. if (in_array($plugin_path, $active)) { continue; } echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } // If multisite, grab network as well. if (is_multisite()) { $net_plugins = wp_get_active_network_plugins(); $net_active = get_site_option('active_sitewide_plugins', array()); echo "\n"; echo 'NETWORK ACTIVE PLUGINS: (' . count($net_plugins) . ')' . "\n\n"; foreach ($net_plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); // If the plugin isn't active, don't show it. if (!array_key_exists($plugin_base, $net_active)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n"; } } echo "\n"; $cptui_post_types = cptui_get_post_type_data(); echo "\t\t" . 'Post Types: ' . "\n"; echo "\t\t" . esc_html(json_encode($cptui_post_types)) . "\n"; echo "\n\n"; $cptui_taxonomies = cptui_get_taxonomy_data(); echo "\t\t" . 'Taxonomies: ' . "\n"; echo "\t\t" . esc_html(json_encode($cptui_taxonomies)) . "\n"; echo "\n"; if (has_action('cptui_custom_debug_info')) { echo "\t\t" . 'EXTRA DEBUG INFO'; } /** * Fires at the end of the debug info output. * * @since 1.3.0 */ do_action('cptui_custom_debug_info'); echo "\n"; ?> ### End Debug Info ### <?php return ob_get_clean(); }
/** * Get system information. * * Based on a function from Easy Digital Downloads by Pippin Williamson * * @link https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/includes/admin/tools.php#L470 * @since 1.2.3 * @return string */ public function get_system_info() { global $wpdb; // Get theme info $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; $return = '### Begin System Info ###' . "\n\n"; // WPForms info $activated = get_option('wpforms_activated', array()); $return .= '-- WPForms Info' . "\n\n"; if (!empty($activated['pro'])) { $date = $activated['pro'] + get_option('gmt_offset') * 3600; $return .= 'Pro: ' . date_i18n(__('M j, Y @ g:ia'), $date) . "\n"; } if (!empty($activated['lite'])) { $date = $activated['lite'] + get_option('gmt_offset') * 3600; $return .= 'Lite: ' . date_i18n(__('M j, Y @ g:ia'), $date) . "\n"; } // Now the basics... $return .= '-- Site Info' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n"; // WordPress configuration $return .= "\n" . '-- WordPress Configuration' . "\n\n"; $return .= 'Version: ' . get_bloginfo('version') . "\n"; $return .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n"; $return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n"; $return .= 'Active Theme: ' . $theme . "\n"; $return .= 'Show On Front: ' . get_option('show_on_front') . "\n"; // Only show page specs if frontpage is set to 'page' if (get_option('show_on_front') == 'page') { $front_page_id = get_option('page_on_front'); $blog_page_id = get_option('page_for_posts'); $return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n"; $return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n"; } $return .= 'ABSPATH: ' . ABSPATH . "\n"; // Make sure wp_remote_post() is working /* $request['cmd'] = '_notify-validate'; $params = array( 'sslverify' => false, 'timeout' => 60, 'user-agent' => 'WPForms/' . WPFORMS_VERSION, 'body' => $request ); $response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); if( !is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { $WP_REMOTE_POST = 'wp_remote_post() works'; } else { $WP_REMOTE_POST = 'wp_remote_post() does not work'; } $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; */ $return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n"; $return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'WPFORMS_DEBUG: ' . (defined('WPFORMS_DEBUG') ? WPFORMS_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; $return .= 'Registered Post Stati: ' . implode(', ', get_post_stati()) . "\n"; // @todo WPForms configuration/specific details $return .= "\n" . '-- WordPress Uploads/Constants' . "\n\n"; $return .= 'WP_CONTENT_DIR: ' . (defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR ? WP_CONTENT_DIR : 'Disabled' : 'Not set') . "\n"; $return .= 'WP_CONTENT_URL: ' . (defined('WP_CONTENT_URL') ? WP_CONTENT_URL ? WP_CONTENT_URL : 'Disabled' : 'Not set') . "\n"; $return .= 'UPLOADS: ' . (defined('UPLOADS') ? UPLOADS ? UPLOADS : 'Disabled' : 'Not set') . "\n"; $uploads_dir = wp_upload_dir(); $return .= 'wp_uploads_dir() path: ' . $uploads_dir['path'] . "\n"; $return .= 'wp_uploads_dir() url: ' . $uploads_dir['url'] . "\n"; $return .= 'wp_uploads_dir() basedir: ' . $uploads_dir['basedir'] . "\n"; $return .= 'wp_uploads_dir() baseurl: ' . $uploads_dir['baseurl'] . "\n"; // Get plugins that have an update $updates = get_plugin_updates(); // Must-use plugins // NOTE: MU plugins can't show updates! $muplugins = get_mu_plugins(); if (count($muplugins) > 0 && !empty($muplugins)) { $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; foreach ($muplugins as $plugin => $plugin_data) { $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } } // WordPress active plugins $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } // WordPress inactive plugins $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } if (is_multisite()) { // WordPress Multisite active plugins $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $update = array_key_exists($plugin_path, $updates) ? ' (needs update - ' . $updates[$plugin_path]->update->new_version . ')' : ''; $plugin = get_plugin_data($plugin_path); $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } } // Server configuration (really just versioning) $return .= "\n" . '-- Webserver Configuration' . "\n\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; // PHP configs... now we're getting to the important stuff $return .= "\n" . '-- PHP Configuration' . "\n\n"; //$return .= 'Safe Mode: ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" ); $return .= 'Memory Limit: ' . ini_get('memory_limit') . "\n"; $return .= 'Upload Max Size: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Post Max Size: ' . ini_get('post_max_size') . "\n"; $return .= 'Upload Max Filesize: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Time Limit: ' . ini_get('max_execution_time') . "\n"; $return .= 'Max Input Vars: ' . ini_get('max_input_vars') . "\n"; $return .= 'Display Errors: ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n"; // PHP extensions and such $return .= "\n" . '-- PHP Extensions' . "\n\n"; $return .= 'cURL: ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'fsockopen: ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'SOAP Client: ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n"; $return .= 'Suhosin: ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n"; // Session stuff $return .= "\n" . '-- Session Configuration' . "\n\n"; $return .= 'Session: ' . (isset($_SESSION) ? 'Enabled' : 'Disabled') . "\n"; // The rest of this is only relevant is session is enabled if (isset($_SESSION)) { $return .= 'Session Name: ' . esc_html(ini_get('session.name')) . "\n"; $return .= 'Cookie Path: ' . esc_html(ini_get('session.cookie_path')) . "\n"; $return .= 'Save Path: ' . esc_html(ini_get('session.save_path')) . "\n"; $return .= 'Use Cookies: ' . (ini_get('session.use_cookies') ? 'On' : 'Off') . "\n"; $return .= 'Use Only Cookies: ' . (ini_get('session.use_only_cookies') ? 'On' : 'Off') . "\n"; } $return .= "\n" . '### End System Info ###'; return $return; }
function fes_system_info_page() { global $wpdb, $fes_settings; ?> <div class="wrap"> <style>#system-info-textarea { width: 800px; height: 400px; font-family: Menlo, Monaco, monospace; background: none; white-space: pre; overflow: auto; display: block; } </style> <h2><?php _e('EDD Frontend Submissions Debugging Information', 'edd_fes'); ?> </h2><br/> <form action="<?php echo esc_url(admin_url('edit.php?post_type=download&page=edd-system-info')); ?> " method="post" dir="ltr"> <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="fes-sysinfo" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd'); ?> "> ### Begin EDD Frontend Submissions Debugging Information ### ## Please include this information when posting support requests regarding FES ## <?php do_action('fes_system_info_before'); ?> Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> Dashboard URL: <?php echo get_permalink(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false)) . "\n"; ?> FES Version: <?php echo fes_plugin_version . "\n"; ?> FES Plugin Name: <?php echo fes_plugin_name . "\n"; ?> FES File Name: <?php echo fes_plugin_file . "\n"; ?> FES Plugin Path: <?php echo fes_plugin_dir . "\n"; ?> FES Plugin Url: <?php echo fes_plugin_url . "\n"; ?> FES Assets Url: <?php echo fes_assets_url . "\n"; print_r(array_filter($fes_settings)); $posts = get_posts(array('post_type' => 'fes-forms', 'posts_per_page' => -1)); foreach ($posts as $post) { echo $post->id; echo get_the_title($post->id); print_r(get_post_meta($post->id, 'fes-form', false)); } ?> FES TEMPLATES: <?php // Show templates that have been copied to the theme's fes_templates dir $dir = get_stylesheet_directory() . '/fes_templates/*'; if (!empty($dir)) { foreach (glob($dir) as $file) { echo "Filename: " . basename($file) . "\n"; } } else { echo 'No overrides found'; } ?> PLUGINS: <?php $plugins = get_plugins(); ksort($plugins); foreach ($plugins as $plugin_file => $plugin_data) { echo $plugin_data['Title'] . "\r\n" . $plugin_data['Version'] . "\r\n"; if (is_plugin_active($plugin_file)) { echo 'Active'; } else { echo 'Inactive'; } echo "\r\n" . $plugin_data['PluginURI'] . "\r\n\r\n"; } if (is_multisite()) { ?> NETWORK ACTIVE PLUGINS: <?php $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); // If the plugin isn't active, don't show it. if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n"; } } do_action('fes_system_info_after'); ?> ### End System Info ###</textarea> <p class="submit"> <input type="hidden" name="edd-action" value="download_fes_sysinfo" /> <?php submit_button('Download System Info File', 'primary', 'edd-download-fes-sysinfo', false); ?> </p> </form> </div> </div> <?php }
/** * Diagnostic information for the support tab * * @param bool $escape */ function output_diagnostic_info($escape = true) { global $table_prefix; global $wpdb; echo 'site_url(): '; echo esc_html(site_url()); echo "\r\n"; echo 'home_url(): '; echo esc_html(home_url()); echo "\r\n"; echo 'Database Name: '; echo esc_html($wpdb->dbname); echo "\r\n"; echo 'Table Prefix: '; echo esc_html($table_prefix); echo "\r\n"; echo 'WordPress: '; echo bloginfo('version'); if (is_multisite()) { echo ' Multisite'; } echo "\r\n"; echo 'Web Server: '; echo esc_html(!empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''); echo "\r\n"; echo 'PHP: '; if (function_exists('phpversion')) { echo esc_html(phpversion()); } echo "\r\n"; echo 'MySQL: '; echo esc_html(empty($wpdb->use_mysqli) ? mysql_get_server_info() : mysqli_get_server_info($wpdb->dbh)); echo "\r\n"; echo 'ext/mysqli: '; echo empty($wpdb->use_mysqli) ? 'no' : 'yes'; echo "\r\n"; echo 'PHP Memory Limit: '; if (function_exists('ini_get')) { echo esc_html(ini_get('memory_limit')); } echo "\r\n"; echo 'WP Memory Limit: '; echo esc_html(WP_MEMORY_LIMIT); echo "\r\n"; echo 'Blocked External HTTP Requests: '; if (!defined('WP_HTTP_BLOCK_EXTERNAL') || !WP_HTTP_BLOCK_EXTERNAL) { echo 'None'; } else { $accessible_hosts = defined('WP_ACCESSIBLE_HOSTS') ? WP_ACCESSIBLE_HOSTS : ''; if (empty($accessible_hosts)) { echo 'ALL'; } else { echo 'Partially (Accessible Hosts: ' . esc_html($accessible_hosts) . ')'; } } echo "\r\n"; echo 'WP Locale: '; echo esc_html(get_locale()); echo "\r\n"; echo 'Debug Mode: '; echo esc_html(defined('WP_DEBUG') && WP_DEBUG ? 'Yes' : 'No'); echo "\r\n"; echo 'WP Max Upload Size: '; echo esc_html(size_format(wp_max_upload_size())); echo "\r\n"; echo 'PHP Time Limit: '; if (function_exists('ini_get')) { echo esc_html(ini_get('max_execution_time')); } echo "\r\n"; echo 'PHP Error Log: '; if (function_exists('ini_get')) { echo esc_html(ini_get('error_log')); } echo "\r\n"; echo 'WP Cron: '; echo esc_html(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ? 'Disabled' : 'Enabled'); echo "\r\n"; echo 'fsockopen: '; if (function_exists('fsockopen')) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'OpenSSL: '; if ($this->open_ssl_enabled()) { echo esc_html(OPENSSL_VERSION_TEXT); } else { echo 'Disabled'; } echo "\r\n"; echo 'cURL: '; if (function_exists('curl_init')) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'Zlib Compression: '; if (function_exists('gzcompress')) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'PHP GD: '; if ($this->gd_enabled()) { $gd_info = gd_info(); echo isset($gd_info['GD Version']) ? esc_html($gd_info['GD Version']) : 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'Imagick: '; if ($this->imagick_enabled()) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n\r\n"; $media_counts = $this->diagnostic_media_counts(); echo 'Media Files: '; echo number_format_i18n($media_counts['all']); echo "\r\n"; echo 'Media Files on S3: '; echo number_format_i18n($media_counts['s3']); echo "\r\n"; echo 'Number of Image Sizes: '; $sizes = count(get_intermediate_image_sizes()); echo number_format_i18n($sizes); echo "\r\n\r\n"; echo 'Bucket: '; echo $this->get_setting('bucket'); echo "\r\n"; echo 'Region: '; $region = $this->get_setting('region'); if (!is_wp_error($region)) { echo $region; } echo "\r\n"; echo 'Copy Files to S3: '; echo $this->on_off('copy-to-s3'); echo "\r\n"; echo 'Rewrite File URLs: '; echo $this->on_off('serve-from-s3'); echo "\r\n"; echo "\r\n"; echo 'URL Preview: '; echo $this->get_url_preview($escape); echo "\r\n"; echo "\r\n"; echo 'Domain: '; echo $this->get_setting('domain'); echo "\r\n"; echo 'Enable Path: '; echo $this->on_off('enable-object-prefix'); echo "\r\n"; echo 'Custom Path: '; echo $this->get_setting('object-prefix'); echo "\r\n"; echo 'Use Year/Month: '; echo $this->on_off('use-yearmonth-folders'); echo "\r\n"; echo 'SSL: '; echo $this->get_setting('ssl'); echo "\r\n"; echo 'Remove Files From Server: '; echo $this->on_off('remove-local-file'); echo "\r\n"; echo 'Object Versioning: '; echo $this->on_off('object-versioning'); echo "\r\n"; echo 'Far Future Expiration Header: '; echo $this->on_off('expires'); echo "\r\n"; echo 'Copy HiDPI (@2x) Images: '; echo $this->on_off('hidpi-images'); echo "\r\n\r\n"; do_action('as3cf_diagnostic_info'); if (has_action('as3cf_diagnostic_info')) { echo "\r\n"; } echo "Active Plugins:\r\n"; $active_plugins = (array) get_option('active_plugins', array()); $plugin_details = array(); if (is_multisite()) { $network_active_plugins = wp_get_active_network_plugins(); $active_plugins = array_map(array($this, 'remove_wp_plugin_dir'), $network_active_plugins); } foreach ($active_plugins as $plugin) { $plugin_details[] = $this->get_plugin_details(WP_PLUGIN_DIR . '/' . $plugin); } asort($plugin_details); echo implode('', $plugin_details); $mu_plugins = wp_get_mu_plugins(); if ($mu_plugins) { $mu_plugin_details = array(); echo "\r\n"; echo "Must-use Plugins:\r\n"; foreach ($mu_plugins as $mu_plugin) { $mu_plugin_details[] = $this->get_plugin_details($mu_plugin); } asort($mu_plugin_details); echo implode('', $mu_plugin_details); } }
/** * Get system info * * @since 1.0 * @access public * @global object $wpdb Used to query the database using the WordPress Database API * @global array $gmb_options Array of all Maps Builder options * @return string $return A string containing the info to output */ function gmb_tools_sysinfo_get() { global $wpdb, $gmb_options; if (!class_exists('Browser')) { require_once GMB_PLUGIN_PATH . 'includes/libraries/browser.php'; } $browser = new Browser(); // Get theme info if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; } // Try to identify the hosting provider $host = gmb_get_host(); $return = '### Begin System Info ###' . "\n\n"; // Start with the basics... $return .= '-- Site Info' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n"; $return = apply_filters('gmb_sysinfo_after_site_info', $return); // Can we determine the site's host? if ($host) { $return .= "\n" . '-- Hosting Provider' . "\n\n"; $return .= 'Host: ' . $host . "\n"; $return = apply_filters('gmb_sysinfo_after_host_info', $return); } // The local users' browser information, handled by the Browser class $return .= "\n" . '-- User Browser' . "\n\n"; $return .= $browser; $return = apply_filters('gmb_sysinfo_after_user_browser', $return); // WordPress configuration $return .= "\n" . '-- WordPress Configuration' . "\n\n"; $return .= 'Version: ' . get_bloginfo('version') . "\n"; $return .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n"; $return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n"; $return .= 'Active Theme: ' . $theme . "\n"; $return .= 'Show On Front: ' . get_option('show_on_front') . "\n"; // Only show page specs if frontpage is set to 'page' if (get_option('show_on_front') == 'page') { $front_page_id = get_option('page_on_front'); $blog_page_id = get_option('page_for_posts'); $return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n"; $return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n"; } // Make sure wp_remote_post() is working $request['cmd'] = '_notify-validate'; $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'Maps Builder/' . GMB_VERSION, 'body' => $request); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $WP_REMOTE_POST = 'wp_remote_post() works'; } else { $WP_REMOTE_POST = 'wp_remote_post() does not work'; } $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; $return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n"; $return .= 'Admin AJAX: ' . (gmb_test_ajax_works() ? 'Accessible' : 'Inaccessible') . "\n"; $return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; $return .= 'Registered Post Stati: ' . implode(', ', get_post_stati()) . "\n"; $return = apply_filters('gmb_sysinfo_after_wordpress_config', $return); // GMB configuration $return .= "\n" . '-- Maps Builder Configuration' . "\n\n"; $return .= 'Version: ' . GMB_VERSION . "\n"; $return .= 'Upgraded From: ' . get_option('gmb_version_upgraded_from', 'None') . "\n"; $return = apply_filters('gmb_sysinfo_after_gmb_config', $return); // Must-use plugins $muplugins = get_mu_plugins(); if (count($muplugins > 0)) { $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; foreach ($muplugins as $plugin => $plugin_data) { $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } $return = apply_filters('gmb_sysinfo_after_wordpress_mu_plugins', $return); } // WordPress active plugins $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } $return = apply_filters('gmb_sysinfo_after_wordpress_plugins', $return); // WordPress inactive plugins $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } $return = apply_filters('gmb_sysinfo_after_wordpress_plugins_inactive', $return); if (is_multisite()) { // WordPress Multisite active plugins $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } $return = apply_filters('gmb_sysinfo_after_wordpress_ms_plugins', $return); } // Server configuration (really just versioning) $return .= "\n" . '-- Webserver Configuration' . "\n\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; $return = apply_filters('gmb_sysinfo_after_webserver_config', $return); // PHP configs... now we're getting to the important stuff $return .= "\n" . '-- PHP Configuration' . "\n\n"; $return .= 'Safe Mode: ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n"); $return .= 'Memory Limit: ' . ini_get('memory_limit') . "\n"; $return .= 'Upload Max Size: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Post Max Size: ' . ini_get('post_max_size') . "\n"; $return .= 'Upload Max Filesize: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Time Limit: ' . ini_get('max_execution_time') . "\n"; $return .= 'Max Input Vars: ' . ini_get('max_input_vars') . "\n"; $return .= 'Display Errors: ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n"; $return = apply_filters('gmb_sysinfo_after_php_config', $return); // PHP extensions and such $return .= "\n" . '-- PHP Extensions' . "\n\n"; $return .= 'cURL: ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'fsockopen: ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'SOAP Client: ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n"; $return .= 'Suhosin: ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n"; $return = apply_filters('gmb_sysinfo_after_php_ext', $return); // The rest of this is only relevant is session is enabled if (isset($_SESSION)) { $return .= 'Session Name: ' . esc_html(ini_get('session.name')) . "\n"; $return .= 'Cookie Path: ' . esc_html(ini_get('session.cookie_path')) . "\n"; $return .= 'Save Path: ' . esc_html(ini_get('session.save_path')) . "\n"; $return .= 'Use Cookies: ' . (ini_get('session.use_cookies') ? 'On' : 'Off') . "\n"; $return .= 'Use Only Cookies: ' . (ini_get('session.use_only_cookies') ? 'On' : 'Off') . "\n"; } $return = apply_filters('gmb_sysinfo_after_session_config', $return); $return .= "\n" . '### End System Info ###'; return $return; }
/** * Returns the system info. * @access public * @return string */ public static function get_sysinfo() { global $wpdb; $return = '### Begin System Info ###' . "\n\n"; // Basic site info $return .= '-- WordPress Configuration' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n"; $return .= 'Version: ' . get_bloginfo('version') . "\n"; $return .= 'Language: ' . get_locale() . "\n"; $return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . "\n"; $return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; // Plugin Configuration $return .= "\n" . '-- Better Search Replace Configuration' . "\n\n"; $return .= 'Plugin Version: ' . BSR_VERSION . "\n"; $page_size = get_option('bsr_page_size') ? get_option('bsr_page_size') : '50000'; $return .= 'Max Page Size: ' . $page_size . "\n"; // Server Configuration $return .= "\n" . '-- Server Configuration' . "\n\n"; $return .= 'Operating System: ' . php_uname('s') . "\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $return .= 'Server Software: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; // PHP configs... now we're getting to the important stuff $return .= "\n" . '-- PHP Configuration' . "\n\n"; $return .= 'Safe Mode: ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n"); $return .= 'Memory Limit: ' . ini_get('memory_limit') . "\n"; $return .= 'Post Max Size: ' . ini_get('post_max_size') . "\n"; $return .= 'Upload Max Filesize: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Time Limit: ' . ini_get('max_execution_time') . "\n"; $return .= 'Max Input Vars: ' . ini_get('max_input_vars') . "\n"; $return .= 'Display Errors: ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n"; // WordPress active plugins $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } // WordPress inactive plugins $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (is_multisite()) { // WordPress Multisite active plugins $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } } $return .= "\n" . '### End System Info ###'; return $return; }
/** * Generate the system information * * @since 3.1 */ function wprss_system_info() { global $wpdb; if (!class_exists('Browser')) { require_once WPRSS_DIR . 'includes/libraries/browser.php'; } $browser = new Browser(); ?> <h3><?php _e('System Information', 'wprss'); ?> </h3> <form action="<?php echo esc_url(admin_url('edit.php?post_type=wprss_feed&page=wprss-debugging')); ?> " method="post"> <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="wprss-sysinfo" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'wprss'); ?> "> ### Begin System Info ### ## Please include this information when posting support requests ## Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> SITE_URL: <?php echo site_url() . "\n"; ?> HOME_URL: <?php echo home_url() . "\n"; ?> Plugin Version: <?php echo WPRSS_VERSION . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> <?php echo $browser; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo mysql_get_server_info() . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?> PHP Memory Limit: <?php echo ini_get('memory_limit') . "\n"; ?> PHP Post Max Size: <?php echo ini_get('post_max_size') . "\n"; ?> PHP Time Limit: <?php echo ini_get('max_execution_time') . "\n"; ?> WP_DEBUG: <?php echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n"; ?> WP Table Prefix: <?php echo "Length: " . strlen($wpdb->prefix); echo " Status:"; if (strlen($wpdb->prefix) > 16) { echo " ERROR: Too Long"; } else { echo " Acceptable"; } echo "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' #' . $id . "\n"; ?> Page For Posts: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' #' . $id . "\n"; ?> Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; echo "\n"; ?> Session Name: <?php echo esc_html(ini_get('session.name')); echo "\n"; ?> Cookie Path: <?php echo esc_html(ini_get('session.cookie_path')); echo "\n"; ?> Save Path: <?php echo esc_html(ini_get('session.save_path')); echo "\n"; ?> Use Cookies: <?php echo ini_get('session.use_cookies') ? 'On' : 'Off'; echo "\n"; ?> Use Only Cookies: <?php echo ini_get('session.use_only_cookies') ? 'On' : 'Off'; echo "\n"; ?> UPLOAD_MAX_FILESIZE: <?php if (function_exists('phpversion')) { echo wprss_let_to_num(ini_get('upload_max_filesize')) / (1024 * 1024) . "MB"; } echo "\n"; ?> POST_MAX_SIZE: <?php if (function_exists('phpversion')) { echo wprss_let_to_num(ini_get('post_max_size')) / (1024 * 1024) . "MB"; } echo "\n"; ?> WordPress Memory Limit: <?php echo wprss_let_to_num(WP_MEMORY_LIMIT) / (1024 * 1024) . "MB"; echo "\n"; ?> DISPLAY ERRORS: <?php echo ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A'; echo "\n"; ?> FSOCKOPEN: <?php echo function_exists('fsockopen') ? __('Your server supports fsockopen.', 'wprss') : __('Your server does not support fsockopen.', 'wprss'); echo "\n"; ?> ACTIVE PLUGINS: <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active_plugins)) { $inactive_plugins[] = $plugin; continue; } echo $plugin['Name']; ?> : <?php echo $plugin['Version'] . "\n"; } if (is_multisite()) { ?> NETWORK ACTIVE PLUGINS: <?php $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); // If the plugin isn't active, don't show it. if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } } if (!is_multisite()) { ?> DEACTIVATED PLUGINS: <?php foreach ($inactive_plugins as $inactive_plugin) { echo $inactive_plugin['Name']; ?> : <?php echo $inactive_plugin['Version'] . "\n"; } } ?> CURRENT THEME: <?php if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); echo $theme_data['Name'] . ': ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); echo $theme_data->Name . ': ' . $theme_data->Version; } ?> ### End System Info ### </textarea> <p class="submit"> <input type="hidden" name="wprss-action" value="download_sysinfo" /> <?php submit_button(__('Download System Info File', 'wprss'), 'primary', 'wprss-download-sysinfo', false); ?> </p> </form> <?php }
/** * @ticket 28651 */ function test_duplicate_network_active_plugin() { $path = "hello.php"; $mock = new MockAction(); add_action( 'activate_' . $path, array ( $mock, 'action' ) ); // should activate on the first try activate_plugin( $path, '', true ); $active_plugins = wp_get_active_network_plugins(); $this->assertCount( 1, $active_plugins ); $this->assertEquals( 1, $mock->get_call_count() ); // should do nothing on the second try activate_plugin( $path, '', true ); $active_plugins = wp_get_active_network_plugins(); $this->assertCount( 1, $active_plugins ); $this->assertEquals( 1, $mock->get_call_count() ); remove_action( 'activate_' . $path, array ( $mock, 'action' ) ); }
/** * Get system info * * Returns the system info for a WordPress instance * * @access public * @author Daniel J Griffiths * @since 1.0.0 * @global $wpdb * @global object $wpdb Used to query the database * @param bool $show_inactive Whether or not to show inactive plugins * @param string $id The ID to assign to the returned textarea (Default: system-info-box) * @param string $class The class to assign to the returned textarea (Default: none) * @return string $return A string containing all system info */ public function get($show_inactive = false, $id = 'system-info-box', $class = null) { global $wpdb; if (!defined('SSINFO_VERSION')) { define('SSINFO_VERSION', '1.0.0'); } // We need the Browser class! if (!class_exists('Browser')) { require_once 'browser.php'; } $browser = new Browser(); // Get theme info for this WordPress version if (get_bloginfo('version') < '3.4') { $theme_data = wp_get_theme(get_stylesheet_directory() . '/style.css'); $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; } $return = '<textarea readonly="readonly" onclick="this.focus(); this.select()" id="' . $id . '"' . ($class != null ? ' class="' . $class . '"' : '') . ' title="To copy the system info, click below and press Ctrl+C (PC) or Cmd+C (Mac).">'; $return .= '### Begin System Info ###' . "\n\n"; do_action('simple_system_info_before'); // Start with the basice... $return .= '-- Site Info' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n"; if (has_filter('ssi_after_site_info')) { $return .= apply_filters('ssi_after_site_info', $return); } // The local users' browser information, handled by the Browser class $return .= "\n" . '-- User Browser' . "\n\n"; $return .= $browser; if (has_filter('ssi_after_user_browser')) { $return .= apply_filters('ssi_after_user_browser', $return); } // WordPress configuration $return .= "\n" . '-- WordPress Configuration' . "\n\n"; $return .= 'Version: ' . get_bloginfo('version') . "\n"; $return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n"; $return .= 'Active Theme: ' . $theme . "\n"; $return .= 'Show On Front: ' . get_option('show_on_front') . "\n"; // Only show page specs if frontpage is set to 'page' if (get_option('show_on_front') == 'page') { $front_page_id = get_option('page_on_front'); $blog_page_id = get_option('page_for_posts'); $return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n"; $return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n"; } // Make sure wp_remote_post() is working $request['cmd'] = '_notify-validate'; $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'SSInfo/' . SSINFO_VERSION, 'body' => $request); $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params); if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { $WP_REMOTE_POST = 'wp_remote_post() works'; } else { $WP_REMOTE_POST = 'wp_remote_post() does not work'; } $return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n"; $return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n"; $return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; if (has_filter('ssi_after_wordpress_config')) { $return .= apply_filters('ssi_after_wordpress_config', $return); } // WordPress active plugins $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (!in_array($plugin_path, $active_plugins)) { continue; } //if( $plugin['Name'] !== 'Redux Framework' ) continue; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (has_filter('ssi_after_wordpress_plugins')) { $return .= apply_filters('ssi_after_wordpress_plugins', $return); } // WordPress inactive plugins if ($show_inactive == true) { $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } } if (has_filter('ssi_after_wordpress_plugins_inactive')) { $return .= apply_filters('ssi_after_wordpress_plugins_inactive', $return); } // WordPress Multisite active plugins if (is_multisite()) { $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (has_filter('ssi_after_wordpress_ms_plugins')) { $return .= apply_filters('ssi_after_wordpress_ms_plugins', $return); } // WordPress Multisite inactive plugins if ($show_inactive == true) { $return .= "\n" . '-- Network Inactive Plugins' . "\n\n"; foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); if (array_key_exists($plugin_base, $active_plugins)) { continue; } $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } } } if (has_filter('ssi_after_wordpress_ms_plugins_inactive')) { $return .= apply_filters('ssi_after_wordpress_ms_plugins_inactive', $return); } // Server configuration (really just versioning) $return .= "\n" . '-- Webserver Configuration' . "\n\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . mysql_get_server_info() . "\n"; $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; if (has_filter('ssi_after_webserver_config')) { $return .= apply_filters('ssi_after_webserver_config', $return); } // PHP configs... now we're getting to the important stuff $return .= "\n" . '-- PHP Configuration' . "\n\n"; $return .= 'Safe Mode: ' . (ini_get('safe_mode') ? 'Yes' : 'No') . "\n"; $return .= 'Memory Limit: ' . ini_get('memory_limit') . "\n"; $return .= 'Upload Max Size: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Post Max Size: ' . ini_get('post_max_size') . "\n"; $return .= 'Upload Max Filesize: ' . ini_get('upload_max_filesize') . "\n"; $return .= 'Time Limit: ' . ini_get('max_execution_time') . "\n"; $return .= 'Max Input Vars: ' . ini_get('max_input_vars') . "\n"; $return .= 'Display Errors: ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n"; if (has_filter('ssi_after_php_config')) { $return .= apply_filters('ssi_after_php_config', $return); } // PHP extensions and such $return .= "\n" . '-- PHP Extensions' . "\n\n"; $return .= 'cURL: ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'fsockopen: ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n"; $return .= 'SOAP Client: ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n"; $return .= 'Suhosin: ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n"; if (has_filter('ssi_after_php_ext')) { $return .= apply_filters('ssi_after_php_ext', $return); } // Session stuff $return .= "\n" . '-- Session Configuration' . "\n\n"; $return .= 'Session: ' . (isset($_SESSION) ? 'Enabled' : 'Disabled') . "\n"; // The rest of this is only relevant is session is enabled if (isset($_SESSION)) { $return .= 'Session Name: ' . esc_html(ini_get('session.name')) . "\n"; $return .= 'Cookie Path: ' . esc_html(ini_get('session.cookie_path')) . "\n"; $return .= 'Save Path: ' . esc_html(ini_get('session.save_path')) . "\n"; $return .= 'Use Cookies: ' . (ini_get('session.use_cookies') ? 'On' : 'Off') . "\n"; $return .= 'Use Only Cookies: ' . (ini_get('session.use_only_cookies') ? 'On' : 'Off') . "\n"; } if (has_filter('ssi_after_session_config')) { $return .= apply_filters('ssi_after_session_config', $return); } do_action('ssi_after'); $return .= "\n" . '### End System Info ###'; $return .= '</textarea>'; return $return; }
function wprss_send_tracking_data() { // Check the tracking option - if turned off, exit out of function $tracking_option = wprss_get_general_setting('tracking'); if ($tracking_option == 0 || $tracking_option == FALSE) { return; } // Get the tracking transient. $transient = get_transient('wprss_tracking_transient'); // If the transient did not expire, exit out of function if ($transient !== FALSE && !isset($_GET['wprss_send_report'])) { return; } // If the GET parameter is set, show an admin notice if (isset($_GET['wprss_send_report'])) { add_action('admin_notices', 'wprss_tracking_notice'); } // Check if running on localhost $site_url = site_url(); $running_on_local = preg_match_all("/(localhost|127\\.0\\.0\\.1)/", $site_url, $matches) > 0; if ($running_on_local) { return; } // Get data about the plugin $plugin_data = get_plugin_data(WPRSS_FILE_CONSTANT); // Get the theme name if (function_exists('wp_get_theme')) { $theme_data = wp_get_theme(); $theme_name = $theme_data->Name; } else { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $theme_name = $theme_data['Name']; } // Get plugins $plugins = get_plugins(); $active_plugins_option = get_option('active_plugins', array()); // Prepare plugin arrays $active_plugins = array(); $inactive_plugins = array(); // Loop through plugins foreach ($plugins as $plugins_path => $plugin_info) { // If plugin found in active plugins list, then add to the active_plugins array if (in_array($plugins_path, $active_plugins_option)) { $add_to =& $active_plugins; } else { $add_to =& $inactive_plugins; } // Add the plugin info to the chosen array $add_to[] = $plugin_info['Name'] . ' v' . $plugin_info['Version']; } // If multisite if (is_multisite()) { // Get network plugins $network_plugins = wp_get_active_network_plugins(); $network_active_plugins_option = get_site_option('active_sitewide_plugins', array()); // Prepare plugin array $network_active_plugins = array(); // Loop through plugins foreach ($network_plugins as $plugin_path) { // Get plugin basename $plugin_base = plugin_basename($plugin_path); // If the plugin basename is found in the active network plugin list if (array_key_exists($plugin_base, $network_active_plugins_option)) { // Get the plugin info and add it to the plugin list $plugin_info = get_plugin_data($plugin_path); $network_active_plugins[] = $plugin_info['Name'] . ' v' . $plugin_info['Version']; } } } else { // Otherwise, indicate that the site is not a multisite installation $network_active_plugins = 'Not multisite'; } // Detect add-ons $addons = array(); if (defined('WPRSS_C_VERSION')) { $addons[] = 'Categories'; } if (defined('WPRSS_ET_VERSION')) { $addons[] = 'Excerpts & Thumbnails'; } if (defined('WPRSS_KF_VERSION')) { $addons[] = 'Keyword Filtering'; } if (defined('WPRSS_FTP_VERSION')) { $addons[] = 'Feed to Post'; } // Compile the data $data = array('Site URL' => base64_encode($site_url), 'Plugin Version' => $plugin_data['Version'], 'Active Add-ons' => $addons, 'Theme Name' => $theme_name, 'Site Name' => str_replace(' ', '', get_bloginfo('name')), 'Plugin Count' => count(get_option('active_plugins')), 'Active Plugins' => $active_plugins, 'Network Active Plugins' => $network_active_plugins, 'Inactive Plugins' => $inactive_plugins, 'WordPress Version' => get_bloginfo('version')); // Send the data wp_remote_post(WPRSS_TRACKING_SERVER_URL, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => array('wprss_tracking_data' => $data), 'cookies' => array())); // Set a transient that expires in 1 week. When it expires, this function will run again // Expiration: 60secs * 60mins * 24hrs * 7days = 1 week set_transient('wprss_tracking_transient', '-', 60 * 60 * 24 * 7); }
/** * Collect system information for support * * @return array of system data for support * @author Peter Chester */ public static function getSupportStats() { $user = wp_get_current_user(); $plugins = array(); if (function_exists('get_plugin_data')) { $plugins_raw = wp_get_active_and_valid_plugins(); foreach ($plugins_raw as $k => $v) { $plugin_details = get_plugin_data($v); $plugin = $plugin_details['Name']; if (!empty($plugin_details['Version'])) { $plugin .= sprintf(' version %s', $plugin_details['Version']); } if (!empty($plugin_details['Author'])) { $plugin .= sprintf(' by %s', $plugin_details['Author']); } if (!empty($plugin_details['AuthorURI'])) { $plugin .= sprintf('(%s)', $plugin_details['AuthorURI']); } $plugins[] = $plugin; } } $network_plugins = array(); if (is_multisite() && function_exists('get_plugin_data')) { $plugins_raw = wp_get_active_network_plugins(); foreach ($plugins_raw as $k => $v) { $plugin_details = get_plugin_data($v); $plugin = $plugin_details['Name']; if (!empty($plugin_details['Version'])) { $plugin .= sprintf(' version %s', $plugin_details['Version']); } if (!empty($plugin_details['Author'])) { $plugin .= sprintf(' by %s', $plugin_details['Author']); } if (!empty($plugin_details['AuthorURI'])) { $plugin .= sprintf('(%s)', $plugin_details['AuthorURI']); } $network_plugins[] = $plugin; } } $mu_plugins = array(); if (function_exists('get_mu_plugins')) { $mu_plugins_raw = get_mu_plugins(); foreach ($mu_plugins_raw as $k => $v) { $plugin = $v['Name']; if (!empty($v['Version'])) { $plugin .= sprintf(' version %s', $v['Version']); } if (!empty($v['Author'])) { $plugin .= sprintf(' by %s', $v['Author']); } if (!empty($v['AuthorURI'])) { $plugin .= sprintf('(%s)', $v['AuthorURI']); } $mu_plugins[] = $plugin; } } $keys = apply_filters('tribe-pue-install-keys', array()); $systeminfo = array('url' => 'http://' . $_SERVER["HTTP_HOST"], 'name' => $user->display_name, 'email' => $user->user_email, 'install keys' => $keys, 'WordPress version' => get_bloginfo('version'), 'PHP version' => phpversion(), 'plugins' => $plugins, 'network plugins' => $network_plugins, 'mu plugins' => $mu_plugins, 'theme' => wp_get_theme()->get('Name'), 'multisite' => is_multisite(), 'settings' => TribeEvents::getOptions()); $systeminfo = apply_filters('tribe-events-pro-support', $systeminfo); return $systeminfo; }
/** * Is mPDF installed? * * @return bool */ static function isInstalled() { if (in_array(WP_PLUGIN_DIR . '/pressbooks-mpdf/pressbooks-mpdf.php', wp_get_active_network_plugins())) { return true; } else { return false; } }
/** * Retrieve an array of active and valid plugin files. * * While upgrading or installing WordPress, no plugins are returned. * * The default directory is wp-content/plugins. To change the default * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` * in wp-config.php. * * @since 3.0.0 * @access private * * @return array Files. */ function wp_get_active_and_valid_plugins() { $plugins = array(); $active_plugins = (array) get_option('active_plugins', array()); if (empty($active_plugins) || wp_installing()) { return $plugins; } $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; foreach ($active_plugins as $plugin) { if (!validate_file($plugin) && '.php' == substr($plugin, -4) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) && (!$network_plugins || !in_array(WP_PLUGIN_DIR . '/' . $plugin, $network_plugins))) { $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; } } return $plugins; }
/** * Collect system information for support * * @return array of system data for support */ public function getSupportStats() { $user = wp_get_current_user(); $plugins = array(); if (function_exists('get_plugin_data')) { $plugins_raw = wp_get_active_and_valid_plugins(); foreach ($plugins_raw as $k => $v) { $plugin_details = get_plugin_data($v); $plugin = $plugin_details['Name']; if (!empty($plugin_details['Version'])) { $plugin .= sprintf(' version %s', $plugin_details['Version']); } if (!empty($plugin_details['Author'])) { $plugin .= sprintf(' by %s', $plugin_details['Author']); } if (!empty($plugin_details['AuthorURI'])) { $plugin .= sprintf('(%s)', $plugin_details['AuthorURI']); } $plugins[] = $plugin; } } $network_plugins = array(); if (is_multisite() && function_exists('get_plugin_data')) { $plugins_raw = wp_get_active_network_plugins(); foreach ($plugins_raw as $k => $v) { $plugin_details = get_plugin_data($v); $plugin = $plugin_details['Name']; if (!empty($plugin_details['Version'])) { $plugin .= sprintf(' version %s', $plugin_details['Version']); } if (!empty($plugin_details['Author'])) { $plugin .= sprintf(' by %s', $plugin_details['Author']); } if (!empty($plugin_details['AuthorURI'])) { $plugin .= sprintf('(%s)', $plugin_details['AuthorURI']); } $network_plugins[] = $plugin; } } $mu_plugins = array(); if (function_exists('get_mu_plugins')) { $mu_plugins_raw = get_mu_plugins(); foreach ($mu_plugins_raw as $k => $v) { $plugin = $v['Name']; if (!empty($v['Version'])) { $plugin .= sprintf(' version %s', $v['Version']); } if (!empty($v['Author'])) { $plugin .= sprintf(' by %s', $v['Author']); } if (!empty($v['AuthorURI'])) { $plugin .= sprintf('(%s)', $v['AuthorURI']); } $mu_plugins[] = $plugin; } } $keys = apply_filters('tribe-pue-install-keys', array()); $systeminfo = array('url' => 'http://' . $_SERVER['HTTP_HOST'], 'name' => $user->display_name, 'email' => $user->user_email, 'install keys' => $keys, 'WordPress version' => get_bloginfo('version'), 'PHP version' => phpversion(), 'plugins' => $plugins, 'network plugins' => $network_plugins, 'mu plugins' => $mu_plugins, 'theme' => wp_get_theme()->get('Name'), 'multisite' => is_multisite(), 'settings' => Tribe__Events__Main::getOptions(), 'WordPress timezone' => get_option('timezone_string', __('Unknown or not set', 'the-events-calendar')), 'server timezone' => date_default_timezone_get()); if ($this->rewrite_rules_purged) { $systeminfo['rewrite rules purged'] = __('Rewrite rules were purged on load of this help page. Chances are there is a rewrite rule flush occurring in a plugin or theme!', 'the-events-calendar'); } $systeminfo = apply_filters('tribe-events-pro-support', $systeminfo); return $systeminfo; }
/** * Outputs diagnostic info for debugging. * * Outputs useful diagnostic info text at the Diagnostic Info & Error Log * section under the Help tab so the information can be viewed or * downloaded and shared for debugging. * * If you would like to add additional diagnostic information use the * `wpmdb_diagnostic_info` action hook (see {@link https://developer.wordpress.org/reference/functions/add_action/}). * * <code> * add_action( 'wpmdb_diagnostic_info', 'my_diagnostic_info' ) { * echo "Additional Diagnostic Info: \r\n"; * echo "...\r\n"; * } * </code> * * @return void */ function output_diagnostic_info() { global $wpdb; $table_prefix = $wpdb->base_prefix; echo 'site_url(): '; echo esc_html(site_url()); echo "\r\n"; echo 'home_url(): '; echo esc_html(home_url()); echo "\r\n"; echo 'Database Name: '; echo esc_html($wpdb->dbname); echo "\r\n"; echo 'Table Prefix: '; echo esc_html($table_prefix); echo "\r\n"; echo 'WordPress: '; echo bloginfo('version'); if (is_multisite()) { echo ' Multisite'; } echo "\r\n"; echo 'Web Server: '; echo esc_html(!empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''); echo "\r\n"; echo 'PHP: '; if (function_exists('phpversion')) { echo esc_html(phpversion()); } echo "\r\n"; echo 'MySQL: '; echo esc_html(empty($wpdb->use_mysqli) ? mysql_get_server_info() : mysqli_get_server_info($wpdb->dbh)); echo "\r\n"; echo 'ext/mysqli: '; echo empty($wpdb->use_mysqli) ? 'no' : 'yes'; echo "\r\n"; echo 'WP Memory Limit: '; echo esc_html(WP_MEMORY_LIMIT); echo "\r\n"; echo 'Blocked External HTTP Requests: '; if (!defined('WP_HTTP_BLOCK_EXTERNAL') || !WP_HTTP_BLOCK_EXTERNAL) { echo 'None'; } else { $accessible_hosts = defined('WP_ACCESSIBLE_HOSTS') ? WP_ACCESSIBLE_HOSTS : ''; if (empty($accessible_hosts)) { echo 'ALL'; } else { echo 'Partially (Accessible Hosts: ' . esc_html($accessible_hosts) . ')'; } } echo "\r\n"; echo 'WPMDB Bottleneck: '; echo esc_html(size_format($this->get_bottleneck())); echo "\r\n"; echo 'WP Locale: '; echo esc_html(get_locale()); echo "\r\n"; echo 'DB Charset: '; echo esc_html(DB_CHARSET); echo "\r\n"; if (function_exists('ini_get') && ($suhosin_limit = ini_get('suhosin.post.max_value_length'))) { echo 'Suhosin Post Max Value Length: '; echo esc_html(is_numeric($suhosin_limit) ? size_format($suhosin_limit) : $suhosin_limit); echo "\r\n"; } if (function_exists('ini_get') && ($suhosin_limit = ini_get('suhosin.request.max_value_length'))) { echo 'Suhosin Request Max Value Length: '; echo esc_html(is_numeric($suhosin_limit) ? size_format($suhosin_limit) : $suhosin_limit); echo "\r\n"; } echo 'Debug Mode: '; echo esc_html(defined('WP_DEBUG') && WP_DEBUG ? 'Yes' : 'No'); echo "\r\n"; echo 'WP Max Upload Size: '; echo esc_html(size_format(wp_max_upload_size())); echo "\r\n"; echo 'PHP Post Max Size: '; echo esc_html(size_format($this->get_post_max_size())); echo "\r\n"; echo 'PHP Time Limit: '; if (function_exists('ini_get')) { echo esc_html(ini_get('max_execution_time')); } echo "\r\n"; echo 'PHP Error Log: '; if (function_exists('ini_get')) { echo esc_html(ini_get('error_log')); } echo "\r\n"; echo 'fsockopen: '; if (function_exists('fsockopen')) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'OpenSSL: '; if ($this->open_ssl_enabled()) { echo esc_html(OPENSSL_VERSION_TEXT); } else { echo 'Disabled'; } echo "\r\n"; echo 'cURL: '; if (function_exists('curl_init')) { echo 'Enabled'; } else { echo 'Disabled'; } echo "\r\n"; echo 'Enable SSL verification setting: '; if (1 == $this->settings['verify_ssl']) { echo 'Yes'; } else { echo 'No'; } echo "\r\n"; echo 'Compatibility Mode: '; if (isset($GLOBALS['wpmdb_compatibility'])) { echo 'Yes'; } else { echo 'No'; } echo "\r\n"; echo 'Delay Between Requests: '; $delay_between_requests = $this->settings['delay_between_requests']; $delay_between_requests = $delay_between_requests > 0 ? $delay_between_requests / 1000 : $delay_between_requests; echo esc_html($delay_between_requests) . ' s'; echo "\r\n\r\n"; do_action('wpmdb_diagnostic_info'); if (has_action('wpmdb_diagnostic_info')) { echo "\r\n"; } $theme_info = wp_get_theme(); echo "Active Theme Name: " . esc_html($theme_info->Name) . "\r\n"; echo "Active Theme Folder: " . esc_html(basename($theme_info->get_stylesheet_directory())) . "\r\n"; if ($theme_info->get('Template')) { echo "Parent Theme Folder: " . esc_html($theme_info->get('Template')) . "\r\n"; } if (!file_exists($theme_info->get_stylesheet_directory())) { echo "WARNING: Active Theme Folder Not Found\r\n"; } echo "\r\n"; echo "Active Plugins:\r\n"; if (isset($GLOBALS['wpmdb_compatibility'])) { remove_filter('option_active_plugins', 'wpmdbc_exclude_plugins'); remove_filter('site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins'); $blacklist = array_flip((array) $this->settings['blacklist_plugins']); } else { $blacklist = array(); } $active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { $network_active_plugins = wp_get_active_network_plugins(); $active_plugins = array_map(array($this, 'remove_wp_plugin_dir'), $network_active_plugins); } foreach ($active_plugins as $plugin) { $suffix = isset($blacklist[$plugin]) ? '*' : ''; $this->print_plugin_details(WP_PLUGIN_DIR . '/' . $plugin, $suffix); } if (isset($GLOBALS['wpmdb_compatibility'])) { add_filter('option_active_plugins', 'wpmdbc_exclude_plugins'); add_filter('site_option_active_sitewide_plugins', 'wpmdbc_exclude_site_plugins'); } $mu_plugins = wp_get_mu_plugins(); if ($mu_plugins) { echo "\r\n"; echo "Must-use Plugins:\r\n"; foreach ($mu_plugins as $mu_plugin) { $this->print_plugin_details($mu_plugin); } } }
function test_active_network_plugins() { $path = "hello.php"; // local activate, should be invisible for the network activate_plugin($path); // $network_wide = false $active_plugins = wp_get_active_network_plugins(); $this->assertEquals( Array(), $active_plugins ); add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) ); // activate the plugin sitewide activate_plugin($path, '', $network_wide = true); $active_plugins = wp_get_active_network_plugins(); $this->assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins ); //deactivate the plugin deactivate_plugins($path); $active_plugins = wp_get_active_network_plugins(); $this->assertEquals( Array(), $active_plugins ); $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode activate_plugin($path, '', $network_wide = true); deactivate_plugins($path, true); // silent $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode }
function view() { ?> <div id="wdwt_theme_support" class="no_option_content"> <div class="clear"></div> <h3><?php _e('System Information', "news-magazine"); ?> </h3> <h4><?php _e('Please include the following information when requesting support', "news-magazine"); ?> </h4> <textarea readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', "news-magazine"); ?> " style="width: 800px;min-height: 800px; font-family: monospace; background: 0 0;white-space: pre;overflow: auto;display:inline-block;margin-left: 0 !important;"> # SITE_URL: <?php echo site_url() . "\n"; ?> # HOME_URL: <?php echo home_url() . "\n"; ?> # IS MULTISITE : <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> # THEME VERSION : <?php echo WDWT_VERSION . "\n"; ?> # WP VERSION : <?php echo get_bloginfo('version') . "\n"; ?> # PERMALINK STRUCTURE : <?php echo get_option('permalink_structure') . "\n"; ?> # ACTIVE PLUGINS : <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // show only active ones if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (is_multisite()) { ?> # NETWORK ACTIVE PLUGINS: <?php $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); // If the plugin isn't active, don't show it. if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n"; } } global $wpdb; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo @mysql_get_server_info() . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT . "B"; echo "\n"; ?> PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?> PHP Memory Limit: <?php echo ini_get('memory_limit') . "\n"; ?> PHP Upload Max Size: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Post Max Size: <?php echo ini_get('post_max_size') . "\n"; ?> PHP Upload Max Filesize: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Time Limit: <?php echo ini_get('max_execution_time') . "\n"; ?> PHP Max Input Vars: <?php echo ini_get('max_input_vars') . "\n"; ?> PHP Arg Separator: <?php echo ini_get('arg_separator.output') . "\n"; ?> PHP Allow URL File Open: <?php echo ini_get('allow_url_fopen') ? "Yes" : "No\n"; ?> WP_DEBUG: <?php echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> Page For Posts: <?php $id = get_option('page_for_posts'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> </textarea> </div> <?php }
public static function display_system_info($hook) { global $wpdb; $screen = get_current_screen(); if ($screen->id != 'landing-page_page_lp_global_settings') { return; } if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); $theme = $theme_data['Name'] . ' ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; } /* Try to identifty the hosting provider */ $host = false; if (defined('WPE_APIKEY')) { $host = 'WP Engine'; } elseif (defined('PAGELYBIN')) { $host = 'Pagely'; } ?> <form id="sys-inbound-form" action="<?php echo esc_url(admin_url('edit.php?post_type=landing-page&page=lp_global_settings')); ?> " method="post" dir="ltr"> <h2><?php _e('System Information', 'inboundnow'); ?> </h2> <input type="hidden" name="inbound-action" value="inbound-download-sysinfo"/> <style type="text/css">#inbound-download-sysinfo { display: none; }</style> <?php submit_button(__('Download System Info File for Support Requests', 'inboundnow'), 'primary', 'inbound-download-sysinfo', false); ?> <textarea readonly="readonly" onclick="this.focus();this.select()" id="copy-inbound-info" name="landing_pages_sysinfo" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd'); ?> "> ### Begin System Info ### ## Please include this information when posting support requests ## Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> SITE_URL: <?php echo site_url() . "\n"; ?> HOME_URL: <?php echo home_url() . "\n"; ?> Landing Page Version: <?php echo LANDINGPAGES_CURRENT_VERSION . "\n"; ?> Upgraded From: <?php echo get_option('lp_version_upgraded_from', 'None') . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> Permalink Structure: <?php echo get_option('permalink_structure') . "\n"; ?> Active Theme: <?php echo $theme . "\n"; ?> <?php if ($host) { ?> Host: <?php echo $host . "\n"; ?> <?php } ?> Registered Post Stati: <?php echo implode(', ', get_post_stati()) . "\n\n"; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo mysql_get_server_info($wpdb->dbh) . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?> PHP Memory Limit: <?php echo ini_get('memory_limit') . "\n"; ?> PHP Upload Max Size: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Post Max Size: <?php echo ini_get('post_max_size') . "\n"; ?> PHP Upload Max Filesize: <?php echo ini_get('upload_max_filesize') . "\n"; ?> PHP Time Limit: <?php echo ini_get('max_execution_time') . "\n"; ?> PHP Max Input Vars: <?php echo ini_get('max_input_vars') . "\n"; ?> WP_DEBUG: <?php echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n"; ?> WP Table Prefix: <?php echo "Length: " . strlen($wpdb->prefix); echo " Status:"; if (strlen($wpdb->prefix) > 16) { echo " ERROR: Too Long"; } else { echo " Acceptable"; } echo "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> Page For Posts: <?php $id = get_option('page_for_posts'); echo get_the_title($id) . ' (#' . $id . ')' . "\n"; ?> Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; echo "\n"; ?> Session Name: <?php echo esc_html(ini_get('session.name')); echo "\n"; ?> Cookie Path: <?php echo esc_html(ini_get('session.cookie_path')); echo "\n"; ?> Save Path: <?php echo esc_html(ini_get('session.save_path')); echo "\n"; ?> Use Cookies: <?php echo ini_get('session.use_cookies') ? 'On' : 'Off'; echo "\n"; ?> Use Only Cookies: <?php echo ini_get('session.use_only_cookies') ? 'On' : 'Off'; echo "\n"; ?> WordPress Memory Limit: NA DISPLAY ERRORS: <?php echo ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A'; echo "\n"; ?> FSOCKOPEN: <?php echo function_exists('fsockopen') ? __('Your server supports fsockopen.', 'edd') : __('Your server does not support fsockopen.', 'edd'); echo "\n"; ?> cURL: <?php echo function_exists('curl_init') ? __('Your server supports cURL.', 'edd') : __('Your server does not support cURL.', 'edd'); echo "\n"; ?> SOAP Client: <?php echo class_exists('SoapClient') ? __('Your server has the SOAP Client enabled.', 'edd') : __('Your server does not have the SOAP Client enabled.', 'edd'); echo "\n"; ?> SUHOSIN: <?php echo extension_loaded('suhosin') ? __('Your server has SUHOSIN installed.', 'edd') : __('Your server does not have SUHOSIN installed.', 'edd'); echo "\n"; ?> - INSTALLED LP TEMPLATES: <?php /* Show templates that have been copied to the theme's edd_templates dir */ $dir = LANDINGPAGES_UPLOADS_PATH . '/*'; if (!empty($dir)) { foreach (glob($dir) as $file) { echo "Template: " . basename($file) . "\n"; } } else { echo 'No overrides found'; } ?> - ACTIVE PLUGINS: <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { /* If the plugin isn't active, don't show it. */ if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } if (is_multisite()) { ?> - NETWORK ACTIVE PLUGINS: <?php $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option('active_sitewide_plugins', array()); foreach ($plugins as $plugin_path) { $plugin_base = plugin_basename($plugin_path); /* If the plugin isn't active, don't show it. */ if (!array_key_exists($plugin_base, $active_plugins)) { continue; } $plugin = get_plugin_data($plugin_path); echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n"; } } ?> ### End System Info ###</textarea> </form> <?php }