コード例 #1
0
ファイル: options.php プロジェクト: xpander54/wp-drz
 public function __construct($name, $default, $properties = array())
 {
     parent::__construct($name, $default, $properties);
     $this->icon->options = function () {
         $icons = array_intersect_key(\Drone\Options\Option\ImageSelect::cssToOptions('data/img/icons/icons.css'), array_flip(array('mail', 'aim', 'amazon', 'app-store', 'apple', 'arto', 'aws', 'baidu', 'basecamp', 'bebo', 'behance', 'bing', 'blip', 'blogger', 'bnter', 'brightkite', 'cloudapp', 'dailybooth', 'delicious', 'designfloat', 'designmoo', 'deviantart', 'digg', 'diigo', 'dribbble', 'dropbox', 'drupal', 'dzone', 'ebay', 'ember', 'etsy', 'evernote', 'facebook', 'facebook-alt', 'facebook-places', 'feedburner', 'flickr', 'folkd', 'forrst', 'foursquare', 'friendfeed', 'friendster', 'gdgt', 'github', 'goodreads', 'googleplus', 'gowalla', 'gowalla-alt', 'grooveshark', 'hacker-news', 'hi5', 'hype-machine', 'hyves', 'icq', 'instapaper', 'itunes', 'kik', 'krop', 'last', 'linkedin', 'linkedin-alt', 'livejournal', 'lovedsgn', 'meetup', 'metacafe', 'mister-wong', 'mobileme', 'msn-messenger', 'myspace', 'newsvine', 'official', 'openid', 'orkut', 'pandora', 'path', 'paypal', 'photobucket', 'picasa', 'pinboard', 'ping', 'pingchat', 'pinterest', 'playstation', 'plixi', 'plurk', 'podcast', 'posterous', 'qik', 'quora', 'rdio', 'readernaut', 'reddit', 'retweet', 'rss', 'scribd', 'sharethis', 'simplenote', 'skype', 'slashdot', 'slideshare', 'smugmug', 'soundcloud', 'spotify', 'squarespace', 'squidoo', 'steam', 'stumbleupon', 'technorati', 'tribe', 'tripit', 'tumblr', 'twitter', 'viddler', 'vimeo', 'virb', 'vk', 'w3', 'whatsapp', 'wikipedia', 'windows', 'wists', 'wordpress', 'wordpress-alt', 'xbox360', 'xing', 'yahoo', 'yahoo-buzz', 'yahoo-messenger', 'yelp', 'youtube', 'youtube-alt', 'zerply', 'zynga', 'instagram')));
         ksort($icons);
         return apply_filters('everything_social_media_icons', $icons);
     };
     $this->icon->required = false;
     $this->icon->font_path = \Everything::ICON_FONT_PATH;
     $this->icon->on_html = function ($option, &$html) {
         $html->style('float: left; margin-top: 6px;');
     };
 }
コード例 #2
0
ファイル: options.php プロジェクト: xpander54/wp-drz
 public function __construct($name, $default, array $properties = array())
 {
     parent::__construct($name, $default, $properties);
     self::$instances[] = $this;
     if (!self::$google_fonts && !(self::$google_fonts = get_transient(Theme::getInstance()->getTransientName('google_fonts')))) {
         self::$google_fonts = Func::googleGetFonts(Func::GOOGLE_API_KEY);
         if (self::$google_fonts === false) {
             self::$google_fonts = unserialize(@file_get_contents(get_template_directory() . '/' . \Drone\DIRECTORY . '/odd/google-fonts.dat'));
         }
         $expiration = Func::intRandJitter(self::GOOGLE_FONTS_UPDATE_INTERVAL, self::GOOGLE_FONTS_UPDATE_INTERVAL_JITTER) * 86400;
         set_transient(Theme::getInstance()->getTransientName('google_fonts'), self::$google_fonts, $expiration);
     }
     $this->family->on_sanitize = function ($option, $original_value, &$value) {
         $value = (string) $original_value;
     };
     $this->family->on_html = function ($option, &$html) {
         $html->data('value', $option->value);
         $i = 0;
         foreach (array('web_safe', 'google_fonts', 'custom_fontface') as $type) {
             if ($option->parent->{'allow_' . $type}) {
                 $html->child($i)->data('type', $type);
                 $i++;
             }
         }
     };
     if ($this->allow_web_safe) {
         $this->family->groups[__('Classic web fonts', $this->domain)] = array();
     }
     if ($this->allow_google_fonts) {
         $this->family->groups[__('Google Fonts', $this->domain)] = array();
     }
     if ($this->allow_custom_fontface) {
         $this->family->groups[__('Custom font-face', $this->domain)] = array();
     }
     if (isset($this->color)) {
         $this->color->required = false;
         $this->color->placeholder = __('default', $this->domain);
     }
     if (isset($this->size)) {
         $this->size->unit = $this->size_unit;
         switch ($this->size_unit) {
             case 'px':
             case 'pt':
                 $this->size->min = 0;
                 $this->size->max = 100;
                 break;
             case 'em':
                 $this->size->float = true;
                 $this->size->min = 0;
                 $this->size->max = 10;
                 break;
             case '%':
                 $this->size->float = true;
                 $this->size->min = 0;
                 $this->size->max = 1000;
                 break;
         }
     }
     if (isset($this->line_height)) {
         $this->line_height->unit = $this->line_height_unit;
         switch ($this->line_height_unit) {
             case 'px':
             case 'pt':
                 $this->line_height->min = 0;
                 $this->line_height->max = 100;
                 break;
             case 'em':
             case '':
                 $this->line_height->float = true;
                 $this->line_height->min = 0;
                 $this->line_height->max = 10;
                 break;
             case '%':
                 $this->line_height->float = true;
                 $this->line_height->min = 0;
                 $this->line_height->max = 1000;
                 break;
         }
     }
     if (isset($this->styles)) {
         $this->styles->multiple = true;
         $this->styles->style = 'horizontal';
         $this->styles->options = array('bold' => __('Bold', $this->domain), 'italic' => __('Italic', $this->domain), 'underline' => __('Underline', $this->domain));
     }
 }