Admin dashboard widget, namespace EOS, remove unused widgets

This commit is contained in:
Brian Miyaji
2014-02-22 12:25:27 +11:00
parent 9b35725bba
commit 9f46acc6b5
16 changed files with 271 additions and 316 deletions

View File

@@ -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_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() );
wp_enqueue_script( 'jquery' ); 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( 'jquery-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-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' ): 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' ); 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 ); wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'assets/js/admin.js', array( 'jquery' ), time(), true );
// Localize scripts. // 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' ); add_action( 'admin_enqueue_scripts', 'sportspress_admin_enqueue_scripts' );

View File

@@ -35,5 +35,7 @@ function sportspress_admin_init() {
$administrator->add_cap( $cap . '_' . $post_type . 's' ); $administrator->add_cap( $cap . '_' . $post_type . 's' );
endforeach; endforeach;
endforeach; endforeach;
$administrator->add_cap( 'view_sportspress_reports' );
} }
add_action( 'admin_init', 'sportspress_admin_init' ); add_action( 'admin_init', 'sportspress_admin_init' );

View File

@@ -0,0 +1,7 @@
<?php
function sportspress_current_screen() {
$screen = get_current_screen();
if ( $screen->id == 'dashboard' )
include_once( dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/dashboard.php' );
}
add_action( 'current_screen', 'sportspress_current_screen' );

View File

@@ -74,6 +74,8 @@ function sportspress_activation_hook() {
'delete_sp_tables' => true, 'delete_sp_tables' => true,
'delete_private_sp_tables' => true, 'delete_private_sp_tables' => true,
'delete_published_sp_tables' => true, 'delete_published_sp_tables' => true,
'view_sportspress_reports' => true,
) )
); );

115
admin/tools/dashboard.php Normal file
View File

@@ -0,0 +1,115 @@
<?php
/**
* Admin Dashboard
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! class_exists( 'SP_Admin_Dashboard' ) ) :
/**
* SP_Admin_Dashboard Class
*/
class SP_Admin_Dashboard {
/**
* Hook in tabs.
*/
public function __construct() {
// Only hook in admin parts if the user has admin access
if ( current_user_can( 'view_sportspress_reports' ) || current_user_can( 'manage_sportspress' ) || current_user_can( 'publish_sp_tables' ) ) {
add_action( 'wp_dashboard_setup', array( $this, 'init' ) );
}
}
/**
* Init dashboard widgets
*/
public function init() {
wp_add_dashboard_widget( 'sportspress_dashboard_status', __( 'SportsPress Status', 'sportspress' ), array( $this, 'status_widget' ) );
}
/**
* Show status widget
*/
public function status_widget() {
$next_event = sportspress_get_next_event();
$now = new DateTime( current_time( 'mysql', 0 ) );
$date = new DateTime( $next_event->post_date );
$interval = date_diff( $now, $date );
$count = wp_count_posts( 'sp_event' );
$scheduled_count = $count->future;
$published_count = $count->publish;
?>
<ul class="sp_status_list">
<?php if ( $next_event ): ?>
<li class="countdown" data-countdown="<?php echo str_replace( '-', '/', $next_event->post_date ); ?>">
<a href="<?php echo get_edit_post_link( $next_event->ID ); ?>">
<?php printf( __( '<strong>%s</strong> until next event', 'sportspress' ), $interval->d . ' ' . __( 'days', 'sportspress' ) . ' ' . sprintf( '%02s:%02s:%02s', $interval->h, $interval->i, $interval->s ) ); ?>
(<?php echo $next_event->post_title; ?>)
</a>
</li>
<?php endif; ?>
<li class="events-scheduled">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=future' ); ?>">
<?php printf( _n( '<strong>%s event</strong> scheduled', '<strong>%s events</strong> scheduled', $scheduled_count, 'sportspress' ), $scheduled_count ); ?>
</a>
</li>
<li class="events-published">
<a href="<?php echo admin_url( 'edit.php?post_type=sp_event&post_status=publish' ); ?>">
<?php printf( _n( '<strong>%s event</strong> published', '<strong>%s events</strong> published', $published_count, 'sportspress' ), $published_count ); ?>
</a>
</li>
</ul>
<?php
}
/**
* Recent reviews widget
*/
public function recent_reviews() {
global $wpdb;
$comments = $wpdb->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 '<ul>';
foreach ( $comments as $comment ) {
echo '<li>';
echo get_avatar( $comment->comment_author, '32' );
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
echo '<div class="star-rating" title="' . esc_attr( $rating ) . '">
<span style="width:'. ( $rating * 20 ) . '%">' . $rating . ' ' . __( 'out of 5', 'sportspress' ) . '</span></div>';
echo '<h4 class="meta"><a href="' . get_permalink( $comment->ID ) . '#comment-' . absint( $comment->comment_ID ) .'">' . esc_html__( $comment->post_title ) . '</a> ' . __( 'reviewed by', 'sportspress' ) . ' ' . esc_html( $comment->comment_author ) .'</h4>';
echo '<blockquote>' . wp_kses_data( $comment->comment_excerpt ) . ' [...]</blockquote></li>';
}
echo '</ul>';
} else {
echo '<p>' . __( 'There are no product reviews yet.', 'sportspress' ) . '</p>';
}
}
}
endif;
return new SP_Admin_Dashboard();

View File

@@ -1,128 +0,0 @@
<?php
class SportsPress_Widget_Future_Events extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => '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 '<div id="sp_future_events_wrap">';
echo sportspress_events( $args );
echo '</div>';
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']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('league'); ?>"><?php _e( 'League:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('season'); ?>"><?php _e( 'Season:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('venue'); ?>"><?php _e( 'Venue:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('team'); ?>"><?php _e( 'Team:', 'sportspress' ); ?></label>
<?php
$args = array(
'post_type' => '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;
?>
</p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of events to show:', 'sportspress' ); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3"></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Future_Events" );' ) );

View File

@@ -1,128 +0,0 @@
<?php
class SportsPress_Widget_Recent_Events extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => '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 '<div id="sp_recent_events_wrap">';
echo sportspress_events( $args );
echo '</div>';
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']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('league'); ?>"><?php _e( 'League:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('season'); ?>"><?php _e( 'Season:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('venue'); ?>"><?php _e( 'Venue:', 'sportspress' ); ?></label>
<?php
$args = array(
'taxonomy' => '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 );
?>
</p>
<p><label for="<?php echo $this->get_field_id('team'); ?>"><?php _e( 'Team:', 'sportspress' ); ?></label>
<?php
$args = array(
'post_type' => '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;
?>
</p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of events to show:', 'sportspress' ); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3"></p>
<?php
}
}
add_action( 'widgets_init', create_function( '', 'return register_widget( "SportsPress_Widget_Recent_Events" );' ) );

View File

@@ -34,6 +34,10 @@
.icon-shield:before { .icon-shield:before {
content: "\f334"; content: "\f334";
} }
.icon-calendar:before {
content: "\f469";
}
#adminmenu #toplevel_page_sportspress .menu-icon-generic div.wp-menu-image:before, #adminmenu #toplevel_page_sportspress .menu-icon-generic div.wp-menu-image:before,
#adminmenu #menu-posts-sp_event .menu-icon-sp_event div.wp-menu-image:before, #adminmenu #menu-posts-sp_event .menu-icon-sp_event div.wp-menu-image:before,
@@ -42,6 +46,108 @@
font-family: sportspress, dashicons !important; font-family: sportspress, dashicons !important;
} }
#sportspress_dashboard_status .inside {
padding: 0;
margin: 0;
}
#sportspress_dashboard_status .sp_status_list {
overflow: hidden;
margin: 0;
}
#sportspress_dashboard_status .sp_status_list li {
width: 50%;
float: left;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
border-top: 1px solid #ececec;
color: #aaa;
}
#sportspress_dashboard_status .sp_status_list li:first-child {
border-top: 0;
}
#sportspress_dashboard_status .sp_status_list li.countdown {
width: 100%;
}
#sportspress_dashboard_status .sp_status_list li.events-scheduled {
border-right: 1px solid #ececec;
}
#sportspress_dashboard_status .sp_status_list li a {
display: block;
color: #aaa;
padding: 9px 12px;
-webkit-transition: all ease .5s;
position: relative;
font-size: 12px;
}
#sportspress_dashboard_status .sp_status_list li a:before {
font-family: sportspress, dashicons;
speak: none;
font-weight: 400;
font-variant: normal;
text-transform: none;
-webkit-font-smoothing: antialiased;
margin: 0;
text-indent: 0;
top: 0;
left: 0;
height: 100%;
text-align: center;
content: "\f145";
font-size: 2em;
position: relative;
width: auto;
line-height: 1.2em;
color: #464646;
float: left;
margin-right: 12px;
margin-bottom: 12px;
}
#sportspress_dashboard_status .sp_status_list li.countdown a:before {
content: "\f469";
}
#sportspress_dashboard_status .sp_status_list li.events-scheduled a:before,
#sportspress_dashboard_status .sp_status_list li.events-published a:before {
color: #999;
font-size: 2.5em;
line-height: 1em;
margin-left: -3px;
margin-right: 9px;
}
#sportspress_dashboard_status .sp_status_list li.events-scheduled a:before {
color: #ffba00;
}
#sportspress_dashboard_status .sp_status_list li.events-published a:before {
color: #21759b;
}
#sportspress_dashboard_status .sp_status_list li strong {
font-size: 18px;
line-height: 1.2em;
font-weight: 400;
display: block;
color: #21759b;
}
#sportspress_dashboard_status .sp_status_list li a:hover,
#sportspress_dashboard_status .sp_status_list li a:hover strong,
#sportspress_dashboard_status .sp_status_list li a:hover:before {
color: #2ea2cc;
}
.sportspress-message { .sportspress-message {
border-left-color: #6bc2a5 !important; border-left-color: #6bc2a5 !important;
} }
@@ -72,8 +178,6 @@
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
} }
.widget[id*="sp_recent_events-"] .widget-title h4:before,
.widget[id*="sp_future_events-"] .widget-title h4:before,
.widget[id*="sp_countdown-"] .widget-title h4:before, .widget[id*="sp_countdown-"] .widget-title h4:before,
.widget[id*="sp_events_calendar-"] .widget-title h4:before, .widget[id*="sp_events_calendar-"] .widget-title h4:before,
.widget[id*="sp_player_list-"] .widget-title h4:before, .widget[id*="sp_player_list-"] .widget-title h4:before,

Binary file not shown.

View File

@@ -10,4 +10,5 @@
<glyph unicode="&#xf145;" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM281.6 256h-51.2v-51.2h51.2v51.2zM358.4 256h-51.2v-51.2h51.2v51.2zM204.8 179.2h-51.2v-51.2h51.2v51.2zM204.8 256h-51.2v-51.2h51.2v51.2zM281.6 179.2h-51.2v-51.2h51.2v51.2zM358.4 179.2h-51.2v-51.2h51.2v51.2z" /> <glyph unicode="&#xf145;" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM281.6 256h-51.2v-51.2h51.2v51.2zM358.4 256h-51.2v-51.2h51.2v51.2zM204.8 179.2h-51.2v-51.2h51.2v51.2zM204.8 256h-51.2v-51.2h51.2v51.2zM281.6 179.2h-51.2v-51.2h51.2v51.2zM358.4 179.2h-51.2v-51.2h51.2v51.2z" />
<glyph unicode="&#xf155;" d="M440.909 303.257c-40.525 94.336-105.779 166.17-138.778 152.73-56.038-22.784 33.408-132.199-241.817-244.071-23.782-9.651-29.799-48.333-19.84-71.45 9.933-23.117 42.445-46.131 66.227-36.48 4.096 1.664 19.225 6.528 19.225 6.528 16.973-22.784 34.739-9.267 41.063-23.757 7.577-17.408 24.038-55.219 29.619-68.070 5.632-12.851 18.329-24.781 27.546-21.274 9.165 3.507 40.473 15.437 52.455 19.968s14.848 15.232 11.187 23.654c-3.942 9.063-20.122 11.725-24.729 22.323-4.634 10.599-19.712 44.519-24.038 55.219-5.888 14.541 6.631 26.368 24.832 28.262 125.286 13.056 148.711-64.333 191.36-46.976 32.921 13.466 26.214 109.056-14.31 203.392zM426.803 150.246c-7.322-2.969-56.627 35.891-88.141 109.235-31.488 73.318-27.52 140.339-20.224 143.309 7.322 2.995 55.424-43.93 86.938-117.248 31.462-73.293 28.749-132.327 21.427-135.296z" /> <glyph unicode="&#xf155;" d="M440.909 303.257c-40.525 94.336-105.779 166.17-138.778 152.73-56.038-22.784 33.408-132.199-241.817-244.071-23.782-9.651-29.799-48.333-19.84-71.45 9.933-23.117 42.445-46.131 66.227-36.48 4.096 1.664 19.225 6.528 19.225 6.528 16.973-22.784 34.739-9.267 41.063-23.757 7.577-17.408 24.038-55.219 29.619-68.070 5.632-12.851 18.329-24.781 27.546-21.274 9.165 3.507 40.473 15.437 52.455 19.968s14.848 15.232 11.187 23.654c-3.942 9.063-20.122 11.725-24.729 22.323-4.634 10.599-19.712 44.519-24.038 55.219-5.888 14.541 6.631 26.368 24.832 28.262 125.286 13.056 148.711-64.333 191.36-46.976 32.921 13.466 26.214 109.056-14.31 203.392zM426.803 150.246c-7.322-2.969-56.627 35.891-88.141 109.235-31.488 73.318-27.52 140.339-20.224 143.309 7.322 2.995 55.424-43.93 86.938-117.248 31.462-73.293 28.749-132.327 21.427-135.296z" />
<glyph unicode="&#xf334;" d="M425.76 154.48c-6.16-15.76-14-29.84-23.2-42s-20.24-24.080-33.040-35.68c-12.8-11.52-24.56-21.2-35.36-28.88-10.88-7.6-22.080-14.88-33.84-21.68-11.84-6.8-20.16-11.44-25.12-13.92-4.96-2.4-8.96-4.24-11.92-5.52-2.24-1.2-4.64-1.68-7.28-1.68s-5.040 0.64-7.28 1.68c-3.040 1.28-6.88 3.12-11.92 5.52-5.040 2.4-13.36 7.040-25.12 13.92-11.76 6.8-23.040 14-33.84 21.68-10.88 7.68-22.56 17.28-35.36 28.88-12.8 11.52-23.84 23.36-33.040 35.68s-16.96 26.24-23.2 42c-6.32 15.76-9.44 31.76-9.44 47.76v215.040c0 4.8 1.68 9.12 5.28 12.64s7.76 5.28 12.64 5.28h322.56c4.8 0 9.12-1.68 12.64-5.28s5.28-7.76 5.28-12.64v-215.040c0-16-3.2-32-9.44-47.76zM384 384h-256v-181.92c0-33.36 22.4-67.52 67.12-102.32 17.92-14 38.24-27.040 60.88-38.96v0 0 0 0c22.64 11.92 42.96 24.96 60.88 38.96 44.72 34.88 67.12 68.96 67.12 102.32v181.92zM304.72 122.8c-14.32-11.6-30.56-22.4-48.72-32.24v0 0 267.68h102.4v-150.72c0-27.6-17.92-55.84-53.68-84.72z" /> <glyph unicode="&#xf334;" d="M425.76 154.48c-6.16-15.76-14-29.84-23.2-42s-20.24-24.080-33.040-35.68c-12.8-11.52-24.56-21.2-35.36-28.88-10.88-7.6-22.080-14.88-33.84-21.68-11.84-6.8-20.16-11.44-25.12-13.92-4.96-2.4-8.96-4.24-11.92-5.52-2.24-1.2-4.64-1.68-7.28-1.68s-5.040 0.64-7.28 1.68c-3.040 1.28-6.88 3.12-11.92 5.52-5.040 2.4-13.36 7.040-25.12 13.92-11.76 6.8-23.040 14-33.84 21.68-10.88 7.68-22.56 17.28-35.36 28.88-12.8 11.52-23.84 23.36-33.040 35.68s-16.96 26.24-23.2 42c-6.32 15.76-9.44 31.76-9.44 47.76v215.040c0 4.8 1.68 9.12 5.28 12.64s7.76 5.28 12.64 5.28h322.56c4.8 0 9.12-1.68 12.64-5.28s5.28-7.76 5.28-12.64v-215.040c0-16-3.2-32-9.44-47.76zM384 384h-256v-181.92c0-33.36 22.4-67.52 67.12-102.32 17.92-14 38.24-27.040 60.88-38.96v0 0 0 0c22.64 11.92 42.96 24.96 60.88 38.96 44.72 34.88 67.12 68.96 67.12 102.32v181.92zM304.72 122.8c-14.32-11.6-30.56-22.4-48.72-32.24v0 0 267.68h102.4v-150.72c0-27.6-17.92-55.84-53.68-84.72z" />
<glyph unicode="&#xf469;" d="M256 465.92c-130.073 0-235.52-105.472-235.52-235.52 0-130.073 105.447-235.52 235.52-235.52s235.52 105.447 235.52 235.52c0 130.074-105.447 235.52-235.52 235.52zM256 46.080c-101.811 0-184.32 82.534-184.32 184.32s82.509 184.32 184.32 184.32 184.32-82.534 184.32-184.32-82.509-184.32-184.32-184.32zM273.92 363.52h-35.84v-140.544l87.168-87.168 25.344 25.344-76.672 76.672z" />
</font></defs></svg> </font></defs></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -171,9 +171,9 @@ jQuery(document).ready(function($){
} }
// Select all checkboxes // Select all checkboxes
$(".sp-data-table thead .sp-select-all").change(function() { $(".sp-select-all").change(function() {
$table = $(this).closest(".sp-data-table"); $range = $(this).closest(".sp-select-all-range");
$table.find("tbody input[type=checkbox]").prop("checked", $(this).prop("checked")); $range.find("input[type=checkbox]").prop("checked", $(this).prop("checked"));
}); });
// Check if all checkboxes are checked already // Check if all checkboxes are checked already
@@ -266,4 +266,12 @@ jQuery(document).ready(function($){
return event.keyCode != 13; 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"));
});
});
}); });

View File

@@ -407,9 +407,10 @@ if ( !function_exists( 'sportspress_post_checklist' ) ) {
if ( ! isset( $post_id ) ) if ( ! isset( $post_id ) )
global $post_id; global $post_id;
?> ?>
<div id="<?php echo $meta; ?>-all" class="posttypediv wp-tab-panel sp-tab-panel" style="display: <?php echo $display; ?>;"> <div id="<?php echo $meta; ?>-all" class="posttypediv wp-tab-panel sp-tab-panel sp-select-all-range" style="display: <?php echo $display; ?>;">
<input type="hidden" value="0" name="<?php echo $meta; ?><?php if ( isset( $index ) ) echo '[' . $index . ']'; ?>[]" /> <input type="hidden" value="0" name="<?php echo $meta; ?><?php if ( isset( $index ) ) echo '[' . $index . ']'; ?>[]" />
<ul class="categorychecklist form-no-clear"> <ul class="categorychecklist form-no-clear">
<li><label class="selectit sp-select-all-container"><input type="checkbox" class="sp-select-all"> <strong><?php _e( 'Select All', 'sportspress' ); ?></strong></label></li>
<?php <?php
$selected = sportspress_array_between( (array)get_post_meta( $post_id, $meta, false ), 0, $index ); $selected = sportspress_array_between( (array)get_post_meta( $post_id, $meta, false ), 0, $index );
$posts = get_pages( array( 'post_type' => $meta, 'number' => 0 ) ); $posts = get_pages( array( 'post_type' => $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;
?>
<div class="sp-data-table-container">
<table class="widefat sp-data-table">
<thead>
<tr>
<th><?php _e( 'Event', 'sportspress' ); ?></th>
<th><?php _e( 'Date', 'sportspress' ); ?></th>
<th><?php _e( 'Time', 'sportspress' ); ?></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ( $data as $event ):
?>
<tr class="sp-row sp-post<?php if ( $i % 2 == 0 ) echo ' alternate'; ?>">
<td>
<?php edit_post_link( $event->post_title, null, null, $event->ID ); ?>
</td>
<td>
<?php echo get_the_time( get_option('date_format'), $event->ID ); ?>
</td>
<td>
<?php echo get_the_time( get_option('time_format'), $event->ID ); ?>
</td>
</tr>
<?php
$i++;
endforeach;
?>
</tbody>
</table>
</div>
<?php
}
}
if ( !function_exists( 'sportspress_edit_league_table' ) ) { if ( !function_exists( 'sportspress_edit_league_table' ) ) {
function sportspress_edit_league_table( $columns = array(), $data = array(), $placeholders = array() ) { function sportspress_edit_league_table( $columns = array(), $data = array(), $placeholders = array() ) {
?> ?>
@@ -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 ) { function sportspress_edit_team_columns_table( $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $seasons = array(), $readonly = true ) {
?> ?>
<div class="sp-data-table-container"> <div class="sp-data-table-container">
<table class="widefat sp-data-table"> <table class="widefat sp-data-table sp-select-all-range">
<thead> <thead>
<tr> <tr>
<th class="check-column"><input class="sp-select-all" type="checkbox"></th> <th class="check-column"><input class="sp-select-all" type="checkbox"></th>
@@ -928,7 +886,7 @@ if ( !function_exists( 'sportspress_edit_player_statistics_table' ) ) {
), ),
); );
if ( ! sportspress_dropdown_pages( $args ) ): if ( ! sportspress_dropdown_pages( $args ) ):
_e( 'No teams found.', 'sportspress' ); _e( 'No results found.', 'sportspress' );
endif; endif;
?> ?>
</td> </td>
@@ -1289,7 +1247,7 @@ if ( !function_exists( 'sportspress_solve' ) ) {
if ( $clearance ): if ( $clearance ):
// Equation Operating System // Equation Operating System
$eos = new eqEOS(); $eos = new SP_eqEOS();
// Solve using EOS // Solve using EOS
return round( $eos->solveIF( str_replace( ' ', '', $equation ), $vars ), $precision ); 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' ) ) { if ( !function_exists( 'sportspress_delete_duplicate_post' ) ) {
function sportspress_delete_duplicate_post( &$post ) { function sportspress_delete_duplicate_post( &$post ) {
global $wpdb; global $wpdb;

View File

@@ -73,7 +73,7 @@ require_once "stack.class.php";
* @subpackage EOS * @subpackage EOS
* @version 2.0 * @version 2.0
*/ */
class eqEOS { class SP_eqEOS {
/**#@+ /**#@+
*Private variables *Private variables
*/ */

View File

@@ -24,7 +24,6 @@ define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ ); define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
// Libraries // Libraries
if ( ! class_exists( 'eqEOS' ) )
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ; require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
// Globals // Globals
@@ -75,8 +74,6 @@ require_once dirname( __FILE__ ) . '/admin/terms/venue.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Widgets // 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/countdown.php';
require_once dirname( __FILE__ ) . '/admin/widgets/events-calendar.php'; require_once dirname( __FILE__ ) . '/admin/widgets/events-calendar.php';
require_once dirname( __FILE__ ) . '/admin/widgets/player-list.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-enqueue-scripts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/admin-print-styles.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/admin-head.php';
require_once dirname( __FILE__ ) . '/admin/hooks/current-screen.php';
// Administrative actions // Administrative actions
require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php'; require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php';