function display_settings($section_name, $config = array(), $return = false) { if (($cur = $this->get_option($section_name)) === false) { $cur = array(); } $tabs = $tab_content = array(); op_tpl_assign('section_name', $section_name); foreach ($config as $name => $tab) { $str = ''; $cur_items = op_get_var($cur, $name, array()); $section_array = array($section_name, $name); foreach ($tab['options'] as $short_name => $options) { $cur_item = op_get_var($cur_items, $short_name, array()); $options = $this->_get_options($options, array($section_array, $short_name)); $data = array('tab' => $name, 'title' => $options['title'], 'name' => $short_name, 'options' => $options['tab_opts']); if ($options['tab_opts']['type'] == 'multi') { $items = op_get_var($cur_item, 'ads_array', array()); if (count($items) == 0) { $items[] = array('href' => '', 'imgurl' => '', 'upload_file' => '', 'type' => 'file'); } $data['items'] = $items; } $str .= $this->load_tpl('advert_entry', $data); } $tabs[$name] = array('title' => $tab['title']); if (op_has_group_error($section_name . '_' . $name)) { $tabs[$name]['li_class'] = 'has-error'; } $tab_content[$name] = $str; } $data = array('tabs' => $tabs, 'tab_content' => $tab_content, 'module_name' => 'advertising'); echo $this->load_tpl('generic/tabbed_module', $data, false); }
function display_settings($section_name, $config = array(), $return = false) { $this->add_js = true; $data = array('id' => $this->get_fieldid($section_name), 'fieldname' => $this->get_fieldname($section_name), 'section_name' => $section_name); op_tpl_assign($data); $out = $this->load_tpl('index'); if ($return) { return $out; } echo $out; }
function setup_wizard() { if ($this->error) { op_tpl_assign('error', $this->error); } if ($this->notification) { op_tpl_assign('notification', $this->notification); } if ($this->cur_step > 5) { return op_show_error(__('You have completed the wizard.', 'optimizepress')); } $func = array($this, 'step_' . $this->cur_step); if (!is_callable($func)) { $func[1] = 'step'; } echo call_user_func($func); }
function display_settings($section_name, $config = array(), $return = false, $font_options = false, $fonts_array = array()) { if (!($content_fields = $this->_check_fields($config))) { return; } $content_fields = $this->_prep_fields($content_fields); $data = array('id' => $this->get_fieldid($section_name), 'fieldname' => $this->get_fieldname($section_name), 'section_name' => $section_name); $data = array_merge($data, $config); op_tpl_assign($data); $values = $this->get_option($section_name); $values = is_array($values) ? $values : array(); foreach ($content_fields as $name => $field) { $content_fields[$name]['value'] = isset($values[$name]) ? $values[$name] : $field['default']; if ($field['type'] != 'wysiwyg' && $font_options && !$field['disable_font']) { $content_fields[$name]['font_html'] = op_font_options_str($field['name'] . ' ' . __('Font Options (Optional)', OP_SN), $data['fieldname'] . '[' . $name . ']', op_get_var($fonts_array, $name, array())); } } $out = $this->load_tpl('content_fields', array('content_fields' => $content_fields)); if ($return) { return $out; } echo $out; }
function display_settings($section_name, $config = array(), $return = false) { $tabs = array('form_html' => 'Opt-In HTML', 'color_scheme' => 'Colour Scheme', 'content' => 'Content', 'submit_button' => 'Submit Button'); $tab_content = array(); $disable = $this->_get_disabled($config); foreach ($disable as $d) { unset($tabs[$d]); } $disable_name_options = false; if (isset($config['disable_name']) && $config['disable_name'] === true) { $disable_name_options = true; } $content_fields = array(); if (isset($tabs['content'])) { $data = array('fields' => $this->_get_fields($config), 'ignore_fields' => op_get_var($config, 'ignore_fields', array())); if ($disable_name_options) { $data['ignore_fields'][] = 'name_default'; } if (count($data['fields']) > 0) { if (is_array($section_name)) { $content = $section_name; $content[] = 'content'; } else { $content = array($section_name, 'content'); } $tab_content['content'] = op_mod('content_fields')->display_settings($content, $data, true); } else { unset($tabs['content']); } } if (isset($tabs['submit_button'])) { if (is_array($section_name)) { $submit_button = $section_name; $submit_button[] = 'submit_button'; } else { $submit_button = array($section_name, 'submit_button'); } $tab_content['submit_button'] = op_mod('submit_button')->display_settings($submit_button, op_get_var($config, 'submit_button_config', array()), true); } $data = array('id' => $this->get_fieldid($section_name), 'fieldname' => $this->get_fieldname($section_name), 'section_name' => $section_name, 'module_name' => 'signup_form', 'url' => $this->url, 'add_wrapper' => op_get_var($config, 'add_wrapper', true), 'fields' => array(), 'disable_name_options' => $disable_name_options); if (isset($tabs['color_scheme'])) { $data['color_schemes'] = $this->_get_color_schemes($section_name, $config); } if (isset($tabs['form_html'])) { $fields = array('email_data' => 'N', 'email_address' => '', 'redirect_url' => '', 'html' => '', 'new_window' => 'N', 'disable_name' => 'N', 'name_box' => '', 'email_box' => '', 'method' => '', 'action' => '', 'extra_fields' => array(), 'email_extra_fields' => array(), 'integration_type' => 'custom', 'thank_you_page' => '', 'list' => null, 'action_page' => '', 'gotowebinar' => null); $section = $this->get_option($section_name, 'form_html'); if ($section !== false && is_array($section)) { foreach ($fields as $field => $value) { $fields[$field] = op_get_var($section, $field); } } elseif (isset($config['values'])) { foreach ($fields as $field => $value) { $fields[$field] = op_get_var($config['values'], $field); } } $data['fields'] = $fields; } op_tpl_assign($data); foreach ($tabs as $name => $tab) { if (!isset($tab_content[$name])) { $tab_content[$name] = $this->load_tpl($name); } } if (count($tabs) > 1) { $data['tabs'] = $tabs; $data['tab_content'] = $tab_content; $data['content'] = $this->load_tpl('generic/tabbed_module', $data, false); } else { $data['content'] = $tab_content[key($tab_content)]; } $data['content'] = $return ? $data['content'] : str_replace('module-signup_form">', 'module-signup_form"><p class="module-help-text">' . __('To display the sidebar optin on your blog, please complete the settings below and then go to <a href="/wp-admin/widgets.php">Appearance > Widgets</a> on your Wordpress sidebar and drag the "OptimizePress: Sidebar Opt-in" widget into the Sidebar to position it where you wish.') . '</p>', $data['content']); if ($return) { return $data['content']; } else { echo $this->load_tpl('index', $data); } }
function load_tpl($tpl, $data = array(), $mod_tpl = true) { op_tpl_assign($this->shortname . '_object', $this); return op_tpl($tpl, $data, $mod_tpl ? $this->path . 'tpl/' : null); }
<form id="le-colours-dialog"> <h1><?php _e('Colour Scheme Settings', 'optimizepress'); ?> </h1> <div class="op-lightbox-content"> <div class="op-actual-lightbox-content"> <div class="settings-container"> <?php $le = new OptimizePress_LiveEditor(); $sections = $le->getSections(true); ?> <?php op_tpl_assign('nav_menus', wp_get_nav_menus()); $img = op_img('', true); $tabs = array(); $tab_content = array(); if (is_array($sections) || is_object($sections)) { foreach ($sections as $name => $section) { $tabs[$name] = array('title' => $section['title']); $tab_content[$name] = op_tpl('live_editor/helper', array('section_type' => $name, 'sections' => $name == 'functionality' ? $GLOBALS['functionality_sections'] : $section['object'], 'title' => $section['title'], 'description' => $section['description'])); if (op_has_section_error($name)) { $tabs[$name]['li_class'] = 'has-error'; } } } $data = array('tabs' => $tabs, 'tab_content' => $tab_content, 'module_name' => 'live_editor', 'error' => '', 'notification' => ''); echo op_tpl('live_editor/headers_layout', $data); ?> </div> </div>
function step_4() { op_tpl_assign('nav_menus', wp_get_nav_menus()); $img = op_img('', true); $tabs = array(); $tab_content = array(); if (is_array($this->sections) || is_object($this->sections)) { foreach ($this->sections as $name => $section) { $tabs[$name] = array('title' => $section['title']); $tab_content[$name] = op_tpl('page_builder/step', array('section_type' => $name, 'sections' => $name == 'functionality' ? $GLOBALS['functionality_sections'] : $section['object']->sections(), 'title' => $section['title'], 'description' => $section['description'])); if (op_has_section_error($name)) { $tabs[$name]['li_class'] = 'has-error'; } } } $data = array('tabs' => $tabs, 'tab_content' => $tab_content, 'module_name' => 'page_builder', 'error' => $this->error, 'notification' => $this->notification); return op_tpl('page_builder/step4', array('content' => op_tpl('generic/tabbed_module', $data))); }
function load_editor($post) { global $op_feature_area; $op_feature_area->generate_dialogs(); define('OP_LIVEEDITOR', true); require_once OP_ADMIN . 'assets.php'; require_once OP_ASSETS . 'live_editor.php'; require_once OP_FUNC . 'page.php'; $GLOBALS['post'] =& $post; $theme_type = op_page_option('theme', 'type'); $theme_dir = op_page_option('theme', 'dir'); if ($theme_type === 'landing' && $theme_dir == 2) { $GLOBALS['op_content_layout'] = op_page_layout('body', false, 'content_area', 'editable-area', array(), true); } else { $GLOBALS['op_content_layout'] = op_page_layout('body', false, 'content_area', 'editable-area'); } $GLOBALS['op_footer_layout'] = op_page_layout('footer', false, 'footer_area', 'editable-area'); $dialogs = $this->load_content_layouts_preset_dialogs(); $data['content_layouts_dialog'] = $dialogs[0]; $data['presets_dialog'] = $dialogs[1]; op_tpl_assign($data); require_once OP_PAGES . $theme_type . '/' . $theme_dir . '/template.php'; }
function _generate_tabs($conf = array(), $tabs, $field_name, $field_ext = '', $page_id = 0, $page_id2 = 0, $idx = 0) { _op_tpl('clear'); op_tpl_assign(array('config' => $conf, 'page_id' => $page_id, 'page_id2' => $page_id2, 'field_name' => $field_name, 'field_ext' => $field_ext, 'index' => $idx, 'add_page_link' => $this->data['add_page_link'])); $tab_content = array(); $counter = 0; foreach ($tabs as $name => $title) { $tab_data = array(); if ($name == 'page_setup') { $tab_data['landing_select'] = $this->_page_select($page_id); $tab_data['value_select'] = $this->_page_select($page_id2); } elseif ($name == 'page_setup_sales') { $tab_data['sales_select'] = $this->_page_select($page_id); } $tab_content[$name] = op_tpl('launch_suite/pages/' . $name, $tab_data); //Check if this is the first tab content (if it is, this contains the markup we need to filter) if ($counter == 1) { //Create the regex for finding the ID $pattern = '/<div id=\\".*\\" class=\\"sneezing-panda op-content-slider\\"\\>/'; //Init the counter for the number of replacement we are on $replacement_counter = 0; //Search through the content with regex, using callback so we can increment the replacement counter $tab_content[$name] = preg_replace_callback($pattern, create_function('$matches', ' global $replacement_counter; $replacement_counter++; //Return the same string found only this time, increment the id by one return str_replace("\\" class=\\"sneezing-panda op-content-slider\\">", "_".$replacement_counter."\\" class=\\"sneezing-panda op-content-slider\\">", $matches[0]); '), $tab_content[$name]); } $counter++; } return $tab_content; }