/**
  * Load plugin
  *
  * 1. Load translation
  * 2. Set plugin data (directory and URL paths)
  * 3. Register built-in icon types
  * 4. Attach plugin initialization at wp_loaded hook
  *
  * @since   0.1.0
  * @wp_hook action plugins_loaded/10
  * @link    http://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded Action: plugins_loaded/10
  */
 public static function _load()
 {
     load_plugin_textdomain('menu-icons', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     /**
      * Allow different system path for fontpacks
      *
      * @since 0.4.0
      * @param string Directory path, defaults to /wp-content/fontpacks
      */
     $fontpacks_dir_path = apply_filters('menu_icons_fontpacks_dir_path', WP_CONTENT_DIR . '/fontpacks');
     /**
      * Allow different URL path for fontpacks
      *
      * @since 0.4.0
      * @param string URL path, defaults to /wp-content/fontpacks
      */
     $fontpacks_dir_url = apply_filters('menu_icons_fontpacks_dir_url', WP_CONTENT_URL . '/fontpacks');
     self::$data = array('dir' => plugin_dir_path(__FILE__), 'url' => plugin_dir_url(__FILE__), 'icon_types' => array(), 'default_style' => array('font-size' => '1.2em', 'vertical-align' => 'middle'), 'fontpacks_dir_path' => $fontpacks_dir_path, 'fontpacks_dir_url' => $fontpacks_dir_url);
     require_once self::$data['dir'] . 'includes/library/functions.php';
     add_filter('menu_icons_types', array(__CLASS__, '_register_icon_types'), 7);
     add_filter('menu_icons_types', array(__CLASS__, '_register_font_packs'), 8);
     add_filter('is_protected_meta', array(__CLASS__, '_protect_meta_key'), 10, 3);
     add_action('wp_loaded', array(__CLASS__, '_init'), 9);
     add_action('get_header', array(__CLASS__, '_load_front_end'));
 }
Example #2
0
 /**
  * Load plugin
  *
  * 1. Load translation
  * 2. Set plugin data (directory and URL paths)
  * 3. Attach plugin initialization at icon_picker_init hook
  *
  * @since   0.1.0
  * @wp_hook action plugins_loaded
  * @link    http://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded
  */
 public static function _load()
 {
     load_plugin_textdomain('menu-icons', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     self::$data = array('dir' => plugin_dir_path(__FILE__), 'url' => plugin_dir_url(__FILE__), 'types' => array());
     // Load Icon Picker.
     if (!class_exists('Icon_Picker')) {
         $ip_file = self::$data['dir'] . 'includes/library/icon-picker/icon-picker.php';
         if (file_exists($ip_file)) {
             require_once $ip_file;
         } else {
             add_action('admin_notices', array(__CLASS__, '_notice_missing_icon_picker'));
             return;
         }
     }
     Icon_Picker::instance();
     require_once self::$data['dir'] . 'includes/library/compat.php';
     require_once self::$data['dir'] . 'includes/library/functions.php';
     require_once self::$data['dir'] . 'includes/meta.php';
     Menu_Icons_Meta::init();
     add_action('icon_picker_init', array(__CLASS__, '_init'), 9);
 }