Esempio n. 1
0
    function output($section_name, $config, $op, $return = false)
    {
        if ($return) {
            return $op;
        }
        $style = op_get_current_item($this->_get_styles(), op_get_var($op, 'style'));
        echo '
<div class="post-promo-box post-promo-' . $style . '">' . implode("\n", op_get_var($op, 'fields', array())) . '</div>';
    }
Esempio n. 2
0
 function output($section_name, $config, $op, $return = false)
 {
     $disable = $this->_get_disabled($config);
     if (is_array($section_name[0]) && count($section_name) > 1) {
         $tmp = $section_name;
         $section_name = $section_name[0];
         for ($i = 1, $sl = count($tmp); $i < $sl; $i++) {
             array_push($section_name, $tmp[$i]);
         }
     }
     $data = $used_fields = array();
     if (isset($op['form_html'])) {
         $fh = $op['form_html'];
         $data['before_form'] = op_get_var($config, 'before_form');
         $data['after_form'] = op_get_var($config, 'after_form');
         $data['extra_fields'] = array();
         $form_class = '';
         $disable_name = op_get_var($fh, 'disable_name', 'N') == 'Y';
         $js_defaults = array();
         $fields = array('email');
         if (!$disable_name) {
             array_unshift($fields, 'name');
         }
         switch (op_get_var($fh, 'integration_type')) {
             case 'email':
                 $email_address = op_get_var($fh, 'email_address');
                 $redirect_url = op_get_var($fh, 'redirect_url');
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $new_fields = array();
                 foreach ($fields as $field) {
                     $data[$field . '_input'] = '<input type="text" name="' . $field . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     $new_fields[$field] = array('name' => $field, 'text' => op_get_var($js_defaults, $field));
                 }
                 $extra_fields = op_get_var($fh, 'email_extra_fields', array());
                 $new_extra = array();
                 if (is_array($extra_fields)) {
                     $counter = 1;
                     foreach ($extra_fields as $field) {
                         $new_extra['op_extra_' . $counter] = $field;
                         $data['extra_fields'][] = '<input type="text" name="op_extra_' . $counter . '" placeholder="' . op_attr($field) . '" />';
                         $counter++;
                     }
                 }
                 $data['form_open'] = '<form action="' . op_current_url() . '" method="post"' . ($form_class == '' ? '' : ' class="' . $form_class . '"') . '>';
                 $data['form_close'] = '</form>';
                 $hidden = array('email_to' => $email_address, 'redirect_url' => $redirect_url, 'extra_fields' => $new_extra, 'fields' => $new_fields);
                 $data['hidden_elems'] = '<input type="hidden" name="op_optin_form_data" value="' . op_attr(base64_encode(serialize($hidden))) . '" /><input type="hidden" name="op_optin_form" value="Y" />';
                 break;
             case 'custom':
             case 'oneshoppingcart':
                 $action = site_url('/process-optin-form/');
                 if ($action != '') {
                     if (!isset($disable['content']) && isset($op['content'])) {
                         foreach ($fields as $field) {
                             if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                                 $js_defaults[$field] = $op['content'][$field . '_default'];
                             }
                         }
                         if (count($js_defaults) > 0) {
                             $count = count($this->output_defaults);
                             $this->output_defaults[++$count] = $js_defaults;
                             $form_class = 'op-signup-form-' . $count;
                         }
                     }
                     $data['form_open'] = '<form action="' . esc_url($action) . '" method="' . op_get_var($fh, 'method', 'post') . '"' . ($form_class == '' ? '' : ' class="' . $form_class . '"') . (op_get_var($fh, 'new_window', 'N') == 'Y' ? ' target="_blank"' : '') . '>';
                     $data['form_close'] = '</form>';
                     foreach ($fields as $field) {
                         $fieldname = '';
                         if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                             $used_fields[$fh[$field . '_box']] = true;
                             $fieldname = $fh[$field . '_box'];
                         }
                         $data[$field . '_input'] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     }
                     $extra_fields = op_get_var($fh, 'extra_fields', array());
                     $field_names = op_get_var($extra_fields, 'field_name', array());
                     $field_titles = op_get_var($extra_fields, 'title', array());
                     $field_text = op_get_var($extra_fields, 'text', array());
                     for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                         $fieldname = $field_names[$i];
                         if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                             $fieldname = $field_titles[$i];
                         }
                         $data['extra_fields'][] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                         $used_fields[$fieldname] = true;
                     }
                     $hidden_elems = '';
                     if (isset($fh['fields']) && isset($fh['fields']['field_name']) && isset($fh['fields']['field_vals'])) {
                         $field_names = $fh['fields']['field_name'];
                         $field_vals = $fh['fields']['field_vals'];
                         $field_count = count($field_names);
                         if (is_array($field_names) && is_array($field_vals) && $field_count == count($field_vals)) {
                             for ($i = 0; $i < $field_count; $i++) {
                                 if (!isset($used_fields[$field_names[$i]])) {
                                     $hidden_elems .= '<input type="hidden" name="' . op_attr($field_names[$i]) . '" value="' . op_attr($field_vals[$i]) . '" />';
                                 }
                             }
                         }
                     }
                     $data['hidden_elems'] = $hidden_elems;
                     $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . op_get_var($fh, 'action') . '" />';
                 }
                 break;
             case 'infusionsoft':
                 $action = op_get_var($fh, 'action_page');
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $data['form_open'] = '<form action="' . esc_url($action) . '" method="POST"' . ($form_class == '' ? '' : ' class="' . $form_class . '"') . '>';
                 $data['form_close'] = '</form>';
                 /*
                  * Hardcoding the email field name
                  */
                 $fh['email_box'] = 'inf_field_Email';
                 foreach ($fields as $field) {
                     $fieldname = '';
                     if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                         $used_fields[$fh[$field . '_box']] = true;
                         $fieldname = $fh[$field . '_box'];
                     }
                     $data[$field . '_input'] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                 }
                 $extra_fields = op_get_var($fh, 'extra_fields', array());
                 $field_names = op_get_var($extra_fields, 'field_name', array());
                 $field_titles = op_get_var($extra_fields, 'title', array());
                 $field_text = op_get_var($extra_fields, 'text', array());
                 for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                     $fieldname = $field_names[$i];
                     if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                         $fieldname = $field_titles[$i];
                     }
                     $data['extra_fields'][] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                     $used_fields[$fieldname] = true;
                 }
                 $hidden_elems = '';
                 if (isset($fh['fields']) && isset($fh['fields']['field_name']) && isset($fh['fields']['field_vals'])) {
                     $field_names = $fh['fields']['field_name'];
                     $field_vals = $fh['fields']['field_vals'];
                     $field_count = count($field_names);
                     if (is_array($field_names) && is_array($field_vals) && $field_count == count($field_vals)) {
                         for ($i = 0; $i < $field_count; $i++) {
                             if (!isset($used_fields[$field_names[$i]])) {
                                 $hidden_elems .= '<input type="hidden" name="' . op_attr($field_names[$i]) . '" value="' . op_attr($field_vals[$i]) . '" />';
                             }
                         }
                     }
                 }
                 $data['hidden_elems'] = $hidden_elems;
                 $data['hidden_elems'] .= '<input type="hidden" name="provider" value="' . op_get_var($fh, 'integration_type') . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . op_get_var($fh, 'thank_you_page', op_current_url()) . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="list" value="' . op_get_var($fh, 'list') . '" />';
                 break;
             case 'aweber':
             case 'mailchimp':
             case 'icontact':
             case 'getresponse':
             case 'campaignmonitor':
             case 'officeautopilot':
                 $action = site_url('/process-optin-form/');
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $data['form_open'] = '<form action="' . esc_url($action) . '" method="POST"' . ($form_class == '' ? '' : ' class="' . $form_class . '"') . '>';
                 $data['form_close'] = '</form>';
                 /*
                  * Hardcoding the email field name
                  */
                 $fh['email_box'] = 'email';
                 foreach ($fields as $field) {
                     $fieldname = '';
                     if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                         $used_fields[$fh[$field . '_box']] = true;
                         $fieldname = $fh[$field . '_box'];
                     }
                     $data[$field . '_input'] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                 }
                 $extra_fields = op_get_var($fh, 'extra_fields', array());
                 $field_names = op_get_var($extra_fields, 'field_name', array());
                 $field_titles = op_get_var($extra_fields, 'title', array());
                 $field_text = op_get_var($extra_fields, 'text', array());
                 for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                     $fieldname = $field_names[$i];
                     if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                         $fieldname = $field_titles[$i];
                     }
                     $data['extra_fields'][] = '<input type="text" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                     $used_fields[$fieldname] = true;
                 }
                 $data['hidden_elems'] = $hidden_elems;
                 $data['hidden_elems'] = '<input type="hidden" name="provider" value="' . op_get_var($fh, 'integration_type') . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . op_get_var($fh, 'thank_you_page', op_current_url()) . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="list" value="' . op_get_var($fh, 'list') . '" />';
                 break;
         }
         if (op_get_var($fh, 'gotowebinar')) {
             $data['hidden_elems'] .= '<input type="hidden" name="gotowebinar" value="' . op_get_var($fh, 'gotowebinar') . '" />';
         }
     }
     $tpl = '';
     $out = '';
     $data['content'] = array();
     if (!isset($disable['content'])) {
         $fields = $this->_get_fields($config);
         $data['content'] = op_mod('content_fields')->output(array($section_name, 'content'), array('fields' => $fields), op_get_var($op, 'content', array()));
     }
     $btnconf = op_get_var($config, 'submit_button_config', array());
     if (isset($op['submit_button'])) {
         $btnop = $op['submit_button'];
     } else {
         $btnop = array();
         if (!isset($btnconf['type'])) {
             $btnop['type'] = 0;
         }
         if (isset($btnconf['defaults']) && isset($btnconf['defaults']['content'])) {
             $btnop['content'] = $btnconf['defaults']['content'];
         }
     }
     if (is_array($btnop)) {
         $data['submit_button'] = op_mod('submit_button')->save_settings(array($section_name, 'submit_button'), $btnconf, $btnop, true);
     } else {
         $data['submit_button'] = $btnop;
     }
     if (!isset($disable['color_scheme'])) {
         $styles = $this->_get_color_schemes($section_name, $config);
         if (count($styles) > 0) {
             $tpl = 'output';
             $style = op_get_current_item($styles, op_get_var($op, 'color_scheme'));
             if (isset($styles[$style]['output'])) {
                 $tpl = $styles[$style]['output'];
             }
             $data['color_scheme'] = $style;
         }
     }
     if (isset($config['template'])) {
         $tpl = $config['template'];
     }
     if (!empty($tpl)) {
         $out = $this->load_tpl('output/' . $tpl, $data);
     }
     if (!empty($out)) {
         if ($return) {
             return $out;
         }
         echo $out;
         return true;
     } else {
         return $data;
     }
 }
Esempio n. 3
0
<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar column-layout">
	<?php 
if ($layouts = op_theme_config('layouts')) {
    $cur_layout = op_get_current_item($layouts['layouts'], op_default_option('column_layout', 'option'));
    $previews = $js = $widths = $fields = array();
    foreach ($layouts['layouts'] as $name => $layout) {
        $field_id = 'op_sections_column_layout_' . $name;
        $selected = $cur_layout == $name;
        $li_class = $input_attr = '';
        if ($selected) {
            $li_class = ' img-radio-selected';
            $input_attr = ' checked="checked"';
            $fields = op_get_var($layout, 'widths', array());
        }
        $preview = $layout['preview'];
        $preview['li_class'] = $li_class;
        $preview['input'] = '<input type="radio" name="op[sections][column_layout][option]" id="' . $field_id . '" value="' . $name . '"' . $input_attr . ' />';
        $previews[] = $preview;
        if (isset($layout['widths'])) {
            $widths[$name] = $layout['widths'];
        }
    }
    $js['width'] = $layouts['width'];
    $js['widths'] = $widths;
    echo $this->load_tpl('generic/img_radio_selector', array('previews' => $previews));
    ?>
    <div class="column-container">
    	<h3><?php 
    _e('Choose the width of your columns', 'optimizepress');
    ?>
</h3>
Esempio n. 4
0
    $header_logo_setup['bgcolor'] = $header_layout['bgcolor'];
}
?>

<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar cf" id="op_page_layout_header">
    <label class="form-title"><?php 
_e('Header Style', OP_SN);
?>
</label>
	<p class="op-micro-copy"><?php 
printf(__('Use these options to customize styling of your page header.  Ensure you also create and assign menus to your blog Menus within the %1$sWordpress Menus admin panel%2$s if you want to use navigation menus on your blog.', OP_SN), '<a href="nav-menus.php">', '</a>');
?>
</p>
	<?php 
if ($layouts = op_page_config('header_layout', 'menu-positions')) {
    $cur_layout = op_get_current_item($layouts, op_default_page_option('header_layout', 'menu-position'));
    $previews = array();
    $alongside_nav = false;
    foreach ($layouts as $name => $layout) {
        $field_id = 'op_sections_layout_header_menu-position_' . $name;
        $selected = $cur_layout == $name;
        $li_class = $input_attr = '';
        if ($selected) {
            $alongside_nav = $name == 'alongside';
            $li_class = ' img-radio-selected';
            $input_attr = ' checked="checked"';
        }
        $preview = $layout['preview'];
        $preview['li_class'] = $li_class;
        $preview['input'] = '<input type="radio" name="op[header_layout][menu_position]" id="' . $field_id . '" value="' . $name . '"' . $input_attr . ' />';
        $preview['preview_content'] = __($layout['title'], OP_SN);
Esempio n. 5
0
 function op_popup($atts, $content = '')
 {
     //Extract the attributes into variables
     extract(shortcode_atts(array('style' => '1', 'title' => '', 'letter_spacing' => '', 'width' => '', 'top_margin' => '', 'bottom_margin' => '', 'top_padding' => '', 'bottom_padding' => '', 'left_padding' => '', 'right_padding' => '', 'alignment' => '', 'popup_width' => '700', 'popup_open_effect' => 'fade', 'popup_close_effect' => 'fade', 'popup_open_speed' => 'normal', 'popup_close_speed' => 'normal', 'popup_border_size' => '0', 'popup_border_color' => '#ffffff', 'popup_padding_top' => '20', 'popup_padding_bottom' => '20', 'popup_padding_left' => '30', 'popup_padding_right' => '30'), $atts));
     //Get current style
     $style = op_get_current_item($styles, $style);
     //Set up font
     $font = op_asset_font_style($atts, 'content_font_');
     $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = !empty($font) ? array('elements' => array('p', 'a'), 'style_str' => $font) : $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     //Set the temporary asset tag to the feature box
     // self::$temp_tag = 'op_popup';
     //Get content
     $args = func_get_args();
     //Get the content for adding an element field
     $content = call_user_func_array(array('OptimizePress_Default_Assets', '_add_element_field'), $args);
     //Process content from above
     $content = op_process_asset_content($content);
     //Set the font back to the original string
     $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $GLOBALS['OP_LIVEEDITOR_DEPTH'] == 1 ? $original_font_str : $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     //Init the block style variable
     $block_style = '';
     //Set up attributes for the asset
     $chks = array('width' => 'width', 'top_margin' => 'margin-top', 'bottom_margin' => 'margin-bottom');
     //Loop through each attribute
     foreach ($chks as $chk => $prob) {
         //Add attribute to the block style string
         $block_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : '';
     }
     //Add the style HTML attribute if we have styles in the block style string
     $block_style = !empty($block_style) ? ' style=\'' . $block_style . '\'' : $block_style;
     //Init the content style string
     $content_style = '';
     //Init the attributes for the content styling
     $chks = array('top_padding' => 'padding-top', 'bottom_padding' => 'padding-bottom', 'left_padding' => 'padding-left', 'right_padding' => ' padding-right');
     //Loop through each attribute
     foreach ($chks as $chk => $prob) {
         //Add attribute to the content style string
         $content_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : '';
     }
     //Add font to content style string
     $content_style .= $font;
     //Add the style HTML attribute if we have styles in the content style string
     $content_style = !empty($content_style) ? ' style=\'' . $content_style . '\'' : $content_style;
     if (!defined('OP_LIVEEDITOR')) {
         wp_enqueue_script(OP_SN . '-popup', OP_JS . 'popup' . OP_SCRIPT_DEBUG . '.js', array(OP_SN . '-noconflict-js'), OP_VERSION, true);
     }
     // fancybox options
     $popup_data = ' data-width="' . $popup_width . '" ';
     $popup_data .= ' data-open-effect="' . $popup_open_effect . '" ';
     $popup_data .= ' data-close-effect="' . $popup_close_effect . '" ';
     // $popup_data .= ' data-open-method="' . $popup_open_method . '" ';
     // $popup_data .= ' data-close-method="' . $popup_close_method . '" ';
     $popup_data .= ' data-open-speed="' . $popup_open_speed . '" ';
     $popup_data .= ' data-close-speed="' . $popup_close_speed . '" ';
     $popup_data .= ' data-border-color="' . $popup_border_color . '" ';
     $popup_data .= ' data-border-size="' . $popup_border_size . '" ';
     $popup_data .= ' data-padding-top="' . $popup_padding_top . '" ';
     $popup_data .= ' data-padding-bottom="' . $popup_padding_bottom . '" ';
     $popup_data .= ' data-padding-left="' . $popup_padding_left . '" ';
     $popup_data .= ' data-padding-right="' . $popup_padding_right . '" ';
     return '<div class="op-popup cf"' . $content_style . $popup_data . '>' . $content . '</div>';
 }
Esempio n. 6
0
 static function headline($atts, $content = '')
 {
     // Decode encoded chars
     $atts = op_urldecode($atts);
     // Extract the attributes into variables
     extract(shortcode_atts(array('style' => '1', 'align' => 'left', 'letter_spacing' => '', 'line_height' => '', 'highlight' => '', 'top_margin' => '', 'bottom_margin' => ''), $atts));
     //Init the styles array
     $styles = array(1 => '', 2 => 'headline-style-1', 3 => 'headline-style-2', 4 => 'headline-style-3', 5 => 'headline-style-4', 6 => 'headline-style-5', 7 => 'headline-style-6', 8 => 'headline-style-7', 9 => 'headline-style-8', 10 => 'headline-style-9', 11 => 'headline-style-10', 12 => 'headline-style-11', 13 => 'headline-style-12', 14 => 'headline-style-13', 15 => 'headline-style-14', 16 => 'headline-style-15', 17 => 'headline-style-16', 18 => 'headline-style-17');
     //Process content with regexes
     $content = preg_replace('/<\\/p>\\s*<p>/i', '<br /><br />', $content);
     if (strpos($content, '<br') === false) {
         $content = nl2br($content);
     }
     //Get the current style
     $style = op_get_current_item($styles, $style);
     //Ensure we have a style set
     if (isset($styles[$style])) {
         //Set the path for the images
         $path = OP_ASSETS_URL . 'images/headline/';
         //Init flag for surrounding headline with span tag
         $span = false;
         //Init the before and after HTML variables
         $before = $after = '';
         //Set the fade images
         $fadeimgs = '<img src="' . $path . 'fade-left.png" alt="fade-left" width="120" height="10" class="fade-left" /><img src="' . $path . 'fade-right.png" alt="fade-right" width="120" height="10" class="fade-right" />';
         //Init the templates array that determines whether we use spans and before and after tags
         $tpls = array(8 => array('span' => true), 10 => array('span' => true), 14 => array('span' => true, 'before' => $fadeimgs), 15 => array('span' => true, 'before' => $fadeimgs));
         //If this style is set, extract it's variables
         if (isset($tpls[$style])) {
             extract($tpls[$style]);
         }
         //Get and process content
         $str = do_shortcode(op_clean_shortcode_content($content));
         //Surround headline with span if style has one and any before and after tags
         $str = $before . ($span ? '<span>' . $str . '</span>' : $str) . $after;
         //Init the style string
         $style_str = !empty($styles[$style]) ? ' class="' . $styles[$style] . '"' : '';
         //Get font settings
         $font = op_asset_font_style($atts);
         //Init styling properties
         $chks = array('align' => 'text-align', 'line_height' => array('line-height', 'px'), 'highlight' => 'background-color', 'top_margin' => array('margin-top', 'px'), 'bottom_margin' => array('margin-bottom', 'px'));
         //Loop through each property
         foreach ($chks as $var => $chk) {
             if (!empty(${$var})) {
                 $font .= is_array($chk) ? $chk[0] . ':' . ${$var} . $chk[1] . ';' : $chk . ':' . ${$var} . ';';
             }
         }
         //Surroung styling with style HTML attribute, if styles exist
         $style_str .= !empty($font) ? ' style=\'' . $font . '\'' : '';
         //Init the return HTML
         $return_html = '';
         //Generate return HTML based on style
         switch ($style) {
             case 17:
             case 18:
                 $return_html = '
                     <table' . $style_str . '>
                         <tr>
                             <td class="stroke">
                                 <div></div>
                             </td>
                             <td class="headline">
                                 <h2>' . $str . '<h2>
                             </td>
                             <td class="stroke">
                                 <div></div>
                             </td>
                         </tr>
                     </table>
                 ';
                 break;
             default:
                 $return_html = '<h2' . $style_str . '>' . $str . '</h2>';
         }
         //Return the HTML
         return $return_html;
     }
 }
Esempio n. 7
0
function theme1_output_css($css = '')
{
    $op_fonts = new OptimizePress_Fonts();
    if (($start = op_get_option('color_scheme_fields', 'start')) && ($end = op_get_option('color_scheme_fields', 'end'))) {
        $css .= '
.featured-panel {
    background: ' . $end . ';
    background: -moz-linear-gradient(top, ' . $start . ' 0%, ' . $end . ' 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,' . $start . '), color-stop(100%,' . $end . '));
    background: -webkit-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: -o-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: -ms-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%));
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'' . $start . '\', endColorstr=\'' . $end . '\',GradientType=0 );
}

.op-page-header{
    background: ' . $end . ';
    background: -moz-linear-gradient(top, ' . $start . ' 0%, ' . $end . ' 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,' . $start . '), color-stop(100%,' . $end . '));
    background: -webkit-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: -o-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: -ms-linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%);
    background: linear-gradient(top, ' . $start . ' 0%,' . $end . ' 100%));
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'' . $start . '\', endColorstr=\'' . $end . '\',GradientType=0 );
}';
    }
    if ($top_nav_font = op_get_option('color_scheme_fields', 'top_nav_font')) {
        $op_fonts->add_font($top_nav_font['font_family']);
        $nav_weight = '';
        if ($top_nav_font['font_weight'] == '300') {
            $nav_weight = 'font-weight: 300;';
        } elseif ($top_nav_font['font_weight'] == 'italic') {
            $nav_weight = 'font-style: italic;';
        } elseif (strtolower($top_nav_font['font_weight']) == 'bold italic') {
            $nav_weight = 'font-weight: bold; font-style: italic;';
        } elseif (strtolower($top_nav_font['font_weight']) == 'normal') {
            $nav_weight = 'font-weight: normal;';
        } elseif (strtolower($top_nav_font['font_weight']) == 'bold') {
            $nav_weight = 'font-weight: bold;';
        }
        $nav_shadow = '';
        switch (strtolower(str_replace(' ', '', $top_nav_font['font_shadow']))) {
            case 'light':
                $nav_shadow = 'text-shadow: 1px 1px 0px rgba(255,255,255,0.5);';
                break;
            case 'dark':
                $nav_shadow = 'text-shadow: 0 1px 1px #000000, 0 1px 1px rgba(0, 0, 0, 0.5);';
                break;
            case 'textshadow':
            case 'none':
            default:
                $nav_shadow = 'text-shadow: none;';
        }
        $css .= ' body #nav-top.navigation,body #nav-top.navigation ul li a {';
        if (!empty($top_nav_font['font_family'])) {
            $css .= ' font-family: ' . op_font_str($top_nav_font['font_family']) . ';';
        }
        if (!empty($top_nav_font['font_size'])) {
            $css .= ' font-size: ' . $top_nav_font['font_size'] . 'px;';
        }
        $css .= $nav_shadow . $nav_weight;
        $css .= '}';
    }
    if ($top_nav = op_get_option('color_scheme_fields', 'top_nav_color')) {
        $css .= '
body #nav-top.navigation,body #nav-top.navigation ul ul li { background-color: ' . $top_nav . ' }';
    }
    if ($link_color = op_get_option('color_scheme_fields', 'link_color')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li a{ color: ' . $link_color . ' }';
    }
    if ($top_nav_hover_link = op_get_option('color_scheme_fields', 'top_nav_hover_link')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li:hover a{ color: ' . $top_nav_hover_link . ' }';
    }
    if ($top_nav_dd = op_get_option('color_scheme_fields', 'top_nav_dd')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li ul.sub-menu a { background-color: ' . $top_nav_dd . ' }';
    }
    if ($top_nav_dd_hover = op_get_option('color_scheme_fields', 'top_nav_dd_hover')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li ul.sub-menu li:hover a { background-color: ' . $top_nav_dd_hover . ' }';
    }
    if ($top_nav_dd_link = op_get_option('color_scheme_fields', 'top_nav_dd_link')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li ul.sub-menu li a { color: ' . $top_nav_dd_link . ' }';
    }
    if ($top_nav_dd_hover_link = op_get_option('color_scheme_fields', 'top_nav_dd_hover_link')) {
        $css .= '
body #nav-top.navigation ul#navigation-above li ul.sub-menu li:hover a { color: ' . $top_nav_dd_hover_link . ' }';
    }
    if ($headline = op_get_option('color_scheme_fields', 'headline_title')) {
        $css .= '
.op-page-header h2,.op-page-header h2 a, .op-page-header h2 span { color: ' . $headline . ' }';
    }
    if ($layouts = op_theme_config('header_prefs', 'menu-positions')) {
        $cur_layout = op_get_current_item($layouts, op_default_option('header_prefs', 'menu-position'));
        $layout = $layouts[$cur_layout];
        if (isset($layout['link_color']) && $layout['link_color'] === true) {
            if ($link_color = op_get_option('header_prefs', 'link_color')) {
                $css .= '
' . $layout[op_default_option('header_prefs', 'color_dropdowns') == 'Y' ? 'dropdown_selector' : 'link_selector'] . ' { color: ' . $link_color . ' }';
            }
        }
    }
    $widths = theme1_column_widths();
    if (isset($widths['main-sidebar']) && $widths['main-sidebar'] != 309) {
        $css .= '
.main-content .main-sidebar, .main-content .sidebar-bg { width:' . $widths['main-sidebar'] . 'px }' . (isset($widths['main-content']) ? '
.main-content-area { width:' . $widths['main-content'] . 'px }' : '');
    }
    if (($cols = op_get_option('footer_prefs', 'value')) && ($widths = op_get_option('footer_prefs', 'widths'))) {
        if ($cols > 1) {
            $cols = $cols > 4 ? 4 : $cols;
            $cols++;
            for ($i = 1; $i < $cols; $i++) {
                $int = intval(op_get_var($widths, $i, 0));
                if ($int > 0) {
                    $css .= '
.sub-footer .col:nth-child(' . $i . '){width:' . $int . 'px}';
                }
            }
        } else {
            $css .= '
.sub-footer .col{width:' . op_theme_config('footer_prefs', 'full_width') . 'px;margin-right:0}';
        }
    }
    return $css;
}
Esempio n. 8
0
function op_get_column_width($column)
{
    static $layout;
    static $has_cols = true;
    if ($has_cols && !isset($layout)) {
        if ($layouts = op_theme_config('layouts')) {
            $tmp_layout = $layouts['layouts'][op_get_current_item($layouts['layouts'], op_get_option('column_layout', 'option'))];
            if (isset($tmp_layout['widths'])) {
                $layout = $tmp_layout['widths'];
            } else {
                $has_cols = false;
            }
        } else {
            $has_cols = false;
        }
    }
    if ($has_cols) {
        $col = op_get_var($layout, $column);
        if ($conf = op_get_option('column_layout', 'widths', $column)) {
            $conf = intval($conf);
            if (isset($col['min']) && $conf < $col['min'] || isset($col['max']) && $conf > $col['max']) {
                return $col['width'];
            } else {
                return $conf;
            }
        }
        return $col['width'];
    }
}
Esempio n. 9
0
                break;
            default:
                $feature = 'A';
                break;
        }
        foreach ($landing_themes as $key => $features) {
            ?>
		<div id="op_landing_themes_<?php 
            echo $key;
            ?>
" class="theme-style-selection<?php 
            echo $key > 1 ? ' op-hidden' : '';
            ?>
">
	    	<?php 
            $current = op_get_current_item($features, $feature);
            $previews = array();
            foreach ($features as $theme_key => $preview) {
                $li_class = $input_attr = '';
                if ($theme_key == $current) {
                    $li_class = ' img-radio-selected';
                    $input_attr = ' checked="checked"';
                }
                $preview['input'] = '<input type="radio" name="op[feature_area][' . $key . ']" value="' . $theme_key . '"' . $input_attr . ' />';
                $preview['li_class'] = $li_class;
                $previews[] = $preview;
            }
            echo $this->load_tpl('generic/img_radio_selector', array('previews' => $previews, 'classextra' => ''));
            ?>
	    </div>
	<?php 
Esempio n. 10
0
    function asset_js()
    {
        $languages = $this->_get_facebook_languages();
        $vars = array('appid' => 'id', 'title' => 'title', 'lang' => 'language', 'hide_like' => 'hide_like', 'dark_site' => 'dark_site', 'posts_number' => 'posts_number', 'src_url' => 'src_url');
        $options = array();
        foreach ($vars as $var => $prop) {
            $options[$var] = $this->default_attr('comments', 'facebook', $prop);
            if (empty($options[$var])) {
                $options[$var] = op_default_attr('comments', 'facebook', $prop);
            }
        }
        $options['lang'] = op_get_current_item($languages, $options['lang']);
        echo '
var op_fb_comments_asset = ' . json_encode(array('languages' => $languages, 'options' => $options)) . ';';
    }
Esempio n. 11
0
 function output($section_name, $config, $op, $return = false)
 {
     $disable = $this->_get_disabled($config);
     if (is_array($section_name[0]) && count($section_name) > 1) {
         $tmp = $section_name;
         $section_name = $section_name[0];
         for ($i = 1, $sl = count($tmp); $i < $sl; $i++) {
             array_push($section_name, $tmp[$i]);
         }
     }
     $data = $used_fields = array();
     if (isset($op['form_html'])) {
         $order = array();
         $fh = $op['form_html'];
         $data['before_form'] = op_get_var($config, 'before_form');
         $data['after_form'] = op_get_var($config, 'after_form');
         $data['extra_fields'] = array();
         $form_class = '';
         $disable_name = op_get_var($fh, 'disable_name', 'N') == 'Y';
         $js_defaults = array();
         $fields = array('email');
         $order[op_get_var($fh, 'email_order', 0)][] = 'email_input';
         if (!$disable_name) {
             array_unshift($fields, 'name');
             $order[op_get_var($fh, 'name_order', 0)][] = 'name_input';
         }
         $required = 'required="required"';
         switch (op_get_var($fh, 'integration_type')) {
             case 'email':
                 $email_address = op_get_var($fh, 'email_address');
                 $redirect_url = op_get_var($fh, 'redirect_url');
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $new_fields = array();
                 foreach ($fields as $field) {
                     if ($field == 'email') {
                         $data[$field . '_input'] = '<input type="email" required="required" name="' . $field . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     } else {
                         $requiredField = '';
                         if (!isset($fh['name_required']) || op_get_var($fh, 'name_required') == 'Y') {
                             $requiredField = $required;
                         }
                         $data[$field . '_input'] = '<input type="text" ' . $requiredField . ' name="' . $field . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     }
                     $new_fields[$field] = array('name' => $field, 'text' => op_get_var($js_defaults, $field));
                 }
                 $extra_fields = op_get_var($fh, 'email_extra_fields', array());
                 $extra_fields_order = op_get_var($fh, 'email_extra_fields_order', array());
                 $extra_fields_required = op_get_var($fh, 'email_extra_fields_required', array());
                 $new_extra = array();
                 if (is_array($extra_fields)) {
                     $counter = 1;
                     foreach ($extra_fields as $field) {
                         $new_extra['op_extra_' . $counter] = $field;
                         $requiredField = '';
                         if (isset($extra_fields_required[$counter - 1]) && $extra_fields_required[$counter - 1] == 'Y') {
                             $requiredField = $required;
                         }
                         $data['extra_fields']['op_extra_' . $counter] = '<input type="text" ' . $requiredField . ' name="op_extra_' . $counter . '" placeholder="' . op_attr($field) . '" />';
                         $field_order = $order[op_get_var($extra_fields_order, $counter - 1, 0)][] = 'op_extra_' . $counter;
                         $counter++;
                     }
                 }
                 $data['form_open'] = '<form action="' . op_current_url() . '" method="post" class="op-optin-validation ' . $form_class . '">';
                 $data['form_close'] = '</form>';
                 $hidden = array('email_to' => $email_address, 'redirect_url' => $redirect_url, 'extra_fields' => $new_extra, 'fields' => $new_fields);
                 $data['hidden_elems'] = '<input type="hidden" name="op_optin_form_data" value="' . op_attr(base64_encode(serialize($hidden))) . '" /><input type="hidden" name="op_optin_form" value="Y" />';
                 break;
             case 'custom':
             case 'oneshoppingcart':
                 if ('Y' === op_get_var($fh, 'gotowebinar_enabled', 'N')) {
                     $action = get_bloginfo('url') . '/process-optin-form/';
                 } else {
                     $action = op_get_var($fh, 'action');
                 }
                 if ($action != '') {
                     if (!isset($disable['content']) && isset($op['content'])) {
                         foreach ($fields as $field) {
                             if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                                 $js_defaults[$field] = $op['content'][$field . '_default'];
                             }
                         }
                         if (count($js_defaults) > 0) {
                             $count = count($this->output_defaults);
                             $this->output_defaults[++$count] = $js_defaults;
                             $form_class = 'op-signup-form-' . $count;
                         }
                     }
                     $data['form_open'] = '<form action="' . $action . '" method="' . op_get_var($fh, 'method', 'post') . '" class="op-optin-validation ' . $form_class . '">';
                     $data['form_close'] = '</form>';
                     foreach ($fields as $field) {
                         $fieldname = '';
                         if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                             $used_fields[$fh[$field . '_box']] = true;
                             $fieldname = $fh[$field . '_box'];
                         }
                         if ('email' == $field) {
                             $data[$field . '_input'] = '<input type="email" required="required" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                         } else {
                             $requiredField = '';
                             if (!isset($fh['name_required']) || op_get_var($fh, 'name_required') == 'Y') {
                                 $requiredField = $required;
                             }
                             $data[$field . '_input'] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                         }
                     }
                     $extra_fields = op_get_var($fh, 'extra_fields', array());
                     $field_names = op_get_var($extra_fields, 'field_name', array());
                     $field_titles = op_get_var($extra_fields, 'title', array());
                     $field_text = op_get_var($extra_fields, 'text', array());
                     $field_order = op_get_var($extra_fields, 'order', array());
                     $field_required = op_get_var($extra_fields, 'required', array());
                     $field_hidden = op_get_var($extra_fields, 'hidden', array());
                     for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                         $fieldname = $field_names[$i];
                         if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                             $fieldname = $field_titles[$i];
                         }
                         if (isset($field_hidden[$i]) && $field_hidden[$i] == 'Y') {
                             $data['extra_fields'][$fieldname] = '<input type="hidden" name="' . op_attr($fieldname) . '" value="' . do_shortcode(stripslashes($field_text[$i])) . '" />';
                         } else {
                             $requiredField = '';
                             if (isset($field_required[$i]) && $field_required[$i] == 'Y') {
                                 $requiredField = $required;
                             }
                             $data['extra_fields'][$fieldname] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                         }
                         $order[op_get_var($field_order, $i, 0)][] = $fieldname;
                         $used_fields[$fieldname] = true;
                     }
                     $hidden_elems = '';
                     if (isset($fh['fields']) && isset($fh['fields']['field_name']) && isset($fh['fields']['field_vals'])) {
                         $field_names = $fh['fields']['field_name'];
                         $field_vals = $fh['fields']['field_vals'];
                         $field_count = count($field_names);
                         if (is_array($field_names) && is_array($field_vals) && $field_count == count($field_vals)) {
                             for ($i = 0; $i < $field_count; $i++) {
                                 if (!isset($used_fields[$field_names[$i]])) {
                                     $hidden_elems .= '<input type="hidden" name="' . op_attr($field_names[$i]) . '" value="' . op_attr($field_vals[$i]) . '" />';
                                 }
                             }
                         }
                     }
                     $data['hidden_elems'] = $hidden_elems;
                     $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . op_get_var($fh, 'action') . '" />';
                 }
                 break;
             case 'infusionsoft':
                 if (op_get_var($fh, 'gotowebinar')) {
                     $action = get_bloginfo('url') . '/process-optin-form/';
                 } else {
                     $action = op_get_var($fh, 'action_page');
                 }
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $data['form_open'] = '<form action="' . esc_url($action) . '" method="POST" class="op-optin-validation ' . $form_class . '">';
                 $data['form_close'] = '</form>';
                 /*
                  * Hardcoding the email field name
                  */
                 $fh['email_box'] = 'inf_field_Email';
                 foreach ($fields as $field) {
                     $fieldname = '';
                     if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                         $used_fields[$fh[$field . '_box']] = true;
                         $fieldname = $fh[$field . '_box'];
                     }
                     if ('email' == $field) {
                         $data[$field . '_input'] = '<input type="email" required="required" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     } else {
                         $requiredField = '';
                         if (!isset($fh['name_required']) || op_get_var($fh, 'name_required') == 'Y') {
                             $requiredField = $required;
                         }
                         $data[$field . '_input'] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     }
                 }
                 $extra_fields = op_get_var($fh, 'extra_fields', array());
                 $field_names = op_get_var($extra_fields, 'field_name', array());
                 $field_titles = op_get_var($extra_fields, 'title', array());
                 $field_text = op_get_var($extra_fields, 'text', array());
                 $field_order = op_get_var($extra_fields, 'order', array());
                 $field_required = op_get_var($extra_fields, 'required', array());
                 $field_hidden = op_get_var($extra_fields, 'hidden', array());
                 for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                     $fieldname = $field_names[$i];
                     if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                         $fieldname = $field_titles[$i];
                     }
                     if (isset($field_hidden[$i]) && $field_hidden[$i] == 'Y') {
                         $data['extra_fields'][$fieldname] = '<input type="hidden" name="' . op_attr($fieldname) . '" value="' . do_shortcode(stripslashes($field_text[$i])) . '" />';
                     } else {
                         $requiredField = '';
                         if (isset($field_required[$i]) && $field_required[$i] == 'Y') {
                             $requiredField = $required;
                         }
                         $data['extra_fields'][$fieldname] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                     }
                     $order[op_get_var($field_order, $i, 0)][] = $fieldname;
                     $used_fields[$fieldname] = true;
                 }
                 $hidden_elems = '';
                 $infusionSoftHiddenFields = op_assets_provider_item_fields('infusionsoft', op_get_var($fh, 'list'));
                 foreach ($infusionSoftHiddenFields['hidden'] as $infusionFieldName => $infusionFieldValue) {
                     $hidden_elems .= '<input type="hidden" name="' . $infusionFieldName . '" value="' . $infusionFieldValue . '" />';
                 }
                 $thankYouPage = op_get_var($fh, 'thank_you_page');
                 $thankYouPage = empty($thankYouPage) ? op_current_url() : $thankYouPage;
                 $alreadySubscribed = op_get_var($fh, 'already_subscribed_url');
                 $data['hidden_elems'] = $hidden_elems;
                 $data['hidden_elems'] .= '<input type="hidden" name="provider" value="' . op_get_var($fh, 'integration_type') . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . $thankYouPage . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="already_subscribed_url" value="' . $alreadySubscribed . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="list" value="' . op_get_var($fh, 'list') . '" />';
                 break;
             case 'arpreach':
             case 'aweber':
             case 'mailchimp':
             case 'mailpoet':
             case 'icontact':
             case 'getresponse':
             case 'campaignmonitor':
             case 'constantcontact':
             case 'convertkit':
             case 'activecampaign':
             case 'officeautopilot':
             case 'ontraport':
             case 'emma':
             case 'egoi':
             case 'maropost':
                 $action = get_bloginfo('url') . '/process-optin-form/';
                 if (!isset($disable['content']) && isset($op['content'])) {
                     foreach ($fields as $field) {
                         if (isset($op['content'][$field . '_default']) && !empty($op['content'][$field . '_default'])) {
                             $js_defaults[$field] = $op['content'][$field . '_default'];
                         }
                     }
                     if (count($js_defaults) > 0) {
                         $count = count($this->output_defaults);
                         $this->output_defaults[++$count] = $js_defaults;
                         $form_class = 'op-signup-form-' . $count;
                     }
                 }
                 $data['form_open'] = '<form action="' . esc_url($action) . '" method="POST" class="op-optin-validation ' . $form_class . '">';
                 $data['form_close'] = '</form>';
                 /*
                  * Hardcoding the email field name
                  */
                 $fh['email_box'] = 'email';
                 foreach ($fields as $field) {
                     $fieldname = '';
                     if (isset($fh[$field . '_box']) && !empty($fh[$field . '_box'])) {
                         $used_fields[$fh[$field . '_box']] = true;
                         $fieldname = $fh[$field . '_box'];
                     }
                     if ('email' == $field) {
                         $data[$field . '_input'] = '<input type="email" required="required" name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     } else {
                         $requiredField = '';
                         if (!isset($fh['name_required']) || op_get_var($fh, 'name_required') == 'Y') {
                             $requiredField = $required;
                         }
                         $data[$field . '_input'] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr(op_get_var($js_defaults, $field)) . '" class="' . $field . '" />';
                     }
                 }
                 $extra_fields = op_get_var($fh, 'extra_fields', array());
                 $field_names = op_get_var($extra_fields, 'field_name', array());
                 $field_titles = op_get_var($extra_fields, 'title', array());
                 $field_text = op_get_var($extra_fields, 'text', array());
                 $field_order = op_get_var($extra_fields, 'order', array());
                 $field_required = op_get_var($extra_fields, 'required', array());
                 $field_hidden = op_get_var($extra_fields, 'hidden', array());
                 for ($i = 0, $il = count($field_names); $i < $il; $i++) {
                     $fieldname = $field_names[$i];
                     if ($field_names[$i] == '' || $field_names[$i] == 'op_add_new_field') {
                         $fieldname = $field_titles[$i];
                     }
                     if (isset($field_hidden[$i]) && $field_hidden[$i] == 'Y') {
                         $data['extra_fields'][$fieldname] = '<input type="hidden" name="' . op_attr($fieldname) . '" value="' . do_shortcode(stripslashes($field_text[$i])) . '" />';
                     } else {
                         $requiredField = '';
                         if (isset($field_required[$i]) && $field_required[$i] == 'Y') {
                             $requiredField = $required;
                         }
                         $data['extra_fields'][$fieldname] = '<input type="text" ' . $requiredField . ' name="' . op_attr($fieldname) . '" value="' . getOptinUrlValue($fieldname) . '" placeholder="' . op_attr($field_text[$i]) . '" />';
                     }
                     $order[op_get_var($field_order, $i, 0)][] = $fieldname;
                     $used_fields[$fieldname] = true;
                 }
                 $thankYouPage = op_get_var($fh, 'thank_you_page');
                 $thankYouPage = empty($thankYouPage) ? op_current_url() : $thankYouPage;
                 $alreadySubscribed = op_get_var($fh, 'already_subscribed_url');
                 $list = op_get_var($fh, 'list');
                 $data['hidden_elems'] = '<input type="hidden" name="provider" value="' . op_get_var($fh, 'integration_type') . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="redirect_url" value="' . $thankYouPage . '" />';
                 $data['hidden_elems'] .= '<input type="hidden" name="already_subscribed_url" value="' . $alreadySubscribed . '" />';
                 if (op_get_var($fh, 'integration_type') === 'mailchimp') {
                     $data['hidden_elems'] .= '<input type="hidden" name="double_optin" value="' . op_get_var($fh, 'double_optin') . '" />';
                     $data['hidden_elems'] .= '<input type="hidden" name="welcome_email" value="' . op_get_var($fh, 'welcome_email') . '" />';
                 }
                 if (op_get_var($fh, 'integration_type') === 'emma') {
                     $data['hidden_elems'] .= '<input type="hidden" name="signup_form_id" value="' . op_get_var($fh, 'signup_form_id') . '" />';
                 }
                 /*
                  * In case that user selected arpReach as EMS we need to substitute list param with its "autoresponder_name" param
                  */
                 if (op_get_var($fh, 'integration_type') === 'arpreach') {
                     $list = op_get_var($fh, 'autoresponder_name');
                 }
                 $data['hidden_elems'] .= '<input type="hidden" name="list" value="' . $list . '" />';
                 break;
         }
         if (op_get_var($fh, 'gotowebinar') && 'Y' === op_get_var($fh, 'gotowebinar_enabled')) {
             $data['hidden_elems'] .= '<input type="hidden" name="gotowebinar" value="' . op_get_var($fh, 'gotowebinar') . '" />';
         }
         if (op_get_var($fh, 'opm_level') && 'Y' === op_get_var($fh, 'opm_integration')) {
             $data['hidden_elems'] .= '<input type="hidden" name="opm_level" value="' . op_get_var($fh, 'opm_level') . '" />';
         }
         if (op_get_var($fh, 'opm_packages') && 'Y' === op_get_var($fh, 'opm_integration')) {
             $data['hidden_elems'] .= '<input type="hidden" name="opm_packages" value="' . implode(',', op_get_var($fh, 'opm_packages')) . '" />';
         }
         $data['order'] = flatten_multidim_array($order, true);
     }
     $tpl = '';
     $out = '';
     $data['content'] = array();
     if (!isset($disable['content'])) {
         $fields = $this->_get_fields($config);
         $data['content'] = op_mod('content_fields')->output(array($section_name, 'content'), array('fields' => $fields), op_get_var($op, 'content', array()));
     }
     $btnconf = op_get_var($config, 'submit_button_config', array());
     if (isset($op['submit_button'])) {
         $btnop = $op['submit_button'];
     } else {
         $btnop = array();
         if (!isset($btnconf['type'])) {
             $btnop['type'] = 0;
         }
         if (isset($btnconf['defaults']) && isset($btnconf['defaults']['content'])) {
             $btnop['content'] = $btnconf['defaults']['content'];
         }
     }
     if (is_array($btnop)) {
         $data['submit_button'] = op_mod('submit_button')->save_settings(array($section_name, 'submit_button'), $btnconf, $btnop, true);
     } else {
         $data['submit_button'] = $btnop;
     }
     if (!isset($disable['color_scheme'])) {
         $styles = $this->_get_color_schemes($section_name, $config);
         if (count($styles) > 0) {
             $tpl = 'output';
             $style = op_get_current_item($styles, op_get_var($op, 'color_scheme'));
             if (isset($styles[$style]['output'])) {
                 $tpl = $styles[$style]['output'];
             }
             $data['color_scheme'] = $style;
         }
     }
     if (isset($config['template'])) {
         $tpl = $config['template'];
     }
     if (!empty($tpl)) {
         $out = $this->load_tpl('output/' . $tpl, $data);
     }
     /*
      * Loading validation script
      */
     op_validation_script();
     if (!empty($out)) {
         if ($return) {
             return $out;
         }
         echo $out;
         return true;
     } else {
         return $data;
     }
 }