- Timestamp:
- 04/05/2016 04:05:02 PM (9 years ago)
- Location:
- sites/trunk/wordcamp.org
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org
-
Property
svn:mergeinfo
set to
/sites/branches/application-tracking/wordcamp.org merged eligible
-
Property
svn:mergeinfo
set to
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-loader.php
r171 r2898 15 15 */ 16 16 define( 'WCPT_VERSION', '0.1' ); 17 define( 'WCPT_DIR', plugin_dir_path( __FILE__ ) ); 18 define( 'WCPT_URL', plugins_url( '/', __FILE__ ) ); 17 19 18 20 if ( !class_exists( 'WCPT_Loader' ) ) : … … 30 32 * The main WordCamp Post Type loader 31 33 */ 32 function wcpt_loader () { 33 /** COMPONENT HOOKS ***************************************************/ 34 function __construct() { 35 add_action( 'plugins_loaded', array( $this, 'core_admin' ) ); 36 add_action( 'init', array( $this, 'core_text_domain' ) ); 34 37 35 // Attach the wcpt_loaded action to the WordPress plugins_loaded action. 36 add_action( 'plugins_loaded', array ( $this, 'component_loaded' ) ); 37 38 // Attach the wcpt_init to the WordPress init action. 39 add_action( 'init', array ( $this, 'component_init' ) ); 40 41 // Attach constants to wcpt_loaded. 42 add_action( 'wcpt_loaded', array ( $this, 'component_constants' ) ); 43 44 // Attach includes to wcpt_loaded. 45 add_action( 'wcpt_loaded', array ( $this, 'component_includes' ) ); 46 47 // Attach post type registration to wcpt_init. 48 add_action( 'wcpt_init', array ( $this, 'component_post_types' ) ); 49 50 // Attach tag registration wcpt_init. 51 add_action( 'wcpt_init', array ( $this, 'component_taxonomies' ) ); 52 53 /** CORE HOOKS ********************************************************/ 54 55 // Core Constants 56 add_action( 'wcpt_started', array ( $this, 'core_constants' ) ); 57 58 // Core Includes 59 add_action( 'wcpt_started', array ( $this, 'core_includes' ) ); 60 61 // Core Admin 62 add_action( 'wcpt_loaded', array ( $this, 'core_admin' ) ); 63 64 // Attach theme directory wcpt_loaded. 65 add_action( 'wcpt_loaded', array ( $this, 'core_theme_directory' ) ); 66 67 // Attach textdomain to wcpt_init. 68 add_action( 'wcpt_init', array ( $this, 'core_text_domain' ) ); 69 70 // Register WordCamp Post Type activation sequence 71 register_activation_hook( __FILE__, array( $this, 'activation' ) ); 72 73 // Register WordCamp Post Type deactivation sequence 74 register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) ); 75 76 // Get this party started 77 do_action( 'wcpt_started' ); 38 $this->includes(); 78 39 } 79 40 80 41 /** 81 * core_constants ()82 *83 * WordCamp Core Constants84 */85 function core_constants () {86 // Turn debugging on/off87 if ( !defined( 'WCPT_DEBUG' ) )88 define( 'WCPT_DEBUG', WP_DEBUG );89 90 // Default slug for post type91 if ( !defined( 'WCPT_THEMES_DIR' ) )92 define( 'WCPT_THEMES_DIR', apply_filters( 'wcpt_themes_dir', WP_PLUGIN_DIR . '/wcpt-themes' ) );93 94 // WordCamp Post Type root directory95 define( 'WCPT_DIR', WP_PLUGIN_DIR . '/wcpt' );96 define( 'WCPT_URL', plugins_url( $path = '/wcpt' ) );97 98 // Images URL99 define( 'WCPT_IMAGES_URL', WCPT_URL . '/wcpt-images' );100 }101 102 /**103 * core_includes ()104 *105 42 * WordCamp Core File Includes 106 43 */ 107 function core_includes() {44 function includes() { 108 45 // Load the files 109 require_once ( WCPT_DIR . '/wcpt-functions.php' ); 110 require_once ( WCPT_DIR . '/wcpt-wordcamp/wordcamp-loader.php' ); 46 require_once ( WCPT_DIR . 'wcpt-functions.php' ); 47 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-loader.php' ); 48 require_once ( WCPT_DIR . 'applications/common.php' ); 49 require_once ( WCPT_DIR . 'applications/tracker.php' ); 50 require_once ( WCPT_DIR . 'applications/wordcamp.php' ); 51 111 52 // Require admin files. 112 53 if ( is_admin() ) { 113 require_once ( WCPT_DIR . ' /wcpt-admin.php' );114 require_once ( WCPT_DIR . ' /wcpt-wordcamp/wordcamp-admin.php' );54 require_once ( WCPT_DIR . 'wcpt-admin.php' ); 55 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-admin.php' ); 115 56 } 116 57 } 117 58 118 function core_admin 59 function core_admin() { 119 60 // Quick admin check 120 61 if ( !is_admin() ) … … 122 63 123 64 // Create admin 124 $GLOBALS['wcpt_admin'] = new WCPT_Admin();125 $GLOBALS['wordcamp_admin'] = new WordCamp_Admin();65 $GLOBALS['wcpt_admin'] = new WCPT_Admin; 66 $GLOBALS['wordcamp_admin'] = new WordCamp_Admin; 126 67 } 127 68 … … 131 72 * Load the translation file for current language 132 73 */ 133 function core_text_domain 74 function core_text_domain() { 134 75 $locale = apply_filters( 'wcpt_textdomain', get_locale() ); 135 136 $mofile = WCPT_DIR . "/wcpt-languages/wcpt-$locale.mo"; 76 $mofile = WCPT_DIR . "wcpt-languages/wcpt-$locale.mo"; 137 77 138 78 load_textdomain( 'wcpt', $mofile ); 139 140 /**141 * Text domain has been loaded142 */143 do_action( 'wcpt_load_textdomain' );144 }145 146 /**147 * core_theme_directory ()148 *149 * Sets up the WordCamp Post Type theme directory to use in WordPress150 *151 * @since WordCamp Post Type (0.1)152 * @uses register_theme_directory153 */154 function core_theme_directory () {155 register_theme_directory( WCPT_THEMES_DIR );156 157 /**158 * Theme directory has been registered159 */160 do_action( 'wcpt_register_theme_directory' );161 }162 163 /**164 * activation ()165 *166 * Runs on WordCamp Post Type activation167 *168 * @since WordCamp Post Type (0.1)169 */170 function activation () {171 register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) );172 173 /**174 * WordCamp Post Type has been activated175 */176 do_action( 'wcpt_activation' );177 }178 179 /**180 * deactivation ()181 *182 * Runs on WordCamp Post Type deactivation183 *184 * @since WordCamp Post Type (0.1)185 */186 function deactivation () {187 do_action( 'wcpt_deactivation' );188 }189 190 /**191 * uninstall ()192 *193 * Runs when uninstalling WordCamp Post Type194 *195 * @since WordCamp Post Type (0.1)196 */197 function uninstall () {198 do_action( 'wcpt_uninstall' );199 }200 201 /**202 * component_constants ()203 *204 * Default component constants that can be overridden or filtered205 */206 function component_constants () {207 do_action( 'wcpt_constants' );208 }209 210 /**211 * component_includes ()212 *213 * Include required files214 *215 */216 function component_includes () {217 do_action( 'wcpt_includes' );218 }219 220 /**221 * component_loaded ()222 *223 * A WordCamp Post Type specific action to say that it has started its224 * boot strapping sequence. It's attached to the existing WordPress225 * action 'plugins_loaded' because that's when all plugins have loaded.226 *227 * @uses is_admin If in WordPress admin, load additional file228 * @uses do_action()229 */230 function component_loaded () {231 do_action( 'wcpt_loaded' );232 }233 234 /**235 * component_init ()236 *237 * Initialize WordCamp Post Type as part of the WordPress initilization process238 *239 * @uses do_action Calls custom action to allow external enhancement240 */241 function component_init () {242 do_action ( 'wcpt_init' );243 }244 245 /**246 * component_post_type ()247 *248 * Setup the post types and taxonomies249 */250 function component_post_types () {251 do_action ( 'wcpt_register_post_types' );252 }253 254 /**255 * component_taxonomies ()256 *257 * Register the built in WordCamp Post Type taxonomies258 *259 * @since WordCamp Post Type (0.1)260 *261 * @uses register_taxonomy()262 * @uses apply_filters()263 */264 function component_taxonomies () {265 do_action ( 'wcpt_register_taxonomies' );266 79 } 267 80 } … … 270 83 271 84 // Load everything up 272 $wcpt_loader = new WCPT_Loader(); 273 $wordcamp_loader = new WordCamp_Loader(); 274 ?> 85 $wcpt_loader = new WCPT_Loader; 86 $wordcamp_loader = new WordCamp_Loader;
Note: See TracChangeset
for help on using the changeset viewer.