Esempio n. 1
0
 function display_settings($section_name, $config = array(), $return = false)
 {
     global $wpdb;
     $data = array('fieldid' => $this->get_fieldid($section_name), 'fieldname' => $this->get_fieldname($section_name), 'section_name' => $section_name);
     $funnel_dropdown = '';
     $current = intval(op_page_option($section_name, 'funnel_id'));
     $found = false;
     $funnels = $wpdb->get_results("SELECT id,title FROM `{$wpdb->prefix}optimizepress_launchfunnels` ORDER BY title ASC");
     $funnel_count = 0;
     if ($funnels) {
         $funnel_count = count($funnels);
         foreach ($funnels as $funnel) {
             if ($current < 1) {
                 $current = $funnel->id;
                 $found = true;
             } elseif ($current == $funnel->id) {
                 $found = true;
             }
             $funnel_dropdown .= '<option value="' . $funnel->id . '"' . ($current == $funnel->id ? ' selected="selected"' : '') . '>' . op_attr($funnel->title) . '</option>';
         }
     }
     $data['funnel_count'] = $funnel_count;
     $data['funnel_select'] = '<select name="' . $data['fieldname'] . '[funnel_id]" id="' . $data['fieldid'] . 'funnel_id">' . $funnel_dropdown . '</select>';
     $this->add_js = true;
     $out = $this->load_tpl('settings', $data);
     if ($return) {
         return $out;
     }
     echo $out;
 }
Esempio n. 2
0
 function liveeditor_elements($atts, $content = '')
 {
     $newcontent = $content;
     if (defined('OP_AJAX_SHORTCODE') && isset($GLOBALS['OP_LIVEEDITOR_DEPTH']) && $GLOBALS['OP_LIVEEDITOR_DEPTH'] === 1 && $GLOBALS['OP_ADD_ELEMENT_ROWS'] === true) {
         $mc = preg_match_all('/' . op_shortcode_regex('op_liveeditor_element') . '/s', $content, $matches);
         $new_content = '';
         if ($mc > 0) {
             for ($i = 0; $i < $mc; $i++) {
                 $sc = op_clean_shortcode_content($matches[5][$i]);
                 $new_content .= '<div class="row element-container cf"><div class="op-element-links"><a class="element-settings" href="#settings"><img alt="' . __('Edit Element', OP_SN) . '" title="' . __('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div><div class="element">' . do_shortcode(shortcode_unautop(wpautop($sc))) . '</div><div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(trim(shortcode_unautop($sc))) . '</textarea></div></div>';
             }
         }
         return $new_content;
     }
     $newcontent = do_shortcode(op_clean_shortcode_content($content)) . (defined('OP_LIVEEDITOR') ? '<a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '"><span>' . __('Add Element', OP_SN) . '</span></a>' : '');
     return $newcontent;
 }
Esempio n. 3
0
echo $field_ext;
?>
" id="op_funnel_pages_<?php 
echo str_replace(array('[', ']'), '', $field_name);
?>
_navigation_active_link_text_<?php 
echo str_replace(array('[', ']'), '', $field_ext);
?>
" value="<?php 
echo op_attr(op_get_var($conf, 'active_link_text'));
?>
" />

<label class="form-title"><?php 
_e('Coming Soon Navigation Link Text', OP_SN);
?>
</label>
<p class="op-micro-copy"><?php 
_e('Enter the text for the link which appear in your launch navigation when this page is inactive (coming soon)', OP_SN);
?>
</p>
<input type="text" name="op[funnel_pages]<?php 
echo $field_name;
?>
[navigation][inactive_link_text]<?php 
echo $field_ext;
?>
" value="<?php 
echo op_attr(op_get_var($conf, 'inactive_link_text'));
?>
" />
Esempio n. 4
0
function op_default_attr_e()
{
    $args = func_get_args();
    echo op_attr(call_user_func_array('op_default_option', $args));
}
Esempio n. 5
0
 /**
  * Checks GET vars for 'op_' prefixed parameters to fill the value or call 'op_optin_field_value' filter
  * @author Luka Peharda <*****@*****.**>
  * @param  string $name
  * @return string
  */
 function getOptinUrlValue($name)
 {
     $value = op_get('op_' . strtolower($name));
     if (false !== $value) {
         $value = op_attr($value);
     } else {
         if ('FNAME' == $name) {
             $value = getOptinUrlValue('name');
         } else {
             $value = apply_filters('op_optin_field_value', $value, $name);
         }
     }
     return $value;
 }
Esempio n. 6
0
    <li><div class="fb-like" data-href="<?php 
echo $fb_like_url;
?>
" data-send="false" data-layout="box_count" data-width="450" data-show-faces="true"></div></li>
    <li><div class="g-plusone" data-size="tall" data-href="<?php 
echo $g_url;
?>
"></div></li>
    <li><a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php 
echo $tw_url;
?>
" <?php 
echo $tw_name != '' ? ' data-via="' . op_attr($tw_name) . '"' : '';
?>
 <?php 
echo ucfirst($tw_text) != '' ? ' data-text="' . op_attr($tw_text) . '"' : '';
?>
 data-lang="<?php 
echo $tw_lang;
?>
" data-related="anywhereTheJavascriptAPI" data-count="vertical"><?php 
__('Tweet', OP_SN);
?>
</a></li>
    <li><?php 
include 'linkedin-button.inc.php';
?>
</li>
    <li class="op-pin-it-btn"><a href="http://pinterest.com/pin/create/button/?url=<?php 
echo urlencode($p_url);
?>
Esempio n. 7
0
function op_thumb_gallery($fieldid, $value = '', $gallery_dir = '', $id = '', $return = false)
{
    static $gallery_count = 0;
    $id = empty($id) ? str_replace(array('[]', '][', '[', ']'), array('_' . $gallery_count, '_', '_', ''), $fieldid) : str_replace(array('[]', '][', '[', ']'), array('_' . $gallery_count, '_', '_', ''), $id);
    $html = '
    <div id="' . $id . '" class="op-thumb-gallery">
        <a data-target="' . $id . '_gallery" href="#" class="button op-content-slider-button" title="' . esc_attr__('Select From Gallery') . '" style="background-image:url(images/white-grad.png)">' . __('Select From Gallery', OP_SN) . '</a>
    ';
    $html .= '
        <input type="hidden" name="' . $fieldid . '" id="' . $id . '" value="' . op_attr($value) . '" class="op-gallery-value" />
        <span class="file-preview cf">
            <div class="op-waiting"><img class="op-bsw-waiting op-show-waiting op-hidden" alt="" src="images/wpspin_light.gif" /></div>
            <div class="content cf">
    ';
    if ($value != '' && $value !== false) {
        $ext = preg_match('/\\.([^.]+)$/', $value, $matches) ? strtolower($matches[1]) : false;
        if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) {
            $html .= '<a href="' . $value . '" target="_blank" class="preview-image"><img src="' . $value . '" alt="uploaded-image" /></a><a href="#remove" class="remove-file button">' . __('Remove Image', OP_SN) . '</a>';
        } else {
            $html .= '<a href="' . $value . '" target="_blank" class="preview-image">' . __('View File', OP_SN) . '</a><a href="#remove" class="remove-file button">' . __('Remove File', OP_SN) . '</a>';
        }
    }
    $html .= '
            </div>
        </span>
    </div>
    ';
    $gallery = op_list_directory_images(OP_THUMB . $gallery_dir);
    $html .= op_image_slider($id . '_gallery', $gallery, true);
    //$html .= '<script type="text/javascript">bind_content_sliders();</script>';
    $gallery_count++;
    if ($return) {
        return $html;
    } else {
        echo $html;
    }
}
Esempio n. 8
0
    static function social_sharing($atts)
    {
        global $post;
        $page_id = defined('OP_PAGEBUILDER_ID') ? OP_PAGEBUILDER_ID : $post->ID;
        $url = get_permalink($page_id);
        // Decode encoded chars
        $atts = op_urldecode($atts);
        $data = shortcode_atts(array('style' => 'horizontal', 'fb_like_url' => $url, 'fb_color' => 'light', 'fb_lang' => op_default_attr('comments', 'facebook', 'language'), 'fb_text' => 'Like', 'fb_button_text' => 'Share', 'tw_text' => 'Share', 'tw_lang' => 'en', 'tw_url' => $url, 'tw_button_text' => 'Share', 'tw_name' => '', 'g_url' => $url, 'g_lang' => 'en-GB', 'g_button_text' => 'Share', 'p_url' => $url, 'p_image_url' => $url, 'p_description' => '', 'su_url' => $url, 'linkedin_url' => $url, 'linkedin_lang' => 'en_US', 'alignment' => 'center'), $atts);
        extract($data);
        $attrs = $style == 'horizontal' ? array('fb_button_style' => 'button_count', 'fb_extra' => ' data-width="89"', 'tw_extra' => ' style="width:98px"', 'g_size' => 'medium', 'g_extra' => ' style="width:85px"', 'su_style' => '1', 'p_extra' => ' data-pin-config="beside"') : array('fb_extra' => '', 'fb_button_style' => 'box_count', 'tw_extra' => ' data-count="vertical"', 'g_size' => 'tall', 'su_style' => '5', 'g_extra' => '', 'p_extra' => ' data-pin-config="above"');
        $data['id'] = 'social-sharing-' . op_generate_id();
        //Init Facebook html
        $fbAppId = op_default_attr('comments', 'facebook', 'id') ? 'appId: ' . op_default_attr('comments', 'facebook', 'id') . ',' : '';
        $data['fb_html'] = '
            <script>
            window.fbAsyncInit = function() {
                FB.init({
                    ' . $fbAppId . '
                    xfbml      : true,
                    version    : \'v2.0\'
                });
                opjq(window).trigger("OP.fbAsyncInit");
            };
            (function(d, s, id){
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) {return;}
                js = d.createElement(s); js.id = id;
                js.src = "//connect.facebook.net/' . $fb_lang . '/sdk.js";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, \'script\', \'facebook-jssdk\'));

            if (typeof FB !== "undefined") { FB.XFBML.parse(); }
            </script>
            <div class="fb-like" data-send="false"' . ($fb_like_url != '' ? ' data-href="' . $fb_like_url . '"' : '') . ' data-layout="' . $attrs['fb_button_style'] . '" data-show-faces="false" data-action="' . $fb_text . '" data-colorscheme="' . $fb_color . '"' . $attrs['fb_extra'] . '></div>
        ';
        //Init Twitter html
        $data['twitter_html'] = '
            <a href="https://twitter.com/share" class="twitter-share-button"' . (ucfirst($tw_text) != '' ? ' data-text="' . op_attr($tw_text) . '"' : '') . ($tw_url != '' ? ' data-url="' . op_attr($tw_url) . '"' : '') . ($tw_name != '' ? ' data-via="' . op_attr($tw_name) . '"' : '') . ' data-lang="' . $tw_lang . '"' . $attrs['tw_extra'] . '>' . __('Tweet', OP_SN) . '</a>
            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
            <script>
            if (typeof twttr === "object"
                && typeof twttr.widgets === "object"
                && typeof twttr.widgets.load === "function") {
                try {
                    twttr.widgets.load();
                } catch(e) {}
            }
            </script>
        ';
        //Init Google+ html
        $data['gplus_html'] = '
            <div class="g-plusone" data-size="' . $attrs['g_size'] . '" data-href="' . $g_url . '"' . $attrs['g_extra'] . '></div>
            <script type="text/javascript">
              window.___gcfg = {lang: \'' . $g_lang . '\'};
              (function() {
                var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true;
                po.src = \'https://apis.google.com/js/plusone.js\';
                var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);
              })();
            </script>
        ';
        //Init Pinterest html
        // $data['pinterest_html'] = '
        //     <span class="pinbreak"><a href="http://pinterest.com/pin/create/button/?url='.$p_url.'&media='.$p_image_url.($p_description!=''?'&description='.$p_description:'').'" class="pin-it-button" data-pin-do="buttonPin" count-layout="'.$style.'"'.$attrs['p_extra'].'><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="'.__('Pin It',OP_SN).'" /></a></span>
        //     <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
        // ';
        $data['pinterest_html'] = '
            <span class="pinbreak"><a href="http://pinterest.com/pin/create/button/?url=' . $p_url . '&media=' . $p_image_url . ($p_description != '' ? '&description=' . $p_description : '') . '" class="pin-it-button" data-pin-do="buttonPin" ' . $attrs['p_extra'] . '><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="' . __('Pin It', OP_SN) . '" /></a></span>
            <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
            <script>
            if (typeof window.parsePinBtns === "function") {
                window.parsePinBtns();
            }
            </script>
        ';
        //Init StumbleUpon html
        $data['su_html'] = '
            <div class="op-stumbleupon-badge">
            <su:badge layout="' . $attrs['su_style'] . '" location="' . $su_url . '"></su:badge>

            <script type="text/javascript">
              (function() {
                var li = document.createElement(\'script\'); li.type = \'text/javascript\'; li.async = true;
                li.src = (\'https:\' == document.location.protocol ? \'https:\' : \'http:\') + \'//platform.stumbleupon.com/1/widgets.js\';
                var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(li, s);
              })();
            </script>
            </div>
        ';
        //Init LinkedIn html
        $data['linkedin_html'] = '
            <script src="//platform.linkedin.com/in.js" type="text/javascript">
            lang: ' . $linkedin_lang . '
                </script>
                <script type="IN/Share" data-url="' . $linkedin_url . '" data-counter="top"></script>
                <script>
                if (typeof IN === "object" && typeof IN.parse === "function") {
                    IN.parse();
                }
                </script>
        ';
        //if (is_admin()) return __('--- Social Sharing Element ---', OP_SN);
        //Clear the template
        _op_tpl('clear');
        //Process the new template and load it
        return _op_tpl('_load_file', OP_ASSETS . 'tpls/social_sharing/' . $data['style'] . '.php', $data, true);
    }
Esempio n. 9
0
                case 'addon':
                    $header = __('Add-on Elements', OP_SN);
                    break;
                case 'theme':
                    $header = __('Theme Elements', OP_SN);
                    break;
            }
            echo '
		            <li><h2>' . $header . '</h2></li>';
        }
        uasort($assets, 'op_sort_asset_array');
        foreach ($assets as $tag => $info) {
            $img = '';
            $classname = ' class="asset-list-item no-image"';
            if (isset($info['image']) && !empty($info['image'])) {
                $img = '<img src="' . $info['image'] . '" alt="' . op_attr($info['title']) . '" />';
                $classname = ' class="op-asset-list-item"';
            }
            echo '
                    <li' . $classname . '>
                        <a href="#' . $group . '/' . $tag . '" class="cf asset-' . $group . '-' . $tag . ' group-' . $group . '">' . $img . '<span class="content"><span class="title">' . $info['title'] . '</span>' . (isset($info['description']) && !empty($info['description']) ? '<span class="description">' . $info['description'] . '</span>' : '') . '</span></a>
                    </li>';
            $asset_groups[$group][$tag] = array('settings' => op_get_var($info, 'settings', 'N'), 'base_path' => op_get_var($info, 'base_path', null));
        }
        echo '
                </ul>
            </div>';
    }
}
?>
        	</div>
Esempio n. 10
0
                </div>
            </div>
            <div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar cf" id="op_container_content_<?php 
echo $id;
?>
_text">
                <input type="text" name="<?php 
echo $fieldname;
?>
[content]"<?php 
if ($buttonType != 1) {
    echo ' disabled="disabled"';
}
?>
 id="op_assets_submit_button_text_box_text_properties_1_text" value="<?php 
op_attr(op_get_var($button, 'content', 'Get Started Now'), true);
?>
" />
                <?php 
echo op_font_size_dropdown($fieldname . '[text_size]', op_get_var($button, 'text_size', 32), 'op_assets_submit_button_text_box_text_properties_1_size');
echo op_font_visual_dropdown_with_input('op_assets_submit_button_text_box_text_properties_1_container', $fieldname . '[text_font]', op_get_var($button, 'text_font'));
echo op_color_picker($fieldname . '[text_color]', op_get_var($button, 'text_color', '#000000'), 'op_assets_submit_button_text_box_text_properties_1_color', false, true);
?>
                <div class="style-checkbox-selector cf field-id-op_assets_submit_button_text_box_text_properties_1">
                    <input name="<?php 
echo $fieldname;
?>
[text_bold]" value="1" type="checkbox"<?php 
checked('1', op_get_var($button, 'text_bold', '1'));
?>
 class="op-font-style-checkbox op-font-style-bold" id="op_assets_submit_button_text_box_text_bold_1">
Esempio n. 11
0
echo $field_ext;
?>
" id="op_funnel_pages_<?php 
echo str_replace(array('[', ']'), '', $field_name);
?>
_navigation_active_link_text_<?php 
echo str_replace(array('[', ']'), '', $field_ext);
?>
" value="<?php 
echo stripslashes(op_attr(op_get_var($conf, 'active_link_text')));
?>
" />

<label class="form-title"><?php 
_e('Coming Soon Navigation Link Text', OP_SN);
?>
</label>
<p class="op-micro-copy"><?php 
_e('Enter the text for the link which appear in your launch navigation when this page is inactive (coming soon)', OP_SN);
?>
</p>
<input type="text" name="op[funnel_pages]<?php 
echo $field_name;
?>
[navigation][inactive_link_text]<?php 
echo $field_ext;
?>
" value="<?php 
echo stripslashes(op_attr(op_get_var($conf, 'inactive_link_text')));
?>
" />
Esempio n. 12
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;
     }
 }
Esempio n. 13
0
 function generate_layout($layout, $type, $one_col = false)
 {
     $this->remove_disabled_filters();
     $row_start = $row_end = $element_start = $element_end = $col_start = $col_end = '';
     $measures = array('split-half' => 0.5, 'split-one-third' => 0.33, 'split-two-thirds' => 0.66, 'split-one-fourth' => 0.25, 'split-three-fourths' => 0.75);
     if (defined('OP_LIVEEDITOR')) {
         if ($one_col && count($layout) == 0) {
             $layout = array(array('row_class' => 'row one-col cf ui-sortable', 'columns' => array(array('col_class' => 'one column cols', 'elements' => array())), 'children' => array(array('col_class' => 'one column cols', 'elements' => array()))));
         }
         $row_start = $one_col ? '' : '<div class="op-row-links"><div class="op-row-links-content"><a title="' . __('Copy Row', OP_SN) . '" href="#copy-row" class="copy-row"></a><a title="' . __('Edit Row Options', OP_SN) . '" href="#options" class="edit-row" id="row_options"></a><a title="' . __('Clone Row', OP_SN) . '" href="#clone-row" class="clone-row"></a><a href="#add-new-row" class="add-new-row"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add New Row', OP_SN) . '" /><span>' . __('Add New Row', OP_SN) . '</span></a><a title="' . __('Move Row', OP_SN) . '" href="#move" class="move-row"></a><a title="' . __('Paste Row', OP_SN) . '" href="#paste-row" class="paste-row"></a><a title="' . __('Delete Row', OP_SN) . '" href="#delete-row" class="delete-row"></a></div></div>';
         $row_end = '';
         $col_start = $subcol_start = '';
         //<div class="op-col-links"><a class="move-col" href="#move"><img alt="'.__('Move',OP_SN).'" src="'.OP_IMG.'move-icon.png" /></a></div>';
         $col_end = '<div class="element-container sort-disabled"></div><div class="add-element-container"><a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
         $element_start = '<div class="op-element-links"><a class="element-settings" href="#settings"><img alt="' . __('Edit Element', OP_SN) . '" title="' . __('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-clone" href="#clone-element"><img alt="' . esc_attr__('Clone Element', OP_SN) . '" title="' . esc_attr__('Clone Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div>';
         $element_end = '<div class="op-hidden"><textarea class="op-le-shortcode" name="shortcode[]">{element_str}</textarea></div>';
         $after_element = '<div class="element-container sort-disabled"></div><div class="add-element-container"><a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
     }
     $html = '';
     $pref = 'le_' . $type . '_row_';
     $rcounter = 1;
     $le = defined('OP_LIVEEDITOR');
     $clear = '';
     //check for default wordpress password protection
     global $post;
     if (!$le && post_password_required($post->ID)) {
         $html .= '<div class="row one-column cf ui-sortable"><div class="fixed-width">';
         $html .= get_the_password_form();
     } else {
         foreach ($layout as $row) {
             // generating new styles from row_data_styles!!!
             if (!empty($row['row_data_style'])) {
                 $rowStyle = base64_decode($row['row_data_style']);
                 $rowStyle = json_decode($rowStyle);
                 $row_style = $this->generateRowStyle($rowStyle);
             } else {
                 $row_style = '';
                 $rowStyle = '';
             }
             if (!isset($row['row_data_style'])) {
                 $row['row_data_style'] = '';
             }
             if (isset($rowStyle->codeBefore) and !empty($rowStyle->codeBefore)) {
                 if ($le) {
                     $html .= '<op-row-before class="op-row-code-before">' . htmlentities($rowStyle->codeBefore) . '</op-row-before>';
                 } else {
                     $html .= $rowStyle->codeBefore;
                     // $html .= do_shortcode($rowStyle->codeBefore);
                 }
             }
             $html .= '
                 <div ' . $row_style . ' class="' . $row['row_class'] . '" id="' . $pref . $rcounter . '" data-style="' . $row['row_data_style'] . '">';
             $html .= apply_filters('op_inside_row', $rowStyle);
             $html .= '
                     <div class="fixed-width">' . $row_start;
             $ccounter = 1;
             foreach ($row['children'] as $col) {
                 //do we split or not
                 switch ($col['col_class']) {
                     case 'one-half column cols':
                     case 'two-thirds column cols':
                     case 'two-fourths column cols':
                     case 'three-fourths column cols':
                     case 'three-fifths column cols':
                     case 'four-fifths column cols':
                         $td = substr($col['col_class'], 0, -12);
                         $splitColumns = '<a href="#' . $td . '" class="split-column"><img src="' . OP_IMG . 'live_editor/split_column.png" alt="Split Column" /></a>';
                         break;
                     default:
                         $splitColumns = '';
                         break;
                 }
                 if (is_admin()) {
                     $col_end = '<div class="element-container sort-disabled"></div><div class="add-element-container">' . $splitColumns . '<a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
                 }
                 $html .= '
                     <div class="' . $col['col_class'] . '" id="' . $pref . $rcounter . '_col_' . $ccounter . '">' . $col_start;
                 if (!empty($col['children']) and count($col['children'])) {
                     $ecounter = 1;
                     $elNumber = 1;
                     $subcolNumber = 100;
                     $subcolumn = false;
                     $nrChildren = count($col['children']);
                     $previous = '';
                     $subcounter = 0;
                     $fullWidth = 0;
                     foreach ($col['children'] as $child) {
                         $flag = false;
                         if ($child['type'] != $previous && $previous != '') {
                             $flag = true;
                         }
                         if ($ecounter == $nrChildren && $subcolumn === true && $child['type'] != 'element') {
                             $clear .= '<div class="clearcol"></div>';
                             $subcolumn = false;
                         } else {
                             $clear = '';
                         }
                         switch ($child['type']) {
                             case 'element':
                                 if ($subcolumn === true) {
                                     $html .= '<div class="clearcol"></div>';
                                     $subcolumn = false;
                                     $flag = false;
                                 }
                                 $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 0;
                                 $GLOBALS['OP_PARSED_SHORTCODE'] = '';
                                 $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array();
                                 $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = false;
                                 $sc = op_fix_embed_url_shortcodes(stripslashes($child['object']));
                                 // removing new line before shortcode entered in content
                                 // commented out if() was for testing - custom html element is not behaving properly with this on
                                 // if (strpos($sc, '[custom_html') === false) {
                                 $sc = str_replace(array("\n[", "\r[", "\r\n[", "\n\r["), array("[", "[", "[", "["), $sc);
                                 // }
                                 // getting and processing before and after elements
                                 $elemBefore = '';
                                 $elemAfter = '';
                                 if (empty($child['element_class'])) {
                                     $elClass = 'element-container cf';
                                 } else {
                                     $elClass = $child['element_class'];
                                 }
                                 if (!empty($child['element_data_style'])) {
                                     $elementStyle = base64_decode($child['element_data_style']);
                                     $elementStyle = json_decode($elementStyle);
                                     if (!empty($elementStyle->codeBefore)) {
                                         $elemBefore = $elementStyle->codeBefore;
                                     }
                                     if (!empty($elementStyle->codeAfter)) {
                                         $elemAfter = $elementStyle->codeAfter;
                                     }
                                     if (!empty($elementStyle->fadeIn)) {
                                         $data_fade = ' data-fade="' . $elementStyle->fadeIn . '" style="display:none;" ';
                                     } else {
                                         $data_fade = ' ';
                                     }
                                     $elementDataStyle = $child['element_data_style'];
                                 } else {
                                     $elemBefore = ' ';
                                     $elemAfter = ' ';
                                     $data_fade = ' ';
                                     $elementDataStyle = '';
                                 }
                                 if (strpos($sc, '[op_popup ') !== false) {
                                     $op_popup_present = true;
                                 } else {
                                     $op_popup_present = false;
                                 }
                                 // $html .= '<div class="'.$elClass.'"'.$data_fade.'data-style="'.$elementDataStyle.'" id="'.$pref.$rcounter.'_col_'.$ccounter.'_el_'.$elNumber.'">'.$element_start;
                                 $new_element_start = $element_start;
                                 if (preg_match('/' . op_shortcode_regex('op_liveeditor_elements') . '/s', $sc, $matches) || $op_popup_present) {
                                     $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = true;
                                     $sc = str_replace($matches[0], '#OP_CHILD_ELEMENTS#', $sc);
                                     $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 1;
                                     $child_data = op_page_parse_child_elements($matches[0]);
                                     $matches[0] = $child_data['liveeditorElements'];
                                     // $processed = apply_filters('the_content', $sc);
                                     $processed = op_process_content_filter($sc, true);
                                     $child_html = '';
                                     $child_element_nr = 0;
                                     // preg_match_all('/(<div class="row.*>)(.*)<\/div>/isU', $matches[0], $child_rows_result);
                                     preg_match_all('/(<div class="row.*>)(.*)\\[\\/op_liveeditor_element\\]/isU', $matches[0], $child_rows_result);
                                     foreach ($child_rows_result[2] as $result_row) {
                                         $result_row = $result_row . '[/op_liveeditor_element]';
                                         $child_html .= $child_rows_result[1][$child_element_nr] . op_process_content_filter($result_row) . '</div>';
                                         $child_element_nr += 1;
                                     }
                                     if ($op_popup_present) {
                                         $new_popup_elements = '';
                                         $new_popup_elements_sc = '';
                                         preg_match_all('/\\[op_popup_content_element[ d|\\]].*?\\[\\/op_popup_content_element\\]/is', $sc, $popup_elements);
                                         foreach ($popup_elements[0] as $popup_element) {
                                             $new_popup_elements_sc .= $popup_element;
                                             $popup_element = str_replace('[op_popup_content_element]', '[op_liveeditor_element]', $popup_element);
                                             $popup_element = str_replace('[/op_popup_content_element]', '[/op_liveeditor_element]', $popup_element);
                                             $popup_element = op_process_content_filter($popup_element, true);
                                             $new_popup_elements .= $popup_element;
                                         }
                                         //$new_popup_elements = '[op_liveeditor_elements]' . $new_popup_elements . '[/op_liveeditor_elements]';
                                         $new_popup_elements = '<div class="op-popup-content">' . $new_popup_elements . '</div>';
                                         $new_popup_elements .= op_process_content_filter('[op_liveeditor_elements][/op_liveeditor_elements]', true);
                                         $new_popup_elements = str_replace('$', '\\$', $new_popup_elements);
                                         $processed = preg_replace('/\\[op_popup_content[ d|\\]].*?\\[\\/op_popup_content\\]/is', $new_popup_elements, $sc);
                                         // Parse op_popup_button
                                         // preg_match_all('/\[op_popup_button\].*?\[\/op_popup_button\]/is', $sc, $new_popup_button);
                                         preg_match_all('/\\[op_popup_button\\].*?\\[\\/op_popup_button\\]/is', str_replace('$', '\\$', $sc), $new_popup_button);
                                         $new_popup_button = $new_popup_button[0][0];
                                         $new_popup_button = str_replace('[op_popup_button]', '', $new_popup_button);
                                         $new_popup_button = str_replace('[/op_popup_button]', '', $new_popup_button);
                                         $new_popup_button = op_process_content_filter($new_popup_button, true);
                                         $new_popup_button = '<div class="op-popup-button ' . $popup_button_class . '">' . $new_popup_button . '</div>';
                                         $processed = op_process_content_filter($processed, true);
                                         $new_popup_button = str_replace('$', '\\$', $new_popup_button);
                                         $processed = preg_replace('/\\[op_popup_button\\].*?\\[\\/op_popup_button\\]/is', $new_popup_button, $processed);
                                         // $processed = str_replace('[op_popup_button]', '<div class="op-popup-button ' . $popup_button_class . '">', $processed);
                                         // $processed = str_replace('[/op_popup_button]', '</div>', $processed);
                                         $processed .= $le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop('[op_popup_elements]' . $new_popup_elements_sc . '[/op_popup_elements]')) . '</textarea></div>' : '';
                                     }
                                     if (!$op_popup_present) {
                                         /**
                                          * At the end of child elements "add element" button must
                                          * be inserted, which is done by parsing [op_liveeditor_elements] shortcode
                                          */
                                         $child_html .= op_process_content_filter('[op_liveeditor_elements][/op_liveeditor_elements]', true);
                                         $child_html = op_process_asset_content($child_html) . ($le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop($matches[0])) . '</textarea></div>' : '');
                                         /*
                                          * $ needs to be escaped
                                          */
                                         $child_html = str_replace('$', '\\$', $child_html);
                                         $processed = preg_replace(array('{<p[^>]*>\\s*#OP_CHILD_ELEMENTS#\\s*<\\/p>}i', '{#OP_CHILD_ELEMENTS#}i'), $child_html, $processed);
                                     }
                                     if (defined('OP_LIVEEDITOR')) {
                                         $new_element_start = substr($element_start, 0, 30) . '<a class="element-parent-settings" href="#parent-settings"><img alt="' . __('Edit Parent Element', OP_SN) . '" title="' . __('Edit Parent Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a>' . substr($element_start, 30);
                                     }
                                 } else {
                                     $processed = op_process_content_filter($sc, true);
                                 }
                                 if (strpos($sc, '[op_popup ') !== false && defined('OP_LIVEEDITOR')) {
                                     $new_element_start = substr($element_start, 0, 30) . '<a class="element-parent-settings" href="#parent-settings"><img alt="' . __('Edit Parent Element', OP_SN) . '" title="' . __('Edit Parent Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a>' . substr($element_start, 30);
                                 }
                                 $html .= '<div class="' . $elClass . '"' . $data_fade . 'data-style="' . $elementDataStyle . '" id="' . $pref . $rcounter . '_col_' . $ccounter . '_el_' . $elNumber . '">' . $new_element_start;
                                 //$html .= $elemBefore .'<div class="element">' . $processed . '</div>' . $elemAfter;
                                 if (!is_admin()) {
                                     $content = do_shortcode($elemBefore . '###OP_ELEM_PROCESSED###' . $elemAfter);
                                     $content = str_replace('###OP_ELEM_PROCESSED###', $processed, $content);
                                 } else {
                                     $content = $elemBefore . $processed . $elemAfter;
                                 }
                                 // if (!is_admin() && !$op_popup_present) {
                                 // $content = do_shortcode($content);
                                 // }
                                 $html .= '<div class="element">' . $content . '</div>';
                                 if (isset($GLOBALS['OP_PARSED_SHORTCODE']) && !empty($GLOBALS['OP_PARSED_SHORTCODE'])) {
                                     $sc = $GLOBALS['OP_PARSED_SHORTCODE'];
                                 }
                                 $html .= str_replace('{element_str}', op_attr($sc), $element_end) . '</div>';
                                 if ($flag && $ecounter < $nrChildren) {
                                     $html .= $after_element;
                                 }
                                 $elNumber++;
                                 $previous = 'element';
                                 break;
                             case 'subcolumn':
                                 if ($previous == '') {
                                     $html .= $after_element;
                                 }
                                 if ($flag == true) {
                                     $html .= $after_element;
                                 }
                                 $temp = explode(' ', $child['subcol_class']);
                                 if (!$flag && ($fullWidth == 1 || $fullWidth == 0.99)) {
                                     $html .= '<div class="clearcol"></div>' . $after_element;
                                     $fullWidth = 0;
                                 }
                                 $subcolumn = true;
                                 $html .= '<div class="' . $child['subcol_class'] . '" id="' . $pref . $rcounter . '_col_' . $subcolNumber . '">' . $subcol_start;
                                 if (!empty($child['children']) and count($child['children']) > 0) {
                                     //elements
                                     $elNumber = 1;
                                     foreach ($child['children'] as $kid) {
                                         $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 0;
                                         $GLOBALS['OP_PARSED_SHORTCODE'] = '';
                                         $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array();
                                         $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = false;
                                         $sc = op_fix_embed_url_shortcodes(stripslashes($kid['object']));
                                         // removing new line before shortcode entered in content
                                         $sc = str_replace(array("\n[", "\r[", "\r\n[", "\n\r["), array("[", "[", "[", "["), $sc);
                                         // getting and processing before and after elements
                                         $elemBefore = '';
                                         $elemAfter = '';
                                         if (empty($kid['element_class'])) {
                                             $elClass = 'element-container cf';
                                         } else {
                                             $elClass = $kid['element_class'];
                                         }
                                         if (!empty($kid['element_data_style'])) {
                                             $elementStyle = base64_decode($kid['element_data_style']);
                                             $elementStyle = json_decode($elementStyle);
                                             if (!empty($elementStyle->codeBefore)) {
                                                 $elemBefore = $elementStyle->codeBefore;
                                             }
                                             if (!empty($elementStyle->codeAfter)) {
                                                 $elemAfter = $elementStyle->codeAfter;
                                             }
                                             if (!empty($elementStyle->fadeIn)) {
                                                 $data_fade = ' data-fade="' . $elementStyle->fadeIn . '" style="display:none;" ';
                                             } else {
                                                 $data_fade = '';
                                             }
                                             $elementDataStyle = $kid['element_data_style'];
                                         } else {
                                             $elemBefore = ' ';
                                             $elemAfter = ' ';
                                             $data_fade = ' ';
                                             $elementDataStyle = '';
                                         }
                                         if (strpos($sc, '[op_popup ') !== false) {
                                             $op_popup_present = true;
                                         } else {
                                             $op_popup_present = false;
                                         }
                                         // $html .= '<div class="'.$elClass.'"'.$data_fade.'data-style="'.$elementDataStyle.'" id="'.$pref.$rcounter.'_col_'.$subcolNumber.'_el_'.$elNumber.'">'.$element_start;
                                         $new_element_start = $element_start;
                                         if (preg_match('/' . op_shortcode_regex('op_liveeditor_elements') . '/s', $sc, $matches) || $op_popup_present) {
                                             $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = true;
                                             $sc = str_replace($matches[0], '#OP_CHILD_ELEMENTS#', $sc);
                                             $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 1;
                                             $child_data = op_page_parse_child_elements($matches[0]);
                                             $matches[0] = $child_data['liveeditorElements'];
                                             $processed = op_process_content_filter($sc, true);
                                             $child_html = '';
                                             $child_element_nr = 0;
                                             // preg_match_all('/(<div class="row.*>)(.*)<\/div>/isU', $matches[0], $child_rows_result);
                                             preg_match_all('/(<div class="row.*>)(.*)\\[\\/op_liveeditor_element\\]/isU', $matches[0], $child_rows_result);
                                             foreach ($child_rows_result[2] as $result_row) {
                                                 $result_row = $result_row . '[/op_liveeditor_element]';
                                                 $child_html .= $child_rows_result[1][$child_element_nr] . op_process_content_filter($result_row) . '</div>';
                                                 $child_element_nr += 1;
                                             }
                                             if ($op_popup_present) {
                                                 $new_popup_elements = '';
                                                 $new_popup_elements_sc = '';
                                                 preg_match_all('/\\[op_popup_content_element[ d|\\]].*?\\[\\/op_popup_content_element\\]/is', $sc, $popup_elements);
                                                 foreach ($popup_elements[0] as $popup_element) {
                                                     $new_popup_elements_sc .= $popup_element;
                                                     $popup_element = str_replace('[op_popup_content_element]', '[op_liveeditor_element]', $popup_element);
                                                     $popup_element = str_replace('[/op_popup_content_element]', '[/op_liveeditor_element]', $popup_element);
                                                     $popup_element = op_process_content_filter($popup_element, true);
                                                     $new_popup_elements .= $popup_element;
                                                 }
                                                 $new_popup_elements = str_replace('$', '\\$', $new_popup_elements);
                                                 $new_popup_elements = '<div class="op-popup-content">' . $new_popup_elements . '</div>';
                                                 $new_popup_elements .= op_process_content_filter('[op_liveeditor_elements][/op_liveeditor_elements]', true);
                                                 $processed = preg_replace('/\\[op_popup_content[ d|\\]].*?\\[\\/op_popup_content\\]/is', $new_popup_elements, $sc);
                                                 // Parse op_popup_button
                                                 // preg_match_all('/\[op_popup_button\].*?\[\/op_popup_button\]/is', $sc, $new_popup_button);
                                                 preg_match_all('/\\[op_popup_button\\].*?\\[\\/op_popup_button\\]/is', str_replace('$', '\\$', $sc), $new_popup_button);
                                                 $new_popup_button = $new_popup_button[0][0];
                                                 $new_popup_button = str_replace('[op_popup_button]', '', $new_popup_button);
                                                 $new_popup_button = str_replace('[/op_popup_button]', '', $new_popup_button);
                                                 $new_popup_button = op_process_content_filter($new_popup_button, true);
                                                 $new_popup_button = '<div class="op-popup-button ' . $popup_button_class . '">' . $new_popup_button . '</div>';
                                                 $processed = op_process_content_filter($processed, true);
                                                 $new_popup_button = str_replace('$', '\\$', $new_popup_button);
                                                 $processed = preg_replace('/\\[op_popup_button\\].*?\\[\\/op_popup_button\\]/is', $new_popup_button, $processed);
                                                 // $processed = str_replace('[op_popup_button]', '<div class="op-popup-button ' . $popup_button_class . '">', $processed);
                                                 // $processed = str_replace('[/op_popup_button]', '</div>', $processed);
                                                 $processed .= $le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop('[op_popup_elements]' . $new_popup_elements_sc . '[/op_popup_elements]')) . '</textarea></div>' : '';
                                             }
                                             if (!$op_popup_present) {
                                                 /**
                                                  * At the end of child elements "add element" button must
                                                  * be inserted, which is done by parsing [op_liveeditor_elements] shortcode
                                                  */
                                                 $child_html .= op_process_content_filter('[op_liveeditor_elements][/op_liveeditor_elements]', true);
                                                 $child_html = op_process_asset_content($child_html) . ($le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop($matches[0])) . '</textarea></div>' : '');
                                                 /*
                                                  * $ needs to be escaped
                                                  */
                                                 $child_html = str_replace('$', '\\$', $child_html);
                                                 $processed = preg_replace(array('{<p[^>]*>\\s*#OP_CHILD_ELEMENTS#\\s*<\\/p>}i', '{#OP_CHILD_ELEMENTS#}i'), $child_html, $processed);
                                             }
                                             if (defined('OP_LIVEEDITOR')) {
                                                 $new_element_start = substr($element_start, 0, 30) . '<a class="element-parent-settings" href="#parent-settings"><img alt="' . __('Edit Parent Element', OP_SN) . '" title="' . __('Edit Parent Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a>' . substr($element_start, 30);
                                             }
                                         } else {
                                             // $processed = apply_filters('the_content',$sc);
                                             $processed = op_process_content_filter($sc, true);
                                         }
                                         if (strpos($sc, '[op_popup ') !== false && defined('OP_LIVEEDITOR')) {
                                             $new_element_start = substr($element_start, 0, 30) . '<a class="element-parent-settings" href="#parent-settings"><img alt="' . __('Edit Parent Element', OP_SN) . '" title="' . __('Edit Parent Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a>' . substr($element_start, 30);
                                         }
                                         $html .= '<div class="' . $elClass . '"' . $data_fade . 'data-style="' . $elementDataStyle . '" id="' . $pref . $rcounter . '_col_' . $subcolNumber . '_el_' . $elNumber . '">' . $new_element_start;
                                         if (!is_admin()) {
                                             $content = do_shortcode($elemBefore . '###OP_ELEM_PROCESSED###' . $elemAfter);
                                             $content = str_replace('###OP_ELEM_PROCESSED###', $processed, $content);
                                         } else {
                                             $content = $elemBefore . $processed . $elemAfter;
                                         }
                                         // if (!is_admin()) {
                                         //     $content = do_shortcode($content);
                                         // }
                                         $html .= '<div class="element">' . $content . '</div>';
                                         if (isset($GLOBALS['OP_PARSED_SHORTCODE']) && !empty($GLOBALS['OP_PARSED_SHORTCODE'])) {
                                             $sc = $GLOBALS['OP_PARSED_SHORTCODE'];
                                         }
                                         $html .= str_replace('{element_str}', op_attr($sc), $element_end) . '</div>';
                                         $previous = 'element';
                                         $elNumber++;
                                     }
                                     $html .= $after_element;
                                     $subcolNumber++;
                                 } else {
                                     $html .= $after_element;
                                 }
                                 $html .= $subcol_end . '</div>';
                                 $next = next($child['children']);
                                 $html .= $clear;
                                 $previous = 'subcolumn';
                                 $subcounter++;
                                 $fullWidth += $measures[$temp[0]];
                                 break;
                         }
                         $ecounter++;
                     }
                 }
                 $ccounter++;
                 $html .= $col_end . '</div>';
             }
             $html .= $row_end . '</div></div>';
             if (isset($rowStyle->codeAfter) and !empty($rowStyle->codeAfter)) {
                 if ($le) {
                     $html .= '<op-row-after class="op-row-code-after">' . htmlentities($rowStyle->codeAfter) . '</op-row-after>';
                 } else {
                     $html .= $rowStyle->codeAfter;
                     // $html .= do_shortcode($rowStyle->codeAfter);
                 }
             }
             $rcounter++;
         }
         // end row foreach
     }
     // end else
     $this->revert_disabled_filters();
     // return normal content in LE, but parse shortcodes on frontend to deal with code before and after rows!
     if ($le) {
         return $html;
     } else {
         return do_shortcode($html);
     }
 }
Esempio n. 14
0
 /**
  * Checks GET vars for 'op_' prefixed parameters to fill the value
  * @author Luka Peharda <*****@*****.**>
  * @param  string $name
  * @return string
  */
 function getOptinUrlValue($name)
 {
     $value = op_get('op_' . strtolower($name));
     if (false !== $value) {
         $value = op_attr($value);
     } else {
         if ('FNAME' == $name) {
             $value = getOptinUrlValue('name');
         }
     }
     return $value;
 }
Esempio n. 15
0
        ?>
[form_html][email_extra_fields_order][]" value="<?php 
        echo op_attr($fields['email_extra_fields_order'][$i]);
        ?>
" />
                </div>
                <div class="form_html_field_required">
                    <label><?php 
        _e('Required', OP_SN);
        ?>
</label>
                    <input type="checkbox" name="<?php 
        echo $fieldname;
        ?>
[form_html][email_extra_fields_required][]" value="Y" <?php 
        checked(op_attr($fields['email_extra_fields_required'][$i]), 'Y');
        ?>
 />
                </div>
                <div class="op-multirow-controls">
                    <a href="#remove"><img alt="<?php 
        _e('Remove', OP_SN);
        ?>
" src="<?php 
        echo OP_IMG;
        ?>
remove-row.png" /></a>
                </div>
            </div>
		<?php 
        $i += 1;
Esempio n. 16
0
 function _get_presets_drop($current = 0)
 {
     global $wpdb;
     $preset_dropdown = '';
     $found = false;
     $presets = $wpdb->get_results("SELECT id,name FROM `{$wpdb->prefix}optimizepress_presets` ORDER BY name ASC");
     if ($presets) {
         foreach ($presets as $preset) {
             if ($current < 1) {
                 $current = $preset->id;
                 $found = true;
             } elseif ($current == $preset->id) {
                 $found = true;
             }
             $preset_dropdown .= '<option value="' . $preset->id . '"' . ($current == $preset->id ? ' selected="selected"' : '') . '>' . op_attr($preset->name) . '</option>';
         }
     }
     return $preset_dropdown;
 }
Esempio n. 17
0
    function display_settings($section_name, $config = array(), $return = false)
    {
        if (($items = $this->get_option($section_name)) === false) {
            $items = array();
        }
        $items = is_array($items) ? $items : array();
        $custom_css = op_default_option('custom_css');
        if (count($items) == 0) {
            if (empty($custom_css)) {
                $items[] = array('position' => 'header', 'script' => '');
            } else {
                $items[] = array('position' => 'css', 'script' => $custom_css);
            }
        }
        ?>
<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar">
    <div class="entry-content">
    	<p><?php 
        _e('Add any scripts, code or CSS to this page. If you are using external scripts, ensure you use the Header/Footer dropdown to place them in the correct position in the page code.', OP_SN);
        ?>
</p>
        <p><?php 
        _e('Code added here will not be rendered to pages in the LiveEditor so you will not see changes until you publish your page and view it live online.', OP_SN);
        ?>
</p>
		<?php 
        $id = 'op_' . $section_name . '_';
        $name = 'op[' . $section_name . ']';
        ?>
        <div class="op-multirow">
            <ul class="op-multirow-list">
            <?php 
        foreach ($items as $item) {
            ?>
				<li>
                	<select name="<?php 
            echo $name;
            ?>
[position][]">
                    	<option value="header"<?php 
            selected('header', $item['position']);
            ?>
><?php 
            _e('Header', OP_SN);
            ?>
</option>
                    	<option value="footer"<?php 
            selected('footer', $item['position']);
            ?>
><?php 
            _e('Footer', OP_SN);
            ?>
</option>
                    	<option value="css"<?php 
            selected('css', $item['position']);
            ?>
><?php 
            _e('Custom CSS', OP_SN);
            ?>
</option>
                    </select>
                    <textarea name="<?php 
            echo $name;
            ?>
[script][]" cols="40" rows="5"><?php 
            echo stripslashes($this->isBase64Encoded(op_attr($item['script'])));
            ?>
</textarea>
                    <div class="op-multirow-controls">
                        <a href="#move-up"><?php 
            _e('Move Up', OP_SN);
            ?>
</a> | <a href="#move-down"><?php 
            _e('Move Down', OP_SN);
            ?>
</a> | <a href="#remove"><?php 
            _e('Remove', OP_SN);
            ?>
</a>
                    </div>
                </li>
			<?php 
        }
        ?>
            </ul>
            <div class="clear"></div>
            <a href="#" class="add-new-row"><?php 
        _e('Add New', OP_SN);
        ?>
</a>
        </div>
    </div>
</div>
	<?php 
    }
Esempio n. 18
0
<h2><?php 
_e('Page URL/Permalink', 'optimizepress');
?>
</h2>
<p><?php 
printf(__('Customize your page permalink below. Please ensure your permalinks are set to %1$s in your %2$s.', 'optimizepress'), '/%postname%/', '<a href="options-permalink.php" target="_blank">' . __('Wordpress Permalinks Settings', 'optimizepress') . '</a>');
if ($error = $this->error('page_name')) {
    echo '<br><br><span class="error">' . $error . '</span>';
} elseif ($permalinks_disabled) {
    echo '<br><br><span class="error">' . __('You must enable permalinks in order for this to work.', 'optimizepress') . '</span>';
}
?>
</p>

<input type="text" name="op[page][slug]" id="op_page_slug" value="<?php 
echo op_attr($page_name);
?>
" />
<div id="op_ajax_checker">
    <a href="#check" class="check-availability"><?php 
_e('Check availability', 'optimizepress');
?>
</a>
    <a href="#cancel" class="op-hidden check-availability-cancel"><?php 
_e('Cancel', 'optimizepress');
?>
</a>
    <img class="op-bsw-waiting" src="images/wpspin_light.gif" alt="" style="position: relative; top: -5px;" />
    <!--<span class="success op-hidden"><?php 
_e('Valid Page URL', 'optimizepress');
?>
Esempio n. 19
0
 function liveeditor_elements($atts, $content = '')
 {
     $popup_child_element = false;
     if (strpos($content, 'op_popup_content_element') !== false) {
         $popup_child_element = true;
         $content = str_replace('[op_popup_content_element]', '', $content);
         $content = str_replace('[/op_popup_content_element]', '', $content);
     }
     $newcontent = $content;
     if (defined('OP_AJAX_SHORTCODE') && isset($GLOBALS['OP_LIVEEDITOR_DEPTH']) && $GLOBALS['OP_LIVEEDITOR_DEPTH'] === 1 && $GLOBALS['OP_ADD_ELEMENT_ROWS'] === true) {
         $mc = preg_match_all('/' . op_shortcode_regex('op_liveeditor_element') . '/s', $content, $matches);
         $new_content = '';
         if ($mc > 0) {
             for ($i = 0; $i < $mc; $i++) {
                 $sc = op_clean_shortcode_content($matches[5][$i]);
                 /*
                  * If it is one of the elements that can have children we'll show "parent settings" button
                  */
                 if (strpos($sc, 'feature_box') === 1 || strpos($sc, 'feature_box_creator') === 1 || strpos($sc, 'order_box') === 1 || strpos($sc, 'content_toggle') === 1 || strpos($sc, 'delayed_content') === 1 || strpos($sc, 'terms_conditions') === 1 || strpos($sc, 'op_popup')) {
                     $new_content .= '<div class="row element-container cf"><div class="op-element-links"><a class="element-parent-settings" href="#parent-settings"><img alt="' . esc_attr__('Edit Parent Element', OP_SN) . '" title="' . esc_attr__('Edit Parent Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-settings" href="#settings"><img alt="' . esc_attr__('Edit Element', OP_SN) . '" title="' . __('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-clone" href="#clone-element"><img alt="' . esc_attr__('Clone Element', OP_SN) . '" title="' . esc_attr__('Clone Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div><div class="element">' . op_do_shortcode($sc) . '</div><div class="op-hidden"><textarea class="op-le-child-shortcode" kz="des" name="shortcode[]">' . op_attr(trim(shortcode_unautop($sc))) . '</textarea></div></div>';
                 } else {
                     $m_child_data_style = '';
                     preg_match('/data-style="(.*?)"{1}/i', $matches[0][$i], $m_child_data_style);
                     $childDataStyle = '';
                     $childElemBefore = '';
                     $childElemAfter = '';
                     if ($m_child_data_style[1]) {
                         $childDataStyle = $m_child_data_style[1];
                         $childElementStyle = base64_decode($m_child_data_style[1]);
                         $childElementStyle = json_decode($childElementStyle);
                         if (!empty($childElementStyle->codeBefore)) {
                             $childElemBefore = $childElementStyle->codeBefore;
                         } else {
                             $childElemBefore = '';
                         }
                         if (!empty($childElementStyle->codeAfter)) {
                             $childElemAfter = $childElementStyle->codeAfter;
                         } else {
                             $childElemAfter = '';
                         }
                         if (!empty($childElementStyle->fadeIn)) {
                             $child_data_fade = ' data-fade="' . $childElementStyle->fadeIn . '"';
                             $child_data_fade .= defined('OP_LIVEEDITOR') ? '' : ' style="display:none;" ';
                         } else {
                             $child_data_fade = ' ';
                         }
                         if (!empty($childElementStyle->advancedClass)) {
                             $childAdvancedClass = $childElementStyle->advancedClass;
                         } else {
                             $childAdvancedClass = '';
                         }
                         $hideClasses = $childElementStyle->hideMobile ? ' hide-mobile' : '';
                         $hideClasses .= $childElementStyle->hideTablet ? ' hide-tablet' : '';
                     }
                     $sc_processed = op_do_shortcode($sc);
                     $sc_processed = $childElemBefore . $sc_processed . $childElemAfter;
                     if ($popup_child_element) {
                         $sc = '###OP_POPUP_CONTENT_CHILDREN###';
                     }
                     $new_content .= '<div class="row element-container cf ' . $childAdvancedClass . $hideClasses . '" data-style="' . $childDataStyle . '"' . $child_data_fade . '><div class="op-element-links"><a class="element-settings" href="#settings"><img alt="' . esc_attr__('Edit Element', OP_SN) . '" title="' . esc_attr__('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-clone" href="#clone-element"><img alt="' . esc_attr__('Clone Element', OP_SN) . '" title="' . esc_attr__('Clone Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div><div class="element">' . $sc_processed . '</div><div class="op-hidden"><textarea class="op-le-child-shortcode" dww="nm" name="shortcode[]">' . op_attr(trim(shortcode_unautop($sc))) . '</textarea></div></div>';
                 }
             }
         }
         return $new_content;
     }
     $newcontent = op_do_shortcode(op_clean_shortcode_content($content)) . (defined('OP_LIVEEDITOR') ? '<a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '"><span>' . __('Add Element', OP_SN) . '</span></a>' : '');
     return $newcontent;
 }
Esempio n. 20
0
 function save_launch_suite()
 {
     global $wpdb;
     add_filter(OP_SN . '-script-localize', array($this, 'localize'));
     $funnel_dropdown = '';
     $current = intval(op_get('funnel_id'));
     $found = false;
     $funnels = $wpdb->get_results("SELECT id,title FROM `{$wpdb->prefix}optimizepress_launchfunnels` ORDER BY title ASC");
     $funnel_count = 0;
     if ($funnels) {
         $funnel_count = count($funnels);
         foreach ($funnels as $funnel) {
             if ($current < 1) {
                 $current = $funnel->id;
                 $found = true;
             } elseif ($current == $funnel->id) {
                 $found = true;
             }
             $funnel_dropdown .= '<option value="' . $funnel->id . '"' . ($current == $funnel->id ? ' selected="selected"' : '') . '>' . op_attr($funnel->title) . '</option>';
         }
     }
     $this->funnel_count = $funnel_count;
     $this->funnel_dropdown = $funnel_dropdown;
     if ($found) {
         define('OP_LAUNCH_FUNNEL', $current);
     }
     $this->data['settings_sections'] = array('gateway_key' => __('Funnel Gateway Key', OP_SN), 'perpetual_launch' => __('Perpetual/Evergreen Launch Mode', OP_SN), 'redirect_all' => __('Redirect All Launch Pages', OP_SN), 'hide_coming_soon' => __('Hide Coming Soon Placeholders', OP_SN));
     $this->data['settings_sections'] = apply_filters('op_launch_suite_settings_sections', $this->data['settings_sections']);
     if ($found && isset($_POST[OP_SN . '_launch_suite'])) {
         if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'op_launch_suite')) {
             $op = op_post('op');
             foreach ($this->data['settings_sections'] as $name => $section) {
                 if (is_array($section)) {
                     if (isset($section['save_action'])) {
                         call_user_func($section['save_action'], op_get_var($op, $name));
                     }
                 } else {
                     call_user_func(array($this, '_save_' . $name), op_get_var($op, $name));
                 }
             }
             $funnel_pages = array('sales' => array(), 'stages' => array());
             $used_ids = array();
             $page_ids = array('sales' => 0, 'stages' => array());
             if (isset($op['funnel_pages'])) {
                 if (isset($op['funnel_pages']['sales'])) {
                     $options = array('page_setup' => array('open_sales_cart', 'sales_page', 'hide_cart'), 'page_thumbnails' => array('active_thumbnail', 'inactive_thumbnail'), 'navigation' => array('active_link_text', 'inactive_link_text'));
                     if (isset($op['funnel_pages']['sales']['page_setup']) && ($page_id = op_get_var($op['funnel_pages']['sales']['page_setup'], 'sales_page', 0)) > 0) {
                         foreach ($options as $section => $fields) {
                             $conf = op_get_var($op['funnel_pages']['sales'], $section);
                             if ($section == 'page_setup') {
                                 $page_ids['sales'] = op_get_var($conf, 'sales_page', 0);
                                 if ($page_ids['sales'] > 0) {
                                     $used_ids[$page_ids['sales']] = true;
                                     $funnel_pages['sales']['sales_page'] = $page_ids['sales'];
                                     op_update_page_id_option($page_ids['sales'], array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'sales')));
                                 }
                             }
                             $tmp = array();
                             foreach ($fields as $field) {
                                 $tmp[$field] = op_get_var($conf, $field);
                             }
                             $funnel_pages['sales'][$section] = $tmp;
                         }
                     }
                 }
                 if (empty($funnel_pages['sales'])) {
                     $funnel_pages['sales'] = $op['funnel_pages']['sales'];
                 }
                 if (isset($op['funnel_pages']['stage'])) {
                     $options = array('page_setup' => array('value_page'), 'page_thumbnails' => array('active_thumbnail', 'inactive_thumbnail'), 'navigation' => array('active_link_text', 'inactive_link_text'), 'publish_stage' => array('publish'));
                     if ($this->is_key_on) {
                         array_unshift($options['page_setup'], 'landing_page');
                     }
                     if (isset($op['funnel_pages']['stage']) && is_array($op['funnel_pages']['stage'])) {
                         $count = count(op_get_var($op['funnel_pages']['stage']['page_setup'], 'landing_page', array()));
                         $configs = array('page_setup' => op_get_var($op['funnel_pages']['stage'], 'page_setup', array()), 'page_thumbnails' => op_get_var($op['funnel_pages']['stage'], 'page_thumbnails', array()), 'navigation' => op_get_var($op['funnel_pages']['stage'], 'navigation', array()), 'publish_stage' => op_get_var($op['funnel_pages']['stage'], 'publish_stage', array()));
                         for ($i = 0; $i < $count; $i++) {
                             $stage = array();
                             $pg_ids = array();
                             foreach ($options as $section => $fields) {
                                 $stage[$section] = array();
                                 foreach ($fields as $field) {
                                     $stage[$section][$field] = op_get_var(op_get_var($configs[$section], $field, array()), $i);
                                     if ($field == 'active_link_text' && empty($stage[$section]['active_link_text'])) {
                                         $stage[$section]['active_link_text'] = get_the_title(op_get_var($stage, 'value_page'));
                                     } elseif ($field == 'inactive_link_text' && empty($stage[$section]['inactive_link_text'])) {
                                         $stage[$section]['inactive_link_text'] = 'Coming Soon';
                                     }
                                     if ($field == 'landing_page' || $field == 'value_page') {
                                         $pg_ids[$field] = $stage[$section][$field];
                                         $stage[$field] = $pg_ids[$field];
                                         if ($pg_ids[$field] > 0) {
                                             $used_ids[$pg_ids[$field]] = true;
                                             op_update_page_id_option($pg_ids[$field], array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'stage', 'stage_idx' => $i, 'type' => $field)));
                                         }
                                     }
                                 }
                             }
                             $funnel_pages['stages'][] = $stage;
                             $page_ids['stages'][] = $pg_ids;
                         }
                     }
                 }
             }
             op_launch_update_option('funnel_pages', $funnel_pages);
             op_launch_update_option('page_ids', $page_ids);
             $funnel_pages = $wpdb->get_results($wpdb->prepare("SELECT page_id FROM `{$wpdb->prefix}optimizepress_launchfunnels_pages` WHERE funnel_id=%s", OP_LAUNCH_FUNNEL));
             if ($funnel_pages) {
                 $pages = array();
                 foreach ($funnel_pages as $page) {
                     if (!isset($used_ids[$page->page_id])) {
                         op_update_page_id_option($page->page_id, array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'stage', 'stage_idx' => -1, 'type' => '')));
                     }
                 }
             }
             if (op_has_error()) {
                 $this->error = __('There was a problem processing the form, please review the errors below', OP_SN);
             } else {
                 $this->notification = __('Your launch suite settings have been updated.', OP_SN);
             }
         } else {
             $this->error = __('Verification failed, please refresh the page and try again.', OP_SN);
         }
     }
 }
Esempio n. 21
0
<?php

include 'style.inc.php';
?>

<ul id="<?php 
echo $id;
?>
" data-counter="false" class="social-sharing social-sharing-style-10">
    <li class="twitter" data-url="<?php 
echo $tw_url;
?>
"<?php 
echo !empty($tw_text) ? ' data-title="' . ucfirst($tw_text) . '"' : '';
echo $tw_name != '' ? ' data-via="' . op_attr($tw_name) . '"' : '';
?>
 data-lang="<?php 
echo $tw_lang;
?>
"></li>
    <li class="facebook" data-url="<?php 
echo $fb_like_url;
?>
"<?php 
echo !empty($fb_text) ? ' data-title="' . ucfirst($fb_text) . '"' : '';
?>
></li>
    <li class="googlePlus" data-url="<?php 
echo $g_url;
?>
"<?php 
Esempio n. 22
0
</strong></label><br />
        <div class="op-multirow-container cf">
        <?php 
if (is_array($fields['email_extra_fields'])) {
    foreach ($fields['email_extra_fields'] as $item) {
        ?>
			<div class="op-multirow cf">
            	<label><?php 
        _e('Text', OP_SN);
        ?>
</label>
                <input type="text" name="<?php 
        echo $fieldname;
        ?>
[form_html][email_extra_fields][]" value="<?php 
        echo op_attr($item);
        ?>
" />
                <div class="op-multirow-controls">
                    <a href="#remove"><img alt="<?php 
        _e('Remove', OP_SN);
        ?>
" src="<?php 
        echo OP_IMG;
        ?>
remove-row.png" /></a>
                </div>
            </div>
		<?php 
    }
}
Esempio n. 23
0
    function generate_layout($layout, $type, $one_col = false)
    {
        $this->remove_disabled_filters();
        $row_start = $row_end = $element_start = $element_end = $col_start = $col_end = '';
        $measures = array('split-half' => 0.5, 'split-one-third' => 0.33, 'split-two-thirds' => 0.66, 'split-one-fourth' => 0.25, 'split-three-fourths' => 0.75);
        if (defined('OP_LIVEEDITOR')) {
            if ($one_col && count($layout) == 0) {
                $layout = array(array('row_class' => 'row one-col cf ui-sortable', 'columns' => array(array('col_class' => 'one column cols', 'elements' => array()))));
            }
            $row_start = $one_col ? '' : '<div class="op-row-links"><a href="#options" class="edit-row" id="row_options"></a><a href="#move" class="move-row"></a><a href="#add-new-row" class="add-new-row"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add New Row', OP_SN) . '" /><span>' . __('Add New Row', OP_SN) . '</span></a><a href="#delete-row" class="delete-row"></a></div>';
            $row_end = '';
            $col_start = $subcol_start = '';
            //<div class="op-col-links"><a class="move-col" href="#move"><img alt="'.__('Move',OP_SN).'" src="'.OP_IMG.'move-icon.png" /></a></div>';
            $col_end = '<div class="element-container sort-disabled"></div><div class="add-element-container"><a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
            $element_start = '<div class="op-element-links"><a class="element-settings" href="#settings"><img alt="' . __('Edit Element', OP_SN) . '" title="' . __('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div>';
            $element_end = '<div class="op-hidden"><textarea class="op-le-shortcode" name="shortcode[]">{element_str}</textarea></div>';
            $after_element = '<div class="element-container sort-disabled"></div><div class="add-element-container"><a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
        }
        $html = '';
        $pref = 'le_' . $type . '_row_';
        $rcounter = 1;
        $le = defined('OP_LIVEEDITOR');
        foreach ($layout as $row) {
            /*if (!empty($row['row_style'])) {
            			$row_style = "style='" . stripslashes($row['row_style']) . "' ";
            		} else {
            			$row_style = '';
            		}*/
            // generating new styles from row_data_styles!!!
            if (!empty($row['row_data_style'])) {
                $rowStyle = base64_decode($row['row_data_style']);
                $rowStyle = json_decode($rowStyle);
                $row_style = $this->generateRowStyle($rowStyle);
            } else {
                $row_style = '';
            }
            if (!isset($row['row_data_style'])) {
                $row['row_data_style'] = '';
            }
            $html .= '
<div ' . $row_style . ' class="' . $row['row_class'] . '" id="' . $pref . $rcounter . '" data-style="' . $row['row_data_style'] . '"><div class="fixed-width">' . $row_start;
            $ccounter = 1;
            foreach ($row['children'] as $col) {
                //do we split or not
                switch ($col['col_class']) {
                    case 'one-half column cols':
                    case 'two-thirds column cols':
                    case 'two-fourths column cols':
                    case 'three-fourths column cols':
                    case 'three-fifths column cols':
                    case 'four-fifths column cols':
                        $td = substr($col['col_class'], 0, -12);
                        $splitColumns = '<a href="#' . $td . '" class="split-column"><img src="' . OP_IMG . 'live_editor/split_column.png" alt="Split Column" /></a>';
                        break;
                    default:
                        $splitColumns = '';
                        break;
                }
                if (is_admin()) {
                    $col_end = '<div class="element-container sort-disabled"></div><div class="add-element-container">' . $splitColumns . '<a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '" /><span>' . __('Add Element', OP_SN) . '</span></a></div>';
                }
                $html .= '
	<div class="' . $col['col_class'] . '" id="' . $pref . $rcounter . '_col_' . $ccounter . '">' . $col_start;
                if (!empty($col['children']) and count($col['children'])) {
                    $ecounter = 1;
                    $elNumber = 1;
                    $subcolNumber = 100;
                    $subcolumn = false;
                    $nrChildren = count($col['children']);
                    $previous = '';
                    $subcounter = 0;
                    $fullWidth = 0;
                    foreach ($col['children'] as $child) {
                        $flag = false;
                        if ($child['type'] != $previous && $previous != '') {
                            $flag = true;
                        }
                        if ($ecounter == $nrChildren && $subcolumn === true && $child['type'] != 'element') {
                            $clear .= '<div class="clearcol"></div>';
                            $subcolumn = false;
                        } else {
                            $clear = '';
                        }
                        switch ($child['type']) {
                            case 'element':
                                if ($subcolumn === true) {
                                    $html .= '<div class="clearcol"></div>';
                                    $subcolumn = false;
                                    $flag = false;
                                }
                                $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 0;
                                $GLOBALS['OP_PARSED_SHORTCODE'] = '';
                                $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array();
                                $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = false;
                                $sc = op_fix_embed_url_shortcodes(stripslashes($child['object']));
                                // getting and processing before and after elements
                                $elemBefore = '';
                                $elemAfter = '';
                                if (empty($child['element_class'])) {
                                    $elClass = 'element-container cf';
                                } else {
                                    $elClass = $child['element_class'];
                                }
                                if (!empty($child['element_data_style'])) {
                                    $elementStyle = base64_decode($child['element_data_style']);
                                    $elementStyle = json_decode($elementStyle);
                                    if (!empty($elementStyle->codeBefore)) {
                                        $elemBefore = $elementStyle->codeBefore;
                                    }
                                    if (!empty($elementStyle->codeAfter)) {
                                        $elemAfter = $elementStyle->codeAfter;
                                    }
                                    if (!empty($elementStyle->fadeIn)) {
                                        $data_fade = ' data-fade="' . $elementStyle->fadeIn . '" ';
                                    } else {
                                        $data_fade = ' ';
                                    }
                                    $elementDataStyle = $child['element_data_style'];
                                } else {
                                    $elemBefore = ' ';
                                    $elemAfter = ' ';
                                    $data_fade = ' ';
                                    $elementDataStyle = '';
                                }
                                $html .= '<div class="' . $elClass . '"' . $data_fade . 'data-style="' . $elementDataStyle . '" id="' . $pref . $rcounter . '_col_' . $ccounter . '_el_' . $elNumber . '">' . $element_start;
                                if (preg_match('/' . op_shortcode_regex('op_liveeditor_elements') . '/s', $sc, $matches)) {
                                    $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = true;
                                    $sc = str_replace($matches[0], '#OP_CHILD_ELEMENTS#', $sc);
                                    $processed = apply_filters('the_content', $sc);
                                    $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 1;
                                    $child_html = op_process_asset_content(apply_filters('the_content', $matches[0])) . ($le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop($matches[0])) . '</textarea></div>' : '');
                                    $processed = preg_replace(array('{<p[^>]*>\\s*#OP_CHILD_ELEMENTS#\\s*<\\/p>}i', '{#OP_CHILD_ELEMENTS#}i'), $child_html, $processed);
                                } else {
                                    $processed = apply_filters('the_content', $sc);
                                }
                                //$html .= $elemBefore .'<div class="element">' . $processed . '</div>' . $elemAfter;
                                $content = $elemBefore . $processed . $elemAfter;
                                if (!is_admin()) {
                                    $content = do_shortcode($content);
                                }
                                $html .= '<div class="element">' . $content . '</div>';
                                if (isset($GLOBALS['OP_PARSED_SHORTCODE']) && !empty($GLOBALS['OP_PARSED_SHORTCODE'])) {
                                    $sc = $GLOBALS['OP_PARSED_SHORTCODE'];
                                }
                                $html .= str_replace('{element_str}', op_attr($sc), $element_end) . '</div>';
                                if ($flag && $ecounter < $nrChildren) {
                                    $html .= $after_element;
                                }
                                $elNumber++;
                                $previous = 'element';
                                break;
                            case 'subcolumn':
                                if ($previous == '') {
                                    $html .= $after_element;
                                }
                                if ($flag == true) {
                                    $html .= $after_element;
                                }
                                $temp = explode(' ', $child['subcol_class']);
                                if (!$flag && ($fullWidth == 1 || $fullWidth == 0.99)) {
                                    $html .= '<div class="clearcol"></div>' . $after_element;
                                    $fullWidth = 0;
                                }
                                $subcolumn = true;
                                $html .= '<div class="' . $child['subcol_class'] . '" id="' . $pref . $rcounter . '_col_' . $subcolNumber . '">' . $subcol_start;
                                if (!empty($child['children']) and count($child['children']) > 0) {
                                    //elements
                                    $elNumber = 1;
                                    foreach ($child['children'] as $kid) {
                                        $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 0;
                                        $GLOBALS['OP_PARSED_SHORTCODE'] = '';
                                        $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = array();
                                        $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = false;
                                        $sc = op_fix_embed_url_shortcodes(stripslashes($kid['object']));
                                        // getting and processing before and after elements
                                        $elemBefore = '';
                                        $elemAfter = '';
                                        if (empty($kid['element_class'])) {
                                            $elClass = 'element-container cf';
                                        } else {
                                            $elClass = $kid['element_class'];
                                        }
                                        if (!empty($kid['element_data_style'])) {
                                            $elementStyle = base64_decode($kid['element_data_style']);
                                            $elementStyle = json_decode($elementStyle);
                                            if (!empty($elementStyle->codeBefore)) {
                                                $elemBefore = $elementStyle->codeBefore;
                                            }
                                            if (!empty($elementStyle->codeAfter)) {
                                                $elemAfter = $elementStyle->codeAfter;
                                            }
                                            if (!empty($elementStyle->fadeIn)) {
                                                $data_fade = ' data-fade="' . $elementStyle->fadeIn . '" ';
                                            } else {
                                                $data_fade = '';
                                            }
                                            $elementDataStyle = $kid['element_data_style'];
                                        } else {
                                            $elemBefore = ' ';
                                            $elemAfter = ' ';
                                            $data_fade = ' ';
                                            $elementDataStyle = '';
                                        }
                                        $html .= '<div class="' . $elClass . '"' . $data_fade . 'data-style="' . $elementDataStyle . '" id="' . $pref . $rcounter . '_col_' . $subcolNumber . '_el_' . $elNumber . '">' . $element_start;
                                        if (preg_match('/' . op_shortcode_regex('op_liveeditor_elements') . '/s', $sc, $matches)) {
                                            $GLOBALS['OP_LIVEEDITOR_DISABLE_NEW'] = true;
                                            $sc = str_replace($matches[0], '#OP_CHILD_ELEMENTS#', $sc);
                                            $processed = apply_filters('the_content', $sc);
                                            $GLOBALS['OP_LIVEEDITOR_DEPTH'] = 1;
                                            $child_html = op_process_asset_content(apply_filters('the_content', $matches[0])) . ($le ? '<div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(shortcode_unautop($matches[0])) . '</textarea></div>' : '');
                                            $processed = preg_replace(array('{<p[^>]*>\\s*#OP_CHILD_ELEMENTS#\\s*<\\/p>}i', '{#OP_CHILD_ELEMENTS#}i'), $child_html, $processed);
                                        } else {
                                            $processed = apply_filters('the_content', $sc);
                                        }
                                        //$html .= $elemBefore .'<div class="element">' . $processed . '</div>' . $elemAfter;
                                        $content = $elemBefore . $processed . $elemAfter;
                                        if (!is_admin()) {
                                            $content = do_shortcode($content);
                                        }
                                        $html .= '<div class="element">' . $content . '</div>';
                                        if (isset($GLOBALS['OP_PARSED_SHORTCODE']) && !empty($GLOBALS['OP_PARSED_SHORTCODE'])) {
                                            $sc = $GLOBALS['OP_PARSED_SHORTCODE'];
                                        }
                                        $html .= str_replace('{element_str}', op_attr($sc), $element_end) . '</div>';
                                        $previous = 'element';
                                        $elNumber++;
                                    }
                                    $html .= $after_element;
                                    $subcolNumber++;
                                } else {
                                    $html .= $after_element;
                                }
                                $html .= $subcol_end . '</div>';
                                $next = next($child['children']);
                                $html .= $clear;
                                $previous = 'subcolumn';
                                $subcounter++;
                                $fullWidth += $measures[$temp[0]];
                                break;
                        }
                        $ecounter++;
                    }
                }
                $ccounter++;
                $html .= $col_end . '</div>';
            }
            $html .= $row_end . '</div></div>';
            $rcounter++;
        }
        $this->revert_disabled_filters();
        return $html;
    }
Esempio n. 24
0
?>
    </select>
</div>
<div class="button-option-style button-option-style-1 button-option-style-3">
    <label class="form-title"><?php 
_e('Text', 'optimizepress');
?>
</label>
    <input type="text" name="<?php 
echo $fieldname;
?>
[button][content]" id="<?php 
echo $id;
?>
button_content" value="<?php 
op_attr(op_get_var($button, 'content'), true);
?>
" />
</div>
<div class="button-option-style button-option-style-2">
    <label class="form-title"><?php 
_e('Text', 'optimizepress');
?>
</label>
    <?php 
echo _op_assets('image_selector', array('group' => 'core', 'tag' => 'button', 'folder' => 'button-text-blue', 'fieldid' => $id . 'button_text_2'), $fieldname . '[button][text_2]', op_get_var($button, 'text_2'));
?>
</div>
<div class="button-option-style button-option-style-4">
    <div class="op-type-switcher-container">
        <label class="form-title"><?php 
Esempio n. 25
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. 26
0
        ?>
[form_html][email_extra_fields_order][]" value="<?php 
        echo isset($fields['email_extra_fields_order'][$i]) ? op_attr($fields['email_extra_fields_order'][$i]) : '0';
        ?>
" />
                </div>
                <div class="form_html_field_required">
                    <label><?php 
        _e('Required', 'optimizepress');
        ?>
</label>
                    <input type="checkbox" name="<?php 
        echo $fieldname;
        ?>
[form_html][email_extra_fields_required][]" value="Y" <?php 
        checked(isset($fields['email_extra_fields_required'][$i]) ? op_attr($fields['email_extra_fields_required'][$i]) : 'N', 'Y');
        ?>
 />
                </div>
                <div class="op-multirow-controls">
                    <a href="#remove"><img alt="<?php 
        _e('Remove', 'optimizepress');
        ?>
" src="<?php 
        echo OP_IMG;
        ?>
remove-row.png" /></a>
                </div>
            </div>
        <?php 
        $i += 1;