From fabec5d9b342ace51c609113ffcd200d62354347 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Sat, 24 Jan 2015 12:52:33 +1100 Subject: [PATCH] Add videos module option --- assets/css/admin.css | 27 +++++++--- .../post-types/class-sp-admin-meta-boxes.php | 4 +- .../class-sp-meta-box-calendar-data.php | 2 +- .../settings/class-sp-settings-modules.php | 51 +++++++++++++++++-- includes/class-sp-modules.php | 19 +++++++ includes/sp-template-hooks.php | 4 +- templates/event-list.php | 2 +- 7 files changed, 94 insertions(+), 15 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 985d3914..487b0bd5 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -552,6 +552,10 @@ table.widefat.sp-sortable-table tbody tr .icon { color: #aaa; } +.sp-modules-sidebar table td .sp-theme-screenshot { + margin: 4px 0; +} + .sp-modules-wrapper img { max-width: 100%; } @@ -580,8 +584,17 @@ table.sp-modules-table td > input[type=checkbox][disabled=disabled] { } table.sp-modules-table td .button { - float: right; - margin: -1px -5px -1px 10px; + position: absolute; + right: 9px; + top: 9px; +} + +table.sp-modules-table .button-primary { + display: none; +} + +table.sp-modules-table td:hover .button-primary { + display: inline-block; } table.sp-modules-table [class^="sp-icon-"], @@ -593,14 +606,14 @@ table.sp-modules-table .dashicons { line-height: 1; } -table.sp-modules-table .sp-module-unavailable label { +table.sp-modules-table .sp-module-unavailable span { + vertical-align: middle; color: #aaa; - cursor: text; } -table.sp-modules-table .sp-module-unavailable label [class^="sp-icon-"], -table.sp-modules-table .sp-module-unavailable label [class*=" sp-icon-"], -table.sp-modules-table .sp-module-unavailable label .dashicons { +table.sp-modules-table .sp-module-unavailable span [class^="sp-icon-"], +table.sp-modules-table .sp-module-unavailable span [class*=" sp-icon-"], +table.sp-modules-table .sp-module-unavailable span .dashicons { -moz-opacity: 0.8; opacity: 0.8; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; diff --git a/includes/admin/post-types/class-sp-admin-meta-boxes.php b/includes/admin/post-types/class-sp-admin-meta-boxes.php index 1a5b7089..83135bd5 100644 --- a/includes/admin/post-types/class-sp-admin-meta-boxes.php +++ b/includes/admin/post-types/class-sp-admin-meta-boxes.php @@ -126,7 +126,9 @@ class SP_Admin_Meta_Boxes { add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' ); add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' ); - add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' ); + if ( 'yes' == get_option( 'sportspress_load_videos_module', 'yes' ) ) { + add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' ); + } add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' ); add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' ); add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'low' ); diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php index f934d588..8438dca6 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-calendar-data.php @@ -189,7 +189,7 @@ class SP_Meta_Box_Calendar_Data { ID, 'sp_venue' ); ?> - +
ID ) ): ?>
diff --git a/includes/admin/settings/class-sp-settings-modules.php b/includes/admin/settings/class-sp-settings-modules.php index 2abca5e9..d9edb5cf 100644 --- a/includes/admin/settings/class-sp-settings-modules.php +++ b/includes/admin/settings/class-sp-settings-modules.php @@ -51,7 +51,7 @@ class SP_Settings_Modules extends SP_Settings_Page {
- +
@@ -153,6 +153,43 @@ class SP_Settings_Modules extends SP_Settings_Page {
+ + + + + + + + + + +
+ +
+ +

Your theme does not declare SportsPress support – if you encounter layout issues please read our integration guide or choose a SportsPress theme :)', 'sportspress' ); ?>

+

+ +

+
+ stylesheet ) { ?> + + + + + + + +
+ +
+ +

Rookie is a free starter theme designed for SportsPress.', 'sportspress' ); ?>

+

+ +

+
+
@@ -168,11 +205,13 @@ class SP_Settings_Modules extends SP_Settings_Page { - - + + + + @@ -187,6 +226,9 @@ class SP_Settings_Modules extends SP_Settings_Page { + + +
@@ -199,6 +241,7 @@ class SP_Settings_Modules extends SP_Settings_Page { } + __( 'Calendars', 'sportspress' ), 'icon' => 'sp-icon-calendar', ), + 'videos' => array( + 'label' => __( 'Videos', 'sportspress' ), + 'icon' => 'dashicons dashicons-video-alt', + ), 'tournaments' => array( 'label' => __( 'Tournaments', 'sportspress' ), 'class' => 'SportsPress_Tournaments', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-tournament', + 'link' => 'test', ), ), 'team' => array( @@ -42,7 +48,9 @@ class SP_Modules { 'team_colors' => array( 'label' => __( 'Team Colors', 'sportspress' ), 'class' => 'SportsPress_Team_Colors', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-color', + 'link' => 'test', ), ), 'player' => array( @@ -55,6 +63,7 @@ class SP_Modules { 'class' => 'SportsPress_Birthdays', 'action' => __( 'Review on WP.org', 'sportspress' ), 'link' => 'http://wordpress.org/support/view/plugin-reviews/sportspress#postform', + 'tip' => __( 'Post your ★★★★★ review on WordPress.org and get the Birthdays module for free.', 'sportspress' ), 'icon' => 'sp-icon-cake', ), ), @@ -62,6 +71,7 @@ class SP_Modules { 'staff_directories' => array( 'label' => __( 'Directories', 'sportspress' ), 'class' => 'SportsPress_Staff_Directories', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-archive', ), ), @@ -71,27 +81,36 @@ class SP_Modules { 'class' => 'SportsPress_Twitter', 'action' => __( 'Tweet #SportsPress', 'sportspress' ), 'link' => 'http://ctt.ec/d0sCF', + 'tip' => __( 'Help spread the word by tweeting with #SportsPress and get the Twitter module for free.', 'sportspress' ), 'icon' => 'dashicons dashicons-twitter', ), 'branding' => array( 'label' => __( 'Branding', 'sportspress' ), 'class' => 'SportsPress_Branding', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-sportspress', + 'link' => 'test', ), 'league_menu' => array( 'label' => __( 'League Menu', 'sportspress' ), 'class' => 'SportsPress_League_Menu', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-menu', + 'link' => 'test', ), 'sponsors' => array( 'label' => __( 'Sponsors', 'sportspress' ), 'class' => 'SportsPress_Sponsors', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-megaphone', + 'link' => 'test', ), 'multisite' => array( 'label' => __( 'Multisite', 'sportspress' ), 'class' => 'SportsPress_Multisite', + 'tip' => __( 'Upgrade to Pro', 'sportspress' ), 'icon' => 'sp-icon-globe', + 'link' => 'test', ), ), )); diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php index 22026318..52e5c2fc 100644 --- a/includes/sp-template-hooks.php +++ b/includes/sp-template-hooks.php @@ -33,7 +33,9 @@ add_action( 'get_the_generator_xhtml', 'sp_generator_tag', 10, 2 ); */ add_action( 'sportspress_single_event_content', 'sportspress_output_event_logos', 0 ); add_action( 'sportspress_single_event_content', 'sportspress_output_event_results', 20 ); -add_action( 'sportspress_single_event_content', 'sportspress_output_event_video', 10 ); +if ( 'yes' == get_option( 'sportspress_load_videos_module', 'yes' ) ) { + add_action( 'sportspress_single_event_content', 'sportspress_output_event_video', 10 ); +} add_action( 'sportspress_single_event_content', 'sportspress_output_event_details', 30 ); add_action( 'sportspress_single_event_content', 'sportspress_output_event_venue', 40 ); add_action( 'sportspress_single_event_content', 'sportspress_output_event_performance', 50 ); diff --git a/templates/event-list.php b/templates/event-list.php index 43137ee5..6c33dcfe 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -332,7 +332,7 @@ if ( $id ) { echo ''; if ( $link_events ) echo ''; - if ( $video ): + if ( $video && 'yes' == get_option( 'sportspress_load_videos_module', 'yes' ) ): echo '
'; elseif ( has_post_thumbnail( $event->ID ) ): echo '
';