Add videos module option

This commit is contained in:
Brian Miyaji
2015-01-24 12:52:33 +11:00
parent 104cfcf99b
commit fabec5d9b3
7 changed files with 94 additions and 15 deletions

View File

@@ -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)";

View File

@@ -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' );

View File

@@ -189,7 +189,7 @@ class SP_Meta_Box_Calendar_Data {
<td><?php the_terms( $event->ID, 'sp_venue' ); ?></td>
<td>
<a href="<?php echo get_edit_post_link( $event->ID ); ?>#sp_articlediv">
<?php if ( $video ): ?>
<?php if ( $video && 'yes' == get_option( 'sportspress_load_videos_module', 'yes' ) ): ?>
<div class="dashicons dashicons-video-alt"></div>
<?php elseif ( has_post_thumbnail( $event->ID ) ): ?>
<div class="dashicons dashicons-camera"></div>

View File

@@ -51,7 +51,7 @@ class SP_Settings_Modules extends SP_Settings_Page {
<div class="sp-modules-wrapper">
<div class="sp-modules-sidebar">
<?php if ( !! class_exists( 'SportsPress_Pro' ) ) { ?>
<?php if ( ! class_exists( 'SportsPress_Pro' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
@@ -153,6 +153,43 @@ class SP_Settings_Modules extends SP_Settings_Page {
</td></tr>
</tbody>
</table>
<?php $theme = wp_get_theme(); ?>
<?php if ( ! current_theme_supports( 'sportspress' ) ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<strong><?php _e( 'Current Theme', 'sportspress' ); ?></strong>
</th></tr>
</thead>
<tbody>
<tr><td>
<img src="<?php echo $theme->get_screenshot(); ?>" class="sp-theme-screenshot">
<p><?php _e( '<strong>Your theme does not declare SportsPress support</strong> &#8211; if you encounter layout issues please read our integration guide or choose a SportsPress theme :)', 'sportspress' ); ?></p>
<p class="sp-module-actions">
<a class="button" href="http://themeboy.com/sportspress/themes/" target="_blank"><?php _e( 'Need a Better Theme?', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } elseif ( 'rookie' == $theme->stylesheet ) { ?>
<table class="widefat" cellspacing="0">
<thead>
<tr><th>
<strong><?php _e( 'Current Theme', 'sportspress' ); ?></strong>
</th></tr>
</thead>
<tbody>
<tr><td>
<img src="<?php echo $theme->get_screenshot(); ?>" class="sp-theme-screenshot">
<p><?php _e( '<strong>Rookie</strong> is a free starter theme designed for SportsPress.', 'sportspress' ); ?></p>
<p class="sp-module-actions">
<a class="button" href="http://themeboy.com/sportspress/themes/" target="_blank"><?php _e( 'Need a Better Theme?', 'sportspress' ); ?></a>
</p>
</td></tr>
</tbody>
</table>
<?php } ?>
</div>
<div class="sp-modules-main">
@@ -168,11 +205,13 @@ class SP_Settings_Modules extends SP_Settings_Page {
<?php if ( isset( $module['class'] ) && ! class_exists( $module['class'] ) ) { ?>
<tr class="sp-module-unavailable"><td>
<input type="checkbox" disabled="disabled">
<label>
<span<?php if ( array_key_exists( 'tip', $module ) ) { ?> class="sp-desc-tip" title="<?php echo $module['tip']; ?>"<?php } ?>>
<i class="<?php echo sp_array_value( $module, 'icon', 'dashicons dashicons-admin-generic' ); ?>"></i>
<?php echo sp_array_value( $module, 'label', $id ); ?>
</label>
<a class="button" href="<?php echo sp_array_value( $module, 'link', apply_filters( 'sportspress_pro_url', 'http://sportspresspro.com/pricing/' ) ); ?>" target="_blank"><?php echo sp_array_value( $module, 'action', __( 'Upgrade to Pro', 'sportspress' ) ); ?></a>
</span>
<?php if ( array_key_exists( 'link', $module ) ) { ?>
<a class="button<?php if ( ! array_key_exists( 'action', $module ) ) { ?> button-primary<?php } ?>" href="<?php echo $module['link']; ?>" target="_blank"><?php echo sp_array_value( $module, 'action', __( 'Learn More', 'sportspress' ) ); ?></a>
<?php } ?>
</td></tr>
<?php } else { ?>
<tr><td>
@@ -187,6 +226,9 @@ class SP_Settings_Modules extends SP_Settings_Page {
</tbody>
</table>
<?php } ?>
<input name="save" class="button-primary" type="submit" value="<?php _e( 'Save Changes', 'sportspress' ); ?>" />
<?php $GLOBALS['hide_save_button'] = true; ?>
</div>
</div>
@@ -199,6 +241,7 @@ class SP_Settings_Modules extends SP_Settings_Page {
}
</script>
<?php } ?>
<?php
}

View File

@@ -28,10 +28,16 @@ class SP_Modules {
'label' => __( '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',
),
),
));

View File

@@ -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 );

View File

@@ -332,7 +332,7 @@ if ( $id ) {
echo '<td class="data-article">';
if ( $link_events ) echo '<a href="' . get_permalink( $event->ID ) . '">';
if ( $video ):
if ( $video && 'yes' == get_option( 'sportspress_load_videos_module', 'yes' ) ):
echo '<div class="dashicons dashicons-video-alt"></div>';
elseif ( has_post_thumbnail( $event->ID ) ):
echo '<div class="dashicons dashicons-camera"></div>';