예제 #1
0
 function untitled_scripts()
 {
     global $wp_upload_dir, $zn_framework;
     $zn_uploads_dir = trailingslashit($wp_upload_dir['baseurl']);
     $zn_uploads_basedir = trailingslashit($wp_upload_dir['basedir']);
     $header_width = zget_option('responsive_menu_width', 'general_options', false, '865');
     $show_loading = zget_option('show_page_loading', 'general_options', false, false);
     wp_enqueue_style('bootstrap', THEME_BASE_URI . '/css/bootstrap.min.css', '', ZN_FW_VERSION);
     wp_enqueue_style('theme_style', THEME_BASE_URI . '/css/theme-style.css', '', ZN_FW_VERSION);
     // GENERATE THE DYNAMIC CSS FILE IF IT'S not Created already or it was deleted
     if (!file_exists($zn_uploads_basedir . 'zn_dynamic.css')) {
         generate_options_css();
     }
     wp_enqueue_style('dynamic_css', $zn_uploads_dir . 'zn_dynamic.css', '', ZN_FW_VERSION);
     // Load print.css files
     wp_enqueue_style('zn_print_css', THEME_BASE_URI . '/css/print.css', '', ZN_FW_VERSION, 'print');
     wp_register_script('bootstrapjs', THEME_BASE_URI . '/js/bootstrap.min.js', array('jquery'), ZN_FW_VERSION, true);
     wp_enqueue_script('bootstrapjs');
     wp_enqueue_script('magnific_popup', THEME_BASE_URI . '/js/jquery.magnific-popup.js', 'jquery', ZN_FW_VERSION, true);
     if (is_singular() && comments_open() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     //** Ocasional scripts. Load them when needed
     wp_register_script('instafeed', THEME_BASE_URI . '/js/instafeed.min.js', array('jquery'), ZN_FW_VERSION, true);
     wp_register_script('nprogress', THEME_BASE_URI . '/js/jquery.nprogress.min.js', array('jquery'), ZN_FW_VERSION, true);
     wp_register_script('ytplayer', THEME_BASE_URI . '/js/jquery.mb.YTPlayer.js', array('jquery'), ZN_FW_VERSION, true);
     if ($show_loading == 'yes') {
         wp_enqueue_script('nprogress');
     }
     wp_enqueue_script('zn_script', THEME_BASE_URI . '/js/zn_script.js', array('jquery'), ZN_FW_VERSION, true);
     wp_localize_script('zn_script', 'ZnThemeAjax', array('ajaxurl' => admin_url('admin-ajax.php'), 'header_res' => $header_width));
 }
/**
 * Add default options upon activation else DB does not exist
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine, $wp_rewrite;
    $options_machine = new Options_Machine($of_options);
    if (is_admin() && !get_option(OPTIONS) || isset($_GET['activated']) && $_GET['activated'] == true) {
        update_option(OPTIONS, $options_machine->Defaults);
        generate_options_css($options_machine->Defaults);
        $wp_rewrite->flush_rules();
    }
}
예제 #3
0
 function do_icon_install($path, $title)
 {
     $unzipped = $this->do_icons_archive($path);
     if (!empty($unzipped['error'])) {
         $return['message'] = $unzipped['error'];
     } else {
         // ADD THE FONT INFO TO DB AND CREATE ICON_LIST
         $font_data = $this->create_data();
         if (!empty($font_data['message'])) {
             $return['message'] = $font_data['message'];
         } else {
             $return['message'] = 'The ' . $this->font_name . ' font was succesfully added';
             $return['html'] = '<a class="zn_remove_font" href="#">' . $this->font_name . '<span data-font_name="' . $title . '" class="zn_remove_font_trigger">&#215;</span></a> ';
         }
     }
     generate_options_css();
     return $return;
 }
예제 #4
0
 function zn_set_options()
 {
     // THIS IS THE EXPORTED THEME OPTIONS
     $import_code = 'YTo3MDp7czoxMToibWVudV9mb2xsb3ciO3M6MzoieWVzIjtzOjE0OiJwYWdlX3ByZWxvYWRlciI7czoyOiJubyI7czoxNToiaGVhZF9zaG93X2xvZ2luIjtzOjE6IjEiO3M6MTE6ImxvZ29fdXBsb2FkIjtzOjY5OiJodHRwOi8vaG9nYXNoLWRlbW8uY29tL2thbGx5YXNfd3Avd3AtY29udGVudC91cGxvYWRzLzIwMTMvMDEvbG9nby5wbmciO3M6OToibG9nb19zaXplIjtzOjM6InllcyI7czoxNjoibG9nb19tYW51YWxfc2l6ZSI7YToyOntzOjU6IndpZHRoIjtzOjM6IjEyNiI7czo2OiJoZWlnaHQiO3M6MjoiNDIiO31zOjk6ImxvZ29fZm9udCI7YTo0OntzOjQ6InNpemUiO3M6NDoiMzZweCI7czo2OiJoZWlnaHQ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VsZW1lbnRfdHlwZSI7czoxNToiY3Nfc29jaWFsX2ljb25zIjtzOjE1OiJjc19zb2NpYWxfdGl0bGUiO3M6MDoiIjtzOjE0OiJjc19zb2NpYWxfbGluayI7YToyOntzOjM6InVybCI7czowOiIiO3M6NjoidGFyZ2V0IjtzOjY6Il9ibGFuayI7fXM6MTQ6ImNzX3NvY2lhbF9pY29uIjtzOjA6IiI7fX1zOjE2OiI0MDRfaGVhZGVyX3N0eWxlIjtzOjI2OiJwYWdlc18tX2JhY2tncm91bmRfM19zdHlsZSI7czoxMzoid29vX3Nob3dfY2FydCI7czoxOiIxIjtzOjEzOiJ3b29fbmV3X2JhZGdlIjtzOjE6IjEiO3M6MTg6Indvb19uZXdfYmFkZ2VfZGF5cyI7czoxOiIzIjtzOjE5OiJ3b29fYXJjaF9wYWdlX3RpdGxlIjtzOjEyOiJPVVIgUFJPRFVDVFMiO3M6MjI6Indvb19hcmNoX3BhZ2Vfc3VidGl0bGUiO3M6MzY6IlNob3AgY2F0ZWdvcnkgaGVyZSB3aXRoIHByb2R1Y3QgbGlzdCI7czoyNToid29vX2FyY2hfc2lkZWJhcl9wb3NpdGlvbiI7czoxMzoicmlnaHRfc2lkZWJhciI7czoxNjoid29vX2FyY2hfc2lkZWJhciI7czoxNDoiZGVmYXVsdHNpZGViYXIiO3M6Mjc6Indvb19zaW5nbGVfc2lkZWJhcl9wb3NpdGlvbiI7czoxMzoicmlnaHRfc2lkZWJhciI7czoxODoid29vX3NpbmdsZV9zaWRlYmFyIjtzOjE0OiJkZWZhdWx0c2lkZWJhciI7czo3OiJmYWNlX29nIjtzOjE6IjEiO3M6MTA6ImZhY2VfQVBfSUQiO3M6MTU6IjQyNjM5MTAyNDEwNzE4MiI7czo4OiJ6bl9yZXNldCI7czo1OiJyZXNldCI7fQ==';
     $import_code = base64_decode($import_code);
     $import_code = unserialize($import_code);
     // Remove some values
     $import_code['mailchimp_api'] = '';
     $import_code['face_AP_ID'] = '';
     $import_code = array_map('stripslashes_deep', $import_code);
     // FIX IMAGES URL'S AND UPLOAD LOCAL IMAGES
     $import_code = zn_replace_image_links_with_local($import_code);
     update_option('zn_kallyas_options', $import_code);
     generate_options_css($import_code);
     //generate static css file
     generate_options_js($import_code);
     //generate static js file
 }
/**
 * Ajax Save Options
 *
 * @uses get_option()
 * @uses update_option()
 *
 * @since 1.0.0
 */
function of_ajax_callback()
{
    global $options_machine, $of_options;
    $nonce = $_POST['security'];
    if (!wp_verify_nonce($nonce, 'of_ajax_nonce')) {
        die('-1');
    }
    //get options array from db
    $all = get_option(OPTIONS);
    $save_type = $_POST['type'];
    //echo $_POST['data'];
    //Uploads
    if ($save_type == 'upload') {
        $clickedID = $_POST['data'];
        // Acts as the name
        $filename = $_FILES[$clickedID];
        $filename['name'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', $filename['name']);
        $override['test_form'] = false;
        $override['action'] = 'wp_handle_upload';
        $uploaded_file = wp_handle_upload($filename, $override);
        $upload_tracking[] = $clickedID;
        //update $options array w/ image URL
        $upload_image = $all;
        //preserve current data
        $upload_image[$clickedID] = $uploaded_file['url'];
        update_option(OPTIONS, $upload_image);
        if (!empty($uploaded_file['error'])) {
            echo 'Upload Error: ' . $uploaded_file['error'];
        } else {
            echo $uploaded_file['url'];
        }
        // Is the Response
    } elseif ($save_type == 'image_reset') {
        $id = $_POST['data'];
        // Acts as the name
        $delete_image = $all;
        //preserve rest of data
        $delete_image[$id] = '';
        //update array key with empty value
        update_option(OPTIONS, $delete_image);
    } elseif ($save_type == 'backup_options') {
        $backup = $all;
        $backup['backup_log'] = date('r');
        update_option(BACKUPS, $backup);
        die('1');
    } elseif ($save_type == 'restore_options') {
        $b_data = get_option(BACKUPS);
        update_option(OPTIONS, $b_data);
        die('1');
    } elseif ($save_type == 'import_options') {
        $b_data = $_POST['data'];
        $b_data = unserialize(base64_decode($b_data));
        //100% safe - ignore theme check nag
        update_option(OPTIONS, $b_data);
        die('1');
    } elseif ($save_type == 'save') {
        wp_parse_str(stripslashes($_POST['data']), $b_data);
        unset($b_data['security']);
        unset($b_data['of_save']);
        update_option(OPTIONS, $b_data);
        generate_options_css($b_data);
        //generate static css file
        generate_js($b_data);
        // generate js
        die('1');
    } elseif ($save_type == 'reset') {
        update_option(OPTIONS, $options_machine->Defaults);
        die('1');
        //options reset
    }
    die;
}
예제 #6
0
 function import_theme_options()
 {
     $file = $this->file_location . "/theme_options.txt";
     // Fail early if this is not needed
     if (!is_file($file)) {
         return;
     }
     $data = file_get_contents($file);
     $saved_values = json_decode($data, true);
     $options_field = ZN()->theme_data['options_prefix'];
     update_option($options_field, $saved_values);
     generate_options_css($saved_values);
     ZN()->pagebuilder->refresh_pb_data();
 }
예제 #7
0
/**
 * Format Configuration Array.
 *
 * Get an array of all default values as set in
 * options.php. The 'id','std' and 'type' keys need
 * to be defined in the configuration array. In the
 * event that these keys are not present the option
 * will not be included in this function's output.
 *
 * @return    array     Rey-keyed options configuration array.
 *
 * @access    private
 */
function of_get_default_values()
{
    $output = array();
    $config = optionsframework_options();
    foreach ((array) $config as $option) {
        if (!isset($option['id'])) {
            continue;
        }
        if (!isset($option['std'])) {
            continue;
        }
        if (!isset($option['type'])) {
            continue;
        }
        if (has_filter('of_sanitize_' . $option['type'])) {
            $output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
        }
    }
    generate_options_css($output);
    //generate static css file
    generate_options_js($output);
    return $output;
}
예제 #8
0
 /**
  * This function will install the theme for the first time
  */
 function do_theme_activation()
 {
     $options_field = ZN()->theme_data['options_prefix'];
     $saved_values = array();
     $file = THEME_BASE . "/template_helpers/dummy_content/theme_options.txt";
     if (!is_file($file)) {
         include THEME_BASE . '/template_helpers/options/theme-options.php';
         foreach ($admin_options as $key => $option) {
             if (!empty($option['std'])) {
                 $saved_values[$option['parent']][$option['id']] = $option['std'];
             }
         }
     } else {
         $data = file_get_contents($file);
         $saved_values = json_decode($data, true);
     }
     update_option($options_field, $saved_values);
     generate_options_css($saved_values);
     ZN()->pagebuilder->refresh_pb_data();
     update_option($this->theme_version_string, $this->theme_version, false);
     do_action('zn_theme_installed');
 }
 function do_theme_activation()
 {
     $options_field = ZN()->theme_data['options_prefix'];
     $saved_values = array();
     //delete_option(  $options_field );
     // IF THE OPTIONS FIELD IS NOT PRESENT
     if (false === get_option($options_field)) {
         $file = THEME_BASE . "/template_helpers/dummy_content/theme_options.txt";
         if (!is_file($file)) {
             include THEME_BASE . '/template_helpers/options/theme-options.php';
             foreach ($admin_options as $key => $option) {
                 if (!empty($option['std'])) {
                     $saved_values[$option['parent']][$option['id']] = $option['std'];
                 } else {
                     $saved_values[$option['parent']][$option['id']] = '0';
                 }
             }
         } else {
             $data = file_get_contents($file);
             $saved_values = json_decode($data, true);
         }
         update_option($options_field, $saved_values);
         generate_options_css($saved_values);
         ZN()->pagebuilder->refresh_pb_data();
     }
 }
예제 #10
0
파일: defaults.php 프로젝트: ryuqing/cake
 /**
  * HTML OUTPUT.
  *
  * @since Redux_Options 1.0.0
  */
 function _options_page_html()
 {
     echo '<div class="wrap">';
     echo isset($this->args['intro_text']) ? $this->args['intro_text'] : '';
     do_action('redux-opts-page-before-form-' . $this->args['opt_name']);
     echo '<form method="post" action="options.php" enctype="multipart/form-data" id="redux-opts-form-wrapper">';
     settings_fields($this->args['opt_name'] . '_group');
     $this->options['last_tab'] = isset($_GET['tab']) && !get_transient('redux-opts-saved') ? $_GET['tab'] : (isset($this->options['last_tab']) && get_transient('redux-opts-saved') ? $this->options['last_tab'] : $this->args['last_tab']);
     echo '<input type="hidden" id="last_tab" name="' . $this->args['opt_name'] . '[last_tab]" value="' . $this->options['last_tab'] . '" />';
     echo '<div id="redux-opts-header">';
     echo '<div class="theme-logo"><br/></div>';
     submit_button('', 'primary', '', false);
     echo ' &nbsp; ';
     submit_button(__('Reset to Defaults', NECTAR_THEME_NAME), 'secondary', $this->args['opt_name'] . '[defaults]', false);
     echo '<div class="clear"></div><!--clearfix-->';
     echo '</div>';
     if (isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && get_transient('redux-opts-saved') == '1') {
         if (isset($this->options['imported']) && $this->options['imported'] == 1) {
             echo '<div id="redux-opts-imported">' . apply_filters('redux-opts-imported-text-' . $this->args['opt_name'], __('<strong>Settings Imported!</strong>', NECTAR_THEME_NAME)) . '</div>';
         } else {
             echo '<div id="redux-opts-save">' . apply_filters('redux-opts-saved-text-' . $this->args['opt_name'], __('<strong>Settings Saved!</strong>', NECTAR_THEME_NAME)) . '</div>';
         }
         delete_transient('redux-opts-saved');
     }
     echo '<div id="redux-opts-save-warn">' . apply_filters('redux-opts-changed-text-' . $this->args['opt_name'], __('<strong>Settings have changed, you should save them!</strong>', NECTAR_THEME_NAME)) . '</div>';
     echo '<div id="redux-opts-field-errors">' . __('<strong><span></span> error(s) were found!</strong>', NECTAR_THEME_NAME) . '</div>';
     echo '<div id="redux-opts-field-warnings">' . __('<strong><span></span> warning(s) were found!</strong>', NECTAR_THEME_NAME) . '</div>';
     echo '<div class="clear"></div><!--clearfix-->';
     echo '<div id="redux-opts-sidebar">';
     echo '<ul id="redux-opts-group-menu">';
     foreach ($this->sections as $k => $section) {
         $icon_class = !isset($section['icon_class']) ? '' : ' ' . $section['icon_class'];
         $icon = !isset($section['icon']) ? '<i class="icon-cog' . $icon_class . '"></i> ' : '<i class="icon-' . $section['icon'] . $icon_class . '"></i> ';
         echo '<li id="' . $k . '_section_group_li" class="redux-opts-group-tab-link-li">';
         echo '<a href="javascript:void(0);" id="' . $k . '_section_group_li_a" class="redux-opts-group-tab-link-a" data-rel="' . $k . '">' . $icon . '<span>' . $section['title'] . '</span></a>';
         echo '</li>';
     }
     echo '<li class="divide">&nbsp;</li>';
     do_action('redux-opts-after-section-menu-items-' . $this->args['opt_name'], $this);
     if (true === $this->args['show_import_export']) {
         echo '<li id="import_export_default_section_group_li" class="redux-opts-group-tab-link-li">';
         //if($this->args['icon_type'] == 'image') {
         //	$icon = (!isset($this->args['import_icon'])) ? '' : '<img src="' . $this->args['import_icon'] . '" /> ';
         //} else {
         $icon_class = !isset($this->args['import_icon_class']) ? '' : ' ' . $this->args['import_icon_class'];
         $icon = !isset($this->args['import_icon']) ? '<i class="icon-refresh' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['import_icon'] . $icon_class . '"></i> ';
         //}
         echo '<a href="javascript:void(0);" id="import_export_default_section_group_li_a" class="redux-opts-group-tab-link-a" data-rel="import_export_default">' . $icon . ' <span>' . __('Import / Export', NECTAR_THEME_NAME) . '</span></a>';
         echo '</li>';
         echo '<li class="divide">&nbsp;</li>';
     }
     if (is_array($this->extra_tabs)) {
         foreach ($this->extra_tabs as $k => $tab) {
             $icon_class = !isset($tab['icon_class']) ? '' : ' ' . $tab['icon_class'];
             $icon = !isset($tab['icon']) ? '<i class="icon-cog' . $icon_class . '"></i> ' : '<i class="icon-' . $tab['icon'] . $icon_class . '"></i> ';
             echo '<li id="' . $k . '_section_group_li" class="redux-opts-group-tab-link-li">';
             echo '<a href="javascript:void(0);" id="' . $k . '_section_group_li_a" class="redux-opts-group-tab-link-a custom-tab" data-rel="' . $k . '">' . $icon . '<span>' . $tab['title'] . '</span></a>';
             echo '</li>';
         }
     }
     if (true === $this->args['dev_mode']) {
         echo '<li id="dev_mode_default_section_group_li" class="redux-opts-group-tab-link-li">';
         if ($this->args['icon_type'] == 'image') {
             $icon = !isset($this->args['dev_mode_icon']) ? '' : '<img src="' . $this->args['dev_mode_icon'] . '" /> ';
         } else {
             $icon_class = !isset($this->args['dev_mode_icon_class']) ? '' : ' ' . $this->args['dev_mode_icon_class'];
             $icon = !isset($this->args['dev_mode_icon']) ? '<i class="icon-info-sign' . $icon_class . '"></i>' : '<i class="icon-' . $this->args['dev_mode_icon'] . $icon_class . '"></i> ';
         }
         echo '<a href="javascript:void(0);" id="dev_mode_default_section_group_li_a" class="redux-opts-group-tab-link-a custom-tab" data-rel="dev_mode_default">' . $icon . ' <span>' . __('Dev Mode Info', NECTAR_THEME_NAME) . '</span></a>';
         echo '</li>';
     }
     echo '</ul>';
     echo '</div>';
     echo '<div id="redux-opts-main">';
     foreach ($this->sections as $k => $section) {
         echo '<div id="' . $k . '_section_group' . '" class="redux-opts-group-tab">';
         do_settings_sections($this->args['opt_name'] . $k . '_section_group');
         echo '</div>';
     }
     if (true === $this->args['show_import_export']) {
         echo '<div id="import_export_default_section_group' . '" class="redux-opts-group-tab">';
         echo '<h3>' . __('Import / Export Options', NECTAR_THEME_NAME) . '</h3>';
         echo '<h4>' . __('Import Options', NECTAR_THEME_NAME) . '</h4>';
         echo '<p><a href="javascript:void(0);" id="redux-opts-import-code-button" class="button-secondary">' . __('Import from file', NECTAR_THEME_NAME) . '</a> <a href="javascript:void(0);" id="redux-opts-import-link-button" class="button-secondary">' . __('Import from URL', NECTAR_THEME_NAME) . '</a></p>';
         echo '<div id="redux-opts-import-code-wrapper">';
         echo '<div class="redux-opts-section-desc">';
         echo '<p class="description" id="import-code-description">' . apply_filters('redux-opts-import-file-description', __('Input your backup file below and hit Import to restore your sites options from a backup.', NECTAR_THEME_NAME)) . '</p>';
         echo '</div>';
         echo '<textarea id="import-code-value" name="' . $this->args['opt_name'] . '[import_code]" class="large-text" rows="8"></textarea>';
         echo '</div>';
         echo '<div id="redux-opts-import-link-wrapper">';
         echo '<div class="redux-opts-section-desc">';
         echo '<p class="description" id="import-link-description">' . apply_filters('redux-opts-import-link-description', __('Input the URL to another sites options set and hit Import to load the options from that site.', NECTAR_THEME_NAME)) . '</p>';
         echo '</div>';
         echo '<input type="text" id="import-link-value" name="' . $this->args['opt_name'] . '[import_link]" class="large-text" value="" />';
         echo '</div>';
         echo '<p id="redux-opts-import-action"><input type="submit" id="redux-opts-import" name="' . $this->args['opt_name'] . '[import]" class="button-primary" value="' . __('Import', NECTAR_THEME_NAME) . '"> <span>' . apply_filters('redux-opts-import-warning', __('WARNING! This will overwrite any existing options, please proceed with caution!', NECTAR_THEME_NAME)) . '</span></p>';
         echo '<div id="import_divide"></div>';
         echo '<h4>' . __('Export Options', NECTAR_THEME_NAME) . '</h4>';
         echo '<div class="redux-opts-section-desc">';
         echo '<p class="description">' . apply_filters('redux-opts-backup-description', __('Here you can copy/download your current option settings. Keep this safe as you can use it as a backup should anything go wrong, or you can use it to restore your settings on this site (or any other site).', NECTAR_THEME_NAME)) . '</p>';
         echo '</div>';
         echo '<p><a href="javascript:void(0);" id="redux-opts-export-code-copy" class="button-secondary">' . __('Copy', NECTAR_THEME_NAME) . '</a> <a href="javascript:void(0);" id="redux-opts-export-link" class="button-secondary">' . __('Copy Link', NECTAR_THEME_NAME) . '</a></p>';
         $backup_options = $this->options;
         $backup_options['redux-opts-backup'] = '1';
         $encoded_options = '###' . serialize($backup_options) . '###';
         echo '<textarea class="large-text" id="redux-opts-export-code" rows="8">';
         print_r($encoded_options);
         echo '</textarea>';
         echo '<input type="text" class="large-text" id="redux-opts-export-link-value" value="' . add_query_arg(array('feed' => 'reduxopts-' . $this->args['opt_name'], 'secret' => md5(AUTH_KEY . SECURE_AUTH_KEY)), site_url()) . '" />';
         echo '</div>';
     }
     if (is_array($this->extra_tabs)) {
         foreach ($this->extra_tabs as $k => $tab) {
             echo '<div id="' . $k . '_section_group' . '" class="redux-opts-group-tab">';
             echo '<h3>' . $tab['title'] . '</h3>';
             echo $tab['content'];
             echo '</div>';
         }
     }
     if (true === $this->args['dev_mode']) {
         echo '<div id="dev_mode_default_section_group' . '" class="redux-opts-group-tab">';
         echo '<h3>' . __('Dev Mode Info', NECTAR_THEME_NAME) . '</h3>';
         echo '<div class="redux-opts-section-desc">';
         echo '<textarea class="large-text" rows="24">' . print_r($this, true) . '</textarea>';
         echo '</div>';
         echo '</div>';
     }
     do_action('redux-opts-after-section-items-' . $this->args['opt_name'], $this);
     echo '<div class="clear"></div><!--clearfix-->';
     echo '</div>';
     echo '<div class="clear"></div><!--clearfix-->';
     echo '<div id="redux-opts-footer">';
     if (isset($this->args['share_icons'])) {
         echo '<div id="redux-opts-share">';
         foreach ($this->args['share_icons'] as $link) {
             echo '<a href="' . $link['link'] . '" title="' . $link['title'] . '" target="_blank"><img src="' . $link['img'] . '"/></a>';
         }
         echo '</div>';
     }
     echo '<div class="clear"></div><!--clearfix-->';
     echo '</div>';
     echo '</form>';
     echo isset($this->args['footer_text']) ? '<div id="redux-opts-sub-footer">' . $this->args['footer_text'] . '</div>' : '';
     do_action('redux-opts-page-after-form-' . $this->args['opt_name']);
     echo '<div class="clear"></div><!--clearfix-->';
     echo '</div><!--wrap-->';
     //removed in v1.4
     //generate_color_css(); //generate color css
     //generate_font_css(); //generate font css
     //generate_custom_css(); //generate custom css
     global $options;
     if (!empty($options['external-dynamic-css']) && $options['external-dynamic-css'] == 1) {
         generate_options_css();
     }
 }
예제 #11
0
function zn_cnv_v4_convert_theme_options()
{
    // Change theme options
    $theme_options = get_option('zn_kallyas_options');
    // The new options field will be 'zn_kallyas_optionsv4';
    $admin_options = ZN()->theme_options->get_theme_options();
    $new_options = array();
    foreach ($admin_options as $key => $value) {
        if (isset($theme_options[$value['id']])) {
            $new_options[$value['parent']][$value['id']] = $theme_options[$value['id']];
        } elseif (isset($value['std'])) {
            $new_options[$value['parent']][$value['id']] = $value['std'];
        }
    }
    // CONVERT FONT OPTIONS
    /** Google fonts **/
    if (!empty($theme_options['g_fonts_subset'])) {
        // Convert font subsets to array
        $subsets = str_replace(' ', '', strtolower($theme_options['g_fonts_subset']));
        $subsets = explode(',', $subsets);
        $new_options['google_font_options']['zn_google_fonts_subsets'] = $subsets;
        unset($subsets);
    }
    /** Convert loaded google fonts **/
    $loaded_fonts = array();
    // Some fonts are saved in the fonts key
    if (!empty($theme_options['fonts'])) {
        if (is_array($theme_options['fonts'])) {
            $normal_faces = array('arial', 'verdana', 'trebuchet', 'georgia', 'times', 'tahoma', 'palatino', 'helvetica');
            foreach ($theme_options['fonts'] as $key => $value) {
                if (!in_array($value, $normal_faces)) {
                    $loaded_fonts[$value]['font_family'] = $value;
                    $loaded_fonts[$value]['font_variants'] = array();
                }
            }
        }
    }
    // Some fonts are saved in all_g_fonts key
    if (!empty($theme_options['all_g_fonts'])) {
        if (is_array($theme_options['all_g_fonts'])) {
            foreach ($theme_options['all_g_fonts'] as $key => $value) {
                $loaded_fonts[$key]['font_family'] = $key;
                if (!empty($value['variant'])) {
                    $loaded_fonts[$key]['font_variants'] = $value['variant'];
                }
            }
        }
    }
    if (!empty($loaded_fonts)) {
        $new_options['google_font_options']['zn_google_fonts_setup'] = $loaded_fonts;
        unset($loaded_fonts);
    }
    /** Convert all "typography" options to use the font option **/
    $typography_options = array('logo_font' => 'general_options', 'logo_hover' => 'general_options', 'h1_typo' => 'font_options', 'h2_typo' => 'font_options', 'h3_typo' => 'font_options', 'h4_typo' => 'font_options', 'h5_typo' => 'font_options', 'h6_typo' => 'font_options', 'body_font' => 'font_options', 'ga_font' => 'font_options', 'footer_font' => 'font_options', 'menu_font' => 'font_options');
    foreach ($typography_options as $key => $value) {
        if (isset($new_options[$value][$key])) {
            if (isset($theme_options[$key])) {
                $font_saved_data = $theme_options[$key];
                // Perform the line-height convert
                if (isset($font_saved_data['height'])) {
                    $font_saved_data['line-height'] = $font_saved_data['height'];
                    unset($font_saved_data['height']);
                }
                // Perform the font-size convert
                if (isset($font_saved_data['size'])) {
                    $font_saved_data['font-size'] = $font_saved_data['size'];
                    unset($font_saved_data['size']);
                }
                // Convert font family
                if (isset($font_saved_data['face'])) {
                    $font_saved_data['font-family'] = $font_saved_data['face'];
                    unset($font_saved_data['face']);
                }
                // Special case when the font family is moved to fonts
                if (isset($theme_options['fonts'][$key])) {
                    $font_saved_data['font-family'] = $theme_options['fonts'][$key];
                }
                // Break the font style in font style and font weight
                if (isset($font_saved_data['style'])) {
                    // Normal and italic font
                    if ($font_saved_data['style'] == 'normal' || $font_saved_data['style'] == 'italic') {
                        $font_saved_data['font-style'] = $font_saved_data['style'];
                        $font_saved_data['font-weight'] = '400';
                    } elseif ($font_saved_data['style'] == 'bold') {
                        $font_saved_data['font-style'] = 'normal';
                        $font_saved_data['font-weight'] = '700';
                    } elseif ($font_saved_data['style'] == 'bold italic') {
                        $font_saved_data['font-style'] = 'italic';
                        $font_saved_data['font-weight'] = '700';
                    }
                    unset($font_saved_data['style']);
                }
                // Save the converted values
                $new_options[$value][$key] = $font_saved_data;
            }
        }
    }
    // These are all the options that contained an icon font
    $social_icon_options = array('header_social_icon', 'footer_social_icon', 'cs_social_icon');
    // Update header colors
    if (!empty($theme_options['header_social_icons'])) {
        foreach ($theme_options['header_social_icons'] as $key => $value) {
            if (!empty($value['header_social_icon'])) {
                $new_options['general_options']['header_social_icons'][$key]['header_social_color'] = zn_get_social_icon_color($value['header_social_icon']);
            } elseif (empty($value['header_social_icon'])) {
                unset($new_options['general_options']['header_social_icons'][$key]);
            }
        }
    }
    // Update footer colors
    if (!empty($theme_options['footer_social_icons'])) {
        foreach ($theme_options['footer_social_icons'] as $key => $value) {
            if (!empty($value['footer_social_icon'])) {
                $new_options['general_options']['footer_social_icons'][$key]['footer_social_color'] = zn_get_social_icon_color($value['footer_social_icon']);
            } elseif (empty($value['footer_social_icon'])) {
                unset($new_options['general_options']['footer_social_icons'][$key]);
            }
        }
    }
    // Update coming soon colors
    if (!empty($theme_options['cs_social_icons'])) {
        foreach ($theme_options['cs_social_icons'] as $key => $value) {
            if (!empty($value['cs_social_icon'])) {
                $new_options['coming_soon_options']['cs_social_icons'][$key]['cs_social_color'] = zn_get_social_icon_color($value['cs_social_icon']);
            } elseif (empty($value['cs_social_icon'])) {
                unset($new_options['general_options']['cs_social_icons'][$key]);
            }
        }
    }
    // Convert old PNG icons to the new font icons
    array_walk_recursive($new_options, 'update_social_icons_std', $social_icon_options);
    // Update unlimited sidebars to use the new location
    if (!empty($theme_options['sidebar_generator'])) {
        $new_options['unlimited_sidebars']['unlimited_sidebars'] = $theme_options['sidebar_generator'];
    }
    // Convert sidebars config to use the new system
    // Post
    $post_sidebar_setup = array();
    if (!empty($theme_options['default_sidebar_position'])) {
        $post_sidebar_setup['layout'] = $theme_options['default_sidebar_position'];
    }
    if (!empty($theme_options['single_sidebar'])) {
        $post_sidebar_setup['sidebar'] = zn_sanitize_widget_id($theme_options['single_sidebar']);
    }
    $new_options['unlimited_sidebars']['single_sidebar'] = $post_sidebar_setup;
    // Page
    $page_sidebar_setup = array();
    if (!empty($theme_options['page_sidebar_position'])) {
        $page_sidebar_setup['layout'] = $theme_options['page_sidebar_position'];
    }
    if (!empty($theme_options['page_sidebar'])) {
        $page_sidebar_setup['sidebar'] = zn_sanitize_widget_id($theme_options['page_sidebar']);
    }
    $new_options['unlimited_sidebars']['page_sidebar'] = $page_sidebar_setup;
    // Archive
    $archive_sidebar_setup = array();
    if (!empty($theme_options['archive_sidebar_position'])) {
        $archive_sidebar_setup['layout'] = $theme_options['archive_sidebar_position'];
    }
    if (!empty($theme_options['archive_sidebar'])) {
        $archive_sidebar_setup['sidebar'] = zn_sanitize_widget_id($theme_options['archive_sidebar']);
    }
    $new_options['unlimited_sidebars']['archive_sidebar'] = $archive_sidebar_setup;
    // Blog default - It was not present in previous versions so we have to set it as archive sidebar
    $new_options['unlimited_sidebars']['blog_sidebar'] = $archive_sidebar_setup;
    // WooCommerce archive sidebars
    $woo_sidebar_setup = array();
    if (!empty($theme_options['woo_arch_sidebar_position'])) {
        $woo_sidebar_setup['layout'] = $theme_options['woo_arch_sidebar_position'];
    }
    if (!empty($theme_options['woo_arch_sidebar'])) {
        $woo_sidebar_setup['sidebar'] = zn_sanitize_widget_id($theme_options['woo_arch_sidebar']);
    }
    $new_options['unlimited_sidebars']['woo_archive_sidebar'] = $woo_sidebar_setup;
    // WooCommerce single sidebars
    $woo_single_sidebar_setup = array();
    if (!empty($theme_options['woo_single_sidebar_position'])) {
        $woo_single_sidebar_setup['layout'] = $theme_options['woo_single_sidebar_position'];
    }
    if (!empty($theme_options['woo_single_sidebar'])) {
        $woo_single_sidebar_setup['sidebar'] = zn_sanitize_widget_id($theme_options['woo_single_sidebar']);
    }
    $new_options['unlimited_sidebars']['woo_single_sidebar'] = $woo_single_sidebar_setup;
    // CONVERT CUSTOM CSS TO NEW OPTION TYPE
    if (isset($theme_options['zn_custom_css'])) {
        update_option('zn_' . ZN()->theme_data['theme_id'] . '_custom_css', $theme_options['zn_custom_css'], false);
    }
    // EXTRA TWEAKS
    // Set blog content to excerpt
    $new_options['blog_options']['sb_archive_content_type'] = 'excerpt';
    // Save the new options
    // TODO : Replace this field with the theme data field from config
    update_option('zn_kallyas_optionsv4', $new_options);
    generate_options_css($new_options);
    $theme_options = $new_options = null;
}
예제 #12
0
function zn_ajax_callback()
{
    check_ajax_referer('zn_framework', 'zn_ajax_nonce');
    $save_action = $_POST['zn_action'];
    if ($save_action == 'zn_save_options') {
        // DO ACTION FOR SAVED OPTIONS
        do_action('zn_save_theme_options');
        $_POST = array_map('stripslashes_deep', $_POST);
        $data = $_POST;
        $options_field = $data['zn_option_field'];
        /* REMOVE THE HIDDEN FORM DATA */
        unset($data['zn_ajax_nonce']);
        unset($data['zn_option_field']);
        unset($data['action']);
        unset($data['zn_action']);
        // Combine all options
        // Get all saved options
        $saved_options = zget_option('', '', true);
        $saved_options[$options_field] = $data;
        $custom_css = '';
        if (isset($saved_options['advanced']['custom_css'])) {
            $custom_css = $saved_options['advanced']['custom_css'];
            $uploads = wp_upload_dir();
            $zn_uploads_dir = trailingslashit($uploads['basedir']);
            file_put_contents($zn_uploads_dir . 'zn_custom_css.css', $custom_css);
            unset($saved_options['advanced']['custom_css']);
        }
        $result = update_option(ZN()->theme_data['options_prefix'], $saved_options);
        generate_options_css($saved_options);
        //generate static css file
        if ($result == 0 || $result) {
            echo 'Settings successfully save';
            die;
        } else {
            echo 'There was a problem while saving the options';
            die;
        }
    } elseif ($save_action == 'zn_add_element') {
        $data = $_POST;
        if (empty($data['zn_elem_type'])) {
            return;
        }
        $value = json_decode(base64_decode($data['zn_json']), true);
        $value['dynamic'] = true;
        echo ZN()->html->zn_render_single_option($value);
        die;
    } elseif ($save_action == 'zn_add_google_font') {
        $data = $_POST;
        if (empty($data['zn_elem_type'])) {
            return;
        }
        $value = json_decode(base64_decode($data['zn_json']), true);
        if (isset($data['selected_font'])) {
            $value['selected_font'] = $data['selected_font'];
        }
        $value['dynamic'] = true;
        echo ZN()->html->zn_render_single_option($value);
        die;
    } elseif ($save_action == 'zn_import_dummy_data') {
        include FW_PATH . '/importer/zn_importer.php';
        installDummy($_POST['step'], $_POST['data']);
        die;
    } elseif ($save_action == 'zn_refresh_pb') {
        ZN()->pagebuilder->refresh_pb_data();
        die;
    } else {
        die('Are you cheating ?');
    }
}
예제 #13
0
function zn_ajax_callback()
{
    $nonce = $_POST['security'];
    if (!wp_verify_nonce($nonce, 'zn_ajax_nonce')) {
        die('-1');
    }
    //get options array from db
    $all = get_option(OPTIONS);
    $save_type = $_POST['type'];
    if ($save_type == 'save') {
        $_POST = array_map('stripslashes_deep', $_POST);
        parse_str($_POST['data'], $data);
        unset($data['security']);
        unset($data['of_save']);
        $args = wp_parse_args($data, $all);
        update_option(OPTIONS, $args);
        generate_options_css($args);
        //generate static css file
        generate_options_js($args);
        //generate static js file
        echo '1';
    } elseif ($save_type == 'zn_restore_options') {
        $saved_backup = get_option($_POST['data']);
        update_option(OPTIONS, $saved_backup);
        generate_options_css($args);
        //generate static css file
        generate_options_js($args);
        //generate static js file
        ob_clean();
        echo '1';
    } elseif ($save_type == 'zn_delete_backup') {
        $saved_backup = delete_option($_POST['data']);
        ob_clean();
        echo '1';
    } elseif ($save_type == 'install_dummy') {
        locate_template(array('admin/dummy_content/zn_importer.php'), true, true);
        installDummy();
    } elseif ($save_type == 'zn_backup_options') {
        $_POST = array_map('stripslashes_deep', $_POST);
        parse_str($_POST['data'], $data);
        unset($data['security']);
        unset($data['of_save']);
        $args = wp_parse_args($data, $all);
        $date = date('Y m d H i s');
        $option_field = THEMENAME . '_backup_from_' . str_replace(' ', '_', $date);
        $option_field = strtolower($option_field);
        add_option($option_field, $args, '', 'no');
        ob_clean();
        echo $option_field;
    } elseif ($save_type == 'add_element') {
        //$what_element = $_POST['data'];
        $html = new zn_html();
        parse_str($_POST['data'], $data);
        // Make a check to see if the element is a subelement
        // All subelements options must be placed in the same array that is passed to zn_get_element_from_id() function in functions-zn-admin.php !!
        $full_id = $data['element_type'];
        if (preg_match('/\\[(\\d+)\\]/', $full_id, $matches)) {
            $split_element_type = preg_split('/\\[(\\d+)\\]/', $full_id);
            $number_of_ids = count($split_element_type) - 1;
            $string = str_replace('[', '', $split_element_type[$number_of_ids]);
            $string = str_replace(']', '', $string);
            $data['element_type'] = $string;
        }
        $option = zn_get_element_from_id($data['element_type']);
        if (isset($option['link'])) {
            $option['is_dynamic'] = true;
        }
        $option['id'] = $full_id;
        if (isset($data['pb_area']) && !empty($data['pb_area'])) {
            $option['pb_area'] = $data['pb_area'];
        }
        echo $html->zn_render_element($option);
        //print_r($option);
        unset($data['security']);
        unset($data['of_save']);
        die(1);
    }
    die;
}
예제 #14
0
function zn_ajax_callback()
{
    check_ajax_referer('zn_framework', 'zn_ajax_nonce');
    $save_action = $_POST['zn_action'];
    if ($save_action == 'zn_save_options') {
        // DO ACTION FOR SAVED OPTIONS
        do_action('zn_save_theme_options');
        $data = json_decode(stripslashes($_POST['data']), true);
        /* REMOVE THE HIDDEN FORM DATA */
        unset($data['action']);
        unset($data['zn_action']);
        unset($data['zn_ajax_nonce']);
        $options_field = $data['zn_option_field'];
        // Combine all options
        // Get all saved options
        $saved_options = zget_option('', '', true);
        $saved_options[$options_field] = $data;
        // Save the Custom CSS in c sutom field
        if (isset($saved_options['advanced']['custom_css'])) {
            $custom_css = $saved_options['advanced']['custom_css'];
            update_option('zn_' . ZN()->theme_data['theme_id'] . '_custom_css', $custom_css, false);
            // Remove custom css from the main options field
            unset($saved_options['advanced']['custom_css']);
        }
        if (isset($saved_options['advanced']['custom_js'])) {
            $custom_js = $saved_options['advanced']['custom_js'];
            update_option('zn_' . ZN()->theme_data['theme_id'] . '_custom_js', $custom_js, false);
            // Remove custom css from the main options field
            unset($saved_options['advanced']['custom_js']);
        }
        $saved_options = apply_filters('zn_options_to_save', $saved_options);
        $result = update_option(ZN()->theme_data['options_prefix'], $saved_options);
        generate_options_css($saved_options);
        //generate static css file
        if ($result == 0 || $result) {
            echo 'Settings successfully save';
            die;
        } else {
            echo 'There was a problem while saving the options';
            die;
        }
    } elseif ($save_action == 'zn_add_element') {
        $data = $_POST;
        if (empty($data['zn_elem_type'])) {
            return;
        }
        $value = json_decode(base64_decode($data['zn_json']), true);
        $value['dynamic'] = true;
        echo ZN()->html()->zn_render_single_option($value);
        die;
    } elseif ($save_action == 'zn_add_google_font') {
        $data = $_POST;
        if (empty($data['zn_elem_type'])) {
            return;
        }
        $value = json_decode(base64_decode($data['zn_json']), true);
        if (isset($data['selected_font'])) {
            $value['selected_font'] = $data['selected_font'];
        }
        $value['dynamic'] = true;
        echo ZN()->html()->zn_render_single_option($value);
        die;
    } elseif ($save_action == 'zn_process_theme_updater') {
        ZN()->installer->update($_POST['step'], $_POST['data']);
        die;
    } elseif ($save_action == 'zn_refresh_pb') {
        ZN()->pagebuilder->refresh_pb_data();
        die;
    } else {
        die('Are you cheating ?');
    }
}
예제 #15
0
 function optionsCompiler()
 {
     generate_options_css();
 }