Use new code style
This commit is contained in:
@ -81,8 +81,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function init() {
|
||||
|
||||
add_action('wp_ajax_wu_generate_text_file_system_info', array($this, 'generate_text_file_system_info'));
|
||||
|
||||
} // end init;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow child classes to register scripts and styles that can be loaded on the output function, for example.
|
||||
@ -95,8 +94,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
wp_enqueue_script('dashboard');
|
||||
|
||||
wp_enqueue_script('clipboard');
|
||||
|
||||
} // end register_scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow child classes to register widgets, if they need them.
|
||||
@ -109,16 +107,19 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$screen = get_current_screen();
|
||||
|
||||
foreach ($this->get_data() as $name_type => $data) {
|
||||
add_meta_box(
|
||||
'wp-table-system-info-' . sanitize_title($name_type),
|
||||
$name_type,
|
||||
function () use ($data) {
|
||||
|
||||
add_meta_box('wp-table-system-info-' . sanitize_title($name_type), $name_type, function() use ($data) {
|
||||
|
||||
$this->output_table_system_info($data);
|
||||
|
||||
}, $screen->id, 'normal', null);
|
||||
|
||||
} // end foreach;
|
||||
|
||||
} // end register_widgets;
|
||||
$this->output_table_system_info($data);
|
||||
},
|
||||
$screen->id,
|
||||
'normal',
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display system info Table
|
||||
@ -132,12 +133,14 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
wu_get_template('system-info/system-info-table', array(
|
||||
'data' => $data,
|
||||
'screen' => $screen,
|
||||
));
|
||||
|
||||
} // end output_table_system_info;
|
||||
wu_get_template(
|
||||
'system-info/system-info-table',
|
||||
array(
|
||||
'data' => $data,
|
||||
'screen' => $screen,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of the page.
|
||||
@ -148,8 +151,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function get_title() {
|
||||
|
||||
return __('System Info', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of menu for this page.
|
||||
@ -160,8 +162,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function get_menu_title() {
|
||||
|
||||
return __('System Info', 'wp-ultimo');
|
||||
|
||||
} // end get_menu_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows admins to rename the sub-menu (first item) for a top-level page.
|
||||
@ -172,8 +173,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function get_submenu_title() {
|
||||
|
||||
return __('Dashboard', 'wp-ultimo');
|
||||
|
||||
} // end get_submenu_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every child class should implement the output method to display the contents of the page.
|
||||
@ -185,12 +185,14 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
wu_get_template('system-info/system-info', array(
|
||||
'data' => $this->get_data(),
|
||||
'screen' => $screen,
|
||||
));
|
||||
|
||||
} // end output;
|
||||
wu_get_template(
|
||||
'system-info/system-info',
|
||||
array(
|
||||
'data' => $this->get_data(),
|
||||
'screen' => $screen,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data for system info
|
||||
@ -238,336 +240,316 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$array_constants = array();
|
||||
|
||||
foreach ($array_constants_options as $constant) {
|
||||
|
||||
$array_constants[] = array(
|
||||
'tooltip' => '',
|
||||
'title' => $constant,
|
||||
'value' => defined($constant) ? (is_bool(constant($constant)) ? __('Enabled', 'wp-ultimo') : constant($constant)) : __('Disabled', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
foreach ($plugins as $plugin_path => $plugin) {
|
||||
|
||||
if (in_array($plugin_path, array_keys($active_plugins), true)) {
|
||||
|
||||
$plugin_uri = '';
|
||||
|
||||
if (isset($plugin['PluginURI'])) {
|
||||
|
||||
$plugin_uri = ' (' . $plugin['PluginURI'] . ')';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$array_active_plugins[] = array(
|
||||
'tooltip' => '',
|
||||
'title' => $plugin['Name'],
|
||||
'value' => $plugin['Version'] . $plugin_uri
|
||||
'value' => $plugin['Version'] . $plugin_uri,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
$array_active_plugins_main_site = array();
|
||||
|
||||
foreach ($plugins as $plugin_path => $plugin) {
|
||||
|
||||
if (in_array($plugin_path, $active_plugins_main_site, true)) {
|
||||
|
||||
$plugin_uri = '';
|
||||
|
||||
if (isset($plugin['PluginURI'])) {
|
||||
|
||||
$plugin_uri = ' (' . $plugin['PluginURI'] . ')';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$array_active_plugins_main_site[] = array(
|
||||
'tooltip' => '',
|
||||
'title' => $plugin['Name'],
|
||||
'value' => $plugin['Version'] . $plugin_uri
|
||||
'value' => $plugin['Version'] . $plugin_uri,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
$wpultimo_settings = array();
|
||||
|
||||
foreach ($this->get_all_wp_ultimo_settings() as $setting => $value) {
|
||||
|
||||
if (is_array($value)) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
$wpultimo_settings[$setting] = array(
|
||||
$wpultimo_settings[ $setting ] = array(
|
||||
'tooltip' => '',
|
||||
'title' => $setting,
|
||||
'value' => $value
|
||||
'value' => $value,
|
||||
);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$array_wu_tables = array();
|
||||
|
||||
foreach ($wpdb->ms_global_tables as $key => $value) {
|
||||
|
||||
if (strncmp((string) $value, 'wu_', strlen('wu_')) === 0 && !array_key_exists($value, $array_wu_tables)) {
|
||||
|
||||
$array_wu_tables[$value] = array(
|
||||
if (strncmp((string) $value, 'wu_', strlen('wu_')) === 0 && ! array_key_exists($value, $array_wu_tables)) {
|
||||
$array_wu_tables[ $value ] = array(
|
||||
'tooltip' => '',
|
||||
'title' => $value,
|
||||
'value' => get_network_option(null, "wpdb_{$value}_version")
|
||||
'value' => get_network_option(null, "wpdb_{$value}_version"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
|
||||
return apply_filters('wu_system_info_data', array(
|
||||
'WordPress and System Settings' => array(
|
||||
'wp-ultimo-version' => array(
|
||||
'tooltip' => 'WP Multisite WaaS current version installed locally',
|
||||
'title' => 'WP Multisite WaaS Version',
|
||||
'value' => wu_get_version(),
|
||||
),
|
||||
'wordpress-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WordPress Version',
|
||||
'value' => get_bloginfo('version')
|
||||
),
|
||||
'php-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Version',
|
||||
'value' => PHP_VERSION
|
||||
),
|
||||
'mysql-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'MySQL Version ',
|
||||
'value' => $wpdb->db_version()
|
||||
),
|
||||
'web-server' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Web Server',
|
||||
'value' => $_SERVER['SERVER_SOFTWARE']
|
||||
),
|
||||
'wordpress-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WordPress URL',
|
||||
'value' => get_bloginfo('wpurl')
|
||||
),
|
||||
'home-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Home URL',
|
||||
'value' => get_bloginfo('url')
|
||||
),
|
||||
'content-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Content Directory',
|
||||
'value' => WP_CONTENT_DIR
|
||||
),
|
||||
'content-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Content URL',
|
||||
'value' => WP_CONTENT_URL
|
||||
),
|
||||
'plugins-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins Directory',
|
||||
'value' => WP_PLUGIN_DIR
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins URL',
|
||||
'value' => WP_PLUGIN_URL
|
||||
),
|
||||
'uploads-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Uploads Directory',
|
||||
'value' => (defined('UPLOADS') ? UPLOADS : WP_CONTENT_DIR . '/uploads')
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Cookie Domain',
|
||||
'value' => defined('COOKIE_DOMAIN') ? COOKIE_DOMAIN ? COOKIE_DOMAIN : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'multisite-active' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Multi-Site Active',
|
||||
'value' => is_multisite() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo')
|
||||
),
|
||||
'php-current-time-gmt' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - GMT',
|
||||
'value' => wu_get_current_time('mysql', true),
|
||||
),
|
||||
'timezone' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Timezone',
|
||||
'value' => wp_timezone_string(),
|
||||
),
|
||||
'php-current-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - with Timezone',
|
||||
'value' => wu_get_current_time()
|
||||
),
|
||||
'database-current-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Database Current Time',
|
||||
'value' => gmdate('Y-m-d H:i:s', strtotime((string) $wpdb->get_row('SELECT NOW() as time;')->time))
|
||||
),
|
||||
'php-curl-support' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP cURL Support',
|
||||
'value' => function_exists('curl_init') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo')
|
||||
),
|
||||
'php-gd-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP GD Support',
|
||||
'value' => function_exists('gd_info') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo')
|
||||
),
|
||||
'php-memory-limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Limit',
|
||||
'value' => $memory_limit . 'M'
|
||||
),
|
||||
'php-memory-usage' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Usage',
|
||||
'value' => $memory_usage . 'M (' . round($memory_usage / $memory_limit * $pad_spaces, 0) . '%)'
|
||||
),
|
||||
'php-post-max-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Post Max Size',
|
||||
'value' => ini_get('post_max_size')
|
||||
),
|
||||
'php-upload-max-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Upload Max Size',
|
||||
'value' => ini_get('upload_max_filesize')
|
||||
),
|
||||
'php-max-execution-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max Execution Time',
|
||||
'value' => $max_execution_time
|
||||
),
|
||||
'php-allow-url-fopen' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Allow URL Fopen',
|
||||
'value' => ini_get('allow_url_fopen')
|
||||
),
|
||||
'php-max-file-uploads' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max File Uploads',
|
||||
'value' => ini_get('max_file_uploads')
|
||||
),
|
||||
'wp-options-count' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Count',
|
||||
'value' => count($all_options)
|
||||
),
|
||||
'wp-options-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Size',
|
||||
'value' => $all_options_bytes . 'kb'
|
||||
),
|
||||
'wp-options-transients' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => count($all_options_transients)
|
||||
),
|
||||
'wp-debug' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_DEBUG') ? WP_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'script-debug' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SCRIPT_DEBUG') ? SCRIPT_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'save-queries' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SAVEQUERIES') ? SAVEQUERIES ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'autosave-interval' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('AUTOSAVE_INTERVAL') ? AUTOSAVE_INTERVAL ? AUTOSAVE_INTERVAL : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'wp_post_revisions' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_POST_REVISIONS') ? WP_POST_REVISIONS ? WP_POST_REVISIONS : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'disable_wp_cron' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'DISABLE_WP_CRON',
|
||||
'value' => defined('DISABLE_WP_CRON') ? DISABLE_WP_CRON ? DISABLE_WP_CRON : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo')
|
||||
),
|
||||
'wp_lang' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WPLANG',
|
||||
'value' => defined('WPLANG') ? WPLANG ? WPLANG : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo')
|
||||
),
|
||||
'wp_memory_limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MEMORY_LIMIT') && WP_MEMORY_LIMIT) ? WP_MEMORY_LIMIT : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'wp_max_memory_limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MAX_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MAX_MEMORY_LIMIT') && WP_MAX_MEMORY_LIMIT) ? WP_MAX_MEMORY_LIMIT : __('Not set', 'wp-ultimo')
|
||||
),
|
||||
'operating-system' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Operating System',
|
||||
'value' => $browser['platform']
|
||||
),
|
||||
'browser' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Browser',
|
||||
'value' => $browser['name'] . ' ' . $browser['version']
|
||||
),
|
||||
'user-agent' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'User Agent',
|
||||
'value' => $browser['user_agent']
|
||||
),
|
||||
),
|
||||
|
||||
'Active Theme' => array(
|
||||
'active-theme' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Active Theme',
|
||||
'value' => $theme->get('Name') . ' - ' . $theme->get('Version') . '(' . $theme->get('ThemeURI') . ')'
|
||||
),
|
||||
),
|
||||
|
||||
'Active Plugins' => $array_active_plugins,
|
||||
'Active Plugins on Main Site' => $array_active_plugins_main_site,
|
||||
|
||||
'WP Multisite WaaS Database Status' => $array_wu_tables,
|
||||
|
||||
'WP Multisite WaaS Core Settings' => array_merge(
|
||||
array(
|
||||
'logs-directory' => array(
|
||||
return apply_filters(
|
||||
'wu_system_info_data',
|
||||
array(
|
||||
'WordPress and System Settings' => array(
|
||||
'wp-ultimo-version' => array(
|
||||
'tooltip' => 'WP Multisite WaaS current version installed locally',
|
||||
'title' => 'WP Multisite WaaS Version',
|
||||
'value' => wu_get_version(),
|
||||
),
|
||||
'wordpress-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Logs Directory',
|
||||
'value' => is_writable(Logger::get_logs_folder()) ? __('Writable', 'wp-ultimo') : __('Not Writable', 'wp-ultimo')
|
||||
'title' => 'WordPress Version',
|
||||
'value' => get_bloginfo('version'),
|
||||
),
|
||||
'php-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Version',
|
||||
'value' => PHP_VERSION,
|
||||
),
|
||||
'mysql-version' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'MySQL Version ',
|
||||
'value' => $wpdb->db_version(),
|
||||
),
|
||||
'web-server' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Web Server',
|
||||
'value' => $_SERVER['SERVER_SOFTWARE'],
|
||||
),
|
||||
'wordpress-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WordPress URL',
|
||||
'value' => get_bloginfo('wpurl'),
|
||||
),
|
||||
'home-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Home URL',
|
||||
'value' => get_bloginfo('url'),
|
||||
),
|
||||
'content-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Content Directory',
|
||||
'value' => WP_CONTENT_DIR,
|
||||
),
|
||||
'content-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Content URL',
|
||||
'value' => WP_CONTENT_URL,
|
||||
),
|
||||
'plugins-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins Directory',
|
||||
'value' => WP_PLUGIN_DIR,
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Plugins URL',
|
||||
'value' => WP_PLUGIN_URL,
|
||||
),
|
||||
'uploads-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Uploads Directory',
|
||||
'value' => (defined('UPLOADS') ? UPLOADS : WP_CONTENT_DIR . '/uploads'),
|
||||
),
|
||||
'pluguins-url' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Cookie Domain',
|
||||
'value' => defined('COOKIE_DOMAIN') ? COOKIE_DOMAIN ? COOKIE_DOMAIN : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'multisite-active' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Multi-Site Active',
|
||||
'value' => is_multisite() ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-current-time-gmt' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - GMT',
|
||||
'value' => wu_get_current_time('mysql', true),
|
||||
),
|
||||
'timezone' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Timezone',
|
||||
'value' => wp_timezone_string(),
|
||||
),
|
||||
'php-current-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Current Time - with Timezone',
|
||||
'value' => wu_get_current_time(),
|
||||
),
|
||||
'database-current-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Database Current Time',
|
||||
'value' => gmdate('Y-m-d H:i:s', strtotime((string) $wpdb->get_row('SELECT NOW() as time;')->time)),
|
||||
),
|
||||
'php-curl-support' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP cURL Support',
|
||||
'value' => function_exists('curl_init') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-gd-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP GD Support',
|
||||
'value' => function_exists('gd_info') ? __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'php-memory-limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Limit',
|
||||
'value' => $memory_limit . 'M',
|
||||
),
|
||||
'php-memory-usage' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Memory Usage',
|
||||
'value' => $memory_usage . 'M (' . round($memory_usage / $memory_limit * $pad_spaces, 0) . '%)',
|
||||
),
|
||||
'php-post-max-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Post Max Size',
|
||||
'value' => ini_get('post_max_size'),
|
||||
),
|
||||
'php-upload-max-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Upload Max Size',
|
||||
'value' => ini_get('upload_max_filesize'),
|
||||
),
|
||||
'php-max-execution-time' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max Execution Time',
|
||||
'value' => $max_execution_time,
|
||||
),
|
||||
'php-allow-url-fopen' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Allow URL Fopen',
|
||||
'value' => ini_get('allow_url_fopen'),
|
||||
),
|
||||
'php-max-file-uploads' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'PHP Max File Uploads',
|
||||
'value' => ini_get('max_file_uploads'),
|
||||
),
|
||||
'wp-options-count' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Count',
|
||||
'value' => count($all_options),
|
||||
),
|
||||
'wp-options-size' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Size',
|
||||
'value' => $all_options_bytes . 'kb',
|
||||
),
|
||||
'wp-options-transients' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => count($all_options_transients),
|
||||
),
|
||||
'wp-debug' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_DEBUG') ? WP_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'script-debug' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SCRIPT_DEBUG') ? SCRIPT_DEBUG ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'save-queries' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('SAVEQUERIES') ? SAVEQUERIES ? __('Enabled', 'wp-ultimo') : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'autosave-interval' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('AUTOSAVE_INTERVAL') ? AUTOSAVE_INTERVAL ? AUTOSAVE_INTERVAL : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'wp_post_revisions' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP Options Transients',
|
||||
'value' => defined('WP_POST_REVISIONS') ? WP_POST_REVISIONS ? WP_POST_REVISIONS : __('Disabled', 'wp-ultimo') : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'disable_wp_cron' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'DISABLE_WP_CRON',
|
||||
'value' => defined('DISABLE_WP_CRON') ? DISABLE_WP_CRON ? DISABLE_WP_CRON : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'wp_lang' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WPLANG',
|
||||
'value' => defined('WPLANG') ? WPLANG ? WPLANG : __('Yes', 'wp-ultimo') : __('No', 'wp-ultimo'),
|
||||
),
|
||||
'wp_memory_limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MEMORY_LIMIT') && WP_MEMORY_LIMIT) ? WP_MEMORY_LIMIT : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'wp_max_memory_limit' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'WP_MAX_MEMORY_LIMIT',
|
||||
'value' => (defined('WP_MAX_MEMORY_LIMIT') && WP_MAX_MEMORY_LIMIT) ? WP_MAX_MEMORY_LIMIT : __('Not set', 'wp-ultimo'),
|
||||
),
|
||||
'operating-system' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Operating System',
|
||||
'value' => $browser['platform'],
|
||||
),
|
||||
'browser' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Browser',
|
||||
'value' => $browser['name'] . ' ' . $browser['version'],
|
||||
),
|
||||
'user-agent' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'User Agent',
|
||||
'value' => $browser['user_agent'],
|
||||
),
|
||||
),
|
||||
$wpultimo_settings
|
||||
),
|
||||
'Defined Constants' => $array_constants,
|
||||
));
|
||||
|
||||
} // end get_data;
|
||||
'Active Theme' => array(
|
||||
'active-theme' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Active Theme',
|
||||
'value' => $theme->get('Name') . ' - ' . $theme->get('Version') . '(' . $theme->get('ThemeURI') . ')',
|
||||
),
|
||||
),
|
||||
|
||||
'Active Plugins' => $array_active_plugins,
|
||||
'Active Plugins on Main Site' => $array_active_plugins_main_site,
|
||||
|
||||
'WP Multisite WaaS Database Status' => $array_wu_tables,
|
||||
|
||||
'WP Multisite WaaS Core Settings' => array_merge(
|
||||
array(
|
||||
'logs-directory' => array(
|
||||
'tooltip' => '',
|
||||
'title' => 'Logs Directory',
|
||||
'value' => is_writable(Logger::get_logs_folder()) ? __('Writable', 'wp-ultimo') : __('Not Writable', 'wp-ultimo'),
|
||||
),
|
||||
),
|
||||
$wpultimo_settings
|
||||
),
|
||||
'Defined Constants' => $array_constants,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate text file of system info data
|
||||
@ -581,14 +563,10 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$txt = fopen($file_name, 'w') or die('Unable to open file!');
|
||||
|
||||
foreach ($this->get_data() as $type) {
|
||||
|
||||
foreach ($type as $item) {
|
||||
|
||||
fwrite($txt, $item['title'] . ': ' . $item['value'] . PHP_EOL);
|
||||
|
||||
} // end foreach;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($txt);
|
||||
|
||||
@ -602,8 +580,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
readfile($file_name);
|
||||
|
||||
die;
|
||||
|
||||
} // end generate_text_file_system_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get browser data
|
||||
@ -623,59 +600,41 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
// First get the platform
|
||||
if (preg_match('/linux/i', (string) $user_agent)) {
|
||||
|
||||
$platform = 'Linux';
|
||||
|
||||
} elseif (preg_match('/macintosh|mac os x/i', (string) $user_agent)) {
|
||||
|
||||
$platform = 'Mac';
|
||||
|
||||
} elseif (preg_match('/windows|win32/i', (string) $user_agent)) {
|
||||
|
||||
$platform = 'Windows';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// Next get the name of the user agent yes seperately and for good reason
|
||||
if (preg_match('/MSIE/i', (string) $user_agent) && !preg_match('/Opera/i', (string) $user_agent)) {
|
||||
|
||||
if (preg_match('/MSIE/i', (string) $user_agent) && ! preg_match('/Opera/i', (string) $user_agent)) {
|
||||
$browser_name = 'Internet Explorer';
|
||||
$browser_name_short = 'MSIE';
|
||||
|
||||
} elseif (preg_match('/Firefox/i', (string) $user_agent)) {
|
||||
|
||||
$browser_name = 'Mozilla Firefox';
|
||||
$browser_name_short = 'Firefox';
|
||||
|
||||
} elseif (preg_match('/Chrome/i', (string) $user_agent)) {
|
||||
|
||||
$browser_name = 'Google Chrome';
|
||||
$browser_name_short = 'Chrome';
|
||||
|
||||
} elseif (preg_match('/Safari/i', (string) $user_agent)) {
|
||||
|
||||
$browser_name = 'Apple Safari';
|
||||
$browser_name_short = 'Safari';
|
||||
|
||||
} elseif (preg_match('/Opera/i', (string) $user_agent)) {
|
||||
|
||||
$browser_name = 'Opera';
|
||||
$browser_name_short = 'Opera';
|
||||
|
||||
} elseif (preg_match('/Netscape/i', (string) $user_agent)) {
|
||||
|
||||
$browser_name = 'Netscape';
|
||||
$browser_name_short = 'Netscape';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// Finally get the correct version number
|
||||
$known = array('Version', $browser_name_short, 'other');
|
||||
$pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
|
||||
|
||||
if (!preg_match_all($pattern, (string) $user_agent, $matches)) {
|
||||
if ( ! preg_match_all($pattern, (string) $user_agent, $matches)) {
|
||||
// We have no matching number just continue
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// See how many we have
|
||||
$i = count($matches['browser']);
|
||||
@ -685,37 +644,27 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
// We will have two since we are not using 'other' argument yet
|
||||
// See if version is before or after the name
|
||||
if (strripos((string) $user_agent, 'Version') < strripos((string) $user_agent, (string) $browser_name_short)) {
|
||||
|
||||
$version = $matches['version'][0];
|
||||
|
||||
} else {
|
||||
|
||||
$version = $matches['version'][1];
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$version = $matches['version'][0];
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
// Check if we have a version number
|
||||
if (empty($version)) {
|
||||
|
||||
$version = '?';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array(
|
||||
'user_agent' => $user_agent,
|
||||
'name' => $browser_name,
|
||||
'version' => $version,
|
||||
'platform' => $platform,
|
||||
'pattern' => $pattern
|
||||
'pattern' => $pattern,
|
||||
);
|
||||
|
||||
} // end get_browser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of all the plugins
|
||||
@ -725,8 +674,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function get_all_plugins() {
|
||||
|
||||
return get_plugins();
|
||||
|
||||
} // end get_all_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get only the active plugins
|
||||
@ -735,9 +683,8 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
*/
|
||||
public function get_active_plugins() {
|
||||
|
||||
return (array) get_site_option( 'active_sitewide_plugins', array() );
|
||||
|
||||
} // end get_active_plugins;
|
||||
return (array) get_site_option('active_sitewide_plugins', array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get only the active plugins on main site
|
||||
@ -747,16 +694,14 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
public function get_active_plugins_on_main_site() {
|
||||
|
||||
return (array) get_option('active_plugins', array());
|
||||
|
||||
} // end get_active_plugins_on_main_site;
|
||||
}
|
||||
/**
|
||||
* Get memory usage
|
||||
*/
|
||||
public function get_memory_usage(): float {
|
||||
|
||||
return round(memory_get_usage() / 1024 / 1024, 2);
|
||||
|
||||
} // end get_memory_usage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the ioptions
|
||||
@ -767,8 +712,7 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
// Not to be confused with the core deprecated get_alloptions
|
||||
return wp_load_alloptions();
|
||||
|
||||
} // end get_all_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the desired WP Multisite WaaS Settings
|
||||
@ -796,35 +740,26 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
|
||||
$return_settings = array();
|
||||
|
||||
$settings = new \WP_Ultimo\Settings;
|
||||
$settings = new \WP_Ultimo\Settings();
|
||||
|
||||
foreach ($settings->get_all() as $setting => $value) {
|
||||
|
||||
$add = true;
|
||||
|
||||
foreach ($exclude as $ex) {
|
||||
|
||||
if (stristr($setting, $ex) !== false) {
|
||||
|
||||
$add = false;
|
||||
|
||||
break;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
}
|
||||
|
||||
if ($add) {
|
||||
|
||||
$return_settings[$setting] = $value;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
$return_settings[ $setting ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $return_settings;
|
||||
|
||||
} // end get_all_wp_ultimo_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transients om the options
|
||||
@ -837,17 +772,11 @@ class System_Info_Admin_Page extends Base_Admin_Page {
|
||||
$transients = array();
|
||||
|
||||
foreach ($options as $name => $value) {
|
||||
|
||||
if (stristr($name, 'transient')) {
|
||||
|
||||
$transients[$name] = $value;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
$transients[ $name ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $transients;
|
||||
|
||||
} // end get_transients_in_options;
|
||||
|
||||
} // end class System_Info_Admin_Page;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user