Exemple #1
0
 /**
  * Get stylesheet URI
  *
  * @since  0.1.0
  * @return string
  */
 public function get_stylesheet_uri()
 {
     $stylesheet_uri = sprintf('%1$s/css/types/%2$s%3$s.css', Icon_Picker::instance()->url, $this->stylesheet_id, defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min');
     /**
      * Filters icon type's stylesheet URI
      *
      * @since  0.4.0
      *
      * @param  string                $stylesheet_uri Icon type's stylesheet URI.
      * @param  string                $icon_type_id   Icon type's ID.
      * @param  Icon_Picker_Type_Font $icon_type      Icon type's instance.
      *
      * @return string
      */
     $stylesheet_uri = apply_filters('icon_picker_icon_type_stylesheet_uri', $stylesheet_uri, $this->id, $this);
     return $stylesheet_uri;
 }
Exemple #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);
 }
Exemple #3
0
 /**
  * Get instance
  *
  * @since  0.1.0
  * @param  array $args Arguments {@see Icon_Picker::__construct()}.
  * @return Icon_Picker
  */
 public static function instance($args = array())
 {
     if (is_null(self::$instance)) {
         self::$instance = new self($args);
     }
     return self::$instance;
 }
Exemple #4
0
 /**
  * Media templates
  *
  * @since   0.1.0
  * @wp_hook action print_media_templates
  * @return  void
  */
 public function _media_templates()
 {
     $icon_picker = Icon_Picker::instance();
     foreach ($icon_picker->registry->types as $type) {
         if (empty($type->templates)) {
             continue;
         }
         $template_id_prefix = "tmpl-iconpicker-{$type->template_id}";
         if (in_array($template_id_prefix, $this->printed_templates)) {
             continue;
         }
         foreach ($type->templates as $template_id_suffix => $template) {
             $this->_print_template("{$template_id_prefix}-{$template_id_suffix}", $template);
         }
         $this->printed_templates[] = $template_id_prefix;
     }
     /**
      * Fires after all media templates have been printed
      *
      * @since 0.1.0
      * @param Icon_Picker $icon_picker Icon Picker instance.
      */
     do_action('icon_picker_print_media_templates', $icon_picker);
 }
/**
 * Register Genericons type for Icon Picker
 *
 * @action icon_picker_types_registry_init
 * @param  Icon_Picker_Types_Registry      $ip_registry Icon_Picker_Types_Registry instance.
 * @return void
 */
function icon_picker_genericons_register(Icon_Picker_Types_Registry $ip_registry)
{
    require_once Icon_Picker::instance()->dir . '/includes/types/font.php';
    require_once dirname(__FILE__) . '/genericons.php';
    $ip_registry->add(new Icon_Picker_Type_Genericons());
}
Exemple #6
0
 /**
  * Get stylesheet URI
  *
  * @since  0.1.0
  * @return string
  */
 public function get_stylesheet_uri()
 {
     return sprintf('%1$s/css/types/%2$s%3$s.css', Icon_Picker::instance()->url, $this->stylesheet_id, defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min');
 }
Exemple #7
0
 /**
  * Register icon packs
  *
  * @since  0.1.0
  * @access protected
  * @return void
  */
 protected function register_packs()
 {
     if (empty($this->packs)) {
         return;
     }
     $icon_picker = Icon_Picker::instance();
     require_once "{$icon_picker->dir}/includes/types/fontello.php";
     foreach ($this->packs as $pack_data) {
         $icon_picker->registry->add(new Icon_Picker_Type_Fontello($pack_data));
     }
 }
Exemple #8
0
 /**
  * Constructor
  *
  * @since 0.1.0
  * @see   {CMB_Field::__construct()}
  */
 public function __construct($name, $title, array $values, $args = array())
 {
     parent::__construct($name, $title, $values, $args);
     Icon_Picker::instance()->load();
 }
Exemple #9
0
 /**
  * Load Icon Picker
  *
  * @since   0.9.0
  * @wp_hook action load-nav-menus.php
  */
 public static function _load_nav_menus()
 {
     Icon_Picker::instance()->load();
     add_action('print_media_templates', array(__CLASS__, '_media_templates'));
 }