Exemplo n.º 1
0
 /**
  * Collect icon types
  *
  * @since  0.3.0
  * @access private
  */
 private static function _collect_icon_types()
 {
     $registered_types = Menu_Icons::get('icon_types');
     foreach (Menu_Icons_Settings::get('global', 'icon_types') as $id) {
         self::$_icon_types[$id] = $registered_types[$id];
     }
 }
Exemplo n.º 2
0
 /**
  * Perform actions after Menu Icons is fully loaded
  *
  * @since   0.8.0
  * @wp_hook action menu_icons_loaded
  * @return  void
  */
 public function _menu_icons_loaded()
 {
     $active_types = Menu_Icons_Settings::get('global', 'icon_types');
     if (in_array($this->type, $active_types)) {
         add_filter('upload_mimes', array($this, '_add_mime_type'));
     }
 }
Exemplo n.º 3
0
 /**
  * Add hooks for front-end functionalities
  *
  * @since 0.9.0
  */
 public static function init()
 {
     $active_types = Menu_Icons_Settings::get('global', 'icon_types');
     if (empty($active_types)) {
         return;
     }
     foreach (Menu_Icons::get('types') as $type) {
         if (in_array($type->id, $active_types)) {
             self::$icon_types[$type->id] = $type;
         }
     }
     /**
      * Allow themes/plugins to override the hidden label class
      *
      * @since  0.8.0
      * @param  string $hidden_label_class Hidden label class.
      * @return string
      */
     self::$hidden_label_class = apply_filters('menu_icons_hidden_label_class', self::$hidden_label_class);
     /**
      * Allow themes/plugins to override default inline style
      *
      * @since  0.9.0
      * @param  array $default_style Default inline style.
      * @return array
      */
     self::$default_style = apply_filters('menu_icons_default_style', self::$default_style);
     add_action('wp_enqueue_scripts', array(__CLASS__, '_enqueue_styles'), 7);
     add_filter('wp_nav_menu_args', array(__CLASS__, '_add_menu_item_title_filter'));
     add_filter('wp_nav_menu', array(__CLASS__, '_remove_menu_item_title_filter'));
 }
Exemplo n.º 4
0
 /**
  * Enqueue stylesheets
  *
  * @since   0.1.0
  * @access  protected
  * @wp_hook action          wp_enqueue_scripts/10
  * @link   http://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts Action: wp_enqueue_scripts/10
  */
 public static function _enqueue_styles()
 {
     // Enqueue icon types' stylesheets
     foreach (Menu_Icons_Settings::get('global', 'icon_types') as $id) {
         if (isset(self::$data['icon_types'][$id])) {
             self::enqueue_type_stylesheet($id, self::$data['icon_types'][$id]);
         }
     }
     wp_enqueue_style('menu-icons-extra', Menu_Icons::get('url') . 'css/extra' . self::get_script_suffix() . '.css', false, Menu_Icons::VERSION);
 }