예제 #1
0
 /**
  * Get instance
  *
  * @static
  * @since  0.1.0
  * @param  array $args Arguments.
  *
  * @return Icon_Picker_Types_Registry
  */
 public static function instance($args = array())
 {
     if (is_null(self::$instance)) {
         self::$instance = new self($args);
     }
     return self::$instance;
 }
예제 #2
0
 /**
  * Initialize
  *
  * 1. Get registered types from Icon Picker
  * 2. Load settings
  * 3. Load front-end functionalities
  *
  * @since   0.1.0
  * @since   0.9.0  Hook into `icon_picker_init`.
  * @wp_hook action icon_picker_init
  * @link    http://codex.wordpress.org/Plugin_API/Action_Reference
  */
 public static function _init()
 {
     /**
      * Allow themes/plugins to add/remove icon types
      *
      * @since 0.1.0
      * @param array $types Icon types
      */
     self::$data['types'] = apply_filters('menu_icons_types', Icon_Picker_Types_Registry::instance()->types);
     // Nothing to do if there are no icon types registered.
     if (empty(self::$data['types'])) {
         if (WP_DEBUG) {
             trigger_error(esc_html__('Menu Icons: No registered icon types found.', 'menu-icons'));
         }
         return;
     }
     // Load settings.
     require_once self::$data['dir'] . 'includes/settings.php';
     Menu_Icons_Settings::init();
     // Load front-end functionalities.
     if (!is_admin()) {
         require_once self::$data['dir'] . '/includes/front.php';
         Menu_Icons_Front_End::init();
     }
     do_action('menu_icons_loaded');
 }
예제 #3
0
 /**
  * Initialize icon types registry
  *
  * @since  0.1.0
  * @access protected
  * @return void
  */
 protected function init_registry()
 {
     require_once "{$this->dir}/includes/registry.php";
     $this->registry = Icon_Picker_Types_Registry::instance();
     $this->register_default_types();
     /**
      * Fires when Icon Picker's Registry is ready and the default types are registered.
      *
      * @since 0.1.0
      * @param Icon_Picker $this Icon_Picker instance.
      */
     do_action('icon_picker_types_registry_ready', $this);
 }