Source Code Documentation


s2member-pro\includes\menu-pages\alipay-buttons.inc.php


  1. <?php
  2. /**
  3. * Menu page for s2Member Pro ( AliPay® Buttons page ).
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * ( coded in the USA )
  8. *
  9. * This WordPress® plugin ( s2Member Pro ) is comprised of two parts:
  10. *
  11. * o (1) Its PHP code is licensed under the GPL license, as is WordPress®.
  12. * You should have received a copy of the GNU General Public License,
  13. * along with this software. In the main directory, see: /licensing/
  14. * If not, see: {@link http://www.gnu.org/licenses/}.
  15. *
  16. * o (2) All other parts of ( s2Member Pro ); including, but not limited to:
  17. * the CSS code, some JavaScript code, images, and design;
  18. * are licensed according to the license purchased.
  19. * See: {@link http://www.s2member.com/prices/}
  20. *
  21. * Unless you have our prior written consent, you must NOT directly or indirectly license,
  22. * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module;
  23. * or make an offer to do any of these things. All of these things are strictly
  24. * prohibited with part (2) of the s2Member Pro Module.
  25. *
  26. * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
  27. * ( i.e. new features, bug fixes, updates, improvements ); along with full access
  28. * to our video tutorial library: {@link http://www.s2member.com/videos/}
  29. *
  30. * @package s2Member\Menu_Pages
  31. * @since 1.5
  32. */
  33. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  34. exit ("Do not access this file directly.");
  35. /**/
  36. if (!class_exists ("c_ws_plugin__s2member_pro_menu_page_alipay_buttons"))
  37. {
  38. /**
  39. * Menu page for s2Member Pro ( AliPay® Buttons page ).
  40. *
  41. * @package s2Member\Menu_Pages
  42. * @since 110531
  43. */
  44. class c_ws_plugin__s2member_pro_menu_page_alipay_buttons
  45. {
  46. public function __construct ()
  47. {
  48. echo '<div class="wrap ws-menu-page">' . "\n";
  49. /**/
  50. echo '<div id="icon-plugins" class="icon32"><br /></div>' . "\n";
  51. echo '<h2>s2Member® / AliPay® Buttons</h2>' . "\n";
  52. /**/
  53. echo '<table class="ws-menu-page-table">' . "\n";
  54. echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
  55. echo '<tr class="ws-menu-page-table-tr">' . "\n";
  56. echo '<td class="ws-menu-page-table-l">' . "\n";
  57. /**/
  58. for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
  59. {
  60. echo '<div class="ws-menu-page-group" title="AliPay® Buttons For Level #' . $n . ' Access">' . "\n";
  61. /**/
  62. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-level' . $n . '-buttons-section">' . "\n";
  63. echo '<h3>Button Code Generator For Level #' . $n . ' Access</h3>' . "\n";
  64. echo '<p>Very simple. All you do is customize the form fields provided, for each Membership Level that you plan to offer. Then press (Generate Button Code). These special AliPay® Buttons are customized to work with s2Member seamlessly. Member accounts will be activated instantly, in an automated fashion. s2Member makes extensive use of the AliPay® IPN service. s2Member receives updates from AliPay® behind-the-scene. <em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your Membership Options Page. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
  65. /**/
  66. echo '<table class="form-table">' . "\n";
  67. echo '<tbody>' . "\n";
  68. echo '<tr>' . "\n";
  69. /**/
  70. echo '<th class="ws-menu-page-th-side">' . "\n";
  71. echo '<label for="ws-plugin--s2member-pro-level' . $n . '-shortcode">' . "\n";
  72. echo 'Button Code<br />For Level #' . $n . ':<br /><br />' . "\n";
  73. echo '</label>' . "\n";
  74. echo '</th>' . "\n";
  75. /**/
  76. echo '<td>' . "\n";
  77. echo '<form onsubmit="return false;">' . "\n";
  78. echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-level' . $n . '-term">' . trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/alipay-membership-regular-terms.php"))) . '</select></p>' . "\n";
  79. echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-desc" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]) . ' / description and pricing details here." size="73" /></p>' . "\n";
  80. echo '<p' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma-delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -> API Scripting -> Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-ccaps" size="40" /></p>' . "\n";
  81. echo '<p><input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_alipayButtonGenerate(\'level' . $n . '\');" class="button-primary" /></p>' . "\n";
  82. echo '</form>' . "\n";
  83. echo '</td>' . "\n";
  84. /**/
  85. echo '</tr>' . "\n";
  86. echo '<tr>' . "\n";
  87. /**/
  88. echo '<td colspan="2">' . "\n";
  89. echo '<form onsubmit="return false;">' . "\n";
  90. echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
  91. $ws_plugin__s2member_pro_temp_s = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/alipay-checkout-button-shortcode.php")));
  92. $ws_plugin__s2member_pro_temp_s = preg_replace ("/%%level%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($n)), $ws_plugin__s2member_pro_temp_s);
  93. $ws_plugin__s2member_pro_temp_s = preg_replace ("/%%level_label%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"])), $ws_plugin__s2member_pro_temp_s);
  94. $ws_plugin__s2member_pro_temp_s = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
  95. echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-level' . $n . '-shortcode" value="' . format_to_edit ($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
  96. echo '</form>' . "\n";
  97. echo '</td>' . "\n";
  98. /**/
  99. echo '</tr>' . "\n";
  100. echo '</tbody>' . "\n";
  101. echo '</table>' . "\n";
  102. echo '</div>' . "\n";
  103. /**/
  104. echo '</div>' . "\n";
  105. }
  106. /**/
  107. if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
  108. {
  109. echo '<div class="ws-menu-page-group" title="AliPay® Capability (Buy Now) Buttons">' . "\n";
  110. /**/
  111. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccap-buttons-section">' . "\n";
  112. echo '<h3>Button Code Generator For Independent Custom Capabilities</h3>' . "\n";
  113. echo '<p>This is VERY advanced. For further details, please check your Dashboard: <code>s2Member -> API Scripting -> Custom Capabiities</code>.</p>' . "\n";
  114. echo '<p>With s2Member, you can sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site <em>( i.e. you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like )</em>. So this is quite flexible. Independent Custom Capabilities do NOT rely on any specific Membership Level. That\'s why s2Member refers to these as `Independent` Custom Capabilities, because you can sell Capabilities this way, through Buy Now functionality, and the Customer\'s Membership Level Access, along with any existing paid access they may already have with you, will remain completely unaffected.</p>' . "\n";
  115. echo '<p>Independent Custom Capabilities are added to a Customer\'s account immediately after checkout, and the Customer will have the Custom Capabilities for as long as their Membership lasts, based on their primary Subscription with your site, and/or forever, if they have a Lifetime account with you. In other words, Independent Custom Capabilities will exist on the Customer\'s account forever, or until an EOT <em>( End Of Term )</em> occurs on their primary Subscription with you; in which case s2Member would demote or delete the Customer\'s account <em>( based on your EOT configuration )</em>, and all Custom Capabilities are removed as well.</p>' . "\n";
  116. echo '<p>Very simple. All you do is customize the form fields provided, for each set of Custom Capabilities that you plan to sell. Then press (Generate Button Code). These special AliPay® Buttons are customized to work with s2Member seamlessly. The Customer will be granted additional access to one or more Custom Capabilities that you specify; while the Customer\'s Membership Level Access and any existing paid Subscription they may already have with you, will remain completely unaffected.</p>' . "\n";
  117. echo '<p><em><strong>*Important Note*</strong> Independent Custom Capability Buttons should ONLY be displayed to existing Users/Members, and they MUST be logged-in, BEFORE clicking this Button. Otherwise, post-processing of their transaction will fail to recognize the Customer\'s existing account within WordPress®. Please display this Button only to Users/Members that are already logged into their account ( perhaps in your Login Welcome Page for s2Member ), or in another location where you can be absolutely sure that a User/Member is logged in. s2Member\'s Simple Conditionals could also be used to ensure a User/Member is logged in, by wrapping your Shortcode within a Conditional test. For further details, please see: <code>s2Member -> API Scripting -> Simple Conditionals</code>.</em></p>' . "\n";
  118. echo '<p><em>* Buttons are NOT saved here. This is only a Button Generator. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
  119. /**/
  120. echo '<table class="form-table">' . "\n";
  121. echo '<tbody>' . "\n";
  122. echo '<tr>' . "\n";
  123. /**/
  124. echo '<th class="ws-menu-page-th-side">' . "\n";
  125. echo '<label for="ws-plugin--s2member-pro-ccap-shortcode">' . "\n";
  126. echo 'Button Code<br />For Capabilities:<br /><br />' . "\n";
  127. echo '</label>' . "\n";
  128. echo '</th>' . "\n";
  129. /**/
  130. echo '<td>' . "\n";
  131. echo '<form onsubmit="return false;">' . "\n";
  132. echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-ccap-term">' . trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/alipay-membership-ccap-terms.php"))) . '</select></p>' . "\n";
  133. echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-desc" value="Description and pricing details here." size="73" /></p>' . "\n";
  134. echo '<p>Custom Capabilities ( comma-delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -> API Scripting -> Custom Capabilities.\\n\\n*ADVANCED TIP: You can specifiy a list of Custom Capabilities that will be (Added) with this purchase. Or, you could tell s2Member to (Remove All) Custom Capabilities that may or may not already exist for a particular Member, and (Add) only the new ones that you specify. To do this, just start your list of Custom Capabilities with `-all`.\\n\\nSo instead of just (Adding) Custom Capabilities:\\nmusic,videos,archives,gifts\\n\\nYou could (Remove All) that may already exist, and then (Add) new ones:\\n-all,calendar,forums,tools\\n\\nOr to just (Remove All) and (Add) nothing:\\n-all\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-ccap-ccaps" size="40" /></p>' . "\n";
  135. echo '<p><input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_alipayCcapButtonGenerate();" class="button-primary" /></p>' . "\n";
  136. echo '</form>' . "\n";
  137. echo '</td>' . "\n";
  138. /**/
  139. echo '</tr>' . "\n";
  140. echo '<tr>' . "\n";
  141. /**/
  142. echo '<td colspan="2">' . "\n";
  143. echo '<form onsubmit="return false;">' . "\n";
  144. echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
  145. $ws_plugin__s2member_pro_temp_s = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/alipay-ccaps-checkout-button-shortcode.php")));
  146. $ws_plugin__s2member_pro_temp_s = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
  147. echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-ccap-shortcode" value="' . format_to_edit ($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
  148. echo '</form>' . "\n";
  149. echo '</td>' . "\n";
  150. /**/
  151. echo '</tr>' . "\n";
  152. echo '</tbody>' . "\n";
  153. echo '</table>' . "\n";
  154. echo '</div>' . "\n";
  155. /**/
  156. echo '</div>' . "\n";
  157. }
  158. /**/
  159. echo '<div class="ws-menu-page-group" title="AliPay® Member Registration Access Links">' . "\n";
  160. /**/
  161. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-reg-links-section">' . "\n";
  162. echo '<h3>Registration Access Link Generator ( for Customer Service )</h3>' . "\n";
  163. echo '<p>s2Member automatically generates Registration Access Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Registration Access Link to be created manually, you can use this tool for that. Alternatively, you can create their account yourself/manually by going to <code>s2Member -> Add A Member</code>. Either of these methods will work fine.</p>' . "\n";
  164. /**/
  165. echo '<table class="form-table">' . "\n";
  166. echo '<tbody>' . "\n";
  167. echo '<tr>' . "\n";
  168. /**/
  169. echo '<td>' . "\n";
  170. echo '<form onsubmit="return false;">' . "\n";
  171. echo '<p>Paid Membership Level#: <select id="ws-plugin--s2member-pro-reg-link-level">' . "\n";
  172. for ($n = 1; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
  173. echo '<option value="' . $n . '">s2Member Level #' . $n . '</option>' . "\n";
  174. echo '</select></p>' . "\n";
  175. echo '<p>Paid Subscr. ID: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-subscr-id" value="" size="50" /> <a href="#" onclick="alert(\'The Customer\\\'s Paid Subscr. ID ( aka: AliPay® Trade No. ) must be unique. This value can be obtained from inside your AliPay® account. Each paying Customer MUST be associated with a unique Paid Subscr. ID. If the Customer is NOT associated with a Paid Subscr. ID, you will need to generate a unique value for this field on your own. But keep in mind, s2Member will be unable to maintain future communication with the AliPay® IPN ( i.e. Notification ) service if this value does not reflect a real Paid Subscr. ID that exists in your AliPay® transaction log.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
  176. echo '<p>Custom String Value: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-custom" value="' . esc_attr ($_SERVER["HTTP_HOST"]) . '" size="30" /> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_alipayRegLinkGenerate();" class="button-primary" /> <img id="ws-plugin--s2member-pro-reg-link-loading" src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
  177. echo '<p' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma-delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" maxlength="125" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-ccaps" size="40" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^a-z_0-9,]/gi, \'\').toLowerCase ());" /></p>' . "\n";
  178. echo '<p>Fixed Term Length ( for Buy Now transactions ): <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-reg-link-fixed-term" value="" size="10" /> <a href="#" onclick="alert(\'You may configure a Fixed Term Length in this field. This way the Customer\\\'s Membership Access is automatically revoked by s2Member at the appropriate time. This will be a numeric value, followed by a space, then a single letter.\\n\\nHere are some examples:\\n\\n1 D ( this means 1 Day )\\n1 W ( this means 1 Week )\\n1 M ( this means 1 Month )\\n1 Y ( this means 1 Year )\\n1 L ( this means 1 Lifetime )\'); return false;">[?]</a></p>' . "\n";
  179. echo '<p id="ws-plugin--s2member-pro-reg-link" style="font-family:Consolas, monospace; display:none;"></p>' . "\n";
  180. echo '</form>' . "\n";
  181. echo '</td>' . "\n";
  182. /**/
  183. echo '</tr>' . "\n";
  184. echo '</tbody>' . "\n";
  185. echo '</table>' . "\n";
  186. echo '</div>' . "\n";
  187. /**/
  188. echo '</div>' . "\n";
  189. /**/
  190. echo '<div class="ws-menu-page-group" title="AliPay® Specific Post/Page (Buy Now) Buttons">' . "\n";
  191. /**/
  192. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-buttons-section">' . "\n";
  193. echo '<h3>Button Code Generator For Specific Post/Page Buttons</h3>' . "\n";
  194. echo '<p>s2Member now supports an additional layer of functionality ( very powerful ), which allows you to sell access to specific Posts/Pages that you\'ve created in WordPress®. Specific Post/Page Access works independently from Member Level Access. That is, you can sell an unlimited number of Posts/Pages using "Buy Now" Buttons, and your Customers will NOT be required to have a Membership Account with your site in order to receive access. If they are already a Member, that\'s fine, but they won\'t need to be.</p>' . "\n";
  195. echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link ( see: <code>s2Member -> AliPay® Options -> Specific Post/Page Email</code> ). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
  196. echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress®. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress® Post/Page that you\'ve created. To protect Specific Posts/Pages, please see: <code>s2Member -> Restriction Options -> Specific Post/Page Access</code>. Once you\'ve configured your Specific Post/Page Restrictions, those Posts/Pages will be available in the menus below.</p>' . "\n";
  197. echo '<p>Very simple. All you do is customize the form fields provided, for each Post/Page that you plan to sell. Then press (Generate Button Code). These special AliPay® Buttons are customized to work with s2Member seamlessly. You can even Package Additional Posts/Pages together into one transaction. <em>* Buttons are NOT saved here. This is only a Button Generator. Once you\'ve generated your Button, copy/paste it into your WordPress® Editor, wherever you feel it would be most appropriate. If you lose your Button Code, you\'ll need to come back &amp; re-generate a new one.</em></p>' . "\n";
  198. /**/
  199. echo '<table class="form-table">' . "\n";
  200. echo '<tbody>' . "\n";
  201. echo '<tr>' . "\n";
  202. /**/
  203. echo '<th class="ws-menu-page-th-side">' . "\n";
  204. echo '<label for="ws-plugin--s2member-pro-sp-shortcode">' . "\n";
  205. echo 'Button Code<br />Specific Posts/Pages:<br /><br />' . "\n";
  206. echo '</label>' . "\n";
  207. echo '</th>' . "\n";
  208. /**/
  209. echo '<td>' . "\n";
  210. echo '<form onsubmit="return false;">' . "\n";
  211. /**/
  212. echo '<p><select id="ws-plugin--s2member-pro-sp-leading-id">' . "\n";
  213. echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
  214. /**/
  215. $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp ("exclude-conflicts");
  216. /**/
  217. foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o)
  218. echo '<option value="' . esc_attr ($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
  219. /**/
  220. echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
  221. /**/
  222. echo '<p><select id="ws-plugin--s2member-pro-sp-additional-ids" multiple="multiple" style="height:100px;">' . "\n";
  223. echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
  224. /**/
  225. foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o)
  226. echo '<option value="' . esc_attr ($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
  227. /**/
  228. echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
  229. /**/
  230. echo '<p>I want to charge: $<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-pro-sp-hours">' . trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/alipay-sp-hours.php"))) . '</select></p>' . "\n";
  231. echo '<p>Description: <input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-desc" value="Description and pricing details here." size="67" /></p>' . "\n";
  232. echo '<p><input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_pro_alipaySpButtonGenerate();" class="button-primary" /></p>' . "\n";
  233. echo '</form>' . "\n";
  234. echo '</td>' . "\n";
  235. /**/
  236. echo '</tr>' . "\n";
  237. echo '<tr>' . "\n";
  238. /**/
  239. echo '<td colspan="2">' . "\n";
  240. echo '<form onsubmit="return false;">' . "\n";
  241. echo '<strong>WordPress® Shortcode:</strong> ( recommended for both the WordPress® Visual &amp; HTML Editors )<br />' . "\n";
  242. $ws_plugin__s2member_pro_temp_s = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/alipay-sp-checkout-button-shortcode.php")));
  243. $ws_plugin__s2member_pro_temp_s = preg_replace ("/%%custom%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_pro_temp_s);
  244. echo '<input type="text" autocomplete="off" id="ws-plugin--s2member-pro-sp-shortcode" value="' . format_to_edit ($ws_plugin__s2member_pro_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
  245. echo '</form>' . "\n";
  246. echo '</td>' . "\n";
  247. /**/
  248. echo '</tr>' . "\n";
  249. echo '</tbody>' . "\n";
  250. echo '</table>' . "\n";
  251. echo '</div>' . "\n";
  252. /**/
  253. echo '</div>' . "\n";
  254. /**/
  255. echo '<div class="ws-menu-page-group" title="AliPay® Specific Post/Page Access Links">' . "\n";
  256. /**/
  257. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-sp-links-section">' . "\n";
  258. echo '<h3>Specific Post/Page Link Generator ( for Customer Service )</h3>' . "\n";
  259. echo '<p>s2Member automatically generates Specific Post/Page Links for your Customers after checkout, and also sends them a link in a Confirmation Email. However, if you ever need to deal with a Customer Service issue that requires a new Specific Post/Page Link to be created manually, you can use this tool for that.</p>' . "\n";
  260. /**/
  261. echo '<table class="form-table">' . "\n";
  262. echo '<tbody>' . "\n";
  263. echo '<tr>' . "\n";
  264. /**/
  265. echo '<td>' . "\n";
  266. echo '<form onsubmit="return false;">' . "\n";
  267. /**/
  268. echo '<p><select id="ws-plugin--s2member-pro-sp-link-leading-id">' . "\n";
  269. echo '<option value="">&mdash; Select a Leading Post/Page that you\'ve protected &mdash;</option>' . "\n";
  270. /**/
  271. $ws_plugin__s2member_pro_temp_a_singulars = c_ws_plugin__s2member_utils_gets::get_all_singulars_with_sp ("exclude-conflicts");
  272. /**/
  273. foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o)
  274. echo '<option value="' . esc_attr ($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
  275. /**/
  276. echo '</select> <a href="#" onclick="alert(\'Required. The Leading Post/Page, is what your Customers will land on after checkout.\n\n*Tip* If there are no Posts/Pages in the menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
  277. /**/
  278. echo '<p><select id="ws-plugin--s2member-pro-sp-link-additional-ids" multiple="multiple" style="height:100px; min-width:450px;">' . "\n";
  279. echo '<optgroup label="&mdash; Package Additional Posts/Pages that you\'ve protected &mdash;">' . "\n";
  280. /**/
  281. foreach ($ws_plugin__s2member_pro_temp_a_singulars as $ws_plugin__s2member_pro_temp_o)
  282. echo '<option value="' . esc_attr ($ws_plugin__s2member_pro_temp_o->ID) . '">' . esc_html ($ws_plugin__s2member_pro_temp_o->post_title) . '</option>' . "\n";
  283. /**/
  284. echo '</optgroup></select> <a href="#" onclick="alert(\'Hold down your `Ctrl` key to select multiples.\\n\\nOptional. If you include Additional Posts/Pages, Customers will still land on your Leading Post/Page; BUT, they\\\'ll ALSO have access to some Additional Posts/Pages that you\\\'ve protected. This gives you the ability to create Post/Page Packages.\\n\\nIn other words, a Customer is sold a Specific Post/Page ( they\\\'ll land on your Leading Post/Page after checkout ), which might contain links to some other Posts/Pages that you\\\'ve packaged together under one transaction.\\n\\nBundling Additional Posts/Pages into one Package, authenticates the Customer for access to the Additional Posts/Pages automatically ( e.g. only one Access Link is needed, and s2Member generates this automatically ). However, you will STILL need to design your Leading Post/Page ( which is what a Customer will actually land on ), with links pointing to the other Posts/Pages. This way your Customers will have clickable links to everything they\\\'ve paid for.\\n\\n*Quick Summary* s2Member sends Customers to your Leading Post/Page, and also authenticates them for access to any Additional Posts/Pages automatically. You handle it from there.\\n\\n*Tip* If there are no Posts/Pages in this menu, it\\\'s because you\\\'ve not configured s2Member for Specific Post/Page Access yet. See: s2Member -> Restriction Options -> Specific Post/Page Access.\'); return false;" tabindex="-1">[?]</a></p>' . "\n";
  285. /**/
  286. echo '<p><select id="ws-plugin--s2member-pro-sp-link-hours">' . trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/alipay-sp-hours.php"))) . '</select> <input type="button" value="Generate Access Link" onclick="ws_plugin__s2member_pro_alipaySpLinkGenerate();" class="button-primary" /> <img id="ws-plugin--s2member-pro-sp-link-loading" src="' . esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/ajax-loader.gif" alt="" style="display:none;" /></p>' . "\n";
  287. echo '<p id="ws-plugin--s2member-pro-sp-link" style="font-family:Consolas, monospace; display:none;"></p>' . "\n";
  288. echo '</form>' . "\n";
  289. echo '</td>' . "\n";
  290. /**/
  291. echo '</tr>' . "\n";
  292. echo '</tbody>' . "\n";
  293. echo '</table>' . "\n";
  294. echo '</div>' . "\n";
  295. /**/
  296. echo '</div>' . "\n";
  297. /**/
  298. echo '<div class="ws-menu-page-group" title="Shortcode Attributes ( Explained )">' . "\n";
  299. /**/
  300. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-shortcode-attrs-section">' . "\n";
  301. echo '<h3>Shortcode Attributes ( Explained In Full Detail )</h3>' . "\n";
  302. echo '<p>When you generate a Button Code, s2Member will make a <a href="http://codex.wordpress.org/Shortcode_API#Overview" target="_blank" rel="external">Shortcode</a> available to you. Like most Shortcodes for WordPress®, s2Member reads Attributes in your Shortcode. These Attributes will be pre-configured by one of s2Member\'s Button Generators automatically; so there really is nothing more you need to do. However, many site owners like to know exactly how these Shortcode Attributes work. Below, is a brief overview of each possible Shortcode Attribute.</p>' . "\n";
  303. /**/
  304. echo '<table class="form-table" style="margin-top:0;">' . "\n";
  305. echo '<tbody>' . "\n";
  306. echo '<tr style="padding-top:0;">' . "\n";
  307. /**/
  308. echo '<td style="padding-top:0;">' . "\n";
  309. echo '<ul>' . "\n";
  310. echo (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? '<li><code>ccaps="music,videos"</code> A comma-delimited list of Custom Capabilities. Only valid w/ Membership Level Access and/or Independent Custom Capabilities.</li>' . "\n" : '';
  311. echo '<li><code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '"</code> must start with your domain. Additional values can be piped in ( ex: <code>custom="' . esc_html ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3|etc"</code> ).</li>' . "\n";
  312. echo '<li><code>desc="Gold Membership"</code> A brief purchase Description; which may also include pricing details.</li>' . "\n";
  313. echo '<li><code>exp="72"</code> Access Expires ( in hours ). Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
  314. echo '<li><code>ids="14"</code> A Post/Page ID#, or a comma-delimited list of IDs. Only valid when <code>sp="1"</code> for Specific Post/Page Access.</li>' . "\n";
  315. echo '<li><code>image="default"</code> Button Image Location. Possible values: <code>default</code> = use the default AliPay® Button, <code>http://...</code> = location of your custom Image.</li>' . "\n";
  316. echo '<li><code>level="1"</code> Membership Level [1-4] <em>( or, up to the number of configured Levels )</em>. Only valid for Buttons providing paid Membership Level Access.' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? '' : ' Or, with Independent Custom Capabilities this MUST be set to <code>level="*"</code>, and <code>ccaps=""</code> must NOT be empty <em>( i.e. <code>level="*" ccaps="music,videos"</code> )</em>.') . '</li>' . "\n";
  317. echo '<li><code>output="anchor"</code> Output Type. Possible values: <code>anchor</code> = AliPay® Button ( &lt;a&gt; anchor tag ) URL w/ ?query string, <code>url</code> = raw URL w/ ?query string.</li>' . "\n";
  318. echo '<li><code>ra="0.01"</code> Regular / Buy Now Amount. Must be &gt;= <code>0.01</code>.</li>' . "\n";
  319. echo '<li><code>rp="1"</code> Regular Period. Only valid w/ Membership Level Access' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? '' : ' and/or Independent Custom Capabilities') . '. Must be &gt;= <code>1</code> ( ex: <code>1</code> Week, <code>2</code> Months, <code>1</code> Month, <code>3</code> Days ).</li>' . "\n";
  320. echo '<li><code>rt="M"</code> Regular Term. Only valid w/ Membership Level Access' . ((is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ()) ? '' : ' and/or Independent Custom Capabilities') . '. Possible values: <code>D</code> = Days, <code>W</code> = Weeks, <code>M</code> = Months, <code>Y</code> = Years, <code>L</code> = Lifetime.</li>' . "\n";
  321. echo '<li><code>sp="0"</code> Specific Post/Page Button. Possible values: <code>0</code> = this is NOT a Specific Post/Page Access Button, <code>1</code> = this IS a Specific Post/Page Access Button.</li>' . "\n";
  322. echo '<li><code>success=""</code> Success Return URL <em>( optional )</em>. s2Member handles this automatically for you. However, if you would prefer to take control over the landing page after checkout <em>( i.e. your own custom Thank-You Page )</em>, you can. If supplied, this must be a full URL, starting with <code>http://</code>. Note, s2Member will NOT use this value if an existing account holder is being modified. s2Member handles account updates <em>( i.e. billing modification )</em> in a more dynamic way. Your Success Return URL is only applied to (new) Customers.</li>' . "\n";
  323. echo '</ul>' . "\n";
  324. echo '</td>' . "\n";
  325. /**/
  326. echo '</tr>' . "\n";
  327. echo '</tbody>' . "\n";
  328. echo '</table>' . "\n";
  329. echo '</div>' . "\n";
  330. /**/
  331. echo '</div>' . "\n";
  332. /**/
  333. echo '</td>' . "\n";
  334. /**/
  335. echo '<td class="ws-menu-page-table-r">' . "\n";
  336. c_ws_plugin__s2member_menu_pages_rs::display ();
  337. echo '</td>' . "\n";
  338. /**/
  339. echo '</tr>' . "\n";
  340. echo '</tbody>' . "\n";
  341. echo '</table>' . "\n";
  342. /**/
  343. echo '</div>' . "\n";
  344. }
  345. }
  346. }
  347. /**/
  348. new c_ws_plugin__s2member_pro_menu_page_alipay_buttons ();
  349. ?>

s2member-pro\includes\menu-pages\alipay-buttons.inc.php

Source Code Documentation