예제 #1
0
 /**
  * shortcode parsing of membership order button element
  * @param array $atts
  * @param string $content
  * @return String
  */
 static function membership_order_button($atts, $content)
 {
     // Decode encoded chars
     $atts = op_urldecode($atts);
     self::$used_items['membership_order_button'] = true;
     $domain = str_replace('http://', '', home_url());
     $domain = str_replace('https://', '', home_url());
     $temp = parse_url(home_url());
     $domain = $temp['host'];
     extract($atts);
     switch ($gateway) {
         case 'alipay':
             $temp = explode('-', $one_time);
             $output = '[optimizeMember-Pro-AliPay-Button level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" custom="' . $domain . '" ra="' . $want_to_charge . '" rp="' . $temp[0] . '" rt="' . $temp[1] . '" image="default" output="anchor"]' . do_shortcode($content) . '[/optimizeMember-Pro-AliPay-Button]';
             break;
         case 'authnet':
             $temp = explode('-', $one_time_auth);
             if (empty($first)) {
                 $at = 0;
                 $first = 0;
             }
             if ($temp[2] == 'BN') {
                 $at = 0;
                 $first = 0;
             }
             $output = '[optimizeMember-Pro-AuthNet-Form level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" cc="USD" custom="' . $domain . '" ta="' . $at . '" tp="' . $first . '" tt="' . $days . '" ra="' . $want_to_charge . '" rp="' . $temp[0] . '" rt="' . $temp[1] . '" rr="' . $temp[2] . '" rrt="" accept="visa,mastercard,amex,discover" coupon="" accept_coupons="0" default_country_code="US" captcha="0"]' . do_shortcode($content) . '[/optimizeMember-Pro-AuthNet-Form]';
             break;
         case 'ccbill':
             $temp = explode('-', $one_time_cc);
             if (empty($first)) {
                 $at_cc = 0;
                 $first_cc = 0;
             }
             if ($temp[2] == '0') {
                 $at_cc = 0;
                 $first_cc = 0;
             }
             $output = '[optimizeMembecustomo-ccBill-Button level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" cc="' . $currency_cc . '" custom="' . $domain . '" ta="' . $at_cc . '" tp="' . $first_cc . '" tt="' . $days_cc . '" ra="' . $want_to_charge_cc . '" rp="' . $temp[0] . '" rt="' . $temp['1'] . '" rr="' . $temp[2] . '" image="default" output="anchor"]' . do_shortcode($content) . '[/optimizeMember-Pro-ccBill-Button]';
             break;
         case 'google':
             $temp = explode('-', $one_time_auth);
             if (empty($first)) {
                 $at = 0;
                 $first = 0;
             }
             if ($temp[2] == 'BN') {
                 $at = 0;
                 $first = 0;
             }
             $output = '[optimizeMember-Pro-Google-Button level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" cc="' . $currency_new . '" custom="' . $domain . '" ta="' . $at . '" tp="' . $first . '" tt="' . $days . '" ra="' . $want_to_charge . '" rp="' . $temp[0] . '" rt="' . $temp[1] . '" rr="' . $temp[2] . '" image="default" output="anchor"]' . do_shortcode($content) . '[/optimizeMember-Pro-Google-Button]';
             break;
         case 'paypal':
             $temp = explode('-', $one_time_auth);
             if (empty($first)) {
                 $at = 0;
                 $first = 0;
             }
             if ($temp[2] == 'BN') {
                 $at = 0;
                 $first = 0;
             }
             if (!empty($success_url)) {
                 $success = ' success="' . $success_url . '"';
             } else {
                 $success = '';
             }
             $output = '[optimizeMember-PayPal-Button level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" ps="' . $page_style . '" lc="" cc="' . $currency_new . '" dg="0" ns="1" custom="' . $domain . '" ta="' . $at . '" tp="' . $first . '" tt="' . $days . '" ra="' . $want_to_charge . '" rp="' . $temp[0] . '" rt="' . $temp[1] . '" rr="' . $temp[2] . '" rrt="" rra="1" ' . $success . ' image="default" output="button"]' . do_shortcode($content) . '[/optimizeMember-PayPal-Button]';
             break;
         case 'clickbank':
             if ($click_product_type == 'standard') {
                 $temp = explode('-', $one_time_clickbank);
                 $click_trial_period = '0';
                 $rr = '0';
                 $temp2[0] = '0';
                 $temp2[1] = 'D';
             } else {
                 $temp = explode('-', $click_rebill);
                 $temp2 = explode('-', $click_trial_period);
                 $rr = '1';
             }
             $output = '[optimizeMember-Pro-ClickBank-Button cbp="' . $click_product_item . '" level="' . $level . '" ccaps="' . $ccaps . '" desc="' . $description . '" custom="' . $domain . '" tp="' . $temp2[0] . '" tt="' . $temp2[1] . '" rp="' . $temp[0] . '" rt="' . $temp[1] . '" rr="' . $rr . '" image="default" output="anchor" cbskin="' . $click_skin . '"  cbfid="' . $click_fid . '"  cbur="' . $click_ur . '"  cbf="' . $click_f . '"]' . do_shortcode($content) . '[/optimizeMember-Pro-ClickBank-Button]';
             break;
     }
     //die($output);
     $output = str_replace('$', '\\$', $output);
     return do_shortcode($output);
 }
예제 #2
0
 static function op_popup($atts, $content = '')
 {
     // Decode encoded chars
     $atts = op_urldecode($atts);
     //Extract the attributes into variables
     extract(shortcode_atts(array('style' => '1', 'title' => '', 'letter_spacing' => '', 'width' => '', 'top_margin' => '', 'bottom_margin' => '', 'top_padding' => '', 'bottom_padding' => '', 'left_padding' => '', 'right_padding' => '', 'alignment' => '', 'popup_width' => '700', 'popup_open_effect' => 'fade', 'popup_close_effect' => 'fade', 'popup_open_speed' => 'normal', 'popup_close_speed' => 'normal', 'popup_border_size' => '0', 'popup_border_color' => '#ffffff', 'popup_padding_top' => '20', 'popup_padding_bottom' => '20', 'popup_padding_left' => '30', 'popup_padding_right' => '30', 'pop_exit_intent' => 'N', 'pop_trigger_time' => '0', 'pop_trigger_dontshow' => '0', 'pop_dont_show_on_tablet' => '0', 'pop_dont_show_on_mobile' => '0', 'popup_id' => '0'), $atts));
     //Set up font
     $font = op_asset_font_style($atts, 'content_font_');
     $original_font_str = $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = !empty($font) ? array('elements' => array('p', 'a'), 'style_str' => $font) : $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     //Set the temporary asset tag to the feature box
     // self::$temp_tag = 'op_popup';
     //Get content
     $args = func_get_args();
     //Get the content for adding an element field
     $content = call_user_func_array(array('OptimizePress_Default_Assets', '_add_element_field'), $args);
     //Process content from above
     $content = op_process_asset_content($content);
     //Set the font back to the original string
     $GLOBALS['OP_LIVEEDITOR_FONT_STR'] = $GLOBALS['OP_LIVEEDITOR_DEPTH'] == 1 ? $original_font_str : $GLOBALS['OP_LIVEEDITOR_FONT_STR'];
     //Init the block style variable
     $block_style = '';
     //Set up attributes for the asset
     $chks = array('width' => 'width', 'top_margin' => 'margin-top', 'bottom_margin' => 'margin-bottom');
     //Loop through each attribute
     foreach ($chks as $chk => $prob) {
         //Add attribute to the block style string
         $block_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : '';
     }
     //Add the style HTML attribute if we have styles in the block style string
     $block_style = !empty($block_style) ? ' style=\'' . $block_style . '\'' : $block_style;
     //Init the content style string
     $content_style = '';
     //Init the attributes for the content styling
     $chks = array('top_padding' => 'padding-top', 'bottom_padding' => 'padding-bottom', 'left_padding' => 'padding-left', 'right_padding' => ' padding-right');
     //Loop through each attribute
     foreach ($chks as $chk => $prob) {
         //Add attribute to the content style string
         $content_style .= !empty_allow_zero(${$chk}) ? $prob . ': ' . ${$chk} . 'px;' : '';
     }
     //Add font to content style string
     $content_style .= $font;
     //Add the style HTML attribute if we have styles in the content style string
     $content_style = !empty($content_style) ? ' style=\'' . $content_style . '\'' : $content_style;
     if (!defined('OP_LIVEEDITOR')) {
         wp_enqueue_script(OP_SN . '-popup', OP_JS . 'popup' . OP_SCRIPT_DEBUG . '.js', array(OP_SCRIPT_BASE), OP_VERSION, true);
     }
     // fancybox options
     $popup_data = ' data-width="' . $popup_width . '" ';
     $popup_data .= ' data-open-effect="' . $popup_open_effect . '" ';
     $popup_data .= ' data-close-effect="' . $popup_close_effect . '" ';
     // $popup_data .= ' data-open-method="' . $popup_open_method . '" ';
     // $popup_data .= ' data-close-method="' . $popup_close_method . '" ';
     $popup_data .= ' data-open-speed="' . $popup_open_speed . '" ';
     $popup_data .= ' data-close-speed="' . $popup_close_speed . '" ';
     $popup_data .= ' data-border-color="' . $popup_border_color . '" ';
     $popup_data .= ' data-border-size="' . $popup_border_size . '" ';
     $popup_data .= ' data-padding-top="' . $popup_padding_top . '" ';
     $popup_data .= ' data-padding-bottom="' . $popup_padding_bottom . '" ';
     $popup_data .= ' data-padding-left="' . $popup_padding_left . '" ';
     $popup_data .= ' data-padding-right="' . $popup_padding_right . '" ';
     $popup_data .= ' data-exit-intent="' . $pop_exit_intent . '" ';
     $popup_data .= ' data-trigger-time="' . $pop_trigger_time . '" ';
     $popup_data .= ' data-trigger-dontshow="' . $pop_trigger_dontshow . '" ';
     $popup_data .= ' data-dont-show-on-tablet="' . $pop_dont_show_on_tablet . '" ';
     $popup_data .= ' data-dont-show-on-mobile="' . $pop_dont_show_on_mobile . '" ';
     $popup_data .= ' data-popup-id="' . $popup_id . '" ';
     return '<div class="op-popup cf"' . $content_style . $popup_data . '>' . $content . '</div>';
 }