Clean up spaces, tabs, indentation, and bracket formatting

This commit is contained in:
Brian Miyaji
2021-11-10 15:41:40 +09:00
parent e58beb1201
commit 3dff686a00
285 changed files with 29638 additions and 24147 deletions

View File

@@ -2,9 +2,9 @@
/**
* Countdown Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Countdown
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Countdown
* @version 0.7
*/
class SP_Shortcode_Countdown {
@@ -16,8 +16,9 @@ class SP_Shortcode_Countdown {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'countdown.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Blocks Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Blocks
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Blocks
* @version 0.8
*/
class SP_Shortcode_Event_Blocks {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Blocks {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-blocks.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Calendar Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Calendar
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Calendar
* @version 0.7
*/
class SP_Shortcode_Event_Calendar {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Calendar {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-calendar.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Details Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Details
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Details
* @version 0.8
*/
class SP_Shortcode_Event_Details {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Details {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-details.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Full info Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Full
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Full
* @version 2.6.9
*/
class SP_Shortcode_Event_Full {
@@ -16,47 +16,54 @@ class SP_Shortcode_Event_Full {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
$type = 'event';
$content = apply_filters( 'the_content', get_post_field( 'post_content', $atts['id'] ) );
// Get layout setting
$layout = (array) get_option( 'sportspress_' . $type . '_template_order', array() );
// Get templates
$templates = SP()->templates->$type;
// Combine layout setting with available templates
$templates = array_merge( array_flip( $layout ), $templates );
$templates = apply_filters( 'sportspress_' . $type . '_templates', $templates );
// Split templates into sections and tabs
$slice = array_search( 'tabs', array_keys( $templates ) );
if ( $slice ) {
$section_templates = array_slice( $templates, 0, $slice );
$tab_templates = array_slice( $templates, $slice );
$tab_templates = array_slice( $templates, $slice );
} else {
$section_templates = $templates;
$tab_templates = array();
$tab_templates = array();
}
ob_start();
// Before template hook
do_action( 'sportspress_before_single_' . $type );
// Loop through sections
if ( ! empty( $section_templates ) ) {
foreach ( $section_templates as $key => $template ) {
// Ignore templates that are unavailable or that have been turned off
if ( ! is_array( $template ) ) continue;
if ( ! isset( $template['option'] ) ) continue;
if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) continue;
if ( ! is_array( $template ) ) {
continue;
}
if ( ! isset( $template['option'] ) ) {
continue;
}
if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) {
continue;
}
// Render the template
echo '<div class="sp-section-content sp-section-content-' . $key . '">';
if ( 'content' === $key ) {
@@ -66,30 +73,36 @@ class SP_Shortcode_Event_Full {
} elseif ( 'excerpt' === $key ) {
sp_get_template( 'post-excerpt.php', $atts );
} else {
//call_user_func( $template['action'] );
// call_user_func( $template['action'] );
sp_get_template( 'event-' . $key . '.php', $atts );
}
echo '</div>';
}
}
// After template hook
do_action( 'sportspress_after_single_' . $type );
$ob = ob_get_clean();
$tabs = '';
if ( ! empty( $tab_templates ) ) {
$i = 0;
$i = 0;
$tab_content = '';
foreach ( $tab_templates as $key => $template ) {
// Ignore templates that are unavailable or that have been turned off
if ( ! is_array( $template ) ) continue;
if ( ! isset( $template['option'] ) ) continue;
if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) continue;
if ( ! is_array( $template ) ) {
continue;
}
if ( ! isset( $template['option'] ) ) {
continue;
}
if ( 'yes' !== get_option( $template['option'], sp_array_value( $template, 'default', 'yes' ) ) ) {
continue;
}
// Put tab content into buffer
ob_start();
if ( 'content' === $key ) {
@@ -99,40 +112,42 @@ class SP_Shortcode_Event_Full {
} elseif ( 'excerpt' === $key ) {
sp_get_template( 'post-excerpt.php', $atts );
} else {
//call_user_func( $template['action'] );
// call_user_func( $template['action'] );
sp_get_template( 'event-' . $key . '.php', $atts );
}
$buffer = ob_get_clean();
// Trim whitespace from buffer
$buffer = trim( $buffer );
// Continue if tab content is empty
if ( empty( $buffer ) ) continue;
if ( empty( $buffer ) ) {
continue;
}
// Get template label
$label = sp_array_value( $template, 'label', $template['title'] );
// Add to tabs
$tabs .= '<li class="sp-tab-menu-item' . ( 0 === $i ? ' sp-tab-menu-item-active' : '' ) . '"><a href="#sp-tab-content-' . $key . '" data-sp-tab="' . $key . '">' . apply_filters( 'gettext', $label, $label, 'sportspress' ) . '</a></li>';
// Render the template
$tab_content .= '<div class="sp-tab-content sp-tab-content-' . $key . '" id="sp-tab-content-' . $key . '"' . ( 0 === $i ? ' style="display: block;"' : '' ) . '>' . $buffer . '</div>';
$i++;
}
$ob .= '<div class="sp-tab-group">';
if ( ! empty( $tabs ) ) {
$ob .= '<ul class="sp-tab-menu">' . $tabs . '</ul>';
}
$ob .= $tab_content;
$ob .= '</div>';
}
echo $ob;
}

View File

@@ -2,9 +2,9 @@
/**
* Event List Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_List
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_List
* @version 0.7
*/
class SP_Shortcode_Event_List {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_List {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-list.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Officials Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Officials
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Officials
* @version 2.6.9
*/
class SP_Shortcode_Event_Officials {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Officials {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-officials.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Performance Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Performance
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Performance
* @version 0.8
*/
class SP_Shortcode_Event_Performance {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Performance {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-performance.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Results Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Results
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Results
* @version 0.8
*/
class SP_Shortcode_Event_Results {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Results {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-results.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Teams Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Officials
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Officials
* @version 2.6.9
*/
class SP_Shortcode_Event_Teams {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Teams {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-logos.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Event Venue Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Venue
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Event_Venue
* @version 2.6.9
*/
class SP_Shortcode_Event_Venue {
@@ -16,8 +16,9 @@ class SP_Shortcode_Event_Venue {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'event-venue.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* League Table Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/League_Table
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/League_Table
* @version 0.7
*/
class SP_Shortcode_League_Table {
@@ -16,8 +16,9 @@ class SP_Shortcode_League_Table {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'league-table.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Player Details Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Details
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Details
* @version 1.4.7
*/
class SP_Shortcode_Player_Details {
@@ -16,8 +16,9 @@ class SP_Shortcode_Player_Details {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'player-photo.php', $atts );
sp_get_template( 'player-details.php', $atts );

View File

@@ -2,9 +2,9 @@
/**
* Player Gallery Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Gallery
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Gallery
* @version 0.7
*/
class SP_Shortcode_Player_Gallery {
@@ -16,8 +16,9 @@ class SP_Shortcode_Player_Gallery {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'player-gallery.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Player List Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_List
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_List
* @version 0.7
*/
class SP_Shortcode_Player_List {
@@ -16,8 +16,9 @@ class SP_Shortcode_Player_List {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'player-list.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Player Statistics Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Statistics
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Player_Statistics
* @version 1.2
*/
class SP_Shortcode_Player_Statistics {
@@ -16,8 +16,9 @@ class SP_Shortcode_Player_Statistics {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'player-statistics.php', $atts );
}

View File

@@ -2,9 +2,9 @@
/**
* Staff Profile Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Staff
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Staff
* @version 2.5.5
*/
class SP_Shortcode_Staff_Profile {
@@ -16,11 +16,12 @@ class SP_Shortcode_Staff_Profile {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'staff-header.php', $atts );
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-header.php', $atts );
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-details.php', $atts );
sp_get_template( 'staff-excerpt.php', $atts );
sp_get_template( 'staff-content.php', $atts );

View File

@@ -2,9 +2,9 @@
/**
* Staff Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Staff
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Staff
* @version 2.5.5
*/
class SP_Shortcode_Staff {
@@ -16,10 +16,11 @@ class SP_Shortcode_Staff {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-photo.php', $atts );
sp_get_template( 'staff-details.php', $atts );
}
}

View File

@@ -2,9 +2,9 @@
/**
* Team Gallery Shortcode
*
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Team_Gallery
* @author ThemeBoy
* @category Shortcodes
* @package SportsPress/Shortcodes/Team_Gallery
* @version 2.4
*/
class SP_Shortcode_Team_Gallery {
@@ -16,8 +16,9 @@ class SP_Shortcode_Team_Gallery {
*/
public static function output( $atts ) {
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) )
if ( ! isset( $atts['id'] ) && isset( $atts[0] ) && is_numeric( $atts[0] ) ) {
$atts['id'] = $atts[0];
}
sp_get_template( 'team-gallery.php', $atts );
}