/** * Get instance * * @static * @since 0.1.0 * @return Icon_Picker_Fontpack */ public static function instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Register default icon types * * @since 0.1.0 * @access protected */ protected function register_default_types() { require_once "{$this->dir}/includes/fontpack.php"; Icon_Picker_Fontpack::instance(); /** * Allow themes/plugins to disable one or more default types * * @since 0.1.0 * @param array $default_types Default icon types. */ $default_types = array_filter((array) apply_filters('icon_picker_default_types', $this->default_types)); /** * Validate filtered default types */ $default_types = array_intersect($this->default_types, $default_types); if (empty($default_types)) { return; } foreach ($default_types as $filename => $class_suffix) { $class_name = "Icon_Picker_Type_{$class_suffix}"; require_once "{$this->dir}/includes/types/{$filename}.php"; $this->registry->add(new $class_name()); } }