public function import_theme_options($input = array())
 {
     // update import status
     // update_option( $this->import_status_slug, 'imported' );
     $of_options = get_option('optionsframework');
     $the7_options = get_option('the7');
     $current_theme_options = $input;
     $options_fields =& _optionsframework_options();
     $options_intersect = array_intersect_key($the7_options, $current_theme_options);
     unset($options_intersect['preset']);
     $options_intersect_keys = array_keys($options_intersect);
     foreach ($options_fields as $option_field) {
         if (empty($option_field['id']) || !in_array($option_field['id'], $options_intersect_keys)) {
             continue;
         }
         $option_id = $option_field['id'];
         $intersect_value = $options_intersect[$option_id];
         $current_theme_value = $current_theme_options[$option_id];
         switch ($option_field['type']) {
             case 'radio':
                 $radio_options = array_keys($option_field['options']);
                 if (!in_array($intersect_value, $radio_options)) {
                     $options_intersect[$option_id] = $current_theme_value;
                 }
                 break;
             case 'background_img':
                 if (!dt_maybe_uploaded_image_url($intersect_value['image'])) {
                     $options_intersect[$option_id]['image'] = $current_theme_value['image'];
                 }
                 break;
             case 'upload':
                 if ($intersect_value) {
                     if (is_array($intersect_value) && dt_maybe_uploaded_image_url($intersect_value[0])) {
                         $options_intersect[$option_id] = $intersect_value;
                     } else {
                         if (!is_array($intersect_value) && dt_maybe_uploaded_image_url($intersect_value)) {
                             $options_intersect[$option_id] = $intersect_value;
                         } else {
                             $options_intersect[$option_id] = $current_theme_value;
                         }
                     }
                 }
                 break;
         }
     }
     $current_theme_options = array_merge($current_theme_options, $options_intersect);
     return apply_filters('presscore_compatibility_import_theme_options', $current_theme_options, $the7_options);
 }
Esempio n. 2
0
/**
 * Description here.
 *
 * @param $src string
 *
 * @return string
 *
 * @since presscore 0.1
 */
function dt_get_of_uploaded_image($src)
{
    if (!$src) {
        return '';
    }
    $uri = $src;
    if (!parse_url($src, PHP_URL_SCHEME)) {
        if (dt_maybe_uploaded_image_url($src)) {
            $uri = site_url($src);
        } else {
            $uri = PRESSCORE_PRESET_BASE_URI . $src;
        }
    }
    return $uri;
}