-
Notifications
You must be signed in to change notification settings - Fork 0
/
enhanced-author-dropdown.php
99 lines (89 loc) · 2.73 KB
/
enhanced-author-dropdown.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Plugin Name: Enhanced Author Dropdown
* Plugin URI: http://www.chriscct7.com
* Description: Enhance the standard dropdown for authors on posts in WordPress
* Author: Chris Christoff
* Author URI: http://www.chriscct7.com
*
* Contributors: chriscct7, sunnyratilal, pippinsplugins
*
* Version: 1.0
* Requires at least: 3.5.0
* Tested up to: 3.6 Beta 4
*
* Text Domain: ead
* Domain Path: /languages/
*
* @category Plugin
* @copyright Copyright © 2013 Chris Christoff
* @author Chris Christoff
* @package WPEAD
*/
/* Define an absolute path to our plugin directory. */
if ( ! defined( 'EAD_PLUGIN_DIR' ) ) define( 'EAD_PLUGIN_DIR', trailingslashit( dirname( __FILE__ ) ));
if ( ! defined( 'EAD_ASSETS_URL' ) ) define( 'EAD_ASSETS_URL', trailingslashit( plugins_url( 'WPEAD' , __FILE__ ) ) );
if ( ! defined( 'EAD_VERSION' ) ) define( 'EAD_VERSION', '1.0' );
/**
* Main WPEAD class
*
* @package WPEAD
* @since 1.0
* @author Chris Christoff
*/
class EAD_Main {
/**
* @static
* @var object Holds the options
* @since 1.0
*/
public static $wpead_options;
public static $id = 'ead';
/**
* Constructor
*
* @access protected
* @since 1.0
* @return void
*/
public function __construct() {
$this->title = __( 'Enhanced Author Dropdown', 'ead' );
add_action( 'admin_init', array( $this, 'load_textdomain_for_ead' ) );
/*
* We must use wp_loaded here. "plugins_loaded" is too early, even at priority
* 9999 since plugin registered taxonomies aren't registered in time.
*/
add_action( 'wp_loaded', array( $this, 'load_settings' ) );
add_action( 'plugins_loaded', array( $this, 'include_core' ) );
// Start a PHP session, if not yet tarted
if ( ! session_id() ) session_start();
}
/**
* Load the textdomain
*
* @since 1.0
* @access public
* @return void
*/
public function load_textdomain_for_ead() {
load_plugin_textdomain( 'ead', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Set static $wpead_options to hold options class
*/
public function load_settings() {
if ( empty( self::$wpead_options ) ) {
require_once EAD_PLUGIN_DIR . '/settings/classes/sf-class-settings.php';
self::$wpead_options = new SF_Settings_API( self::$id, $this->title, 'options-general.php', __FILE__ );
self::$wpead_options->load_options( EAD_PLUGIN_DIR . '/settings/sf-options.php' );
}
}
/**
* Include core files
*/
public function include_core() {
require_once EAD_PLUGIN_DIR . 'class-frontend.php';
$GLOBALS['EAD_Frontend'] = new EAD_Frontend;
}
}
$GLOBALS['EAD_Main'] = new EAD_Main;