60, 'user-agent' => 'woocommerce/', 'httpversion' => '1.1', 'body' => array( 'cmd' => '_notify-validate', ), ) ); $post_response_successful = false; if ( ! is_wp_error( $post_response ) && $post_response['response']['code'] >= 200 && $post_response['response']['code'] < 300 ) { $post_response_successful = true; } return $post_response_successful; } /** * Get_request * * Test GET requests * * @return bool|\WP_Error * * @since 1.1.0 */ private static function get_request() { $get_response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); $get_response_successful = false; if ( ! is_wp_error( $get_response ) && $get_response['response']['code'] >= 200 && $get_response['response']['code'] < 300 ) { $get_response_successful = true; } return $get_response_successful; } /** * Environment_info collector * * All environment info * * @since 1.1.0 */ public static function environment_info() { static $environment_info = null; if ( null !== $environment_info ) { return $environment_info; } global $wpdb; // $get_response_msg = ''; // // Remote Post. // $post_response = self::post_request(); // $post_response_msg = ''; // if ( is_wp_error( $post_response ) ) { // $post_response_msg = $post_response->get_error_message(); // } elseif ( ! empty( $post_response['response']['code'] ) ) { // $post_response_msg = $post_response['response']['code']; // } // // Remote Get. // $get_response = self::get_request(); // $get_response_msg = ''; // if ( is_wp_error( $get_response ) ) { // $get_response_msg = $get_response->get_error_message(); // } elseif ( ! empty( $get_response['response']['code'] ) ) { // $get_response_msg = $get_response['response']['code']; // } return $environment_info = array( 'home_url' => home_url( '/' ), 'site_url' => site_url( '/' ), 'wp_version' => get_bloginfo( 'version' ), 'wp_multisite' => is_multisite(), 'wp_memory_limit' => self::_memory_limit(), 'wp_debug_mode' => ( defined( 'WP_DEBUG' ) && \WP_DEBUG ), 'wp_debug_display' => ( defined( 'WP_DEBUG_DISPLAY' ) && \WP_DEBUG_DISPLAY ), 'wp_debug_log' => ( defined( 'WP_DEBUG_LOG' ) && \WP_DEBUG_LOG ), 'wp_cron_disable' => ( defined( 'DISABLE_WP_CRON' ) && \DISABLE_WP_CRON ), 'script_debug' => ( defined( 'SCRIPT_DEBUG' ) && \SCRIPT_DEBUG ), 'save_queries' => ( defined( 'SAVEQUERIES' ) && \SAVEQUERIES ), 'wp_environment_type' => ( defined( 'WP_ENVIRONMENT_TYPE' ) && \WP_ENVIRONMENT_TYPE ) ? \WP_ENVIRONMENT_TYPE : 'production', 'block_external_requests' => ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && \WP_HTTP_BLOCK_EXTERNAL ) ? \WP_HTTP_BLOCK_EXTERNAL : false, 'wp_development_mode' => ( defined( 'WP_DEVELOPMENT_MODE' ) && \WP_DEVELOPMENT_MODE ) ? \WP_DEVELOPMENT_MODE : '', 'language' => get_locale(), 'server_info' => $_SERVER['SERVER_SOFTWARE'] ?? '', // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized 'php_version' => phpversion(), 'php_post_max_size' => self::_let_to_num( ini_get( 'post_max_size' ) ), 'php_max_execution_time' => ini_get( 'max_execution_time' ), 'php_max_input_vars' => ini_get( 'max_input_vars' ), 'curl_version' => self::_curl_version(), 'suhosin_installed' => extension_loaded( 'suhosin' ), 'max_upload_size' => wp_max_upload_size(), 'mysql_version' => ( ! empty( $wpdb->is_mysql ) ? $wpdb->db_version() : '' ), 'fsockopen_or_curl_enabled' => ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ), 'mbstring_enabled' => extension_loaded( 'mbstring' ), 'xmlreader_enabled' => extension_loaded( 'xmlreader' ), // 'remote_post_successful' => $post_response, // 'remote_post_response' => $post_response_msg, // 'remote_get_successful' => $get_response, // 'remote_get_response' => $get_response_msg, 'secure_connection' => 'https' === substr( get_home_url(), 0, 5 ), 'hide_errors' => ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ), ); } /** * _theme_info * * Get the theme info * * @since 1.1.0 */ private static function _theme_info() { $active_theme = \wp_get_theme(); if ( \is_child_theme() ) { $parent_theme = \wp_get_theme( $active_theme->template ); $parent_theme_info = array( 'is_child_theme' => true, 'parent_name' => $parent_theme->name, 'parent_version' => $parent_theme->version, 'parent_author_url' => $parent_theme->{'Author URI'}, 'version_latest' => $parent_theme->version, ); // $api = themes_api( // 'theme_information', // array( // 'slug' => $parent_theme->stylesheet, // 'fields' => array( // 'sections' => false, // 'tags' => false, // ), // ) // ); // if ( is_object( $api ) && ! is_wp_error( $api ) && ! empty( $api->version ) ) { // $version_latest = $api->version; // $parent_theme_info['version_latest'] = $version_latest; // } } else { $parent_theme_info = array( 'is_child_theme' => false, 'parent_name' => $active_theme->name, 'parent_version' => $active_theme->version, 'parent_author_url' => $active_theme->{'Author URI'}, 'version_latest' => $active_theme->version, ); // $api = themes_api( // 'theme_information', // array( // 'slug' => $active_theme->stylesheet, // 'fields' => array( // 'sections' => false, // 'tags' => false, // ), // ) // ); // if ( is_object( $api ) && ! is_wp_error( $api ) && ! empty( $api->version ) ) { // $version_latest = $api->version; // $parent_theme_info['version_latest'] = $version_latest; // } } return $parent_theme_info; } /** * _get_active_plugins * * Get all active plugins info * * @since 1.1.0 */ private static function _get_active_plugins() { // This Plugin causes an Fatal error. if ( class_exists( 'Envira_Gallery' ) ) { return; } include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // Get both site plugins and network plugins. $active_plugins = (array) \get_option( 'active_plugins', array() ); if ( \is_multisite() ) { $network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); $active_plugins = array_merge( $active_plugins, $network_activated_plugins ); } $active_plugins_data = array(); foreach ( $active_plugins as $plugin ) { $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); $dirname = dirname( $plugin ); $version_latest = ''; $slug = explode( '/', $plugin ); $slug = explode( '.', end( $slug ) ); $slug = $slug[0]; // $api = plugins_api( // 'plugin_information', // array( // 'slug' => $slug, // 'fields' => array( // 'sections' => false, // 'tags' => false, // ), // ) // ); // if ( is_object( $api ) && ! is_wp_error( $api ) && ! empty( $api->version ) ) { // $version_latest = $api->version; // } // convert plugin data to json response format. $active_plugins_data[] = array( 'plugin' => $plugin, 'name' => wp_strip_all_tags( $data['Name'] ), 'version' => wp_strip_all_tags( $data['Version'] ), 'version_latest' => $version_latest, 'url' => wp_strip_all_tags( $data['PluginURI'] ), 'author_name' => wp_strip_all_tags( str_replace( ',', ' | ', $data['AuthorName'] ), true ), 'author_url' => esc_url_raw( $data['AuthorURI'] ), 'network_activated' => $data['Network'], ); } return $active_plugins_data; } /** * _let_to_num * * Transform the php.ini notation for numbers (like '2M') to an integer. * * @since 1.1.0 */ public static function _let_to_num( $size ) { $l = substr( $size, -1 ); $ret = substr( $size, 0, -1 ); switch ( strtoupper( $l ) ) { case 'P': $ret *= 1024; // no break. case 'T': $ret *= 1024; // no break. case 'G': $ret *= 1024; // no break. case 'M': $ret *= 1024; // no break. case 'K': $ret *= 1024; } return $ret; } /** * _print_environment_info * * @since 1.1.0 */ public static function print_environment_info() { // Capability gate: only admins (or users with manage_options) can view detailed environment info. if ( ! \current_user_can( 'manage_options' ) ) { return; } global $wpdb; $environment = self::environment_info(); ?>
:
:
:
: ' : '–'; ?>
: ' . esc_html__( 'Increasing memory allocated to PHP', '0-day-analytics' ) . '' ); echo wp_kses( ' ' . $memory_msg . '', array( 'mark' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array() ) ) ); } else { echo wp_kses( '' . esc_html( size_format( (int) $environment['wp_memory_limit'] ) ) . '', array( 'mark' => array( 'class' => array() ) ) ); } ?>
: –
: –
: –
:
use_mysqli && \function_exists( 'mysqli_get_server_info' ) ) { if ( empty( $wpdb->is_mysql ) || ! $wpdb->use_mysqli ) { $ver = array( 'string' => '', 'number' => '', ); } $server_info = \mysqli_get_server_info( $wpdb->dbh ); // phpcs:ignore WordPress.DB.RestrictedFunctions.mysql_mysqli_get_server_info $ver = array( 'string' => $server_info, 'number' => preg_replace( '/([^\d.]+).*/', '', $server_info ), ); $ver = $ver['number']; } else { $ver = 0; } if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> */ ?>
:
: ' . $php_msg . '', array( 'mark' => array( 'class' => array() ), 'span' => array( 'class' => array() ) ) ); } else { echo wp_kses( '' . esc_html( $environment['php_version'] ) . '', array( 'mark' => array( 'class' => array() ) ) ); } ?>
:
: $environment['php_max_execution_time'] && 0 !== $environment['php_max_execution_time'] ) { /* translators: 1: current max execution time, 2: recommended execution time. */ $time_msg = sprintf( esc_html__( '%1$s - We recommend setting max execution time to at least %2$s.', '0-day-analytics' ), esc_html( (string) $environment['php_max_execution_time'] ), esc_html( '120' ) ); echo wp_kses( ' ' . $time_msg . '', array( 'mark' => array( 'class' => array() ), 'span' => array( 'class' => array() ) ) ); } else { echo esc_html( (string) $environment['php_max_execution_time'] ); } ?>
: ' . $input_msg . '', array( 'mark' => array( 'class' => array() ), 'span' => array( 'class' => array() ) ) ); } else { echo wp_kses( '' . esc_html( (string) $environment['php_max_input_vars'] ) . '', array( 'mark' => array( 'class' => array() ) ) ); } ?>
:
: ' . esc_html__( 'You have to increase the suhosin.post.max_vars and suhosin.request.max_vars parameters to 2000 or more.', '0-day-analytics' ) : '–'; ?>
: ' . esc_html__( 'Learn more', '0-day-analytics' ) . ''; echo wp_kses( ' ' . $mysql_msg . ' ' . $mysql_link . '', array( 'mark' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array() ) ) ); } else { echo wp_kses( '' . esc_html( $environment['mysql_version'] ) . '', array( 'mark' => array( 'class' => array() ) ) ); } ?>
:
: '; } else { echo ' ' . esc_html__( 'Your server does not have fsockopen or cURL enabled. Contact your hosting provider.', '0-day-analytics' ) . ''; } ?>
: '; } else { echo ' ' . esc_html__( 'Your server does not support the mbstring functions - this is required for better character encoding. Some fallbacks will be used instead for it.', '0-day-analytics' ) . ''; } ?>
: '; } else { echo ' ' . esc_html__( 'The XMLReader PHP module/extension is missing. Please contact your hosting company and ask them to install that for you.', '0-day-analytics' ) . ''; } ?>
:
								 0 ) ? 'INF' : '-INF';
											}
										}
									);
									// Encode for safe output.
									echo \esc_html( \wp_json_encode( $filtered, JSON_PRETTY_PRINT ) );
								} else {
									echo \esc_html__( 'Constant list hidden for security. (Requires manage_options)', '0-day-analytics' );
								}
								?>
								
: '; } else { echo ' ' . esc_html__( 'wp_remote_post() failed. Contact your hosting provider.', '0-day-analytics' ) . ' ' . esc_html( $environment['remote_post_response'] ) . ''; } ?>
: '; } else { echo ' ' . esc_html__( 'wp_remote_get() failed. Contact your hosting provider.', '0-day-analytics' ) . ' ' . esc_html( $environment['remote_get_response'] ) . ''; } ?>
:
: ' . sprintf( esc_html__( '%s is available', '0-day-analytics' ), $latest ) . ''; echo wp_kses( ' – ' . $notice, array( 'strong' => array( 'style' => array() ) ) ); } ?>
:
: ' : '–'; ?>
:
: ' . sprintf( esc_html__( '%s is available', '0-day-analytics' ), $latest ) . ''; echo wp_kses( ' – ' . $notice, array( 'strong' => array( 'style' => array() ) ) ); } ?>
:
true, '_builtin' => false, ), 'objects' ); if ( empty( $post_types ) ) { return; } ?>
label; ?> exclude_from_search ? '' . esc_html__( 'Private', '0-day-analytics' ) . '' : esc_html__( 'Public', '0-day-analytics' ); ?>
' . $plugin_name_text . ''; } $version_string = ''; $network_string = ''; if ( ! empty( $plugin['version_latest'] ) && version_compare( $plugin['version_latest'], $plugin['version'], '>' ) ) { /* translators: %s is the latest available version for the plugin. */ $latest_version = esc_html( (string) $plugin['version_latest'] ); $version_string = ' – ' . sprintf( esc_html__( '%s is available', '0-day-analytics' ), $latest_version ) . ''; } if ( true === $plugin['network_activated'] ) { $network_string = ' – ' . esc_html__( '(Network enabled in plugin\'s meta)', '0-day-analytics' ) . ''; } ?>
()
array( 'href' => array(), 'target' => array(), 'rel' => array() ) ) ); ?>

$value ) { if ( ! in_array( $value, array( '.', '..' ) ) ) { if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); foreach ( $sub_files as $sub_file ) { $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; } } else { $result[] = $value; } } } } return $result; } /** * Retrieve metadata from a file. Based on WP Core's get_file_data function * * @since 1.1.0 */ public static function get_template_version( $file ) { // We don't need to write to the file, so just open for reading. $fp = fopen( $file, 'r' ); // Pull only the first 8kiB of the file in. $file_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose( $fp ); // Make sure we catch CR-only line endings. $file_data = str_replace( "\r", "\n", $file_data ); $version = ''; if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) { $version = _cleanup_header_comment( $match[1] ); } return $version; } } }