public static function init() { self::$im = new FT_scope(); self::$im->theme = wp_get_theme(); // Переводим № версии в число: 3.8.3 -> 3.8 self::$im->wpVersion = floatval(get_bloginfo('version')); self::$im->themeName = self::$im->theme->get('Name'); self::$im->optionsName = preg_replace("/\\W/", "_", strtolower(self::$im->themeName)); // Запускаем класс обновления темы self::$im->updater = new FT_ThemeUpdateChecker(self::$im->themeName, 'http://www.fabthemes.com/versions/' . strtolower(str_replace(' ', '-', self::$im->themeName)) . '.json'); // Включаем все хуки для wordpress self::$im->anchors(); }
function FT_OP_update() { $settings = get_option('ft_op'); $settings['id'] = 'ft_' . FT_scope::tool()->optionsName; update_option('ft_op', $settings); }
<?php include_once 'FT/FT_scope.php'; FT_scope::init(); /** * Cartel functions and definitions * * @package Cartel */ /* Custom style */ function custom_style() { $banner_bg = ft_of_get_option('banner_background'); $blog_bg = ft_of_get_option('blog_background'); $subhead_bg = ft_of_get_option('subhead_background'); ?> <style type="text/css"> #subheader { background-image: url(<?php echo $subhead_bg; ?> ); } .home-blog { background-image: url(<?php echo $blog_bg; ?> ); } .home-banners { background-image: url(<?php echo $banner_bg; ?> ); } </style>
?> "><?php bloginfo('name'); ?> </a> - <?php bloginfo('description'); ?> . <?php fflink(); ?> | <a href="http://fabthemes.com/<?php echo FT_scope::tool()->themeName; ?> /" ><?php echo FT_scope::tool()->themeName; ?> WordPress Theme</a> </div> </div><!-- .site-info --> </footer><!-- #colophon .site-footer --> </div><!-- #page .hfeed .site --> <?php wp_footer(); if (is_single()) { ?> <script type="text/javascript"> jQuery.backstretch("<?php get_image_url(); ?>
if (get_theme_mod(FT_scope::tool()->optionsName . '_logo', '') != '') { ?> <h1 class="site-title logo"><a class="mylogo" rel="home" href="<?php bloginfo(site_url()); ?> /" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> "><img relWidth="<?php echo intval(get_theme_mod(FT_scope::tool()->optionsName . '_maxWidth', 0)); ?> " relHeight="<?php echo intval(get_theme_mod(FT_scope::tool()->optionsName . '_maxHeight', 0)); ?> " id="ft_logo" src="<?php echo get_theme_mod(FT_scope::tool()->optionsName . '_logo', ''); ?> " alt="" /></a></h1> <?php } else { ?> <h1 class="site-title logo"><a id="blogname" rel="home" href="/" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> "><?php //bloginfo( 'name' ); ?> </a></h1> <?php } ?>
/** * Validate Options. * * This runs after the submit/reset button has been clicked and * validates the inputs. * * @uses $_POST['reset'] to restore default options */ function validate_options($input) { /* * Restore Defaults. * * In the event that the user clicked the "Restore Defaults" * button, the options defined in the theme's options.php * file will be added to the option for the active theme. */ if (isset($_POST['reset'])) { add_settings_error('ft-op', 'restore_defaults', __('Default options restored.', 'ft_op'), 'updated fade'); return $this->get_default_values(); } /* * Update Settings * * This used to check for $_POST['update'], but has been updated * to be compatible with the theme customizer introduced in WordPress 3.4 */ $clean = array(); $options =& FT_OP::_optionsframework_options(); foreach ($options as $option) { if (!isset($option['id'])) { continue; } if (!isset($option['type'])) { continue; } $id = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($option['id'])); // Set checkbox to false if it wasn't sent in the $_POST if ('checkbox' == $option['type'] && !isset($input[$id])) { $input[$id] = false; } // Set each item in the multicheck to false if it wasn't sent in the $_POST if ('multicheck' == $option['type'] && !isset($input[$id])) { foreach ($option['options'] as $key => $value) { $input[$id][$key] = false; } } // For a value to be submitted to database it must pass through a sanitization filter if (has_filter('ft_of_sanitize_' . $option['type'])) { $clean[$id] = apply_filters('ft_of_sanitize_' . $option['type'], $input[$id], $option); } } // Hook to run after validation do_action('ft_op_after_validate', $clean); // Update css (from less) FT_scope::afterOptionsUpdate($clean); return $clean; }