diff --git a/admin/hooks/admin-enqueue-scripts.php b/admin/hooks/admin-enqueue-scripts.php index d838d953..6926dbe3 100644 --- a/admin/hooks/admin-enqueue-scripts.php +++ b/admin/hooks/admin-enqueue-scripts.php @@ -9,8 +9,9 @@ function sportspress_admin_enqueue_scripts( $hook ) { wp_enqueue_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() ); wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'chosen', SPORTSPRESS_PLUGIN_URL .'assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true ); - wp_enqueue_script( 'caret', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true ); + wp_enqueue_script( 'jquery-chosen', SPORTSPRESS_PLUGIN_URL .'assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true ); + wp_enqueue_script( 'jquery-caret', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true ); + wp_enqueue_script( 'jquery-countdown', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true ); if ( $hook == 'edit-tags.php' && isset( $_GET['taxonomy'] ) && $_GET['taxonomy'] == 'sp_venue' ): wp_enqueue_script( 'google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places' ); @@ -21,6 +22,6 @@ function sportspress_admin_enqueue_scripts( $hook ) { wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'assets/js/admin.js', array( 'jquery' ), time(), true ); // Localize scripts. - wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'remove_text' => __( '— Remove —', 'sportspress' ) ) ); + wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'remove_text' => __( '— Remove —', 'sportspress' ), 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) ); } add_action( 'admin_enqueue_scripts', 'sportspress_admin_enqueue_scripts' ); diff --git a/admin/hooks/admin-init.php b/admin/hooks/admin-init.php index 5f39597e..1b0b3ec6 100644 --- a/admin/hooks/admin-init.php +++ b/admin/hooks/admin-init.php @@ -35,5 +35,7 @@ function sportspress_admin_init() { $administrator->add_cap( $cap . '_' . $post_type . 's' ); endforeach; endforeach; + + $administrator->add_cap( 'view_sportspress_reports' ); } add_action( 'admin_init', 'sportspress_admin_init' ); diff --git a/admin/hooks/current-screen.php b/admin/hooks/current-screen.php new file mode 100644 index 00000000..a703d512 --- /dev/null +++ b/admin/hooks/current-screen.php @@ -0,0 +1,7 @@ +id == 'dashboard' ) + include_once( dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/dashboard.php' ); +} +add_action( 'current_screen', 'sportspress_current_screen' ); diff --git a/admin/hooks/register-activation-hook.php b/admin/hooks/register-activation-hook.php index de57cb63..e6089ae0 100644 --- a/admin/hooks/register-activation-hook.php +++ b/admin/hooks/register-activation-hook.php @@ -74,6 +74,8 @@ function sportspress_activation_hook() { 'delete_sp_tables' => true, 'delete_private_sp_tables' => true, 'delete_published_sp_tables' => true, + + 'view_sportspress_reports' => true, ) ); diff --git a/admin/tools/dashboard.php b/admin/tools/dashboard.php new file mode 100644 index 00000000..8287b6f5 --- /dev/null +++ b/admin/tools/dashboard.php @@ -0,0 +1,115 @@ +post_date ); + $interval = date_diff( $now, $date ); + + $count = wp_count_posts( 'sp_event' ); + $scheduled_count = $count->future; + $published_count = $count->publish; + ?> +
' . wp_kses_data( $comment->comment_excerpt ) . ' [...]
' . __( 'There are no product reviews yet.', 'sportspress' ) . '
'; + } + } + +} + +endif; + +return new SP_Admin_Dashboard(); diff --git a/admin/widgets/future-events.php b/admin/widgets/future-events.php deleted file mode 100644 index fa98f095..00000000 --- a/admin/widgets/future-events.php +++ /dev/null @@ -1,128 +0,0 @@ - 'widget_recent_entries widget_sp_future_events', 'description' => __( 'A list of upcoming events.', 'sportspress' ) ); - parent::__construct('sp_future_events', __( 'SportsPress Future Events', 'sportspress' ), $widget_ops); - } - - function widget( $args, $instance ) { - extract($args); - $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Future Events' ) : $instance['title'], $instance, $this->id_base); - $league = empty($instance['league']) ? null : $instance['league']; - $season = empty($instance['season']) ? null : $instance['season']; - $venue = empty($instance['venue']) ? null : $instance['venue']; - $team = empty($instance['team']) ? null : $instance['team']; - $number = empty($instance['number']) ? get_option( 'posts_per_page' ) : $instance['number']; - $args = array( - 'status' => 'future', - 'league' => $league, - 'season' => $season, - 'venue' => $venue, - 'team' => $team, - 'number' => $number, - ); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; - echo '-
- -- 'sp_league', - 'name' => $this->get_field_name('league'), - 'id' => $this->get_field_id('league'), - 'selected' => $league, - 'show_option_all' => __( 'All Leagues', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_season', - 'name' => $this->get_field_name('season'), - 'id' => $this->get_field_id('season'), - 'selected' => $season, - 'show_option_all' => __( 'All Seasons', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_venue', - 'name' => $this->get_field_name('venue'), - 'id' => $this->get_field_id('venue'), - 'selected' => $venue, - 'show_option_all' => __( 'All Venues', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_team', - 'name' => $this->get_field_name('team'), - 'id' => $this->get_field_id('team'), - 'selected' => $team, - 'show_option_all' => __( 'All Teams', 'sportspress' ), - 'values' => 'ID', - 'class' => 'widefat', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_table', __( 'Add New League Table', 'sportspress' ) ); - endif; - ?> -
- --
- 'widget_recent_entries widget_sp_recent_events', 'description' => __( 'A list of recent events.', 'sportspress' ) ); - parent::__construct('sp_recent_events', __( 'SportsPress Recent Events', 'sportspress' ), $widget_ops); - } - - function widget( $args, $instance ) { - extract($args); - $title = apply_filters('widget_title', empty($instance['title']) ? __( 'Recent Events' ) : $instance['title'], $instance, $this->id_base); - $league = empty($instance['league']) ? null : $instance['league']; - $season = empty($instance['season']) ? null : $instance['season']; - $venue = empty($instance['venue']) ? null : $instance['venue']; - $team = empty($instance['team']) ? null : $instance['team']; - $number = empty($instance['number']) ? get_option( 'posts_per_page' ) : $instance['number']; - $args = array( - 'status' => 'publish', - 'league' => $league, - 'season' => $season, - 'venue' => $venue, - 'team' => $team, - 'number' => $number, - ); - echo $before_widget; - if ( $title ) - echo $before_title . $title . $after_title; - echo '-
- -- 'sp_league', - 'name' => $this->get_field_name('league'), - 'id' => $this->get_field_id('league'), - 'selected' => $league, - 'show_option_all' => __( 'All Leagues', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_season', - 'name' => $this->get_field_name('season'), - 'id' => $this->get_field_id('season'), - 'selected' => $season, - 'show_option_all' => __( 'All Seasons', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_venue', - 'name' => $this->get_field_name('venue'), - 'id' => $this->get_field_id('venue'), - 'selected' => $venue, - 'show_option_all' => __( 'All Venues', 'sportspress' ), - 'hide_empty' => 0, - 'values' => 'term_id', - 'class' => 'widefat', - ); - wp_dropdown_categories( $args ); - ?> -
- -- 'sp_team', - 'name' => $this->get_field_name('team'), - 'id' => $this->get_field_id('team'), - 'selected' => $team, - 'show_option_all' => __( 'All Teams', 'sportspress' ), - 'values' => 'ID', - 'class' => 'widefat', - ); - if ( ! sportspress_dropdown_pages( $args ) ): - sportspress_post_adder( 'sp_table', __( 'Add New League Table', 'sportspress' ) ); - endif; - ?> -
- --
-| - | - | - |
|---|---|---|
| - post_title, null, null, $event->ID ); ?> - | -- ID ); ?> - | -- ID ); ?> - | -
| @@ -928,7 +886,7 @@ if ( !function_exists( 'sportspress_edit_player_statistics_table' ) ) { ), ); if ( ! sportspress_dropdown_pages( $args ) ): - _e( 'No teams found.', 'sportspress' ); + _e( 'No results found.', 'sportspress' ); endif; ?> @@ -1289,7 +1247,7 @@ if ( !function_exists( 'sportspress_solve' ) ) { if ( $clearance ): // Equation Operating System - $eos = new eqEOS(); + $eos = new SP_eqEOS(); // Solve using EOS return round( $eos->solveIF( str_replace( ' ', '', $equation ), $vars ), $precision ); @@ -2381,6 +2339,21 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) { } } +if ( !function_exists( 'sportspress_get_next_event' ) ) { + function sportspress_get_next_event( $args = array() ) { + $options = array( + 'post_type' => 'sp_event', + 'posts_per_page' => 1, + 'order' => 'ASC', + 'post_status' => 'future', + 'meta_query' => $args, + ); + $posts = get_posts( $options ); + $post = array_pop( $posts ); + return $post; + } +} + if ( !function_exists( 'sportspress_delete_duplicate_post' ) ) { function sportspress_delete_duplicate_post( &$post ) { global $wpdb; diff --git a/lib/eos/eos.class.php b/lib/eos/eos.class.php index 0f11aa75..41986e44 100644 --- a/lib/eos/eos.class.php +++ b/lib/eos/eos.class.php @@ -73,7 +73,7 @@ require_once "stack.class.php"; * @subpackage EOS * @version 2.0 */ -class eqEOS { +class SP_eqEOS { /**#@+ *Private variables */ diff --git a/sportspress.php b/sportspress.php index 4e3d9eed..e345f83e 100644 --- a/sportspress.php +++ b/sportspress.php @@ -24,8 +24,7 @@ define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); // Libraries -if ( ! class_exists( 'eqEOS' ) ) - require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ; +require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ; // Globals require_once dirname( __FILE__ ) . '/admin/globals/continents.php'; @@ -75,8 +74,6 @@ require_once dirname( __FILE__ ) . '/admin/terms/venue.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php'; // Widgets -require_once dirname( __FILE__ ) . '/admin/widgets/recent-events.php'; -require_once dirname( __FILE__ ) . '/admin/widgets/future-events.php'; require_once dirname( __FILE__ ) . '/admin/widgets/countdown.php'; require_once dirname( __FILE__ ) . '/admin/widgets/events-calendar.php'; require_once dirname( __FILE__ ) . '/admin/widgets/player-list.php'; @@ -97,6 +94,7 @@ require_once dirname( __FILE__ ) . '/admin/hooks/admin-menu.php'; require_once dirname( __FILE__ ) . '/admin/hooks/admin-enqueue-scripts.php'; require_once dirname( __FILE__ ) . '/admin/hooks/admin-print-styles.php'; require_once dirname( __FILE__ ) . '/admin/hooks/admin-head.php'; +require_once dirname( __FILE__ ) . '/admin/hooks/current-screen.php'; // Administrative actions require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php'; |
|---|