/**
  * Get shop option by name
  *
  * @since 1.0.0
  * @uses cherry_get_option()
  * @param string $option option name.
  * @param mixed  $default default option value.
  * @return mixed
  */
 public function get_option($option, $default = false)
 {
     if (!function_exists('cherry_get_option')) {
         return $default;
     }
     return cherry_get_option($option, $default);
 }
/**
 * Get option by name from theme options
 *
 * @since  1.0.0
 *
 * @uses   cherry_get_option  use cherry_get_option from Cherry framework if exist
 * 
 * @param  string  $name    option name to get
 * @param  mixed   $default default option value
 * @return mixed            option value
 */
function cherry_mega_menu_get_option($name, $default = false)
{
    if (function_exists('cherry_get_option')) {
        $result = cherry_get_option($name, $default);
        return $result;
    }
    return $default;
}
Пример #3
0
 /**
  * Callback-method for registered static.
  *
  * @since 4.0.0
  */
 public function callback()
 {
     $alias = cherry_get_option('moto-slider-alias');
     if (!$alias) {
         return;
     }
     motoPressSlider($alias);
 }
 /**
  * Get option by name from theme options
  *
  * @since  1.0.0
  *
  * @uses   cherry_get_option  use cherry_get_option from Cherry framework if exist
  *
  * @param  string $name option name to get.
  * @param  mixed  $default default option value.
  * @return mixed
  */
 public static function get_option($name, $default = false)
 {
     if (function_exists('cherry_get_option')) {
         $result = cherry_get_option($name, $default);
         return $result;
     }
     return $default;
 }
 /**
  * Get CSS variables into array
  *
  * @since  4.0.0
  *
  * @return array  dynamic CSS variables
  */
 public function get_css_varaibles()
 {
     $var_list = array('color-link', 'color-link-hover', 'color-primary', 'color-secondary', 'color-success', 'color-info', 'color-warning', 'color-danger', 'color-gray-variations', 'typography-body', 'typography-header-logo', 'typography-footer-logo', 'typography-header-menu', 'typography-footer-menu', 'typography-h1', 'typography-h2', 'typography-h3', 'typography-h4', 'typography-h5', 'typography-h6', 'typography-input-text', 'typography-breadcrumbs', 'typography-footer', 'body-background', 'header-background', 'content-background', 'footer-background', 'grid-container-width', 'header-boxed-width', 'content-boxed-width', 'footer-boxed-width', 'header-grid-type', 'content-grid-type', 'footer-grid-type', 'grid-responsive');
     $var_list = apply_filters('cherry_css_var_list', $var_list);
     if (!is_array($var_list)) {
         return array();
     }
     $result = array();
     foreach ($var_list as $var) {
         $result[$var] = cherry_get_option($var);
     }
     return $result;
 }
Пример #6
0
 /**
  * Callback-method for registered static.
  * @since 4.0.0
  */
 public function callback()
 {
     $footer_text = cherry_get_option('footer-text');
     if (!empty($footer_text)) {
         $footer_text = preg_replace_callback('/%%([a-zA-Z0-9-_]+)%%/', array($this, 'texturize_links'), $footer_text);
         printf('<div class="site-info">%s</div>', $footer_text);
         return;
     }
     $format = apply_filters('cherry_default_footer_info_format', '%2$s &copy; %1$s. %3$s');
     $output = '<div class="site-info">';
     $output .= sprintf($format, date_i18n('Y'), cherry_get_site_link('footer-site-link'), cherry_get_link_by_slug('privacy-policy'));
     $output .= '</div>';
     echo $output;
 }
Пример #7
0
/**
 * Returns an array of the core framework's available styles for use in themes.
 *
 * @since  4.0.0
 * @return array $styles All the available framework styles.
 */
function cherry_get_styles()
{
    // Get the theme prefix.
    $prefix = cherry_get_prefix();
    // Get the active theme stylesheet version.
    $version = wp_get_theme()->get('Version');
    // Prepare set of stylesheets.
    $styles = array();
    // Get the theme-supported stylesheets.
    $supports = get_theme_support('cherry-styles');
    // If the theme support for any styles.
    if (!empty($supports[0]) && is_array($supports[0])) {
        $drop_downs = array('handle' => get_template() . '-drop-downs', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/drop-downs.css', 'version' => '1.0.0');
        // Is responsive site?
        $responsive = cherry_get_option('grid-responsive');
        $grid_responsive = 'true' == $responsive ? array('handle' => $prefix . 'grid-responsive', 'src' => cherry_file_uri('assets/css/grid-responsive.css'), 'version' => $version) : false;
        $main_responsive = 'true' == $responsive ? array('handle' => $prefix . 'main-responsive', 'src' => cherry_file_uri('assets/css/main-responsive.css'), 'version' => $version) : false;
        // Default styles.
        $defaults = apply_filters('cherry_get_styles_defaults', array('grid-base' => array('handle' => $prefix . 'grid-base', 'src' => cherry_file_uri('assets/css/grid-base.css'), 'version' => $version), 'grid-responsive' => $grid_responsive, 'drop-downs' => $drop_downs, 'magnific-popup' => array('handle' => 'magnific-popup', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/magnific-popup.css', 'version' => '1.0.0'), 'slick' => array('handle' => 'slick', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/slick.css', 'version' => '1.5.0'), 'main' => array('handle' => $prefix . 'main', 'src' => cherry_file_uri('assets/css/main.css'), 'version' => $version), 'main-responsive' => $main_responsive, 'add-ons' => array('handle' => get_template() . '-add-ons', 'src' => trailingslashit(CHERRY_URI) . 'assets/css/add-ons.css', 'version' => CHERRY_VERSION)));
        foreach ($supports[0] as $s) {
            if (empty($defaults[$s])) {
                continue;
            }
            if (!is_array($defaults[$s])) {
                continue;
            }
            $styles[$s] = $defaults[$s];
        }
    }
    // Add the main stylesheet (this must be included).
    $styles['style'] = array('handle' => $prefix . 'style', 'src' => get_stylesheet_uri(), 'version' => $version);
    /**
     * Filters the array of styles.
     *
     * @since 4.0.0
     * @param array $styles
     */
    return apply_filters('cherry_get_styles', $styles);
}
Пример #8
0
/**
 * Output Primary Content Wrap.
 *
 * @since 4.0.0
 */
function cherry_content_wrap()
{
    if (!did_action('cherry_content')) {
        $wrapper = '';
        if (false !== cherry_display_sidebar(apply_filters('cherry_get_main_sidebar', 'sidebar-main'))) {
            $object_id = apply_filters('cherry_current_object_id', get_queried_object_id());
            $layout = apply_filters('cherry_get_page_layout', get_post_meta($object_id, 'cherry_layout', true));
            if (empty($layout) || 'default-layout' == $layout) {
                if (is_single()) {
                    $layout = apply_filters('cherry_get_single_post_layout', cherry_get_option('single-post-layout'), $object_id);
                } else {
                    $layout = cherry_get_option('page-layout');
                }
            }
            $class = sanitize_html_class($layout . '-wrapper');
            $wrapper_class = apply_filters('cherry_content_sidebar_wrapper_class', $class);
            $wrapper = sprintf('<div class="%s">', $wrapper_class);
        }
        printf('%1$s<div id="primary" class="content-area"><main %2$s>', $wrapper, cherry_get_attr('main'));
    } else {
        echo '</main></div>';
    }
}
function _cherry_post_media_visibility($display, $args)
{
    if (is_single(get_the_ID()) && 'false' == cherry_get_option('blog-post-featured-image')) {
        return '';
    }
    if (!is_single() && 'false' == cherry_get_option('blog-featured-images')) {
        return '';
    }
    return $display;
}
 /**
  * Compile dynamic CSS
  *
  * @since 4.0.0
  */
 function prepare_dynamic_css()
 {
     ob_start();
     $parent_css = PARENT_DIR . '/init/css/dynamic-style.css';
     $child_css = CHILD_DIR . '/init/css/dynamic-style.css';
     // Include framework dynamic CSS file
     if (file_exists($parent_css)) {
         include $parent_css;
     }
     // Include child theme Dynamic CSS file (if fwe use child theme, not framework)
     if (file_exists($child_css) && $parent_css !== $child_css) {
         include $child_css;
     }
     /**
      * Allow 3rd party plugins and child themes pass own CSS to parser
      *
      * @since  4.0.0
      */
     do_action('cherry_dynamic_styles');
     $data = ob_get_clean();
     $user_css = cherry_get_option('general-user-css');
     if ($user_css) {
         $data .= $user_css;
     }
     require_once CHERRY_CLASSES . '/class-cherry-css-parser.php';
     $css_parser = new cherry_css_parser();
     $data = $css_parser->parse($data);
     return $data;
 }
 /**
  * Add to dynamic css
  *
  * @since 1.0.0
  */
 public function dynamic_styles()
 {
     $preset_user_css = cherry_get_option('preset-user-css');
     echo $preset_user_css;
 }
Пример #12
0
 /**
  * Callback-method for registered static.
  *
  * @since 4.0.0
  */
 public function callback()
 {
     echo do_shortcode(cherry_get_option('google_map_block'));
 }
 /**
  * Get single typography option value from database and store it in object property
  *
  * @since  4.0.0
  *
  * @param  string  $option  option name to get from database
  */
 function add_font($option)
 {
     $option_val = cherry_get_option($option, false);
     if (!$option_val || !is_array($option_val)) {
         return;
     }
     if (array_key_exists('family', $option_val)) {
         $this->push_font($option_val);
     } else {
         foreach ($option_val as $font_data) {
             $this->push_font($font_data);
         }
     }
 }
Пример #14
0
/**
 * Loads template for comments.
 *
 * @since  4.0.0
 */
function cherry_get_comments_template()
{
    $post_type = get_post_type();
    if (!post_type_supports($post_type, 'comments')) {
        return;
    }
    if (!is_singular($post_type)) {
        return;
    }
    if ('post' == $post_type && 'false' == cherry_get_option('blog-comment-status')) {
        return;
    }
    if ('page' == $post_type && 'false' == cherry_get_option('page-comments-status')) {
        return;
    }
    // If comments are open or we have at least one comment, load up the comment template.
    if (comments_open() || get_comments_number()) {
        // Loads the comments.php template.
        comments_template('/templates/comments.php', true);
    }
}
Пример #15
0
/**
 * Prepare JS variables for sticky header script
 *
 * @since 4.0.0
 */
function cherry_prepare_sticky_vars()
{
    $is_sticky = cherry_get_option('header-sticky', 'false');
    $defaults = array('correctionSelector' => '#wpadminbar', 'listenSelector' => '.listenSelector', 'pseudo' => true);
    $options_args = array('active' => 'true' == $is_sticky && !wp_is_mobile() ? true : false);
    $args = apply_filters('cherry_header_sticky_args', $defaults);
    $sticky_selector = cherry_get_option('header-sticky-selector', '.site-header');
    $args = array_merge($args, $options_args);
    $data = array('selector' => $sticky_selector, 'args' => $args);
    wp_localize_script('cherry-script', 'sticky_data', $data);
}
 function remap_option_ids()
 {
     if (!function_exists('cherry_get_option')) {
         return;
     }
     $remap_options = apply_filters('cherry_data_manager_rewrite_options', array('logo-image-path' => 'logo-subsection', 'footer-logo-image-path' => 'footer-logo-subsection', 'general-favicon' => 'general-section'));
     if (!is_array($remap_options)) {
         return;
     }
     $opt_id = get_option('cherry-options');
     $opt_id = isset($opt_id['id']) ? $opt_id['id'] : false;
     if (!$opt_id) {
         return;
     }
     $options = get_option($opt_id);
     $default_options = get_option($opt_id . '_defaults');
     if (!$default_options) {
         $default_options = $options;
     }
     foreach ($remap_options as $name => $section) {
         $values = cherry_get_option($name);
         if (!is_string($values)) {
             continue;
         }
         $values = explode(',', $values);
         $new_values = $this->remap_img_ids($values);
         if (empty($new_values)) {
             continue;
         }
         $new_values = implode(',', $new_values);
         // add new values to options array
         if (!isset($options[$section]['options-list'][$name])) {
             continue;
         }
         $options[$section]['options-list'][$name] = $new_values;
         $default_options[$section]['options-list'][$name] = $new_values;
     }
     update_option($opt_id, $options);
     update_option($opt_id . '_defaults', $default_options);
 }
/**
 * Get favicons from theme options
 *
 * @since 4.0.0
 */
function cherry_get_favicon_tags()
{
    $result = apply_filters('cherry_pre_get_favicon_tags', false);
    if (false != $result) {
        return $result;
    }
    $favicons = cherry_get_option('general-favicon');
    $default_format = '<link type="%1$s" href="%3$s" rel="%2$s">';
    $device_format = '<link href="%3$s" sizes="%2$sx%2$s" rel="%1$s">';
    if (!$favicons) {
        return false;
    }
    $icons = array(array('type' => 'image/x-icon', 'rel' => 'shortcut icon', 'sizes' => false));
    $favicons = explode(',', $favicons);
    $count = count($favicons);
    if (1 <= $count) {
        $icons[] = array('type' => false, 'rel' => 'apple-touch-icon-precomposed', 'sizes' => 57);
        $icons[] = array('type' => false, 'rel' => 'apple-touch-icon-precomposed', 'sizes' => 72);
        $icons[] = array('type' => false, 'rel' => 'apple-touch-icon-precomposed', 'sizes' => 114);
        $icons[] = array('type' => false, 'rel' => 'apple-touch-icon-precomposed', 'sizes' => 144);
    }
    $icon1x = null;
    $icon2x = null;
    $width1x = 0;
    $width2x = 0;
    $count = 2 > $count ? $count : 2;
    for ($i = 0; $i < $count; $i++) {
        if (!wp_attachment_is_image($favicons[$i])) {
            continue;
        }
        $type = get_post_mime_type($favicons[$i]);
        if ('image/x-icon' == $type) {
            $icon1x = $icon2x = wp_get_attachment_url($favicons[$i]);
            break;
        }
        $icon = wp_get_attachment_image_src($favicons[$i]);
        if (!is_array($icon)) {
            continue;
        }
        $icon_url = $icon[0];
        $icon_width = intval($icon[1]);
        if (null == $icon1x) {
            $icon1x = $icon_url;
            $icon2x = $icon_url;
            $width1x = $icon_width;
            $width2x = $icon_width;
        } elseif ($icon_width > $width1x) {
            $icon2x = $icon_url;
            $width2x = $icon_width;
        } else {
            $icon1x = $icon_url;
            $width1x = $icon_width;
        }
    }
    $result = '';
    foreach ($icons as $icon_data) {
        if (!$icon_data['sizes']) {
            $result .= sprintf($default_format, $icon_data['type'], $icon_data['rel'], $icon1x);
            continue;
        }
        $result .= sprintf($device_format, $icon_data['rel'], $icon_data['sizes'], $icon2x);
    }
    return $result;
}
 /**
  * Get plugin options from Cherry
  *
  * @since 1.0.0
  * @return array
  */
 private function get_cherry_options()
 {
     if ($this->is_cherry_framework()) {
         foreach ($this->options as $key => $value) {
             $options[$key] = cherry_get_option(self::$name . '_' . $key);
         }
     }
     if (empty($options)) {
         return $this->options;
     }
     return $options;
 }
Пример #19
0
/**
 * Get maintenance page content to show it via template macros
 *
 * @since 4.0.0
 */
function cherry_get_the_post_maintenance_content()
{
    $page_id = cherry_get_option('general-maintenance-page', false);
    if (!$page_id) {
        return;
    }
    $page = get_post($page_id);
    return $page->post_content;
}
Пример #20
0
/**
 * Prepare JS variables for `stickup` script.
 *
 * @since 4.0.0
 */
function cherry_prepare_sticky_vars()
{
    $is_sticky = cherry_get_option('header-sticky', 'false');
    $sticky_selector = cherry_get_option('header-sticky-selector', '.site-header');
    /**
     * Filter a default arguments for `sticky` script.
     *
     * @since 4.0.0
     * @param array $data Default arguments.
     */
    $defaults = apply_filters('cherry_header_sticky_args', array('correctionSelector' => '#wpadminbar', 'listenSelector' => '.listenSelector', 'pseudo' => true, 'active' => false));
    $args = array('active' => 'true' == $is_sticky && !wp_is_mobile() ? true : false);
    $args = wp_parse_args($args, $defaults);
    /**
     * Filter a variables for `sticky` script.
     *
     * @since 4.0.0
     * @param array $data Variables for `sticky`.
     */
    $data = apply_filters('cherry_prepare_sticky_vars', array('selector' => $sticky_selector, 'args' => $args));
    wp_localize_script('cherry-script', 'sticky_data', $data);
}
Пример #21
0
/**
 * Post <article> element attributes.
 *
 * @since  4.0.0
 * @param  array $attr
 * @return array
 */
function cherry_attr_post($attr)
{
    $post = get_post();
    $meta_classes = array();
    $classes = array();
    $classes[] = 'clearfix';
    if ('true' == cherry_get_option('blog-post-date')) {
        $meta_classes[] = 'cherry-has-entry-date';
    }
    if ('true' == cherry_get_option('blog-post-author')) {
        $meta_classes[] = 'cherry-has-entry-author';
    }
    if ('true' == cherry_get_option('blog-post-comments')) {
        $meta_classes[] = 'cherry-has-entry-comments';
    }
    if ('true' == cherry_get_option('blog-categories')) {
        $meta_classes[] = 'cherry-has-entry-cats';
    }
    if ('true' == cherry_get_option('blog-tags')) {
        $meta_classes[] = 'cherry-has-entry-tags';
    }
    if (is_singular()) {
        if (is_single()) {
            $classes = wp_parse_args($classes, $meta_classes);
        }
    } else {
        $classes = wp_parse_args($classes, $meta_classes);
    }
    $attr['class'] = implode(' ', get_post_class($classes));
    // Make sure we have a real post first.
    if (!empty($post)) {
        $attr['id'] = 'post-' . get_the_ID();
    } else {
        $attr['id'] = 'post-0';
    }
    return $attr;
}
Пример #22
0
/**
 * Custom output for gallery shortcode.
 *
 * @since  4.0.0
 * @param  array  $atts Shortcode atts
 * @return string       Gallery HTML
 */
function cherry_gallery_shortcode($result, $attr)
{
    $replace_allowed = cherry_get_option('blog-gallery-shortcode', 'true');
    if ('true' != $replace_allowed) {
        return '';
    }
    /**
     * Filter gallery output.
     *
     * @since  4.0.0
     */
    $result = apply_filters('cherry_pre_get_gallery_shortcode', false, $attr);
    $post = get_post();
    $atts = shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'include' => '', 'exclude' => '', 'link' => ''), $attr, 'gallery');
    if (false !== $result) {
        return $result;
    }
    $id = intval($atts['id']);
    if (!empty($atts['include'])) {
        $attachments = explode(',', str_replace(' ', '', $atts['include']));
    } elseif (!empty($atts['exclude'])) {
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
        $attachments = array_keys($attachments);
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
        $attachments = array_keys($attachments);
    }
    if (empty($attachments) || !is_array($attachments)) {
        return;
    }
    $result = cherry_get_gallery_html($attachments, $atts);
    return $result;
}
 /**
  * Get plugin options
  *
  * @since 1.0.0
  * @return array
  */
 private function get_option($key)
 {
     if ($this->is_cherry_framework()) {
         return cherry_get_option(self::$name . '_' . $key);
     } else {
         $options = get_option(self::$name . '_options');
         return $options[$key];
     }
 }
Пример #24
0
function cherry_shortcodes_modify_nav_menu_args($atts)
{
    if (!function_exists('cherry_get_option')) {
        return $atts;
    }
    $general_landing_page = cherry_get_option('general-landing-page');
    $page_id = get_the_ID();
    if ($general_landing_page && $general_landing_page != $page_id && strpos($atts['href'], '#') === 0 || is_page_template('templates/template-landing.php') && strpos($atts['href'], '#') === 0) {
        $atts['href'] = get_page_link($general_landing_page) . $atts['href'];
    }
    return $atts;
}
Пример #25
0
function cherry_shortcodes_modify_nav_menu_args($atts)
{
    $general_landing_page = cherry_get_option('general-landing-page');
    $page_id = get_the_ID();
    if ($general_landing_page && $general_landing_page != $page_id && strpos($atts['href'], '#') === 0) {
        $atts['href'] = get_page_link($general_landing_page) . $atts['href'];
    }
    return $atts;
}
Пример #26
0
/**
 * Adds the meta viewport to the header.
 *
 * @since 4.0.0
 */
function cherry_meta_viewport()
{
    if ('true' === cherry_get_option('grid-responsive')) {
        echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "\n";
    }
}
Пример #27
0
/**
 * Close `@media` rule.
 *
 * @since  4.0.0
 *
 * @return string
 */
function cherry_media_queries_close()
{
    return 'true' == cherry_get_option('grid-responsive') ? '}' : '';
}
 /**
  * Get single typography option value from database and store it in object property
  *
  * @since  4.0.0
  *
  * @param  string  $option  option name to get from database
  */
 function add_font($option)
 {
     $option_val = cherry_get_option($option, false);
     if (!$option_val || !is_array($option_val)) {
         return;
     }
     if (!$this->is_google_font($option_val)) {
         return;
     }
     $font = $option_val['family'];
     if (!isset($this->fonts_data[$font])) {
         $this->fonts_data[$font] = array('style' => array($option_val['style']), 'character' => array($option_val['character']));
     } else {
         $this->fonts_data[$font] = array('style' => array_merge($this->fonts_data[$font]['style'], array($option_val['style'])), 'character' => array_merge($this->fonts_data[$font]['character'], array($option_val['character'])));
     }
 }
Пример #29
0
/**
 * Display the cookie banner.
 *
 * @since  4.0.0
 * @return string HTML-markup for cookie banner.
 */
function cherry_cookie_banner()
{
    if ('false' == cherry_get_option('cookie-banner-visibility')) {
        return;
    }
    if ('' == cherry_get_option('cookie-banner-text')) {
        return;
    }
    if (isset($_COOKIE['cherry_cookie_banner']) && '1' == $_COOKIE['cherry_cookie_banner']) {
        return;
    }
    ob_start();
    ?>

	<div id="cherry-cookie-banner" class="cherry-cookie-banner-wrap alert alert-warning alert-dismissible" role="alert">
		<div class="container">
			<button type="button" id="cherry-dismiss-cookie" class="close" data-dismiss="alert" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
			<?php 
    echo htmlspecialchars_decode(cherry_get_option('cookie-banner-text'));
    ?>
		</div>
	</div>

	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    /**
     * Filter a cookie banner.
     *
     * @since 4.0.0
     * @param $output HTML-markup for cookie banner.
     */
    $output = apply_filters('cherry_cookie_banner', $output);
    printf('%s', $output);
}
 /**
  * Remap image ID's in theme options to new
  *
  * @return void|null
  */
 function remap_option_ids()
 {
     if (!function_exists('cherry_get_option')) {
         return;
     }
     $remap_options = apply_filters('cherry_data_manager_rewrite_options', array('logo-image-path' => 'logo-subsection', 'footer-logo-image-path' => 'footer-logo-subsection', 'general-favicon' => 'general-section', 'header-background:image' => 'header-section', 'footer-background:image' => 'footer-section'));
     if (!is_array($remap_options)) {
         return;
     }
     $opt_id = get_option('cherry-options');
     $opt_id = isset($opt_id['id']) ? $opt_id['id'] : false;
     if (!$opt_id) {
         return;
     }
     $options = get_option($opt_id);
     $default_options = get_option($opt_id . '_defaults');
     if (!$default_options) {
         $default_options = $options;
     }
     foreach ($remap_options as $name => $section) {
         $name = explode(':', $name);
         $opt_name = $name[0];
         $opt_subname = false;
         if (isset($name[1])) {
             $opt_subname = $name[1];
         }
         $values = cherry_get_option($opt_name);
         if (is_array($values)) {
             $values = $values[$opt_subname];
         }
         $values = explode(',', $values);
         $new_values = $this->remap_img_ids($values);
         if (empty($new_values)) {
             continue;
         }
         $new_values = implode(',', $new_values);
         if (false !== $opt_subname) {
             $options[$section]['options-list'][$opt_name][$opt_subname] = $new_values;
             $default_options[$section]['options-list'][$opt_name][$opt_subname] = $new_values;
         } else {
             $options[$section]['options-list'][$opt_name] = $new_values;
             $default_options[$section]['options-list'][$opt_name] = $new_values;
         }
     }
     update_option($opt_id, $options);
     update_option($opt_id . '_defaults', $default_options);
 }