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; + ?> + + get_results( "SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt + FROM $wpdb->comments + LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) + WHERE comment_approved = '1' + AND comment_type = '' + AND post_password = '' + AND post_type = 'product' + ORDER BY comment_date_gmt DESC + LIMIT 8" ); + + if ( $comments ) { + echo ''; + } else { + echo '

' . __( '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 '
'; - echo sportspress_events( $args ); - echo '
'; - echo $after_widget; - } - - function update( $new_instance, $old_instance ) { - $instance = $old_instance; - $instance['title'] = strip_tags($new_instance['title']); - $instance['league'] = intval($new_instance['league']); - $instance['season'] = intval($new_instance['season']); - $instance['venue'] = intval($new_instance['venue']); - $instance['team'] = intval($new_instance['team']); - $instance['number'] = intval($new_instance['number']); - - return $instance; - } - - function form( $instance ) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'league' => '', 'season' => '', 'venue' => '', 'team' => '', 'number' => 3 ) ); - $title = strip_tags($instance['title']); - $league = intval($instance['league']); - $season = intval($instance['season']); - $venue = intval($instance['venue']); - $team = intval($instance['team']); - $number = intval($instance['number']); -?> -

-

- -

- '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 '
'; - echo sportspress_events( $args ); - echo '
'; - echo $after_widget; - } - - function update( $new_instance, $old_instance ) { - $instance = $old_instance; - $instance['title'] = strip_tags($new_instance['title']); - $instance['league'] = intval($new_instance['league']); - $instance['season'] = intval($new_instance['season']); - $instance['venue'] = intval($new_instance['venue']); - $instance['team'] = intval($new_instance['team']); - $instance['number'] = intval($new_instance['number']); - - return $instance; - } - - function form( $instance ) { - $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'league' => '', 'season' => '', 'venue' => '', 'team' => '', 'number' => 3 ) ); - $title = strip_tags($instance['title']); - $league = intval($instance['league']); - $season = intval($instance['season']); - $venue = intval($instance['venue']); - $team = intval($instance['team']); - $number = intval($instance['number']); -?> -

-

- -

- '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; - ?> -

- -

-

- + \ No newline at end of file diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf index 83d49b7b..50a5bcc2 100755 Binary files a/assets/fonts/sportspress.ttf and b/assets/fonts/sportspress.ttf differ diff --git a/assets/fonts/sportspress.woff b/assets/fonts/sportspress.woff index 1ac066e3..5e11a068 100755 Binary files a/assets/fonts/sportspress.woff and b/assets/fonts/sportspress.woff differ diff --git a/assets/js/admin.js b/assets/js/admin.js index 8db18812..31b0be27 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -171,9 +171,9 @@ jQuery(document).ready(function($){ } // Select all checkboxes - $(".sp-data-table thead .sp-select-all").change(function() { - $table = $(this).closest(".sp-data-table"); - $table.find("tbody input[type=checkbox]").prop("checked", $(this).prop("checked")); + $(".sp-select-all").change(function() { + $range = $(this).closest(".sp-select-all-range"); + $range.find("input[type=checkbox]").prop("checked", $(this).prop("checked")); }); // Check if all checkboxes are checked already @@ -266,4 +266,12 @@ jQuery(document).ready(function($){ return event.keyCode != 13; }); + // Dashboard countdown + $("#sportspress_dashboard_status .sp_status_list li.countdown").each(function() { + var $this = $(this), finalDate = $(this).data('countdown'); + $this.countdown(finalDate, function(event) { + $this.find('strong').html(event.strftime("%D "+localized_strings.days+" %H:%M:%S")); + }); + }); + }); \ No newline at end of file diff --git a/functions.php b/functions.php index ea565b29..5ac80c87 100644 --- a/functions.php +++ b/functions.php @@ -407,9 +407,10 @@ if ( !function_exists( 'sportspress_post_checklist' ) ) { if ( ! isset( $post_id ) ) global $post_id; ?> -
+
    +
  • $meta, 'number' => 0 ) ); @@ -680,49 +681,6 @@ if ( !function_exists( 'sportspress_get_var_calculates' ) ) { } } -if ( !function_exists( 'sportspress_edit_calendar_table' ) ) { - function sportspress_edit_calendar_table( $data = array() ) { - if ( empty( $data ) ): - _e( 'No Events found.', 'sportspress' ); - return false; - endif; - ?> -
    - - - - - - - - - - - - - - - - - -
    - post_title, null, null, $event->ID ); ?> - - ID ); ?> - - ID ); ?> -
    -
    - @@ -827,7 +785,7 @@ if ( !function_exists( 'sportspress_edit_team_columns_table' ) ) { function sportspress_edit_team_columns_table( $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $seasons = array(), $readonly = true ) { ?>
    - +
    @@ -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';