static function init() { // Initialize arguments self::init_args(); // Add admin_head hook add_action('admin_head', array(__CLASS__, 'admin_head')); // Add admin_init scripts & hook add_action('admin_init', array(__CLASS__, 'admin_init')); // Add admin_menu hook add_action('admin_menu', array(__CLASS__, 'admin_menu')); // Add custom MCE styles add_filter('tiny_mce_before_init', array(__CLASS__, 'customize_mce')); if (class_exists('ricMetabox')) { // Are we on the 'Edit' or 'New' screen? If yes, add some metaboxes! $where = array('post', 'post-new'); if (in_array(WPA_PAGE, $where)) { add_action('init', array(__CLASS__, 'init_metaboxes'), 20, 0); } } // Initialize custom Option Panels ricOptionPanel::init(); // Are we in the 'Media Upload' context? Initialize ricUI $where = array('media-upload', 'async-upload'); if (in_array(WPA_PAGE, $where)) { ricUI::singleton(); } }
public static function singleton() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; }
function __construct($args) { // Parse arguments $defaults = array('toplevel' => false, 'icon' => false, 'parent' => 'options-general.php', 'page_title' => 'Theme Options', 'menu_title' => 'Theme Options', 'page_slug' => '', 'option_template' => array()); $this->args = wp_parse_args($args, $defaults); if (empty($this->args['page_slug'])) { $this->args['page_slug'] = sanitize_title_with_dashes($this->args['menu_title']); } // Initialize ricUI if ($_REQUEST['page'] == $this->args['page_slug']) { $this->ui = ricUI::singleton(); } // Admin menu: add extra menus add_action('ric_admin_menu', array($this, 'admin_menu')); // Admin head: add TinyMCE add_action('ric_admin_head', array($this, 'admin_head')); }
function __construct($args) { // Parse arguments $defaults = array('post_id' => 0, 'post_type' => 'post'); $this->args = wp_parse_args($args, $defaults); if (empty($this->args['post_type']) and $this->args['post_id'] > 0) { $this->args['post_type'] = get_post_type($this->args['post_id']); } // Try to load and parse config file if (!$this->parse_config()) { return; } // Initialize ricUI $this->ui = ricUI::singleton(); // Admin init: add metaboxes add_action('ric_admin_init', array(&$this, 'admin_init')); // Hook in to save meta data add_action('save_post', array(&$this, 'save_postdata'), 1, 2); }