当前位置: 首页>>代码示例>>PHP>>正文


PHP FLBuilderModel::get_enabled_icons方法代码示例

本文整理汇总了PHP中FLBuilderModel::get_enabled_icons方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::get_enabled_icons方法的具体用法?PHP FLBuilderModel::get_enabled_icons怎么用?PHP FLBuilderModel::get_enabled_icons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FLBuilderModel的用法示例。


在下文中一共展示了FLBuilderModel::get_enabled_icons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register_custom_sets

 /**
  * Register custom icon set data in the internal sets array.
  *
  * @since 1.4.6
  * @access private
  * @return void
  */
 private static function register_custom_sets()
 {
     // Get uploaded sets.
     $enabled_icons = FLBuilderModel::get_enabled_icons();
     $upload_info = FLBuilderModel::get_cache_dir('icons');
     $folders = glob($upload_info['path'] . '*');
     // Make sure we have an array.
     if (!is_array($folders)) {
         return;
     }
     // Loop through uploaded sets.
     foreach ($folders as $folder) {
         $folder = trailingslashit($folder);
         // This is an Icomoon font.
         if (file_exists($folder . 'selection.json')) {
             $data = json_decode(file_get_contents($folder . 'selection.json'));
             $key = basename($folder);
             $url = str_ireplace($upload_info['path'], $upload_info['url'], $folder);
             if (isset($data->icons)) {
                 if (is_admin() || in_array($key, $enabled_icons)) {
                     self::$sets[$key] = array('name' => $data->metadata->name, 'prefix' => '', 'type' => 'icomoon', 'path' => $folder, 'url' => $url, 'stylesheet' => $url . 'style.css', 'icons' => array());
                     foreach ($data->icons as $icon) {
                         $prefs = $data->preferences->fontPref;
                         $postfix = isset($prefs->postfix) ? $prefs->postfix : '';
                         if (isset($prefs->selector) && 'class' == $prefs->selector) {
                             $selector = trim(str_replace('.', ' ', $prefs->classSelector)) . ' ';
                         } else {
                             $selector = '';
                         }
                         self::$sets[$key]['icons'][] = $selector . $prefs->prefix . $icon->properties->name . $postfix;
                     }
                 }
             }
         } else {
             if (file_exists($folder . 'config.json')) {
                 $data = json_decode(file_get_contents($folder . 'config.json'));
                 $key = basename($folder);
                 $name = empty($data->name) ? 'Fontello' : $data->name;
                 $url = str_ireplace($upload_info['path'], $upload_info['url'], $folder);
                 $style = empty($data->name) ? 'fontello' : $data->name;
                 // Append the date to the name?
                 if (empty($data->name)) {
                     $time = str_replace('icon-', '', $key);
                     $date_format = get_option('date_format');
                     $time_format = get_option('time_format');
                     $date = date($date_format . ' ' . $time_format);
                     $name .= ' (' . $date . ')';
                 }
                 if (isset($data->glyphs)) {
                     if (is_admin() || in_array($key, $enabled_icons)) {
                         self::$sets[$key] = array('name' => $name, 'prefix' => '', 'type' => 'fontello', 'path' => $folder, 'url' => $url, 'stylesheet' => $url . 'css/' . $style . '.css', 'icons' => array());
                         foreach ($data->glyphs as $icon) {
                             if ($data->css_use_suffix) {
                                 self::$sets[$key]['icons'][] = $icon->css . $data->css_prefix_text;
                             } else {
                                 self::$sets[$key]['icons'][] = $data->css_prefix_text . $icon->css;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:71,代码来源:class-fl-builder-icons.php

示例2: _e

    _e('Override network settings?', 'fl-builder');
    ?>
		</label>
		<?php 
}
?>
		
		<div class="fl-settings-form-content">

			<p><?php 
printf(__('Enable or disable icon sets using the options below or upload a custom icon set from either <a%s>Icomoon</a> or <a%s>Fontello</a>.', 'fl-builder'), ' href="https://icomoon.io/" target="_blank"', ' href="http://fontello.com/" target="_blank"');
?>
</p>
			
			<?php 
$enabled_icons = FLBuilderModel::get_enabled_icons();
$icon_sets = FLBuilderIcons::get_sets_for_current_site();
foreach ($icon_sets as $key => $set) {
    $checked = in_array($key, $enabled_icons) ? ' checked' : '';
    ?>
				<p>
					<label>
						<input type="checkbox" name="fl-enabled-icons[]" value="<?php 
    echo $key;
    ?>
" <?php 
    echo $checked;
    ?>
>
						<?php 
    echo ' ' . $set['name'];
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:31,代码来源:admin-settings-icons.php


注:本文中的FLBuilderModel::get_enabled_icons方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。