From a3a443ee45e1c0bde32e1bff8ea3e0b6241c6228 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sun, 15 Mar 2015 15:47:25 +1100 Subject: [PATCH] Move overview to module --- includes/admin/class-sp-admin-menus.php | 19 +- includes/admin/views/html-admin-overview.php | 336 --------------- modules/sportspress-overview.php | 404 +++++++++++++++++++ 3 files changed, 406 insertions(+), 353 deletions(-) delete mode 100644 includes/admin/views/html-admin-overview.php create mode 100644 modules/sportspress-overview.php diff --git a/includes/admin/class-sp-admin-menus.php b/includes/admin/class-sp-admin-menus.php index f84b488c..3d254cea 100755 --- a/includes/admin/class-sp-admin-menus.php +++ b/includes/admin/class-sp-admin-menus.php @@ -24,9 +24,8 @@ class SP_Admin_Menus { add_filter( 'admin_menu', array( $this, 'menu_clean' ), 5 ); add_action( 'admin_menu', array( $this, 'admin_menu' ), 6 ); add_action( 'admin_menu', array( $this, 'config_menu' ), 7 ); - add_action( 'admin_menu', array( $this, 'overview_menu' ), 8 ); - add_action( 'admin_menu', array( $this, 'leagues_menu' ), 9 ); - add_action( 'admin_menu', array( $this, 'seasons_menu' ), 10 ); + add_action( 'admin_menu', array( $this, 'leagues_menu' ), 20 ); + add_action( 'admin_menu', array( $this, 'seasons_menu' ), 21 ); add_action( 'admin_head', array( $this, 'menu_highlight' ) ); add_action( 'admin_head', array( $this, 'menu_rename' ) ); @@ -48,13 +47,6 @@ class SP_Admin_Menus { $main_page = add_menu_page( __( 'SportsPress', 'sportspress' ), __( 'SportsPress', 'sportspress' ), 'manage_sportspress', 'sportspress', array( $this, 'settings_page' ), apply_filters( 'sportspress_menu_icon', null ), '51.5' ); } - /** - * Add menu item - */ - public function overview_menu() { - add_submenu_page( 'sportspress', __( 'Overview', 'sportspress' ), __( 'Overview', 'sportspress' ), 'manage_sportspress', 'sportspress-overview', array( $this, 'overview_page' ) ); - } - /** * Add menu item */ @@ -234,13 +226,6 @@ class SP_Admin_Menus { endif; } - /** - * Init the overview page - */ - public function overview_page() { - include( 'views/html-admin-overview.php' ); - } - /** * Init the config page */ diff --git a/includes/admin/views/html-admin-overview.php b/includes/admin/views/html-admin-overview.php deleted file mode 100644 index e1f0892d..00000000 --- a/includes/admin/views/html-admin-overview.php +++ /dev/null @@ -1,336 +0,0 @@ -
-

- -

-
- - - - - - - - - - - - - object_type, $taxonomy ); ?> - - - - - - false, 'parent' => $term->term_id, 'orderby' => 'slug' ) ); ?> - - - - - - - - - - - - - - false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> - - - - - - - - - - - - - - - - -1, 'post_type' => $post_type ) ); ?> - - - - - - - - - - - false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> - - - - - - -
- -
\ No newline at end of file diff --git a/modules/sportspress-overview.php b/modules/sportspress-overview.php new file mode 100644 index 00000000..1ebc0a03 --- /dev/null +++ b/modules/sportspress-overview.php @@ -0,0 +1,404 @@ +define_constants(); + + add_action( 'admin_menu', array( $this, 'admin_menu' ), 11 ); + } + + /** + * Define constants. + */ + private function define_constants() { + if ( !defined( 'SP_OVERVIEW_VERSION' ) ) + define( 'SP_OVERVIEW_VERSION', '1.7' ); + + if ( !defined( 'SP_OVERVIEW_URL' ) ) + define( 'SP_OVERVIEW_URL', plugin_dir_url( __FILE__ ) ); + + if ( !defined( 'SP_OVERVIEW_DIR' ) ) + define( 'SP_OVERVIEW_DIR', plugin_dir_path( __FILE__ ) ); + } + + /** + * Add menu item + */ + public function admin_menu() { + add_submenu_page( 'sportspress', __( 'Overview', 'sportspress' ), __( 'Overview', 'sportspress' ), 'manage_sportspress', 'sportspress-overview', array( $this, 'overview_page' ) ); + } + + /** + * Init the overview page + */ + public function overview_page() { + ?> +
+

+ +

+
+ + + + + + + + + + + + + object_type, $taxonomy ); ?> + + + + + + false, 'parent' => $term->term_id, 'orderby' => 'slug' ) ); ?> + + + + + + + + + + + + + + false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> + + + + + + + + + + + + + + + + -1, 'post_type' => $post_type ) ); ?> + + + + + + + + + + + false, 'parent' => 0, 'orderby' => 'slug' ) ); ?> + + + + + + +
+ +
+