示例#1
0
 function output($section_name, $config, $op, $return = false)
 {
     $id = rtrim($this->get_fieldid($section_name), '_');
     $id = ltrim($id, 'op_');
     $one_col = op_get_var($config, 'one_col', false);
     $add_class = op_get_var($config, 'container_class');
     if (!empty($add_class)) {
         $add_class = ' ' . $add_class;
     }
     $default = op_get_var($config, 'default_layout', array());
     if (!is_array($default)) {
         $default = unserialize(base64_decode($default));
     }
     return op_page_layout($id, false, $id . '_area', 'editable-area' . $add_class, $default, $one_col);
 }
示例#2
0
 function save_preset()
 {
     global $wpdb;
     $preset = op_post('preset');
     if (!is_array($preset)) {
         $preset = array();
     }
     $type = op_get_var($preset, 'preset_type', 'new');
     switch ($type) {
         case 'new':
             $title = op_get_var($preset, 'preset_new');
             if (empty($title)) {
                 exit(json_encode(array('error' => __('You must provide a preset title', OP_SN))));
             }
             break;
         case 'overwrite':
             $id = op_get_var($preset, 'preset_save', 0);
             if ($id < 1) {
                 exit(json_encode(array('error' => __('You must select a preset to overwrite', OP_SN))));
             }
             break;
     }
     $this->save_page();
     $update = array();
     $layouts = op_post('layouts');
     if (!is_array($layouts)) {
         $layouts = array();
     }
     $layouts = array_keys($layouts);
     $new_layouts = array();
     foreach ($layouts as $layout) {
         $new_layouts[$layout] = op_page_layout($layout, true);
     }
     $update['layouts'] = base64_encode(serialize($new_layouts));
     $new_settings = array();
     $settings = apply_filters('op_export_settings_array', array('membership', 'theme', 'header_layout', 'feature_area', 'feature_title', 'footer_area', 'color_scheme_template', 'typography', 'color_scheme_advanced', 'mobile_redirect', 'seo', 'scripts', 'fb_share', 'lightbox', 'exit_redirect', 'launch_gateway', 'launch_funnel'));
     foreach ($settings as $setting) {
         if ($conf = op_page_option($setting)) {
             $new_settings[$setting] = base64_encode(serialize($conf));
         }
     }
     $update['settings'] = base64_encode(serialize($new_settings));
     if ($type == 'new') {
         $wpdb->insert($wpdb->prefix . 'optimizepress_presets', array_merge(array('name' => $title), $update));
         $current = $wpdb->insert_id;
     } else {
         $wpdb->update($wpdb->prefix . 'optimizepress_presets', $update, array('id' => $id));
         $current = $id;
     }
     echo json_encode(array('preset_dropdown' => $this->_get_presets_drop($current)));
     exit;
 }
示例#3
0
function op_init_page($id)
{
    global $wp_query;
    define('OP_PAGEBUILDER', true);
    define('OP_PAGEBUILDER_ID', $id);
    do_action('op_pre_init_page');
    require_once OP_ASSETS . 'live_editor.php';
    wp_enqueue_script('jquery', false, false, OP_VERSION);
    //If jQuery version is higher than 1.9 we require jQuery migrate plugin (which is by default registered in WP versions that come with jQuery 1.9 or higher)
    if (wp_script_is('jquery-migrate', 'registered')) {
        wp_enqueue_script(OP_SN . '-noconflict-js', OP_JS . 'jquery/jquery.noconflict' . OP_SCRIPT_DEBUG . '.js', array('jquery', 'jquery-migrate'), OP_VERSION);
    } else {
        wp_enqueue_script(OP_SN . '-noconflict-js', OP_JS . 'jquery/jquery.noconflict' . OP_SCRIPT_DEBUG . '.js', array('jquery'), OP_VERSION);
    }
    wp_enqueue_script(OP_SN . '-loadScript', OP_JS . 'jquery/jquery.loadScript' . OP_SCRIPT_DEBUG . '.js', array(OP_SN . '-noconflict-js'), OP_VERSION);
    op_init_page_theme();
    if (have_posts()) {
        the_post();
    }
    $GLOBALS['op_content_layout'] = op_page_layout('body', false, 'content_area', '');
    $GLOBALS['op_footer_layout'] = '';
    if (op_page_option('footer_area', 'enabled') == 'Y' && op_page_option('footer_area', 'large_footer', 'enabled') == 'Y') {
        $GLOBALS['op_footer_layout'] = op_page_layout('footer', false, 'footer_area');
    }
    do_action('op_after_init_page');
}
示例#4
0
function op_init_page($id)
{
    global $wp_query;
    define('OP_PAGEBUILDER', true);
    define('OP_PAGEBUILDER_ID', $id);
    do_action('op_pre_init_page');
    require_once OP_ASSETS . 'live_editor.php';
    wp_enqueue_script('jquery');
    wp_enqueue_script('loadScript', OP_JS . 'jquery/jquery.loadScript.js');
    op_init_page_theme();
    if (have_posts()) {
        the_post();
    }
    $GLOBALS['op_content_layout'] = op_page_layout('body', false, 'content_area', '');
    $GLOBALS['op_footer_layout'] = '';
    if (op_page_option('footer_area', 'enabled') == 'Y' && op_page_option('footer_area', 'large_footer', 'enabled') == 'Y') {
        $GLOBALS['op_footer_layout'] = op_page_layout('footer', false, 'footer_area', 'fixed-width');
    }
    do_action('op_after_init_page');
}