diff --git a/includes/admin/class-sp-admin-assets.php b/includes/admin/class-sp-admin-assets.php index fc2ec0bc..bccbe671 100755 --- a/includes/admin/class-sp-admin-assets.php +++ b/includes/admin/class-sp-admin-assets.php @@ -39,7 +39,7 @@ class SP_Admin_Assets { wp_enqueue_style( 'jquery-chosen', SP()->plugin_url() . '/assets/css/chosen.css', array(), '1.1.0' ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); - } elseif ( strpos( $screen->id, 'sp-config' ) !== false || strpos( $screen->id, 'sp-status' ) !== false ) { + } elseif ( strpos( $screen->id, 'sp-config' ) !== false ) { wp_enqueue_style( 'sportspress-admin', SP()->plugin_url() . '/assets/css/admin.css', array(), SP_VERSION ); } diff --git a/includes/admin/class-sp-admin-menus.php b/includes/admin/class-sp-admin-menus.php index 74b066d3..a285f21e 100755 --- a/includes/admin/class-sp-admin-menus.php +++ b/includes/admin/class-sp-admin-menus.php @@ -29,9 +29,6 @@ class SP_Admin_Menus { add_action( 'admin_menu', array( $this, 'seasons_menu' ), 10 ); add_filter( 'admin_menu', array( $this, 'menu_add' ), 20 ); - if ( current_user_can( 'manage_options' ) ) - add_action( 'admin_menu', array( $this, 'status_menu' ), 20 ); - add_action( 'admin_head', array( $this, 'menu_highlight' ) ); add_action( 'admin_head', array( $this, 'menu_rename' ) ); add_action( 'parent_file', array( $this, 'parent_file' ) ); @@ -80,14 +77,6 @@ class SP_Admin_Menus { add_submenu_page( 'sportspress', __( 'Seasons', 'sportspress' ), __( 'Seasons', 'sportspress' ), 'manage_sportspress', 'edit-tags.php?taxonomy=sp_season'); } - /** - * Add menu item - */ - public function status_menu() { - add_submenu_page( 'sportspress', __( 'System Status', 'sportspress' ), __( 'System Status', 'sportspress' ) , 'manage_sportspress', 'sp-status', array( $this, 'status_page' ) ); - register_setting( 'sportspress_status_settings_fields', 'sportspress_status_options' ); - } - /** * Highlights the correct top level admin menu item for post type add screens. * @@ -197,14 +186,6 @@ class SP_Admin_Menus { return true; } - /** - * Init the status page - */ - public function status_page() { - $page = include( 'class-sp-admin-status.php' ); - $page->output(); - } - /** * Clean the SP menu items in admin. */ diff --git a/includes/admin/class-sp-admin-notices.php b/includes/admin/class-sp-admin-notices.php index d6afa7d4..1d4f2502 100644 --- a/includes/admin/class-sp-admin-notices.php +++ b/includes/admin/class-sp-admin-notices.php @@ -88,7 +88,7 @@ class SP_Admin_Notices { * Show a notice highlighting bad template files */ public function template_file_check_notice() { - if ( isset( $_GET['page'] ) && 'sp-status' == $_GET['page'] ) { + if ( isset( $_GET['page'] ) && 'sportspress' == $_GET['page'] && isset( $_GET['tab'] ) && 'status' == $_GET['tab'] ) { return; } diff --git a/includes/admin/class-sp-admin-settings.php b/includes/admin/class-sp-admin-settings.php index fae8eac1..f3a2c145 100644 --- a/includes/admin/class-sp-admin-settings.php +++ b/includes/admin/class-sp-admin-settings.php @@ -5,7 +5,7 @@ * @author ThemeBoy * @category Admin * @package SportsPress/Admin - * @version 1.3 + * @version 1.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -40,7 +40,8 @@ class SP_Admin_Settings { $settings = apply_filters( 'sportspress_get_settings_pages', $settings ); $settings[] = include( 'settings/class-sp-settings-text.php' ); - //$settings[] = include( 'settings/class-sp-settings-config.php' ); + + if ( current_user_can( 'manage_options' ) ) $settings[] = include( 'settings/class-sp-settings-status.php' ); self::$settings = apply_filters( 'sportspress_get_settings_config_pages', $settings ); } diff --git a/includes/admin/class-sp-admin-status.php b/includes/admin/class-sp-admin-status.php index 5a2fe78d..268c101c 100644 --- a/includes/admin/class-sp-admin-status.php +++ b/includes/admin/class-sp-admin-status.php @@ -5,7 +5,7 @@ * @author ThemeBoy * @category Admin * @package SportsPress/Admin - * @version 0.8 + * @version 1.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -17,13 +17,6 @@ if ( ! class_exists( 'SP_Admin_Status' ) ) : */ class SP_Admin_Status { - /** - * Handles output of the reports page in admin. - */ - public function output() { - include_once( 'views/html-admin-page-status.php' ); - } - /** * Retrieve metadata from a file. Based on WP Core's get_file_data function * diff --git a/includes/admin/settings/class-sp-settings-general.php b/includes/admin/settings/class-sp-settings-general.php index 3343cb0a..553f6792 100644 --- a/includes/admin/settings/class-sp-settings-general.php +++ b/includes/admin/settings/class-sp-settings-general.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! class_exists( 'SP_Settings_General' ) ) : /** - * SP_Admin_Settings_General + * SP_Settings_General */ class SP_Settings_General extends SP_Settings_Page { diff --git a/includes/admin/settings/class-sp-settings-status.php b/includes/admin/settings/class-sp-settings-status.php new file mode 100644 index 00000000..04b40a8e --- /dev/null +++ b/includes/admin/settings/class-sp-settings-status.php @@ -0,0 +1,600 @@ +id = 'status'; + $this->label = __( 'System Status', 'sportspress' ); + + add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); + add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) ); + } + + /** + * Output system status + * + * @access public + * @return void + */ + public function output() { + ?> +
+ +| + | |||
|---|---|---|---|
| : | ++ | ||
| : | ++ | ||
| : | +version ); ?> | +||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | +' . sprintf( __( '%s - We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP', 'sportspress' ), size_format( $memory ), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . ''; + } else { + echo '' . size_format( $memory ) . ''; + } + ?> | +||
| : | +' . __( 'Yes', 'sportspress' ) . ''; else echo '' . __( 'No', 'sportspress' ) . ''; ?> | +||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | ++ | ||
| : | +' . sprintf( __( 'Default timezone is %s - it should be UTC', 'sportspress' ), $default_timezone ) . ''; + } else { + echo '' . sprintf( __( 'Default timezone is %s', 'sportspress' ), $default_timezone ) . ''; + } ?> + | +||
| : | ++ + + + | +||
| + | |||
| : | +' . $plugin_name . '';
+ }
+
+ if ( strstr( $dirname, 'sportspress' ) ) {
+
+ if ( false === ( $version_data = get_transient( md5( $plugin ) . '_version_data' ) ) ) {
+ $changelog = wp_remote_get( 'http://dzv365zjfbd8v.cloudfront.net/changelogs/' . $dirname . '/changelog.txt' );
+ $cl_lines = explode( "\n", wp_remote_retrieve_body( $changelog ) );
+ if ( ! empty( $cl_lines ) ) {
+ foreach ( $cl_lines as $line_num => $cl_line ) {
+ if ( preg_match( '/^[0-9]/', $cl_line ) ) {
+
+ $date = str_replace( '.' , '-' , trim( substr( $cl_line , 0 , strpos( $cl_line , '-' ) ) ) );
+ $version = preg_replace( '~[^0-9,.]~' , '' ,stristr( $cl_line , "version" ) );
+ $update = trim( str_replace( "*" , "" , $cl_lines[ $line_num + 1 ] ) );
+ $version_data = array( 'date' => $date , 'version' => $version , 'update' => $update , 'changelog' => $changelog );
+ set_transient( md5( $plugin ) . '_version_data', $version_data, 60*60*12 );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( ! empty( $version_data['version'] ) && version_compare( $version_data['version'], $plugin_data['Version'], '>' ) )
+ $version_string = ' – ' . $version_data['version'] . ' ' . __( 'is available', 'sportspress' ) . '';
+ }
+
+ $sp_plugins[] = $plugin_name . ' ' . __( 'by', 'sportspress' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'sportspress' ) . ' ' . $plugin_data['Version'] . $version_string;
+
+ }
+ }
+
+ if ( sizeof( $sp_plugins ) == 0 )
+ echo '-';
+ else
+ echo implode( ', ', $sp_plugins ); + + ?> |
+ ||
| + | |||
| : | ++ | ||
| : | +'sp_outcome', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| : | +'sp_result', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| : | +'sp_performance', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| : | +'sp_column', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ' = ' . get_post_meta( $post->ID, 'sp_equation', true ) . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| : | +'sp_metric', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| : | +'sp_statistic', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) ); + foreach ( $posts as $post ) + $display_posts[] = $post->post_title . ' (' . $post->post_name . ' = ' . get_post_meta( $post->ID, 'sp_equation', true ) . ') [' . $post->menu_order . ']'; + echo implode( ', ', array_map( 'esc_html', $display_posts ) ); + ?> | +||
| + | |||
| : | +0 ) ); + foreach ( $terms as $term ) + $display_terms[] = $term->name . ' (' . $term->slug . ')'; + echo implode( ', ', array_map( 'esc_html', $display_terms ) ); + ?> | +||
| : | +0 ) ); + foreach ( $terms as $term ) + $display_terms[] = $term->name . ' (' . $term->slug . ')'; + echo implode( ', ', array_map( 'esc_html', $display_terms ) ); + ?> | +||
| : | +0 ) ); + foreach ( $terms as $term ) + $display_terms[] = $term->name . ' (' . $term->slug . ')'; + echo implode( ', ', array_map( 'esc_html', $display_terms ) ); + ?> | +||
| : | +0 ) ); + foreach ( $terms as $term ) + $display_terms[] = $term->name . ' (' . $term->slug . ')'; + echo implode( ', ', array_map( 'esc_html', $display_terms ) ); + ?> | +||
| + | |||
| + labels->name; + ?>: + | ++ + publish; ?> publish, future; ?> future, draft; ?> draft, private; ?> private, trash; ?> trash, {'auto-draft'}; ?> auto-draft, inherit; ?> inherit + | +||
| + | |||
| : | +Name; + ?> | +||
| : | +Version; + + if ( ! empty( $theme_version_data['version'] ) && version_compare( $theme_version_data['version'], $active_theme->Version, '!=' ) ) + echo ' – ' . $theme_version_data['version'] . ' ' . __( 'is available', 'sportspress' ) . ''; + ?> | +||
| : | +{'Author URI'}; + ?> | +||
| + | |||
| (): | +', $found_plugin_files ); ?> | + +: | ++ + |