Define main SportsPress class

This commit is contained in:
Brian Miyaji
2014-03-25 00:19:34 +11:00
parent 6e778ad40c
commit 6db3e82d66
16 changed files with 357 additions and 168 deletions

View File

@@ -1,26 +1,26 @@
<?php
function sportspress_admin_enqueue_scripts( $hook ) {
wp_enqueue_style( 'jquery-chosen', SPORTSPRESS_PLUGIN_URL . 'assets/css/chosen.css', array(), null );
wp_enqueue_style( 'jquery-chosen', plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/css/chosen.css', array(), null );
// Add ThemeBoy icon font, used in the admin stylesheet.
wp_enqueue_style( 'themeboy', SPORTSPRESS_PLUGIN_URL . 'assets/css/themeboy.css', array(), null );
wp_enqueue_style( 'themeboy', plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/css/themeboy.css', array(), null );
// Load our admin stylesheet.
wp_enqueue_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() );
wp_enqueue_style( 'sportspress-admin', plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/css/admin.css', array(), time() );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-chosen', SPORTSPRESS_PLUGIN_URL .'assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
wp_enqueue_script( 'jquery-tiptip', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', 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 );
wp_enqueue_script( 'jquery-chosen', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
wp_enqueue_script( 'jquery-tiptip', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.tipTip.min.js', array( 'jquery' ), '1.3', true );
wp_enqueue_script( 'jquery-caret', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.caret.min.js', array( 'jquery' ), '1.02', true );
wp_enqueue_script( 'jquery-countdown', plugin_dir_url( SP_PLUGIN_FILE ) .'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' );
wp_enqueue_script( 'jquery-locationpicker', SPORTSPRESS_PLUGIN_URL .'assets/js/locationpicker.jquery.js', array( 'jquery' ), '0.1.6', true );
wp_enqueue_script( 'sportspress-admin-locationpicker', SPORTSPRESS_PLUGIN_URL .'assets/js/admin-locationpicker.js', array( 'jquery', 'google-maps', 'jquery-locationpicker' ), time(), true );
wp_enqueue_script( 'jquery-locationpicker', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/locationpicker.jquery.js', array( 'jquery' ), '0.1.6', true );
wp_enqueue_script( 'sportspress-admin-locationpicker', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/admin-locationpicker.js', array( 'jquery', 'google-maps', 'jquery-locationpicker' ), time(), true );
endif;
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'assets/js/admin.js', array( 'jquery' ), time(), true );
wp_enqueue_script( 'sportspress-admin', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/admin.js', array( 'jquery' ), time(), true );
// Localize scripts.
wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'none' => __( 'None', 'sportspress' ), 'remove_text' => __( '&mdash; Remove &mdash;', 'sportspress' ), 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) );

View File

@@ -34,7 +34,7 @@ add_action( 'admin_print_styles', 'sportspress_admin_notices_styles' );
* @return void
*/
function sportspress_admin_install_notices() {
// include( dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/includes/notice-install.php' );
// include( dirname( SP_PLUGIN_FILE ) . '/admin/includes/notice-install.php' );
}
/**
@@ -44,5 +44,5 @@ function sportspress_admin_install_notices() {
* @return void
*/
function sportspress_theme_check_notice() {
// include( dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/includes/notice-theme-support.php' );
// include( dirname( SP_PLUGIN_FILE ) . '/admin/includes/notice-theme-support.php' );
}

View File

@@ -2,6 +2,6 @@
function sportspress_current_screen() {
$screen = get_current_screen();
if ( $screen->id == 'dashboard' )
include_once( dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/dashboard.php' );
include_once( dirname( SP_PLUGIN_FILE ) . '/admin/tools/dashboard.php' );
}
add_action( 'current_screen', 'sportspress_current_screen' );

View File

@@ -9,5 +9,5 @@ function sportspress_plugin_action_links( $links ) {
return $links;
}
$plugin = SPORTSPRESS_PLUGIN_BASENAME;
$plugin = plugin_basename( SP_PLUGIN_FILE );
add_filter( "plugin_action_links_$plugin", 'sportspress_plugin_action_links' );

View File

@@ -3,7 +3,7 @@ function sportspress_plugins_loaded() {
// Load plugin textdomain
if ( function_exists( 'load_plugin_textdomain' ) ) {
load_plugin_textdomain ( 'sportspress', false, dirname( SPORTSPRESS_PLUGIN_BASENAME ) . '/languages/' );
load_plugin_textdomain ( 'sportspress', false, dirname( plugin_basename( SP_PLUGIN_FILE ) ) . '/languages/' );
}
// Add image sizes

View File

@@ -162,4 +162,4 @@ function sportspress_activation_hook() {
sportspress_flush_rewrite_rules();
}
register_activation_hook( SPORTSPRESS_PLUGIN_FILE, 'sportspress_activation_hook' );
register_activation_hook( SP_PLUGIN_FILE, 'sportspress_activation_hook' );

View File

@@ -3,7 +3,7 @@ function sportspress_save_post( $post_id ) {
global $post, $typenow;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id;
if ( !current_user_can( 'edit_post', $post_id ) ) return $post_id;
if ( !isset( $_POST['sportspress_nonce'] ) || ! wp_verify_nonce( $_POST['sportspress_nonce'], SPORTSPRESS_PLUGIN_BASENAME ) ) return $post_id;
if ( !isset( $_POST['sportspress_nonce'] ) || ! wp_verify_nonce( $_POST['sportspress_nonce'], plugin_basename( SP_PLUGIN_FILE ) ) ) return $post_id;
switch ( $_POST['post_type'] ):
case ( 'sp_team' ):

View File

@@ -1,14 +1,14 @@
<?php
function sportspress_enqueue_scripts() {
// Styles
wp_enqueue_style( 'sportspress', SPORTSPRESS_PLUGIN_URL . 'assets/css/sportspress.css', array( 'dashicons' ), time() );
wp_enqueue_style( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/css/sportspress.css', array( 'dashicons' ), time() );
// Scripts
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
wp_enqueue_script( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true );
wp_enqueue_script( 'jquery-countdown', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
wp_enqueue_script( 'sportspress', SPORTSPRESS_PLUGIN_URL .'assets/js/sportspress.js', array( 'jquery' ), time(), true );
wp_enqueue_script( 'jquery-datatables', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true );
wp_enqueue_script( 'jquery-countdown', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
wp_enqueue_script( 'sportspress', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sportspress.js', array( 'jquery' ), time(), true );
// Localize scripts.
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hrs' => __( 'hrs', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) );

View File

@@ -282,21 +282,21 @@ function sportspress_define_globals() {
// Sports
global $sportspress_sports;
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/soccer.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/football.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/footy.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/baseball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/basketball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/gaming.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/cricket.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/golf.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/handball.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/hockey.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/racing.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/rugby.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/swimming.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/tennis.php';
include_once dirname( SPORTSPRESS_PLUGIN_FILE ) . '/presets/sports/volleyball.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/soccer.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/football.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/footy.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/baseball.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/basketball.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/gaming.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/cricket.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/golf.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/handball.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/hockey.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/racing.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/rugby.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/swimming.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/tennis.php';
include_once dirname( SP_PLUGIN_FILE ) . '/presets/sports/volleyball.php';
uasort( $sportspress_sports, 'sportspress_sort_sports' );
}

View File

@@ -23,7 +23,7 @@ if ( !function_exists( 'sportspress_player_metrics' ) ) {
$common = array();
if ( $nationality ):
$country_name = sportspress_array_value( $sportspress_countries, $nationality, null );
$common[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $r['show_nationality_flag'] ? '<img src="' . SPORTSPRESS_PLUGIN_URL . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
$common[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $r['show_nationality_flag'] ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '&mdash;';
endif;
$data = array_merge( $common, $metrics );

View File

@@ -518,7 +518,7 @@ if ( class_exists( 'WP_Importer' ) ) {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
echo '<p>' . sprintf( __( 'Events need to be defined with columns in a specific order (3+ columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), SPORTSPRESS_PLUGIN_URL . 'dummy-data/events-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Events need to be defined with columns in a specific order (3+ columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/events-sample.csv' ) . '</p>';
$action = 'admin.php?import=sportspress_event_csv&step=1';

View File

@@ -9,7 +9,7 @@ function sportspress_event_importer() {
}
// includes
require dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/event-importer.php';
require dirname( SP_PLUGIN_FILE ) . '/admin/tools/event-importer.php';
// Dispatch
$importer = new SP_Event_Importer();
@@ -26,7 +26,7 @@ function sportspress_team_importer() {
}
// includes
require dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/team-importer.php';
require dirname( SP_PLUGIN_FILE ) . '/admin/tools/team-importer.php';
// Dispatch
$importer = new SP_Team_Importer();
@@ -43,7 +43,7 @@ function sportspress_player_importer() {
}
// includes
require dirname( SPORTSPRESS_PLUGIN_FILE ) . '/admin/tools/player-importer.php';
require dirname( SP_PLUGIN_FILE ) . '/admin/tools/player-importer.php';
// Dispatch
$importer = new SP_Player_Importer();

View File

@@ -285,7 +285,7 @@ if ( class_exists( 'WP_Importer' ) ) {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (7 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), SPORTSPRESS_PLUGIN_URL . 'dummy-data/players-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Players need to be defined with columns in a specific order (7 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/players-sample.csv' ) . '</p>';
$action = 'admin.php?import=sportspress_player_csv&step=1';

View File

@@ -242,7 +242,7 @@ if ( class_exists( 'WP_Importer' ) ) {
echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Choose a .csv file to upload, then click "Upload file and import".', 'sportspress' ).'</p>';
echo '<p>' . sprintf( __( 'Teams need to be defined with columns in a specific order (3 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), SPORTSPRESS_PLUGIN_URL . 'dummy-data/teams-sample.csv' ) . '</p>';
echo '<p>' . sprintf( __( 'Teams need to be defined with columns in a specific order (3 columns). <a href="%s">Click here to download a sample</a>.', 'sportspress' ), plugin_dir_url( SP_PLUGIN_FILE ) . 'dummy-data/teams-sample.csv' ) . '</p>';
$action = 'admin.php?import=sportspress_team_csv&step=1';

View File

@@ -113,7 +113,7 @@ if ( !function_exists( 'sp_flush_rewrite_rules' ) ) {
if ( !function_exists( 'sp_nonce' ) ) {
function sp_nonce() {
echo '<input type="hidden" name="sportspress_nonce" id="sportspress_nonce" value="' . wp_create_nonce( SPORTSPRESS_PLUGIN_BASENAME ) . '" />';
echo '<input type="hidden" name="sportspress_nonce" id="sportspress_nonce" value="' . wp_create_nonce( plugin_basename( SP_PLUGIN_FILE ) ) . '" />';
}
}

View File

@@ -1,132 +1,321 @@
<?php
/**
* Plugin Name: SportsPress
* Plugin URI: http://wordpress.org/plugins/sportspress
* Description: Manage your club and its players, staff, events, league tables, and player lists.
* Version: 0.7
* Author: ThemeBoy
* Author URI: http://themeboy.com
* Requires at least: 3.8
* Tested up to: 3.8
*
* Text Domain: sportspress
* Domain Path: /languages/
*
* @package SportsPress
* @category Core
* @author ThemeBoy
*/
/*
Plugin Name: SportsPress
Plugin URI: http://wordpress.org/plugins/sportspress
Description: Manage your club and its players, staff, events, league tables, and player lists.
Version: 0.6.2
Author: ThemeBoy
Author URI: http://themeboy.com/
License: GPLv3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'SportsPress' ) ) :
/**
* Main SportsPress Class
*
* @class SportsPress
* @version 0.7
*/
final class SportsPress {
/**
* @var string
*/
public $version = '0.7';
/**
* @var SporsPress The single instance of the class
* @since 0.7
*/
protected static $_instance = null;
/**
* Main SportsPress Instance
*
* Ensures only one instance of SportsPress is loaded or can be loaded.
*
* @since 0.7
* @static
* @see SP()
* @return SportsPress - Main instance
*/
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Cloning is forbidden.
*
* @since 0.7
*/
public function __clone() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'sportspress' ), '0.7' );
}
/**
* Unserializing instances of this class is forbidden.
*
* @since 0.7
*/
public function __wakeup() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'sportspress' ), '0.7' );
}
/**
* SportsPress Constructor.
* @access public
* @return SportsPress
*/
public function __construct() {
// Define constants
$this->define_constants();
// Include required files
$this->includes();
// Hooks
add_action( 'widgets_init', array( $this, 'include_widgets' ) );
add_action( 'init', array( $this, 'init' ), 0 );
add_action( 'after_setup_theme', array( $this, 'setup_environment' ) );
// Loaded action
do_action( 'sportspress_loaded' );
}
/**
* Define SP Constants
*/
private function define_constants() {
define( 'SP_PLUGIN_FILE', __FILE__ );
define( 'SP_VERSION', $this->version );
if ( ! defined( 'SP_TEMPLATE_PATH' ) ) {
define( 'SP_TEMPLATE_PATH', $this->template_path() );
}
if ( ! defined( 'SP_DELIMITER' ) ) {
define( 'SP_DELIMITER', '|' );
}
}
/**
* Include required core files used in admin and on the frontend.
*/
private function includes() {
// Libraries
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
// Globals
require_once dirname( __FILE__ ) . '/admin/includes/globals.php';
// Functions
require_once dirname( __FILE__ ) . '/functions.php';
require_once dirname( __FILE__ ) . '/includes/sp-deprecated-functions.php';
// Templates
require_once dirname( __FILE__ ) . '/admin/templates/countdown.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-details.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-results.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-calendar.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-list.php';
require_once dirname( __FILE__ ) . '/admin/templates/league-table.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-league-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-list.php';
//require_once dirname( __FILE__ ) . '/admin/templates/player-roster.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-gallery.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-metrics.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/team-columns.php';
// Options
require_once dirname( __FILE__ ) . '/admin/settings/settings.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-general.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-event.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-team.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-player.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-text.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-permalink.php';
// Custom post types
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
require_once dirname( __FILE__ ) . '/admin/post-types/column.php';
require_once dirname( __FILE__ ) . '/admin/post-types/performance.php';
//require_once dirname( __FILE__ ) . '/admin/post-types/statistic.php';
require_once dirname( __FILE__ ) . '/admin/post-types/metric.php';
require_once dirname( __FILE__ ) . '/admin/post-types/result.php';
require_once dirname( __FILE__ ) . '/admin/post-types/outcome.php';
require_once dirname( __FILE__ ) . '/admin/post-types/event.php';
require_once dirname( __FILE__ ) . '/admin/post-types/calendar.php';
require_once dirname( __FILE__ ) . '/admin/post-types/team.php';
require_once dirname( __FILE__ ) . '/admin/post-types/table.php';
require_once dirname( __FILE__ ) . '/admin/post-types/player.php';
require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
//require_once dirname( __FILE__ ) . '/admin/post-types/directory.php';
// Terms
require_once dirname( __FILE__ ) . '/admin/terms/league.php';
require_once dirname( __FILE__ ) . '/admin/terms/season.php';
require_once dirname( __FILE__ ) . '/admin/terms/venue.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Tools
require_once dirname( __FILE__ ) . '/admin/tools/importers.php';
// Typical request actions
require_once dirname( __FILE__ ) . '/admin/hooks/plugins-loaded.php';
require_once dirname( __FILE__ ) . '/admin/hooks/after-setup-theme.php';
require_once dirname( __FILE__ ) . '/admin/hooks/wp-enqueue-scripts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/loop-start.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-title.php';
// Admin request actions
require_once dirname( __FILE__ ) . '/admin/hooks/admin-init.php';
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';
require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';;
require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php';
// Filters
require_once dirname( __FILE__ ) . '/admin/hooks/admin-post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/gettext.php';
require_once dirname( __FILE__ ) . '/admin/hooks/pre-get-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/sanitize-title.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-content.php';
require_once dirname( __FILE__ ) . '/admin/hooks/widget-text.php';
require_once dirname( __FILE__ ) . '/admin/hooks/wp-insert-post-data.php';
require_once dirname( __FILE__ ) . '/admin/hooks/plugin-action-links.php';
require_once dirname( __FILE__ ) . '/admin/hooks/post-updated-messages.php';
// Register activation hook
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';
}
/**
* Include required frontend files.
*/
public function frontend_includes() {
}
/**
* Function used to Init SportsPress Template Functions - This makes them pluggable by plugins and themes.
*/
public function include_template_functions() {
}
/**
* Include core widgets
*/
public function include_widgets() {
require_once dirname( __FILE__ ) . '/admin/widgets/countdown.php';
require_once dirname( __FILE__ ) . '/admin/widgets/event-calendar.php';
require_once dirname( __FILE__ ) . '/admin/widgets/event-list.php';
require_once dirname( __FILE__ ) . '/admin/widgets/league-table.php';
require_once dirname( __FILE__ ) . '/admin/widgets/player-list.php';
require_once dirname( __FILE__ ) . '/admin/widgets/player-gallery.php';
}
/**
* Init SportsPress when WordPress Initialises.
*/
public function init() {
// Before init action
do_action( 'before_sportspress_init' );
// Set up localisation
$this->load_plugin_textdomain();
// Init action
do_action( 'sportspress_init' );
}
/**
* Load Localisation files.
*
* Note: the first-loaded translation file overrides any following ones if the same translation is present
*/
public function load_plugin_textdomain() {
$locale = apply_filters( 'plugin_locale', get_locale(), 'sportspress' );
// Global + Frontend Locale
load_textdomain( 'sportspress', WP_LANG_DIR . "/sportspress/sportspress-$locale.mo" );
load_plugin_textdomain( 'sportspress', false, plugin_basename( dirname( __FILE__ ) ) . "/languages" );
}
/**
* Ensure theme and server variable compatibility and setup image sizes..
*/
public function setup_environment() {
}
/** Helper functions ******************************************************/
/**
* Get the plugin url.
*
* @return string
*/
public function plugin_url() {
return untrailingslashit( plugins_url( '/', __FILE__ ) );
}
/**
* Get the plugin path.
*
* @return string
*/
public function plugin_path() {
return untrailingslashit( plugin_dir_path( __FILE__ ) );
}
/**
* Get the template path.
*
* @return string
*/
public function template_path() {
return apply_filters( 'SP_TEMPLATE_PATH', 'sportspress/' );
}
}
// Make sure we don't expose any info if called directly
if ( !function_exists( 'add_action' ) ):
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
exit;
endif;
define( 'SPORTSPRESS_VERSION', '0.6.2' );
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'SPORTSPRESS_PLUGIN_FILE', __FILE__ );
/**
* Returns the main instance of SP to prevent the need to use globals.
*
* @since 0.7
* @return SportsPress
*/
function SP() {
return SportsPress::instance();
}
// Libraries
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
// Globals
require_once dirname( __FILE__ ) . '/admin/includes/globals.php';
// Functions
require_once dirname( __FILE__ ) . '/functions.php';
require_once dirname( __FILE__ ) . '/includes/sp-deprecated-functions.php';
// Templates
require_once dirname( __FILE__ ) . '/admin/templates/countdown.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-details.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-results.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-calendar.php';
require_once dirname( __FILE__ ) . '/admin/templates/event-list.php';
require_once dirname( __FILE__ ) . '/admin/templates/league-table.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-league-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-list.php';
//require_once dirname( __FILE__ ) . '/admin/templates/player-roster.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-gallery.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-metrics.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-performance.php';
require_once dirname( __FILE__ ) . '/admin/templates/team-columns.php';
// Options
require_once dirname( __FILE__ ) . '/admin/settings/settings.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-general.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-event.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-team.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-player.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-text.php';
require_once dirname( __FILE__ ) . '/admin/settings/options-permalink.php';
// Custom post types
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
require_once dirname( __FILE__ ) . '/admin/post-types/column.php';
require_once dirname( __FILE__ ) . '/admin/post-types/performance.php';
//require_once dirname( __FILE__ ) . '/admin/post-types/statistic.php';
require_once dirname( __FILE__ ) . '/admin/post-types/metric.php';
require_once dirname( __FILE__ ) . '/admin/post-types/result.php';
require_once dirname( __FILE__ ) . '/admin/post-types/outcome.php';
require_once dirname( __FILE__ ) . '/admin/post-types/event.php';
require_once dirname( __FILE__ ) . '/admin/post-types/calendar.php';
require_once dirname( __FILE__ ) . '/admin/post-types/team.php';
require_once dirname( __FILE__ ) . '/admin/post-types/table.php';
require_once dirname( __FILE__ ) . '/admin/post-types/player.php';
require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
//require_once dirname( __FILE__ ) . '/admin/post-types/directory.php';
// Terms
require_once dirname( __FILE__ ) . '/admin/terms/league.php';
require_once dirname( __FILE__ ) . '/admin/terms/season.php';
require_once dirname( __FILE__ ) . '/admin/terms/venue.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Widgets
require_once dirname( __FILE__ ) . '/admin/widgets/countdown.php';
require_once dirname( __FILE__ ) . '/admin/widgets/event-calendar.php';
require_once dirname( __FILE__ ) . '/admin/widgets/event-list.php';
require_once dirname( __FILE__ ) . '/admin/widgets/league-table.php';
require_once dirname( __FILE__ ) . '/admin/widgets/player-list.php';
require_once dirname( __FILE__ ) . '/admin/widgets/player-gallery.php';
// Tools
require_once dirname( __FILE__ ) . '/admin/tools/importers.php';
// Typical request actions
require_once dirname( __FILE__ ) . '/admin/hooks/plugins-loaded.php';
require_once dirname( __FILE__ ) . '/admin/hooks/after-setup-theme.php';
require_once dirname( __FILE__ ) . '/admin/hooks/wp-enqueue-scripts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/loop-start.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-title.php';
// Admin request actions
require_once dirname( __FILE__ ) . '/admin/hooks/admin-init.php';
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';
require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';;
require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php';
// Filters
require_once dirname( __FILE__ ) . '/admin/hooks/admin-post-thumbnail-html.php';
require_once dirname( __FILE__ ) . '/admin/hooks/gettext.php';
require_once dirname( __FILE__ ) . '/admin/hooks/pre-get-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-posts.php';
require_once dirname( __FILE__ ) . '/admin/hooks/sanitize-title.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-content.php';
require_once dirname( __FILE__ ) . '/admin/hooks/widget-text.php';
require_once dirname( __FILE__ ) . '/admin/hooks/wp-insert-post-data.php';
require_once dirname( __FILE__ ) . '/admin/hooks/plugin-action-links.php';
require_once dirname( __FILE__ ) . '/admin/hooks/post-updated-messages.php';
// Register activation hook
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';
SP();