Move widgets and importers to modules
This commit is contained in:
62
modules/sportspress-importers.php
Normal file
62
modules/sportspress-importers.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: SportsPress Importers
|
||||
Plugin URI: http://themeboy.com/
|
||||
Description: Add importers to SportsPress.
|
||||
Author: ThemeBoy
|
||||
Author URI: http://themeboy.com/
|
||||
Version: 1.7
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'SportsPress_Importers' ) ) :
|
||||
|
||||
/**
|
||||
* Main SportsPress Importers Class
|
||||
*
|
||||
* @class SportsPress_Importers
|
||||
* @version 1.7
|
||||
*/
|
||||
class SportsPress_Importers {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
// Define constants
|
||||
$this->define_constants();
|
||||
|
||||
add_action( 'init', array( $this, 'includes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Define constants.
|
||||
*/
|
||||
private function define_constants() {
|
||||
if ( !defined( 'SP_IMPORTERS_VERSION' ) )
|
||||
define( 'SP_IMPORTERS_VERSION', '1.7' );
|
||||
|
||||
if ( !defined( 'SP_IMPORTERS_URL' ) )
|
||||
define( 'SP_IMPORTERS_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
if ( !defined( 'SP_IMPORTERS_DIR' ) )
|
||||
define( 'SP_IMPORTERS_DIR', plugin_dir_path( __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include importers.
|
||||
*/
|
||||
public function includes() {
|
||||
if ( is_admin() && defined( 'WP_LOAD_IMPORTERS' ) ) {
|
||||
include( SP()->plugin_path() . '/includes/admin/class-sp-admin-importers.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ( get_option( 'sportspress_load_importers_module', 'yes' ) == 'yes' ) {
|
||||
new SportsPress_Importers();
|
||||
}
|
||||
63
modules/sportspress-widgets.php
Normal file
63
modules/sportspress-widgets.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: SportsPress Widgets
|
||||
Plugin URI: http://themeboy.com/
|
||||
Description: Add widgets to SportsPress.
|
||||
Author: ThemeBoy
|
||||
Author URI: http://themeboy.com/
|
||||
Version: 1.7
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'SportsPress_Widgets' ) ) :
|
||||
|
||||
/**
|
||||
* Main SportsPress Widgets Class
|
||||
*
|
||||
* @class SportsPress_Widgets
|
||||
* @version 1.7
|
||||
*/
|
||||
class SportsPress_Widgets {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
// Define constants
|
||||
$this->define_constants();
|
||||
|
||||
add_action( 'widgets_init', array( $this, 'includes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Define constants.
|
||||
*/
|
||||
private function define_constants() {
|
||||
if ( !defined( 'SP_WIDGETS_VERSION' ) )
|
||||
define( 'SP_WIDGETS_VERSION', '1.7' );
|
||||
|
||||
if ( !defined( 'SP_WIDGETS_URL' ) )
|
||||
define( 'SP_WIDGETS_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
if ( !defined( 'SP_WIDGETS_DIR' ) )
|
||||
define( 'SP_WIDGETS_DIR', plugin_dir_path( __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include widgets.
|
||||
*/
|
||||
public function includes() {
|
||||
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-sportspress.php' );
|
||||
include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-staff.php' );
|
||||
|
||||
do_action( 'sportspress_widgets' );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ( get_option( 'sportspress_load_widgets_module', 'yes' ) == 'yes' ) {
|
||||
new SportsPress_Widgets();
|
||||
}
|
||||
Reference in New Issue
Block a user