rdusnr

Untitled

Mar 14th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.93 KB | None | 0 0
  1. <?php
  2. global $gateway, $pmpro_review, $skip_account_fields, $pmpro_paypal_token, $wpdb, $current_user, $pmpro_msg, $pmpro_msgt, $pmpro_requirebilling, $pmpro_level, $pmpro_levels, $tospage, $pmpro_show_discount_code, $pmpro_error_fields;
  3. global $discount_code, $username, $password, $password2, $bfirstname, $blastname, $baddress1, $baddress2, $bcity, $bstate, $bzipcode, $bcountry, $bphone, $bemail, $bconfirmemail, $CardType, $AccountNumber, $ExpirationMonth,$ExpirationYear;
  4.  
  5. /**
  6. * Filter to set if PMPro uses email or text as the type for email field inputs.
  7. *
  8. * @since 1.8.4.5
  9. *
  10. * @param bool $use_email_type, true to use email type, false to use text type
  11. */
  12. $pmpro_email_field_type = apply_filters('pmpro_email_field_type', true);
  13. ?>
  14. <div id="pmpro_level-<?php echo $pmpro_level->id; ?>">
  15. <form id="pmpro_form" class="pmpro_form" action="<?php if(!empty($_REQUEST['review'])) echo pmpro_url("checkout", "?level=" . $pmpro_level->id); ?>" method="post">
  16.  
  17. <input type="hidden" id="level" name="level" value="<?php echo esc_attr($pmpro_level->id) ?>" />
  18. <input type="hidden" id="checkjavascript" name="checkjavascript" value="1" />
  19.  
  20. <?php if($pmpro_msg)
  21. {
  22. ?>
  23. <div id="pmpro_message" class="pmpro_message <?php echo $pmpro_msgt?>"><?php echo $pmpro_msg?></div>
  24. <?php
  25. }
  26. else
  27. {
  28. ?>
  29. <div id="pmpro_message" class="pmpro_message" style="display: none;"></div>
  30. <?php
  31. }
  32. ?>
  33.  
  34. <?php if($pmpro_review) { ?>
  35. <p><?php _e('Almost done. Review the membership information and pricing below then <strong>click the "Complete Payment" button</strong> to finish your order.', 'pmpro');?></p>
  36. <?php } ?>
  37.  
  38. <table id="pmpro_pricing_fields" class="pmpro_checkout" width="100%" cellpadding="0" cellspacing="0" border="0">
  39. <thead>
  40. <tr>
  41. <th>
  42. <span class="pmpro_thead-name"><?php _e('Membership Level', 'pmpro');?></span>
  43. <?php if(count($pmpro_levels) > 1) { ?><span class="pmpro_thead-msg"><a href="<?php echo pmpro_url("levels"); ?>"><?php _e('change', 'pmpro');?></a></span><?php } ?>
  44. </th>
  45. </tr>
  46. </thead>
  47. <tbody>
  48. <tr>
  49. <td>
  50. <p>
  51. <?php printf(__('You have selected the <strong>%s</strong> membership level.', 'pmpro'), $pmpro_level->name);?>
  52. </p>
  53.  
  54. <?php
  55. /**
  56. * All devs to filter the level description at checkout.
  57. * We also have a function in includes/filters.php that applies the the_content filters to this description.
  58. * @param string $description The level description.
  59. * @param object $pmpro_level The PMPro Level object.
  60. */
  61. $level_description = apply_filters('pmpro_level_description', $pmpro_level->description, $pmpro_level);
  62. if(!empty($level_description))
  63. echo $level_description;
  64. ?>
  65.  
  66. <div id="pmpro_level_cost">
  67. <?php if($discount_code && pmpro_checkDiscountCode($discount_code)) { ?>
  68. <?php printf(__('<p class="pmpro_level_discount_applied">The <strong>%s</strong> code has been applied to your order.</p>', 'pmpro'), $discount_code);?>
  69. <?php } ?>
  70. <?php echo wpautop(pmpro_getLevelCost($pmpro_level)); ?>
  71. <?php echo wpautop(pmpro_getLevelExpiration($pmpro_level)); ?>
  72. </div>
  73.  
  74. <?php do_action("pmpro_checkout_after_level_cost"); ?>
  75.  
  76. <?php if($pmpro_show_discount_code) { ?>
  77.  
  78. <?php if($discount_code && !$pmpro_review) { ?>
  79. <p id="other_discount_code_p" class="pmpro_small"><a id="other_discount_code_a" href="#discount_code"><?php _e('Click here to change your discount code', 'pmpro');?></a>.</p>
  80. <?php } elseif(!$pmpro_review) { ?>
  81. <p id="other_discount_code_p" class="pmpro_small"><?php _e('Do you have a discount code?', 'pmpro');?> <a id="other_discount_code_a" href="#discount_code"><?php _e('Click here to enter your discount code', 'pmpro');?></a>.</p>
  82. <?php } elseif($pmpro_review && $discount_code) { ?>
  83. <p><strong><?php _e('Discount Code', 'pmpro');?>:</strong> <?php echo $discount_code?></p>
  84. <?php } ?>
  85.  
  86. <?php } ?>
  87. </td>
  88. </tr>
  89. <?php if($pmpro_show_discount_code) { ?>
  90. <tr id="other_discount_code_tr" style="display: none;">
  91. <td>
  92. <div>
  93. <label for="other_discount_code"><?php _e('Discount Code', 'pmpro');?></label>
  94. <input id="other_discount_code" name="other_discount_code" type="text" class="input <?php echo pmpro_getClassForField("other_discount_code");?>" size="20" value="<?php echo esc_attr($discount_code)?>" />
  95. <input type="button" name="other_discount_code_button" id="other_discount_code_button" value="<?php _e('Apply', 'pmpro');?>" />
  96. </div>
  97. </td>
  98. </tr>
  99. <?php } ?>
  100. </tbody>
  101. </table>
  102.  
  103. <?php if($pmpro_show_discount_code) { ?>
  104. <script>
  105. <!--
  106. //update discount code link to show field at top of form
  107. jQuery('#other_discount_code_a').attr('href', 'javascript:void(0);');
  108. jQuery('#other_discount_code_a').click(function() {
  109. jQuery('#other_discount_code_tr').show();
  110. jQuery('#other_discount_code_p').hide();
  111. jQuery('#other_discount_code').focus();
  112. });
  113.  
  114. //update real discount code field as the other discount code field is updated
  115. jQuery('#other_discount_code').keyup(function() {
  116. jQuery('#discount_code').val(jQuery('#other_discount_code').val());
  117. });
  118. jQuery('#other_discount_code').blur(function() {
  119. jQuery('#discount_code').val(jQuery('#other_discount_code').val());
  120. });
  121.  
  122. //update other discount code field as the real discount code field is updated
  123. jQuery('#discount_code').keyup(function() {
  124. jQuery('#other_discount_code').val(jQuery('#discount_code').val());
  125. });
  126. jQuery('#discount_code').blur(function() {
  127. jQuery('#other_discount_code').val(jQuery('#discount_code').val());
  128. });
  129.  
  130. //applying a discount code
  131. jQuery('#other_discount_code_button').click(function() {
  132. var code = jQuery('#other_discount_code').val();
  133. var level_id = jQuery('#level').val();
  134.  
  135. if(code)
  136. {
  137. //hide any previous message
  138. jQuery('.pmpro_discount_code_msg').hide();
  139.  
  140. //disable the apply button
  141. jQuery('#other_discount_code_button').attr('disabled', 'disabled');
  142.  
  143. jQuery.ajax({
  144. url: '<?php echo admin_url('admin-ajax.php')?>',type:'GET',timeout:<?php echo apply_filters("pmpro_ajax_timeout", 5000, "applydiscountcode");?>,
  145. dataType: 'html',
  146. data: "action=applydiscountcode&code=" + code + "&level=" + level_id + "&msgfield=pmpro_message",
  147. error: function(xml){
  148. alert('Error applying discount code [1]');
  149.  
  150. //enable apply button
  151. jQuery('#other_discount_code_button').removeAttr('disabled');
  152. },
  153. success: function(responseHTML){
  154. if (responseHTML == 'error')
  155. {
  156. alert('Error applying discount code [2]');
  157. }
  158. else
  159. {
  160. jQuery('#pmpro_message').html(responseHTML);
  161. }
  162.  
  163. //enable invite button
  164. jQuery('#other_discount_code_button').removeAttr('disabled');
  165. }
  166. });
  167. }
  168. });
  169. -->
  170. </script>
  171. <?php } ?>
  172.  
  173. <?php
  174. do_action('pmpro_checkout_after_pricing_fields');
  175. ?>
  176.  
  177. <?php if(!$skip_account_fields && !$pmpro_review) { ?>
  178. <table id="pmpro_user_fields" class="pmpro_checkout" width="100%" cellpadding="0" cellspacing="0" border="0">
  179. <thead>
  180. <tr>
  181. <th>
  182. <span class="pmpro_thead-name"><?php _e('Account Information', 'pmpro');?></span>
  183. <span class="pmpro_thead-msg"><?php _e('Already have an account?', 'pmpro');?> <a href="<?php echo wp_login_url(pmpro_url("checkout", "?level=" . $pmpro_level->id))?>"><?php _e('Log in here', 'pmpro');?></a></span>
  184. </th>
  185. </tr>
  186. </thead>
  187. <tbody>
  188. <tr>
  189. <td>
  190. <div>
  191. <label for="username"><?php _e('Username', 'pmpro');?></label>
  192. <input id="username" name="username" type="text" class="input <?php echo pmpro_getClassForField("username");?>" size="30" value="<?php echo esc_attr($username)?>" />
  193. </div>
  194.  
  195. <?php
  196. do_action('pmpro_checkout_after_username');
  197. ?>
  198.  
  199. <div>
  200. <label for="password"><?php _e('Password', 'pmpro');?></label>
  201. <input id="password" name="password" type="password" class="input <?php echo pmpro_getClassForField("password");?>" size="30" value="<?php echo esc_attr($password)?>" />
  202. </div>
  203. <?php
  204. $pmpro_checkout_confirm_password = apply_filters("pmpro_checkout_confirm_password", true);
  205. if($pmpro_checkout_confirm_password)
  206. {
  207. ?>
  208. <div>
  209. <label for="password2"><?php _e('Confirm Password', 'pmpro');?></label>
  210. <input id="password2" name="password2" type="password" class="input <?php echo pmpro_getClassForField("password2");?>" size="30" value="<?php echo esc_attr($password2)?>" />
  211. </div>
  212. <?php
  213. }
  214. else
  215. {
  216. ?>
  217. <input type="hidden" name="password2_copy" value="1" />
  218. <?php
  219. }
  220. ?>
  221.  
  222. <?php
  223. do_action('pmpro_checkout_after_password');
  224. ?>
  225.  
  226. <div>
  227. <label for="bemail"><?php _e('E-mail Address', 'pmpro');?></label>
  228. <input id="bemail" name="bemail" type="<?php echo ($pmpro_email_field_type ? 'email' : 'text'); ?>" class="input <?php echo pmpro_getClassForField("bemail");?>" size="30" value="<?php echo esc_attr($bemail)?>" />
  229. </div>
  230. <?php
  231. $pmpro_checkout_confirm_email = apply_filters("pmpro_checkout_confirm_email", true);
  232. if($pmpro_checkout_confirm_email)
  233. {
  234. ?>
  235. <div>
  236. <label for="bconfirmemail"><?php _e('Confirm E-mail Address', 'pmpro');?></label>
  237. <input id="bconfirmemail" name="bconfirmemail" type="<?php echo ($pmpro_email_field_type ? 'email' : 'text'); ?>" class="input <?php echo pmpro_getClassForField("bconfirmemail");?>" size="30" value="<?php echo esc_attr($bconfirmemail)?>" />
  238.  
  239. </div>
  240. <?php
  241. }
  242. else
  243. {
  244. ?>
  245. <input type="hidden" name="bconfirmemail_copy" value="1" />
  246. <?php
  247. }
  248. ?>
  249.  
  250. <?php
  251. do_action('pmpro_checkout_after_email');
  252. ?>
  253.  
  254. <div class="pmpro_hidden">
  255. <label for="fullname"><?php _e('Full Name', 'pmpro');?></label>
  256. <input id="fullname" name="fullname" type="text" class="input <?php echo pmpro_getClassForField("fullname");?>" size="30" value="" /> <strong><?php _e('LEAVE THIS BLANK', 'pmpro');?></strong>
  257. </div>
  258.  
  259. <div class="pmpro_captcha">
  260. <?php
  261. global $recaptcha, $recaptcha_publickey;
  262. if($recaptcha == 2 || ($recaptcha == 1 && pmpro_isLevelFree($pmpro_level)))
  263. {
  264. echo pmpro_recaptcha_get_html($recaptcha_publickey, NULL, true);
  265. }
  266. ?>
  267. </div>
  268.  
  269. <?php
  270. do_action('pmpro_checkout_after_captcha');
  271. ?>
  272.  
  273. </td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. <?php } elseif($current_user->ID && !$pmpro_review) { ?>
  278.  
  279. <p id="pmpro_account_loggedin">
  280. <?php printf(__('You are logged in as <strong>%s</strong>. If you would like to use a different account for this membership, <a href="%s">log out now</a>.', 'pmpro'), $current_user->user_login, wp_logout_url($_SERVER['REQUEST_URI'])); ?>
  281. </p>
  282. <?php } ?>
  283.  
  284. <?php
  285. do_action('pmpro_checkout_after_user_fields');
  286. ?>
  287.  
  288. <?php
  289. do_action('pmpro_checkout_boxes');
  290. ?>
  291.  
  292. <?php if(pmpro_getGateway() == "paypal" && empty($pmpro_review)) { ?>
  293. <table id="pmpro_payment_method" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0" <?php if(!$pmpro_requirebilling) { ?>style="display: none;"<?php } ?>>
  294. <thead>
  295. <tr>
  296. <th><?php _e('Choose your Payment Method', 'pmpro');?></th>
  297. </tr>
  298. </thead>
  299. <tbody>
  300. <tr>
  301. <td>
  302. <div>
  303. <span class="gateway_paypal">
  304. <input type="radio" name="gateway" value="paypal" <?php if(!$gateway || $gateway == "paypal") { ?>checked="checked"<?php } ?> />
  305. <a href="javascript:void(0);" class="pmpro_radio"><?php _e('Check Out with a Credit Card Here', 'pmpro');?></a>
  306. </span>
  307. <span class="gateway_paypalexpress">
  308. <input type="radio" name="gateway" value="paypalexpress" <?php if($gateway == "paypalexpress") { ?>checked="checked"<?php } ?> />
  309. <a href="javascript:void(0);" class="pmpro_radio"><?php _e('Check Out with PayPal', 'pmpro');?></a>
  310. </span>
  311. </div>
  312. </td>
  313. </tr>
  314. </tbody>
  315. </table>
  316. <?php } ?>
  317.  
  318. <?php
  319. $pmpro_include_billing_address_fields = apply_filters('pmpro_include_billing_address_fields', true);
  320. if($pmpro_include_billing_address_fields)
  321. {
  322. ?>
  323. <table id="pmpro_billing_address_fields" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0" <?php if(!$pmpro_requirebilling || apply_filters("pmpro_hide_billing_address_fields", false) ){ ?>style="display: none;"<?php } ?>>
  324. <thead>
  325. <tr>
  326. <th><?php _e('Billing Address', 'pmpro');?></th>
  327. </tr>
  328. </thead>
  329. <tbody>
  330. <tr>
  331. <td>
  332. <div>
  333. <label for="bfirstname"><?php _e('First Name', 'pmpro');?></label>
  334. <input id="bfirstname" name="bfirstname" type="text" class="input <?php echo pmpro_getClassForField("bfirstname");?>" size="30" value="<?php echo esc_attr($bfirstname)?>" />
  335. </div>
  336. <div>
  337. <label for="blastname"><?php _e('Last Name', 'pmpro');?></label>
  338. <input id="blastname" name="blastname" type="text" class="input <?php echo pmpro_getClassForField("blastname");?>" size="30" value="<?php echo esc_attr($blastname)?>" />
  339. </div>
  340. <div>
  341. <label for="baddress1"><?php _e('Address 1', 'pmpro');?></label>
  342. <input id="baddress1" name="baddress1" type="text" class="input <?php echo pmpro_getClassForField("baddress1");?>" size="30" value="<?php echo esc_attr($baddress1)?>" />
  343. </div>
  344. <div>
  345. <label for="baddress2"><?php _e('Address 2', 'pmpro');?></label>
  346. <input id="baddress2" name="baddress2" type="text" class="input <?php echo pmpro_getClassForField("baddress2");?>" size="30" value="<?php echo esc_attr($baddress2)?>" />
  347. </div>
  348.  
  349. <?php
  350. $longform_address = apply_filters("pmpro_longform_address", true);
  351. if($longform_address)
  352. {
  353. ?>
  354. <div>
  355. <label for="bcity"><?php _e('City', 'pmpro');?></label>
  356. <input id="bcity" name="bcity" type="text" class="input <?php echo pmpro_getClassForField("bcity");?>" size="30" value="<?php echo esc_attr($bcity)?>" />
  357. </div>
  358. <div>
  359. <label for="bstate"><?php _e('State', 'pmpro');?></label>
  360. <input id="bstate" name="bstate" type="text" class="input <?php echo pmpro_getClassForField("bstate");?>" size="30" value="<?php echo esc_attr($bstate)?>" />
  361. </div>
  362. <div>
  363. <label for="bzipcode"><?php _e('Postal Code', 'pmpro');?></label>
  364. <input id="bzipcode" name="bzipcode" type="text" class="input <?php echo pmpro_getClassForField("bzipcode");?>" size="30" value="<?php echo esc_attr($bzipcode)?>" />
  365. </div>
  366. <?php
  367. }
  368. else
  369. {
  370. ?>
  371. <div>
  372. <label for="bcity_state_zip"><?php _e('City, State Zip', 'pmpro');?></label>
  373. <input id="bcity" name="bcity" type="text" class="input <?php echo pmpro_getClassForField("bcity");?>" size="14" value="<?php echo esc_attr($bcity)?>" />,
  374. <?php
  375. $state_dropdowns = apply_filters("pmpro_state_dropdowns", false);
  376. if($state_dropdowns === true || $state_dropdowns == "names")
  377. {
  378. global $pmpro_states;
  379. ?>
  380. <select name="bstate" class=" <?php echo pmpro_getClassForField("bstate");?>">
  381. <option value="">--</option>
  382. <?php
  383. foreach($pmpro_states as $ab => $st)
  384. {
  385. ?>
  386. <option value="<?php echo esc_attr($ab);?>" <?php if($ab == $bstate) { ?>selected="selected"<?php } ?>><?php echo $st;?></option>
  387. <?php } ?>
  388. </select>
  389. <?php
  390. }
  391. elseif($state_dropdowns == "abbreviations")
  392. {
  393. global $pmpro_states_abbreviations;
  394. ?>
  395. <select name="bstate" class=" <?php echo pmpro_getClassForField("bstate");?>">
  396. <option value="">--</option>
  397. <?php
  398. foreach($pmpro_states_abbreviations as $ab)
  399. {
  400. ?>
  401. <option value="<?php echo esc_attr($ab);?>" <?php if($ab == $bstate) { ?>selected="selected"<?php } ?>><?php echo $ab;?></option>
  402. <?php } ?>
  403. </select>
  404. <?php
  405. }
  406. else
  407. {
  408. ?>
  409. <input id="bstate" name="bstate" type="text" class="input <?php echo pmpro_getClassForField("bstate");?>" size="2" value="<?php echo esc_attr($bstate)?>" />
  410. <?php
  411. }
  412. ?>
  413. <input id="bzipcode" name="bzipcode" type="text" class="input <?php echo pmpro_getClassForField("bzipcode");?>" size="5" value="<?php echo esc_attr($bzipcode)?>" />
  414. </div>
  415. <?php
  416. }
  417. ?>
  418.  
  419. <?php
  420. $show_country = apply_filters("pmpro_international_addresses", true);
  421. if($show_country)
  422. {
  423. ?>
  424. <div>
  425. <label for="bcountry"><?php _e('Country', 'pmpro');?></label>
  426. <select name="bcountry" class=" <?php echo pmpro_getClassForField("bcountry");?>">
  427. <?php
  428. global $pmpro_countries, $pmpro_default_country;
  429. if(!$bcountry)
  430. $bcountry = $pmpro_default_country;
  431. foreach($pmpro_countries as $abbr => $country)
  432. {
  433. ?>
  434. <option value="<?php echo $abbr?>" <?php if($abbr == $bcountry) { ?>selected="selected"<?php } ?>><?php echo $country?></option>
  435. <?php
  436. }
  437. ?>
  438. </select>
  439. </div>
  440. <?php
  441. }
  442. else
  443. {
  444. ?>
  445. <input type="hidden" name="bcountry" value="US" />
  446. <?php
  447. }
  448. ?>
  449. <div>
  450. <label for="bphone"><?php _e('Phone', 'pmpro');?></label>
  451. <input id="bphone" name="bphone" type="text" class="input <?php echo pmpro_getClassForField("bphone");?>" size="30" value="<?php echo esc_attr(formatPhone($bphone))?>" />
  452. </div>
  453. <?php if($skip_account_fields) { ?>
  454. <?php
  455. if($current_user->ID)
  456. {
  457. if(!$bemail && $current_user->user_email)
  458. $bemail = $current_user->user_email;
  459. if(!$bconfirmemail && $current_user->user_email)
  460. $bconfirmemail = $current_user->user_email;
  461. }
  462. ?>
  463. <div>
  464. <label for="bemail"><?php _e('E-mail Address', 'pmpro');?></label>
  465. <input id="bemail" name="bemail" type="<?php echo ($pmpro_email_field_type ? 'email' : 'text'); ?>" class="input <?php echo pmpro_getClassForField("bemail");?>" size="30" value="<?php echo esc_attr($bemail)?>" />
  466. </div>
  467. <?php
  468. $pmpro_checkout_confirm_email = apply_filters("pmpro_checkout_confirm_email", true);
  469. if($pmpro_checkout_confirm_email)
  470. {
  471. ?>
  472. <div>
  473. <label for="bconfirmemail"><?php _e('Confirm E-mail', 'pmpro');?></label>
  474. <input id="bconfirmemail" name="bconfirmemail" type="<?php echo ($pmpro_email_field_type ? 'email' : 'text'); ?>" class="input <?php echo pmpro_getClassForField("bconfirmemail");?>" size="30" value="<?php echo esc_attr($bconfirmemail)?>" />
  475.  
  476. </div>
  477. <?php
  478. }
  479. else
  480. {
  481. ?>
  482. <input type="hidden" name="bconfirmemail_copy" value="1" />
  483. <?php
  484. }
  485. ?>
  486. <?php } ?>
  487. </td>
  488. </tr>
  489. </tbody>
  490. </table>
  491. <?php } ?>
  492.  
  493. <?php do_action("pmpro_checkout_after_billing_fields"); ?>
  494.  
  495. <?php
  496. $pmpro_accepted_credit_cards = pmpro_getOption("accepted_credit_cards");
  497. $pmpro_accepted_credit_cards = explode(",", $pmpro_accepted_credit_cards);
  498. $pmpro_accepted_credit_cards_string = pmpro_implodeToEnglish($pmpro_accepted_credit_cards);
  499. ?>
  500.  
  501. <?php
  502. $pmpro_include_payment_information_fields = apply_filters("pmpro_include_payment_information_fields", true);
  503. if($pmpro_include_payment_information_fields)
  504. {
  505. ?>
  506. <table id="pmpro_payment_information_fields" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0" <?php if(!$pmpro_requirebilling || apply_filters("pmpro_hide_payment_information_fields", false) ) { ?>style="display: none;"<?php } ?>>
  507. <thead>
  508. <tr>
  509. <th>
  510. <span class="pmpro_thead-name"><?php _e('Payment Information', 'pmpro');?></span>
  511. <span class="pmpro_thead-msg"><?php printf(__('We Accept %s', 'pmpro'), $pmpro_accepted_credit_cards_string);?></span>
  512. </th>
  513. </tr>
  514. </thead>
  515. <tbody>
  516. <tr valign="top">
  517. <td>
  518. <?php
  519. $sslseal = pmpro_getOption("sslseal");
  520. if($sslseal)
  521. {
  522. ?>
  523. <div class="pmpro_sslseal"><?php echo stripslashes($sslseal)?></div>
  524. <?php
  525. }
  526. ?>
  527.  
  528. <?php
  529. $pmpro_include_cardtype_field = apply_filters('pmpro_include_cardtype_field', false);
  530. if($pmpro_include_cardtype_field)
  531. {
  532. ?>
  533. <div class="pmpro_payment-card-type">
  534. <label for="CardType"><?php _e('Card Type', 'pmpro');?></label>
  535. <select id="CardType" name="CardType" class=" <?php echo pmpro_getClassForField("CardType");?>">
  536. <?php foreach($pmpro_accepted_credit_cards as $cc) { ?>
  537. <option value="<?php echo $cc?>" <?php if($CardType == $cc) { ?>selected="selected"<?php } ?>><?php echo $cc?></option>
  538. <?php } ?>
  539. </select>
  540. </div>
  541. <?php
  542. }
  543. else
  544. {
  545. ?>
  546. <input type="hidden" id="CardType" name="CardType" value="<?php echo esc_attr($CardType);?>" />
  547. <script>
  548. <!--
  549. jQuery(document).ready(function() {
  550. jQuery('#AccountNumber').validateCreditCard(function(result) {
  551. var cardtypenames = {
  552. "amex" : "American Express",
  553. "diners_club_carte_blanche" : "Diners Club Carte Blanche",
  554. "diners_club_international" : "Diners Club International",
  555. "discover" : "Discover",
  556. "jcb" : "JCB",
  557. "laser" : "Laser",
  558. "maestro" : "Maestro",
  559. "mastercard" : "Mastercard",
  560. "visa" : "Visa",
  561. "visa_electron" : "Visa Electron"
  562. };
  563.  
  564. if(result.card_type)
  565. jQuery('#CardType').val(cardtypenames[result.card_type.name]);
  566. else
  567. jQuery('#CardType').val('Unknown Card Type');
  568. });
  569. });
  570. -->
  571. </script>
  572. <?php
  573. }
  574. ?>
  575.  
  576. <div class="pmpro_payment-account-number">
  577. <label for="AccountNumber"><?php _e('Card Number', 'pmpro');?></label>
  578. <input id="AccountNumber" name="AccountNumber" class="input <?php echo pmpro_getClassForField("AccountNumber");?>" type="text" size="25" value="<?php echo esc_attr($AccountNumber)?>" data-encrypted-name="number" autocomplete="off" />
  579. </div>
  580.  
  581. <div class="pmpro_payment-expiration">
  582. <label for="ExpirationMonth"><?php _e('Expiration Date', 'pmpro');?></label>
  583. <select id="ExpirationMonth" name="ExpirationMonth" class=" <?php echo pmpro_getClassForField("ExpirationMonth");?>">
  584. <option value="01" <?php if($ExpirationMonth == "01") { ?>selected="selected"<?php } ?>>01</option>
  585. <option value="02" <?php if($ExpirationMonth == "02") { ?>selected="selected"<?php } ?>>02</option>
  586. <option value="03" <?php if($ExpirationMonth == "03") { ?>selected="selected"<?php } ?>>03</option>
  587. <option value="04" <?php if($ExpirationMonth == "04") { ?>selected="selected"<?php } ?>>04</option>
  588. <option value="05" <?php if($ExpirationMonth == "05") { ?>selected="selected"<?php } ?>>05</option>
  589. <option value="06" <?php if($ExpirationMonth == "06") { ?>selected="selected"<?php } ?>>06</option>
  590. <option value="07" <?php if($ExpirationMonth == "07") { ?>selected="selected"<?php } ?>>07</option>
  591. <option value="08" <?php if($ExpirationMonth == "08") { ?>selected="selected"<?php } ?>>08</option>
  592. <option value="09" <?php if($ExpirationMonth == "09") { ?>selected="selected"<?php } ?>>09</option>
  593. <option value="10" <?php if($ExpirationMonth == "10") { ?>selected="selected"<?php } ?>>10</option>
  594. <option value="11" <?php if($ExpirationMonth == "11") { ?>selected="selected"<?php } ?>>11</option>
  595. <option value="12" <?php if($ExpirationMonth == "12") { ?>selected="selected"<?php } ?>>12</option>
  596. </select>/<select id="ExpirationYear" name="ExpirationYear" class=" <?php echo pmpro_getClassForField("ExpirationYear");?>">
  597. <?php
  598. for($i = date_i18n("Y"); $i < date_i18n("Y") + 10; $i++)
  599. {
  600. ?>
  601. <option value="<?php echo $i?>" <?php if($ExpirationYear == $i) { ?>selected="selected"<?php } ?>><?php echo $i?></option>
  602. <?php
  603. }
  604. ?>
  605. </select>
  606. </div>
  607.  
  608. <?php
  609. $pmpro_show_cvv = apply_filters("pmpro_show_cvv", true);
  610. if($pmpro_show_cvv) { ?>
  611. <div class="pmpro_payment-cvv">
  612. <label for="CVV"><?php _e('CVV', 'pmpro');?></label>
  613. <input class="input" id="CVV" name="CVV" type="text" size="4" value="<?php if(!empty($_REQUEST['CVV'])) { echo esc_attr($_REQUEST['CVV']); }?>" class="<?php echo pmpro_getClassForField("CVV");?>" /> <small>(<a href="javascript:void(0);" onclick="javascript:window.open('<?php echo pmpro_https_filter(PMPRO_URL)?>/pages/popup-cvv.html','cvv','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=600, height=475');"><?php _e("what's this?", 'pmpro');?></a>)</small>
  614. </div>
  615. <?php } ?>
  616.  
  617. <?php if($pmpro_show_discount_code) { ?>
  618. <div class="pmpro_payment-discount-code">
  619. <label for="discount_code"><?php _e('Discount Code', 'pmpro');?></label>
  620. <input class="input <?php echo pmpro_getClassForField("discount_code");?>" id="discount_code" name="discount_code" type="text" size="20" value="<?php echo esc_attr($discount_code)?>" />
  621. <input type="button" id="discount_code_button" name="discount_code_button" value="<?php _e('Apply', 'pmpro');?>" />
  622. <p id="discount_code_message" class="pmpro_message" style="display: none;"></p>
  623. </div>
  624. <?php } ?>
  625.  
  626. </td>
  627. </tr>
  628. </tbody>
  629. </table>
  630. <?php } ?>
  631. <script>
  632. <!--
  633. //checking a discount code
  634. jQuery('#discount_code_button').click(function() {
  635. var code = jQuery('#discount_code').val();
  636. var level_id = jQuery('#level').val();
  637.  
  638. if(code)
  639. {
  640. //hide any previous message
  641. jQuery('.pmpro_discount_code_msg').hide();
  642.  
  643. //disable the apply button
  644. jQuery('#discount_code_button').attr('disabled', 'disabled');
  645.  
  646. jQuery.ajax({
  647. url: '<?php echo admin_url('admin-ajax.php')?>',type:'GET',timeout:<?php echo apply_filters("pmpro_ajax_timeout", 5000, "applydiscountcode");?>,
  648. dataType: 'html',
  649. data: "action=applydiscountcode&code=" + code + "&level=" + level_id + "&msgfield=discount_code_message",
  650. error: function(xml){
  651. alert('Error applying discount code [1]');
  652.  
  653. //enable apply button
  654. jQuery('#discount_code_button').removeAttr('disabled');
  655. },
  656. success: function(responseHTML){
  657. if (responseHTML == 'error')
  658. {
  659. alert('Error applying discount code [2]');
  660. }
  661. else
  662. {
  663. jQuery('#discount_code_message').html(responseHTML);
  664. }
  665.  
  666. //enable invite button
  667. jQuery('#discount_code_button').removeAttr('disabled');
  668. }
  669. });
  670. }
  671. });
  672. -->
  673. </script>
  674.  
  675. <?php do_action('pmpro_checkout_after_payment_information_fields'); ?>
  676.  
  677. <?php
  678. if($tospage && !$pmpro_review)
  679. {
  680. ?>
  681. <table id="pmpro_tos_fields" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0">
  682. <thead>
  683. <tr>
  684. <th><?php echo $tospage->post_title?></th>
  685. </tr>
  686. </thead>
  687. <tbody>
  688. <tr class="odd">
  689. <td>
  690. <div id="pmpro_license">
  691. <?php echo wpautop(do_shortcode($tospage->post_content));?>
  692. </div>
  693. <input type="checkbox" name="tos" value="1" id="tos" /> <label class="pmpro_normal pmpro_clickable" for="tos"><?php printf(__('I agree to the %s', 'pmpro'), $tospage->post_title);?></label>
  694. </td>
  695. </tr>
  696. </tbody>
  697. </table>
  698. <?php
  699. }
  700. ?>
  701.  
  702. <?php do_action("pmpro_checkout_after_tos_fields"); ?>
  703.  
  704. <?php do_action("pmpro_checkout_before_submit_button"); ?>
  705.  
  706. <div class="pmpro_submit">
  707. <?php if($pmpro_review) { ?>
  708.  
  709. <span id="pmpro_submit_span">
  710. <input type="hidden" name="confirm" value="1" />
  711. <input type="hidden" name="token" value="<?php echo esc_attr($pmpro_paypal_token)?>" />
  712. <input type="hidden" name="gateway" value="<?php echo esc_attr($gateway); ?>" />
  713. <input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php _e('Complete Payment', 'pmpro');?> &raquo;" />
  714. </span>
  715.  
  716. <?php } else { ?>
  717.  
  718. <?php
  719. $pmpro_checkout_default_submit_button = apply_filters('pmpro_checkout_default_submit_button', true);
  720. if($pmpro_checkout_default_submit_button)
  721. {
  722. ?>
  723. <span id="pmpro_submit_span">
  724. <input type="hidden" name="submit-checkout" value="1" />
  725. <input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php if($pmpro_requirebilling) { _e('Submit and Check Out', 'pmpro'); } else { _e('Submit and Confirm', 'pmpro');}?> &raquo;" />
  726. </span>
  727. <?php
  728. }
  729. ?>
  730.  
  731. <?php } ?>
  732.  
  733. <span id="pmpro_processing_message" style="visibility: hidden;">
  734. <?php
  735. $processing_message = apply_filters("pmpro_processing_message", __("Processing...", "pmpro"));
  736. echo $processing_message;
  737. ?>
  738. </span>
  739. </div>
  740.  
  741. </form>
  742.  
  743. <?php do_action('pmpro_checkout_after_form'); ?>
  744.  
  745. </div> <!-- end pmpro_level-ID -->
  746.  
  747. <script>
  748. <!--
  749. // Find ALL <form> tags on your page
  750. jQuery('form').submit(function(){
  751. // On submit disable its submit button
  752. jQuery('input[type=submit]', this).attr('disabled', 'disabled');
  753. jQuery('input[type=image]', this).attr('disabled', 'disabled');
  754. jQuery('#pmpro_processing_message').css('visibility', 'visible');
  755. });
  756.  
  757. //iOS Safari fix (see: http://stackoverflow.com/questions/20210093/stop-safari-on-ios7-prompting-to-save-card-data)
  758. var userAgent = window.navigator.userAgent;
  759. if(userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
  760. jQuery('input[type=submit]').click(function() {
  761. try{
  762. jQuery("input[type=password]").attr("type", "hidden");
  763. } catch(ex){
  764. try {
  765. jQuery("input[type=password]").prop("type", "hidden");
  766. } catch(ex) {}
  767. }
  768. });
  769. }
  770.  
  771. //add required to required fields
  772. jQuery('.pmpro_required').after('<span class="pmpro_asterisk"> <abbr title="Required Field">*</abbr></span>');
  773.  
  774. //unhighlight error fields when the user edits them
  775. jQuery('.pmpro_error').bind("change keyup input", function() {
  776. jQuery(this).removeClass('pmpro_error');
  777. });
  778.  
  779. //click apply button on enter in discount code box
  780. jQuery('#discount_code').keydown(function (e){
  781. if(e.keyCode == 13){
  782. e.preventDefault();
  783. jQuery('#discount_code_button').click();
  784. }
  785. });
  786.  
  787. //hide apply button if a discount code was passed in
  788. <?php if(!empty($_REQUEST['discount_code'])) {?>
  789. jQuery('#discount_code_button').hide();
  790. jQuery('#discount_code').bind('change keyup', function() {
  791. jQuery('#discount_code_button').show();
  792. });
  793. <?php } ?>
  794.  
  795. //click apply button on enter in *other* discount code box
  796. jQuery('#other_discount_code').keydown(function (e){
  797. if(e.keyCode == 13){
  798. e.preventDefault();
  799. jQuery('#other_discount_code_button').click();
  800. }
  801. });
  802. -->
  803. </script>
  804. <script>
  805. <!--
  806. //add javascriptok hidden field to checkout
  807. jQuery("input[name=submit-checkout]").after('<input type="hidden" name="javascriptok" value="1" />');
  808. -->
  809. </script>
Add Comment
Please, Sign In to add comment