Version Description
- Added a new shortcode parameter (other_amount_label) to allow customization of the "Other Amount" text/label in the payment form.
- Added a new class name (buy_now_button_image) to the custom button image (so users can target that button image for customization via CSS).
- WordPress 4.4 compatibility.
Download this release
Release Info
| Developer | mra13 |
| Plugin | |
| Version | 4.8 |
| Comparing to | |
| See all releases | |
Code changes from version 4.5 to 4.8
- WP_Accept_Paypal_Payment.php +214 -444
- readme.txt +18 -2
- shortcode_view.php +223 -203
- wpapp-styles.css +7 -3
- wpapp_admin_menu.php +236 -0
- wpapp_paypal_utility.php +68 -0
WP_Accept_Paypal_Payment.php
CHANGED
|
@@ -1,444 +1,214 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/*
|
| 3 |
-
Plugin Name: WP Easy Paypal Payment Accept
|
| 4 |
-
Version: v4.
|
| 5 |
-
Plugin URI:
|
| 6 |
-
Author: Tips and Tricks HQ
|
| 7 |
-
Author URI:
|
| 8 |
-
Description: Easy to use Wordpress plugin to accept paypal payment for a service or product or donation in one click. Can be used in the sidebar, posts and pages.
|
| 9 |
-
License: GPL2
|
| 10 |
-
*/
|
| 11 |
-
|
| 12 |
-
define('WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_VERSION', '4.
|
| 13 |
-
define('WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_URL', plugins_url('', __FILE__));
|
| 14 |
-
|
| 15 |
-
include_once('shortcode_view.php');
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
add_option('
|
| 22 |
-
add_option('
|
| 23 |
-
add_option('
|
| 24 |
-
add_option('
|
| 25 |
-
add_option('
|
| 26 |
-
add_option('
|
| 27 |
-
add_option('
|
| 28 |
-
add_option('
|
| 29 |
-
add_option('
|
| 30 |
-
add_option('
|
| 31 |
-
add_option('
|
| 32 |
-
add_option('
|
| 33 |
-
add_option('
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
function
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
$
|
| 63 |
-
$
|
| 64 |
-
$
|
| 65 |
-
|
| 66 |
-
$
|
| 67 |
-
$
|
| 68 |
-
$
|
| 69 |
-
$
|
| 70 |
-
$
|
| 71 |
-
$
|
| 72 |
-
$
|
| 73 |
-
$
|
| 74 |
-
$
|
| 75 |
-
$
|
| 76 |
-
$
|
| 77 |
-
$
|
| 78 |
-
$
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
$
|
| 82 |
-
$
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
$output
|
| 86 |
-
$output .=
|
| 87 |
-
$output .=
|
| 88 |
-
$output .=
|
| 89 |
-
$output .=
|
| 90 |
-
$output .= "<
|
| 91 |
-
$
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
$
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
<input type="hidden" name="
|
| 129 |
-
|
| 130 |
-
<input type="hidden" name="
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
$
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
<div class=wrap>
|
| 217 |
-
<div id="poststuff"><div id="post-body">
|
| 218 |
-
|
| 219 |
-
<h2>Accept Paypal Payment Settings v <?php echo WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_VERSION; ?></h2>
|
| 220 |
-
|
| 221 |
-
<div style="background: none repeat scroll 0 0 #ECECEC;border: 1px solid #CFCFCF;color: #363636;margin: 10px 0 15px;padding:15px;text-shadow: 1px 1px #FFFFFF;">
|
| 222 |
-
For usage documentation and updates, please visit the plugin page at the following URL:<br />
|
| 223 |
-
<a href="http://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120" target="_blank">http://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120</a>
|
| 224 |
-
</div>
|
| 225 |
-
|
| 226 |
-
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
|
| 227 |
-
<input type="hidden" name="info_update" id="info_update" value="true" />
|
| 228 |
-
|
| 229 |
-
<div class="postbox">
|
| 230 |
-
<h3><label for="title">Plugin Usage</label></h3>
|
| 231 |
-
<div class="inside">
|
| 232 |
-
<p>There are a few ways you can use this plugin:</p>
|
| 233 |
-
<ol>
|
| 234 |
-
<li>Configure the options below and then add the shortcode <strong>[wp_paypal_payment]</strong> to a post or page (where you want the payment button)</li>
|
| 235 |
-
<li>Call the function from a template file: <strong><?php echo Paypal_payment_accept(); ?></strong></li>
|
| 236 |
-
<li>Use the <strong>WP Paypal Payment</strong> Widget from the Widgets menu</li>
|
| 237 |
-
<li>Use the shortcode with custom parameter options to add multiple different payment widgets in different areas of the site.
|
| 238 |
-
<a href="http://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120#shortcode_with_custom_parameters" target="_blank">View shortcode documentation</a></li>
|
| 239 |
-
</ol>
|
| 240 |
-
</div></div>
|
| 241 |
-
|
| 242 |
-
<div class="postbox">
|
| 243 |
-
<h3><label for="title">WP Paypal Payment or Donation Accept Plugin Options</label></h3>
|
| 244 |
-
<div class="inside">
|
| 245 |
-
|
| 246 |
-
<table class="form-table">
|
| 247 |
-
|
| 248 |
-
<tr valign="top"><td width="25%" align="left">
|
| 249 |
-
<strong>WP Paypal Payment Widget Title:</strong>
|
| 250 |
-
</td><td align="left">
|
| 251 |
-
<input name="wp_paypal_widget_title_name" type="text" size="30" value="<?php echo get_option('wp_paypal_widget_title_name'); ?>"/>
|
| 252 |
-
<br /><i>This will be the title of the Widget on the Sidebar if you use it.</i><br />
|
| 253 |
-
</td></tr>
|
| 254 |
-
|
| 255 |
-
<tr valign="top"><td width="25%" align="left">
|
| 256 |
-
<strong>Paypal Email address:</strong>
|
| 257 |
-
</td><td align="left">
|
| 258 |
-
<input name="wp_pp_payment_email" type="text" size="35" value="<?php echo get_option('wp_pp_payment_email'); ?>"/>
|
| 259 |
-
<br /><i>This is the Paypal Email address where the payments will go</i><br />
|
| 260 |
-
</td></tr>
|
| 261 |
-
|
| 262 |
-
<tr valign="top"><td width="25%" align="left">
|
| 263 |
-
<strong>Choose Payment Currency: </strong>
|
| 264 |
-
</td><td align="left">
|
| 265 |
-
<select id="paypal_payment_currency" name="paypal_payment_currency">
|
| 266 |
-
<?php _e('<option value="USD"') ?><?php if ($paypal_payment_currency == "USD") echo " selected " ?><?php _e('>US Dollar</option>') ?>
|
| 267 |
-
<?php _e('<option value="GBP"') ?><?php if ($paypal_payment_currency == "GBP") echo " selected " ?><?php _e('>Pound Sterling</option>') ?>
|
| 268 |
-
<?php _e('<option value="EUR"') ?><?php if ($paypal_payment_currency == "EUR") echo " selected " ?><?php _e('>Euro</option>') ?>
|
| 269 |
-
<?php _e('<option value="AUD"') ?><?php if ($paypal_payment_currency == "AUD") echo " selected " ?><?php _e('>Australian Dollar</option>') ?>
|
| 270 |
-
<?php _e('<option value="CAD"') ?><?php if ($paypal_payment_currency == "CAD") echo " selected " ?><?php _e('>Canadian Dollar</option>') ?>
|
| 271 |
-
<?php _e('<option value="NZD"') ?><?php if ($paypal_payment_currency == "NZD") echo " selected " ?><?php _e('>New Zealand Dollar</option>') ?>
|
| 272 |
-
<?php _e('<option value="HKD"') ?><?php if ($paypal_payment_currency == "HKD") echo " selected " ?><?php _e('>Hong Kong Dollar</option>') ?>
|
| 273 |
-
</select>
|
| 274 |
-
<br /><i>This is the currency for your visitors to make Payments or Donations in.</i><br />
|
| 275 |
-
</td></tr>
|
| 276 |
-
|
| 277 |
-
<tr valign="top"><td width="25%" align="left">
|
| 278 |
-
<strong>Payment Subject:</strong>
|
| 279 |
-
</td><td align="left">
|
| 280 |
-
<input name="wp_pp_payment_subject" type="text" size="35" value="<?php echo get_option('wp_pp_payment_subject'); ?>"/>
|
| 281 |
-
<br /><i>Enter the Product or service name or the reason for the payment here. The visitors will see this text</i><br />
|
| 282 |
-
</td></tr>
|
| 283 |
-
|
| 284 |
-
<tr valign="top"><td width="25%" align="left">
|
| 285 |
-
<strong>Payment Option 1:</strong>
|
| 286 |
-
</td><td align="left">
|
| 287 |
-
<input name="wp_pp_payment_item1" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item1'); ?>"/>
|
| 288 |
-
<strong>Price :</strong>
|
| 289 |
-
<input name="wp_pp_payment_value1" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value1'); ?>"/>
|
| 290 |
-
<br />
|
| 291 |
-
</td></tr>
|
| 292 |
-
|
| 293 |
-
<tr valign="top"><td width="25%" align="left">
|
| 294 |
-
<strong>Payment Option 2:</strong>
|
| 295 |
-
</td><td align="left">
|
| 296 |
-
<input name="wp_pp_payment_item2" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item2'); ?>"/>
|
| 297 |
-
<strong>Price :</strong>
|
| 298 |
-
<input name="wp_pp_payment_value2" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value2'); ?>"/>
|
| 299 |
-
<br />
|
| 300 |
-
</td></tr>
|
| 301 |
-
|
| 302 |
-
<tr valign="top"><td width="25%" align="left">
|
| 303 |
-
<strong>Payment Option 3:</strong>
|
| 304 |
-
</td><td align="left">
|
| 305 |
-
<input name="wp_pp_payment_item3" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item3'); ?>"/>
|
| 306 |
-
<strong>Price :</strong>
|
| 307 |
-
<input name="wp_pp_payment_value3" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value3'); ?>"/>
|
| 308 |
-
<br />
|
| 309 |
-
</td></tr>
|
| 310 |
-
|
| 311 |
-
<tr valign="top"><td width="25%" align="left">
|
| 312 |
-
<strong>Payment Option 4:</strong>
|
| 313 |
-
</td><td align="left">
|
| 314 |
-
<input name="wp_pp_payment_item4" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item4'); ?>"/>
|
| 315 |
-
<strong>Price :</strong>
|
| 316 |
-
<input name="wp_pp_payment_value4" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value4'); ?>"/>
|
| 317 |
-
<br />
|
| 318 |
-
</td></tr>
|
| 319 |
-
|
| 320 |
-
<tr valign="top"><td width="25%" align="left">
|
| 321 |
-
<strong>Payment Option 5:</strong>
|
| 322 |
-
</td><td align="left">
|
| 323 |
-
<input name="wp_pp_payment_item5" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item5'); ?>"/>
|
| 324 |
-
<strong>Price :</strong>
|
| 325 |
-
<input name="wp_pp_payment_value5" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value5'); ?>"/>
|
| 326 |
-
<br />
|
| 327 |
-
</td></tr>
|
| 328 |
-
|
| 329 |
-
<tr valign="top"><td width="25%" align="left">
|
| 330 |
-
<strong>Payment Option 6:</strong>
|
| 331 |
-
</td><td align="left">
|
| 332 |
-
<input name="wp_pp_payment_item6" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item6'); ?>"/>
|
| 333 |
-
<strong>Price :</strong>
|
| 334 |
-
<input name="wp_pp_payment_value6" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value6'); ?>"/>
|
| 335 |
-
<br /><i>Enter the name of the service or product and the price. eg. Enter "Basic service - $10" in the Payment Option text box and "10.00" in the price text box to accept a payment of $10 for "Basic service". Leave the Payment Option and Price fields empty if u don't want to use that option. For example, if you have 3 price options then fill in the top 3 and leave the rest empty.</i>
|
| 336 |
-
</td></tr>
|
| 337 |
-
|
| 338 |
-
<tr valign="top"><td width="25%" align="left">
|
| 339 |
-
<strong>Show Other Amount:</strong>
|
| 340 |
-
</td><td align="left">
|
| 341 |
-
<input name="wp_pp_show_other_amount" type="checkbox"<?php if (get_option('wp_pp_show_other_amount') != '-1') echo ' checked="checked"'; ?> value="1"/>
|
| 342 |
-
<i> Tick this checkbox if you want to show ohter amount text box to your visitors so they can enter custom amount.</i>
|
| 343 |
-
</td></tr>
|
| 344 |
-
|
| 345 |
-
<tr valign="top"><td width="25%" align="left">
|
| 346 |
-
<strong>Show Reference Text Box:</strong>
|
| 347 |
-
</td><td align="left">
|
| 348 |
-
<input name="wp_pp_show_ref_box" type="checkbox"<?php if (get_option('wp_pp_show_ref_box') != '-1') echo ' checked="checked"'; ?> value="1"/>
|
| 349 |
-
<i> Tick this checkbox if you want your visitors to be able to enter a reference text like email or web address.</i>
|
| 350 |
-
</td></tr>
|
| 351 |
-
|
| 352 |
-
<tr valign="top"><td width="25%" align="left">
|
| 353 |
-
<strong>Reference Text Box Title:</strong>
|
| 354 |
-
</td><td align="left">
|
| 355 |
-
<input name="wp_pp_ref_title" type="text" size="35" value="<?php echo get_option('wp_pp_ref_title'); ?>"/>
|
| 356 |
-
<br /><i>Enter a title for the Reference text box (ie. Your Web Address). The visitors will see this text.</i><br />
|
| 357 |
-
</td></tr>
|
| 358 |
-
|
| 359 |
-
<tr valign="top"><td width="25%" align="left">
|
| 360 |
-
<strong>Return URL from PayPal:</strong>
|
| 361 |
-
</td><td align="left">
|
| 362 |
-
<input name="wp_pp_return_url" type="text" size="60" value="<?php echo get_option('wp_pp_return_url'); ?>"/>
|
| 363 |
-
<br /><i>Enter a return URL (could be a Thank You page). PayPal will redirect visitors to this page after Payment.</i><br />
|
| 364 |
-
</td></tr>
|
| 365 |
-
|
| 366 |
-
</table>
|
| 367 |
-
|
| 368 |
-
<br /><br />
|
| 369 |
-
<strong>Choose a Submit Button Type :</strong>
|
| 370 |
-
<br /><i>This is the button the visitors will click on to make Payments or Donations.</i><br />
|
| 371 |
-
<table style="width:50%; border-spacing:0; padding:0; text-align:center;">
|
| 372 |
-
<tr>
|
| 373 |
-
<td>
|
| 374 |
-
<?php _e('<input type="radio" name="payment_button_type" value="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"') ?>
|
| 375 |
-
<?php if ($payment_button_type == "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif") echo " checked " ?>
|
| 376 |
-
<?php _e('/>') ?>
|
| 377 |
-
</td>
|
| 378 |
-
<td>
|
| 379 |
-
<?php _e('<input type="radio" name="payment_button_type" value="https://www.paypal.com/en_US/i/btn/x-click-but11.gif"') ?>
|
| 380 |
-
<?php if ($payment_button_type == "https://www.paypal.com/en_US/i/btn/x-click-but11.gif") echo " checked " ?>
|
| 381 |
-
<?php _e('/>') ?>
|
| 382 |
-
</td>
|
| 383 |
-
</tr>
|
| 384 |
-
<tr>
|
| 385 |
-
<td><img border="0" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" alt="" /></td>
|
| 386 |
-
<td><img border="0" src="https://www.paypal.com/en_US/i/btn/x-click-but11.gif" alt="" /></td>
|
| 387 |
-
</tr>
|
| 388 |
-
</table>
|
| 389 |
-
|
| 390 |
-
</div></div><!-- end of postbox -->
|
| 391 |
-
|
| 392 |
-
<div class="submit">
|
| 393 |
-
<input type="submit" class="button-primary" name="info_update" value="<?php _e('Update options'); ?> »" />
|
| 394 |
-
</div>
|
| 395 |
-
</form>
|
| 396 |
-
|
| 397 |
-
<div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
|
| 398 |
-
<p>If you need a feature rich and supported plugin for accepting PayPal payment then check out our <a href="https://www.tipsandtricks-hq.com/wordpress-estore-plugin-complete-solution-to-sell-digital-products-from-your-wordpress-blog-securely-1059" target="_blank">WP eStore Plugin</a> (You will love the WP eStore Plugin).
|
| 399 |
-
</p>
|
| 400 |
-
</div>
|
| 401 |
-
|
| 402 |
-
</div></div> <!-- end of .poststuff and post-body -->
|
| 403 |
-
</div><!-- end of .wrap -->
|
| 404 |
-
<?php
|
| 405 |
-
}
|
| 406 |
-
|
| 407 |
-
function show_wp_paypal_payment_widget($args) {
|
| 408 |
-
extract($args);
|
| 409 |
-
|
| 410 |
-
$wp_paypal_payment_widget_title_name_value = get_option('wp_paypal_widget_title_name');
|
| 411 |
-
echo $before_widget;
|
| 412 |
-
echo $before_title . $wp_paypal_payment_widget_title_name_value . $after_title;
|
| 413 |
-
echo Paypal_payment_accept();
|
| 414 |
-
echo $after_widget;
|
| 415 |
-
}
|
| 416 |
-
|
| 417 |
-
function wp_paypal_payment_widget_control() {
|
| 418 |
-
?>
|
| 419 |
-
<p>
|
| 420 |
-
<? _e("Set the Plugin Settings from the Settings menu"); ?>
|
| 421 |
-
</p>
|
| 422 |
-
<?php
|
| 423 |
-
}
|
| 424 |
-
|
| 425 |
-
function wp_paypal_payment_init() {
|
| 426 |
-
wp_register_style('wpapp-styles', WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_URL . '/wpapp-styles.css');
|
| 427 |
-
wp_enqueue_style('wpapp-styles');
|
| 428 |
-
|
| 429 |
-
//Widget code
|
| 430 |
-
$widget_options = array('classname' => 'widget_wp_paypal_payment', 'description' => __("Display WP Paypal Payment."));
|
| 431 |
-
wp_register_sidebar_widget('wp_paypal_payment_widgets', __('WP Paypal Payment'), 'show_wp_paypal_payment_widget', $widget_options);
|
| 432 |
-
wp_register_widget_control('wp_paypal_payment_widgets', __('WP Paypal Payment'), 'wp_paypal_payment_widget_control');
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
-
add_filter('the_content', 'wp_ppp_process');
|
| 436 |
-
add_shortcode('wp_paypal_payment', 'Paypal_payment_accept');
|
| 437 |
-
if (!is_admin()) {
|
| 438 |
-
add_filter('widget_text', 'do_shortcode');
|
| 439 |
-
}
|
| 440 |
-
|
| 441 |
-
add_action('init', 'wp_paypal_payment_init');
|
| 442 |
-
|
| 443 |
-
// Insert the paypal_payment_add_option_pages in the 'admin_menu'
|
| 444 |
-
add_action('admin_menu', 'paypal_payment_add_option_pages');
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
Plugin Name: WP Easy Paypal Payment Accept
|
| 4 |
+
Version: v4.8
|
| 5 |
+
Plugin URI: https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120
|
| 6 |
+
Author: Tips and Tricks HQ
|
| 7 |
+
Author URI: https://www.tipsandtricks-hq.com/
|
| 8 |
+
Description: Easy to use Wordpress plugin to accept paypal payment for a service or product or donation in one click. Can be used in the sidebar, posts and pages.
|
| 9 |
+
License: GPL2
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
define('WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_VERSION', '4.8');
|
| 13 |
+
define('WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_URL', plugins_url('', __FILE__));
|
| 14 |
+
|
| 15 |
+
include_once('shortcode_view.php');
|
| 16 |
+
include_once('wpapp_admin_menu.php');
|
| 17 |
+
include_once('wpapp_paypal_utility.php');
|
| 18 |
+
|
| 19 |
+
function wp_pp_plugin_install() {
|
| 20 |
+
// Some default options
|
| 21 |
+
add_option('wp_pp_payment_email', get_bloginfo('admin_email'));
|
| 22 |
+
add_option('paypal_payment_currency', 'USD');
|
| 23 |
+
add_option('wp_pp_payment_subject', 'Plugin Service Payment');
|
| 24 |
+
add_option('wp_pp_payment_item1', 'Basic Service - $10');
|
| 25 |
+
add_option('wp_pp_payment_value1', '10');
|
| 26 |
+
add_option('wp_pp_payment_item2', 'Gold Service - $20');
|
| 27 |
+
add_option('wp_pp_payment_value2', '20');
|
| 28 |
+
add_option('wp_pp_payment_item3', 'Platinum Service - $30');
|
| 29 |
+
add_option('wp_pp_payment_value3', '30');
|
| 30 |
+
add_option('wp_paypal_widget_title_name', 'Paypal Payment');
|
| 31 |
+
add_option('payment_button_type', 'https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif');
|
| 32 |
+
add_option('wp_pp_show_other_amount', '-1');
|
| 33 |
+
add_option('wp_pp_show_ref_box', '1');
|
| 34 |
+
add_option('wp_pp_ref_title', 'Your Email Address');
|
| 35 |
+
add_option('wp_pp_return_url', home_url());
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
register_activation_hook(__FILE__, 'wp_pp_plugin_install');
|
| 39 |
+
|
| 40 |
+
add_shortcode('wp_paypal_payment_box_for_any_amount', 'wpapp_buy_now_any_amt_handler');
|
| 41 |
+
|
| 42 |
+
function wpapp_buy_now_any_amt_handler($args) {
|
| 43 |
+
$output = wppp_render_paypal_button_with_other_amt($args);
|
| 44 |
+
return $output;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
add_shortcode('wp_paypal_payment_box', 'wpapp_buy_now_button_shortcode');
|
| 48 |
+
|
| 49 |
+
function wpapp_buy_now_button_shortcode($args) {
|
| 50 |
+
ob_start();
|
| 51 |
+
wppp_render_paypal_button_form($args);
|
| 52 |
+
$output = ob_get_contents();
|
| 53 |
+
ob_end_clean();
|
| 54 |
+
return $output;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
function Paypal_payment_accept() {
|
| 58 |
+
$paypal_email = get_option('wp_pp_payment_email');
|
| 59 |
+
$payment_currency = get_option('paypal_payment_currency');
|
| 60 |
+
$paypal_subject = get_option('wp_pp_payment_subject');
|
| 61 |
+
|
| 62 |
+
$itemName1 = get_option('wp_pp_payment_item1');
|
| 63 |
+
$value1 = get_option('wp_pp_payment_value1');
|
| 64 |
+
$itemName2 = get_option('wp_pp_payment_item2');
|
| 65 |
+
$value2 = get_option('wp_pp_payment_value2');
|
| 66 |
+
$itemName3 = get_option('wp_pp_payment_item3');
|
| 67 |
+
$value3 = get_option('wp_pp_payment_value3');
|
| 68 |
+
$itemName4 = get_option('wp_pp_payment_item4');
|
| 69 |
+
$value4 = get_option('wp_pp_payment_value4');
|
| 70 |
+
$itemName5 = get_option('wp_pp_payment_item5');
|
| 71 |
+
$value5 = get_option('wp_pp_payment_value5');
|
| 72 |
+
$itemName6 = get_option('wp_pp_payment_item6');
|
| 73 |
+
$value6 = get_option('wp_pp_payment_value6');
|
| 74 |
+
$payment_button = get_option('payment_button_type');
|
| 75 |
+
$wp_pp_show_other_amount = get_option('wp_pp_show_other_amount');
|
| 76 |
+
$wp_pp_show_ref_box = get_option('wp_pp_show_ref_box');
|
| 77 |
+
$wp_pp_ref_title = get_option('wp_pp_ref_title');
|
| 78 |
+
$wp_pp_return_url = get_option('wp_pp_return_url');
|
| 79 |
+
|
| 80 |
+
/* === Paypal form === */
|
| 81 |
+
$output = '';
|
| 82 |
+
$output .= '<div id="accept_paypal_payment_form">';
|
| 83 |
+
$output .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="wp_accept_pp_button_form_classic">';
|
| 84 |
+
$output .= '<input type="hidden" name="cmd" value="_xclick" />';
|
| 85 |
+
$output .= "<input type=\"hidden\" name=\"business\" value=\"$paypal_email\" />";
|
| 86 |
+
$output .= "<input type=\"hidden\" name=\"item_name\" value=\"$paypal_subject\" />";
|
| 87 |
+
$output .= "<input type=\"hidden\" name=\"currency_code\" value=\"$payment_currency\" />";
|
| 88 |
+
$output .= "<span style=\"font-size:10.0pt\"><strong> $paypal_subject</strong></span><br /><br />";
|
| 89 |
+
$output .= '<select id="amount" name="amount" class="">';
|
| 90 |
+
$output .= "<option value=\"$value1\">$itemName1</option>";
|
| 91 |
+
if ($value2 != 0) {
|
| 92 |
+
$output .= "<option value=\"$value2\">$itemName2</option>";
|
| 93 |
+
}
|
| 94 |
+
if ($value3 != 0) {
|
| 95 |
+
$output .= "<option value=\"$value3\">$itemName3</option>";
|
| 96 |
+
}
|
| 97 |
+
if ($value4 != 0) {
|
| 98 |
+
$output .= "<option value=\"$value4\">$itemName4</option>";
|
| 99 |
+
}
|
| 100 |
+
if ($value5 != 0) {
|
| 101 |
+
$output .= "<option value=\"$value5\">$itemName5</option>";
|
| 102 |
+
}
|
| 103 |
+
if ($value6 != 0) {
|
| 104 |
+
$output .= "<option value=\"$value6\">$itemName6</option>";
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
$output .= '</select>';
|
| 108 |
+
|
| 109 |
+
// Show other amount text box
|
| 110 |
+
if ($wp_pp_show_other_amount == '1') {
|
| 111 |
+
$output .= '<br /><br /><strong>Other Amount:</strong>';
|
| 112 |
+
$output .= '<br /><br /><input type="number" min="1" step="any" name="other_amount" title="Other Amount" value="" style="max-width:60px;" />';
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// Show the reference text box
|
| 116 |
+
if ($wp_pp_show_ref_box == '1') {
|
| 117 |
+
$output .= "<br /><br /><strong> $wp_pp_ref_title :</strong>";
|
| 118 |
+
$output .= '<input type="hidden" name="on0" value="'.apply_filters('wp_pp_button_reference_name','Reference').'" />';
|
| 119 |
+
$output .= '<br /><input type="text" name="os0" maxlength="60" value="'.apply_filters('wp_pp_button_reference_value','').'" class="wp_pp_button_reference" />';
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
$output .= '<br /><br />
|
| 123 |
+
<input type="hidden" name="no_shipping" value="0" />
|
| 124 |
+
<input type="hidden" name="no_note" value="1" />
|
| 125 |
+
<input type="hidden" name="bn" value="TipsandTricks_SP" />';
|
| 126 |
+
|
| 127 |
+
if (!empty($wp_pp_return_url)) {
|
| 128 |
+
$output .= '<input type="hidden" name="return" value="' . $wp_pp_return_url . '" />';
|
| 129 |
+
} else {
|
| 130 |
+
$output .='<input type="hidden" name="return" value="' . home_url() . '" />';
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
$output .= "<input type=\"image\" src=\"$payment_button\" name=\"submit\" alt=\"Make payments with payPal - it's fast, free and secure!\" />";
|
| 134 |
+
$output .= '</form>';
|
| 135 |
+
$output .= '</div>';
|
| 136 |
+
$output .= <<<EOT
|
| 137 |
+
<script type="text/javascript">
|
| 138 |
+
jQuery(document).ready(function($) {
|
| 139 |
+
$('.wp_accept_pp_button_form_classic').submit(function(e){
|
| 140 |
+
var form_obj = $(this);
|
| 141 |
+
var other_amt = form_obj.find('input[name=other_amount]').val();
|
| 142 |
+
if (!isNaN(other_amt) && other_amt.length > 0){
|
| 143 |
+
options_val = other_amt;
|
| 144 |
+
//insert the amount field in the form with the custom amount
|
| 145 |
+
$('<input>').attr({
|
| 146 |
+
type: 'hidden',
|
| 147 |
+
id: 'amount',
|
| 148 |
+
name: 'amount',
|
| 149 |
+
value: options_val
|
| 150 |
+
}).appendTo(form_obj);
|
| 151 |
+
}
|
| 152 |
+
return;
|
| 153 |
+
});
|
| 154 |
+
});
|
| 155 |
+
</script>
|
| 156 |
+
EOT;
|
| 157 |
+
/* = end of paypal form = */
|
| 158 |
+
return $output;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
function wp_ppp_process($content) {
|
| 162 |
+
if (strpos($content, "<!-- wp_paypal_payment -->") !== FALSE) {
|
| 163 |
+
$content = preg_replace('/<p>\s*<!--(.*)-->\s*<\/p>/i', "<!--$1-->", $content);
|
| 164 |
+
$content = str_replace('<!-- wp_paypal_payment -->', Paypal_payment_accept(), $content);
|
| 165 |
+
}
|
| 166 |
+
return $content;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
function show_wp_paypal_payment_widget($args) {
|
| 170 |
+
extract($args);
|
| 171 |
+
|
| 172 |
+
$wp_paypal_payment_widget_title_name_value = get_option('wp_paypal_widget_title_name');
|
| 173 |
+
echo $before_widget;
|
| 174 |
+
echo $before_title . $wp_paypal_payment_widget_title_name_value . $after_title;
|
| 175 |
+
echo Paypal_payment_accept();
|
| 176 |
+
echo $after_widget;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
function wp_paypal_payment_widget_control() {
|
| 180 |
+
?>
|
| 181 |
+
<p>
|
| 182 |
+
<? _e("Set the Plugin Settings from the Settings menu"); ?>
|
| 183 |
+
</p>
|
| 184 |
+
<?php
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
function wp_paypal_payment_init() {
|
| 188 |
+
wp_register_style('wpapp-styles', WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_URL . '/wpapp-styles.css');
|
| 189 |
+
wp_enqueue_style('wpapp-styles');
|
| 190 |
+
|
| 191 |
+
//Widget code
|
| 192 |
+
$widget_options = array('classname' => 'widget_wp_paypal_payment', 'description' => __("Display WP Paypal Payment."));
|
| 193 |
+
wp_register_sidebar_widget('wp_paypal_payment_widgets', __('WP Paypal Payment'), 'show_wp_paypal_payment_widget', $widget_options);
|
| 194 |
+
wp_register_widget_control('wp_paypal_payment_widgets', __('WP Paypal Payment'), 'wp_paypal_payment_widget_control');
|
| 195 |
+
|
| 196 |
+
//Listen for IPN and validate it
|
| 197 |
+
if (isset($_REQUEST['wpapp_paypal_ipn']) && $_REQUEST['wpapp_paypal_ipn'] == "process") {
|
| 198 |
+
wpapp_validate_paypl_ipn();
|
| 199 |
+
exit;
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
function wpapp_shortcode_plugin_enqueue_jquery() {
|
| 204 |
+
wp_enqueue_script('jquery');
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
add_filter('the_content', 'wp_ppp_process');
|
| 208 |
+
add_shortcode('wp_paypal_payment', 'Paypal_payment_accept');
|
| 209 |
+
if (!is_admin()) {
|
| 210 |
+
add_filter('widget_text', 'do_shortcode');
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
add_action('init', 'wpapp_shortcode_plugin_enqueue_jquery');
|
| 214 |
+
add_action('init', 'wp_paypal_payment_init');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: Tips and Tricks HQ, Ruhul Amin
|
|
| 3 |
Donate link: https://www.tipsandtricks-hq.com
|
| 4 |
Tags: Paypal payment, Accept payment for services or product, PayPal donation, wordpress paypal, paypal for wordpress, paypal plugin for wordpress, paypal integration, paypal, buy now, payment, currency,
|
| 5 |
Requires at least: 3.0
|
| 6 |
-
Tested up to: 4.
|
| 7 |
-
Stable tag: 4.
|
| 8 |
License: GPLv2 or later
|
| 9 |
|
| 10 |
Easy to use Wordpress plugin to accept paypal payment for a service or product or donation in one click
|
|
@@ -62,6 +62,22 @@ There are few ways you can use this plugin:
|
|
| 62 |
Visit the plugin site at https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120 for screenshots.
|
| 63 |
|
| 64 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
= 4.5 =
|
| 66 |
- The "Other Amount" input field type is now set to "number". This will work better on mobile devices.
|
| 67 |
|
| 3 |
Donate link: https://www.tipsandtricks-hq.com
|
| 4 |
Tags: Paypal payment, Accept payment for services or product, PayPal donation, wordpress paypal, paypal for wordpress, paypal plugin for wordpress, paypal integration, paypal, buy now, payment, currency,
|
| 5 |
Requires at least: 3.0
|
| 6 |
+
Tested up to: 4.4
|
| 7 |
+
Stable tag: 4.8
|
| 8 |
License: GPLv2 or later
|
| 9 |
|
| 10 |
Easy to use Wordpress plugin to accept paypal payment for a service or product or donation in one click
|
| 62 |
Visit the plugin site at https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120 for screenshots.
|
| 63 |
|
| 64 |
== Changelog ==
|
| 65 |
+
|
| 66 |
+
= 4.8 =
|
| 67 |
+
- Added a new shortcode parameter (other_amount_label) to allow customization of the "Other Amount" text/label in the payment form.
|
| 68 |
+
- Added a new class name (buy_now_button_image) to the custom button image (so users can target that button image for customization via CSS).
|
| 69 |
+
- WordPress 4.4 compatibility.
|
| 70 |
+
|
| 71 |
+
= 4.7 =
|
| 72 |
+
- Added a new parameter (default_amount) in the other amount shortcode so you can specify a default amount that will be used to pre-fill the amount field.
|
| 73 |
+
- Added PayPal IPN validation option.
|
| 74 |
+
|
| 75 |
+
= 4.6 =
|
| 76 |
+
- Added two new filters to modify the reference input field name and value programmatically.
|
| 77 |
+
- Added a check to make sure a PayPal email address is specified in the widget shortcode.
|
| 78 |
+
- Added an option to specify the "cbt" parameter via the shortcode.
|
| 79 |
+
- Refactored some code to move all the admin dashboard related code to a separate file.
|
| 80 |
+
|
| 81 |
= 4.5 =
|
| 82 |
- The "Other Amount" input field type is now set to "number". This will work better on mobile devices.
|
| 83 |
|
shortcode_view.php
CHANGED
|
@@ -1,208 +1,228 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
function wppp_render_paypal_button_with_other_amt($args)
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
$
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
-
function wppp_render_paypal_button_form($args)
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
$options = explode( '|' , $options);
|
| 108 |
-
$html_options = '';
|
| 109 |
-
foreach( $options as $option ) {
|
| 110 |
-
$option = explode( ':' , $option );
|
| 111 |
-
$name = esc_attr( $option[0] );
|
| 112 |
-
$price = esc_attr( $option[1] );
|
| 113 |
-
$html_options .= "<option data-product_name='{$name}' value='{$price}'>{$name} - {$price}</option>";
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
$payment_button_img_src = get_option('payment_button_type');
|
| 117 |
-
if(!empty($button_image)){
|
| 118 |
-
$payment_button_img_src = $button_image;
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
$window_target = '';
|
| 122 |
-
if(!empty($new_window)){
|
| 123 |
-
$window_target = 'target="_blank"';
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
?>
|
| 127 |
-
<div class="wp_paypal_button_widget">
|
| 128 |
-
<form name="_xclick" class="wp_accept_pp_button_form" action="https://www.paypal.com/cgi-bin/webscr" method="post" <?php echo $window_target; ?> >
|
| 129 |
-
<div class="wp_pp_button_selection_section">
|
| 130 |
-
<select class="wp_paypal_button_options">
|
| 131 |
-
<?php echo $html_options; ?>
|
| 132 |
-
</select>
|
| 133 |
-
</div>
|
| 134 |
-
|
| 135 |
-
<?php
|
| 136 |
-
if(!empty($other_amount)){
|
| 137 |
-
echo '<div class="wp_pp_button_other_amt_section">';
|
| 138 |
-
echo 'Other Amount: <input type="number" min="1" step="any" name="other_amount" value="" style="max-width:60px;"> '.$currency;
|
| 139 |
-
echo '</div>';
|
| 140 |
-
}
|
| 141 |
-
|
| 142 |
-
if(!empty($reference)){
|
| 143 |
-
echo '<div class="wp_pp_button_reference_section">';
|
| 144 |
-
echo '<label for="wp_pp_button_reference">'.$reference.'</label>';
|
| 145 |
-
echo '<br />';
|
| 146 |
-
echo '<input type="hidden" name="on0" value="Reference" />';
|
| 147 |
-
echo '<input type="text" name="os0" value="" class="wp_pp_button_reference" />';
|
| 148 |
-
echo '</div>';
|
| 149 |
-
}
|
| 150 |
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
jQuery(document).ready(function($) {
|
| 192 |
-
$('.wp_accept_pp_button_form').submit(function(e){
|
| 193 |
-
var form_obj = $(this);
|
| 194 |
-
var options_name = form_obj.find('.wp_paypal_button_options :selected').attr('data-product_name');
|
| 195 |
-
form_obj.find('input[name=item_name]').val(options_name);
|
| 196 |
-
|
| 197 |
-
var options_val = form_obj.find('.wp_paypal_button_options').val();
|
| 198 |
-
var other_amt = form_obj.find('input[name=other_amount]').val();
|
| 199 |
-
if (!isNaN(other_amt) && other_amt.length > 0){
|
| 200 |
-
options_val = other_amt;
|
| 201 |
-
}
|
| 202 |
-
form_obj.find('input[name=amount]').val(options_val);
|
| 203 |
-
return;
|
| 204 |
-
});
|
| 205 |
-
});
|
| 206 |
-
</script>
|
| 207 |
-
<?php
|
| 208 |
}
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
function wppp_render_paypal_button_with_other_amt($args) {
|
| 4 |
+
extract(shortcode_atts(array(
|
| 5 |
+
'email' => '',
|
| 6 |
+
'description' => '',
|
| 7 |
+
'default_amount' => '',
|
| 8 |
+
'other_amount_label' => 'Amount:',
|
| 9 |
+
'currency' => 'USD',
|
| 10 |
+
'reference' => '',
|
| 11 |
+
'return' => site_url(),
|
| 12 |
+
'cbt' => '',
|
| 13 |
+
'country_code' => '',
|
| 14 |
+
'button_image' => '',
|
| 15 |
+
'button_text' => '',
|
| 16 |
+
'cancel_url' => '',
|
| 17 |
+
'new_window' => '',
|
| 18 |
+
'tax' => '',
|
| 19 |
+
'rm' => '0',
|
| 20 |
+
'validate_ipn' => '',
|
| 21 |
+
), $args));
|
| 22 |
+
|
| 23 |
+
$email = apply_filters('wppp_widget_any_amt_email', $email);
|
| 24 |
+
|
| 25 |
+
$output = "";
|
| 26 |
+
$payment_button_img_src = get_option('payment_button_type');
|
| 27 |
+
if (!empty($button_image)) {
|
| 28 |
+
$payment_button_img_src = $button_image;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (empty($email)) {
|
| 32 |
+
$output = '<p style="color: red;">Error! Please enter your PayPal email address for the payment using the "email" parameter in the shortcode</p>';
|
| 33 |
+
return $output;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (empty($description)) {
|
| 37 |
+
$output = '<p style="color: red;">Error! Please enter a description for the payment using the "description" parameter in the shortcode</p>';
|
| 38 |
+
return $output;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$window_target = '';
|
| 42 |
+
if (!empty($new_window)) {
|
| 43 |
+
$window_target = 'target="_blank"';
|
| 44 |
+
}
|
| 45 |
+
$output .= '<div class="wp_paypal_button_widget_any_amt">';
|
| 46 |
+
$output .= '<form name="_xclick" class="wp_accept_pp_button_form_any_amount" action="https://www.paypal.com/cgi-bin/webscr" method="post" ' . $window_target . '>';
|
| 47 |
+
|
| 48 |
+
$output .= '<div class="wp_pp_button_amount_section">'.$other_amount_label.' <input type="number" min="1" step="any" name="amount" value="' . $default_amount . '" style="max-width:60px;"> ' . $currency . '</div>';
|
| 49 |
+
|
| 50 |
+
if (!empty($reference)) {
|
| 51 |
+
$output .= '<div class="wp_pp_button_reference_section">';
|
| 52 |
+
$output .= '<label for="wp_pp_button_reference">' . $reference . '</label>';
|
| 53 |
+
$output .= '<br />';
|
| 54 |
+
$output .= '<input type="hidden" name="on0" value="' . apply_filters('wp_pp_button_reference_name', 'Reference') . '" />';
|
| 55 |
+
$output .= '<input type="text" name="os0" value="' . apply_filters('wp_pp_button_reference_value', '') . '" class="wp_pp_button_reference" />';
|
| 56 |
+
$output .= '</div>';
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
$output .= '<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="bn" value="TipsandTricks_SP" />';
|
| 60 |
+
$output .= '<input type="hidden" name="business" value="' . $email . '">';
|
| 61 |
+
$output .= '<input type="hidden" name="currency_code" value="' . $currency . '">';
|
| 62 |
+
$output .= '<input type="hidden" name="item_name" value="' . stripslashes($description) . '">';
|
| 63 |
+
$output .= '<input type="hidden" name="return" value="' . $return . '" />';
|
| 64 |
+
$output .= '<input type="hidden" name="rm" value="' . $rm . '" />';
|
| 65 |
+
if (!empty($cbt)) {
|
| 66 |
+
$output .= '<input type="hidden" name="cbt" value="' . $cbt . '" />';
|
| 67 |
+
}
|
| 68 |
+
if (is_numeric($tax)) {
|
| 69 |
+
$output .= '<input type="hidden" name="tax" value="' . $tax . '" />';
|
| 70 |
+
}
|
| 71 |
+
if (!empty($cancel_url)) {
|
| 72 |
+
$output .= '<input type="hidden" name="cancel_return" value="' . $cancel_url . '" />';
|
| 73 |
+
}
|
| 74 |
+
if (!empty($country_code)) {
|
| 75 |
+
$output .= '<input type="hidden" name="lc" value="' . $country_code . '" />';
|
| 76 |
+
}
|
| 77 |
+
if (!empty($validate_ipn)) {
|
| 78 |
+
$notify_url = site_url() . '/?wpapp_paypal_ipn=process';
|
| 79 |
+
$output .= '<input type="hidden" name="notify_url" value="' . $notify_url . '" />';
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
$output .= '<div class="wp_pp_button_submit_btn">';
|
| 83 |
+
if (!empty($button_text)) {//Use text button
|
| 84 |
+
$button_class = apply_filters('wppp_text_button_class', '');
|
| 85 |
+
$output .= '<input type="submit" name="submit" class="' . $button_class . '" value="' . $button_text . '" />';
|
| 86 |
+
} else {//Use image button
|
| 87 |
+
$output .= '<input type="image" id="buy_now_button" class="buy_now_button_image" src="' . $payment_button_img_src . '" border="0" name="submit" alt="Make payments with PayPal">';
|
| 88 |
+
}
|
| 89 |
+
$output .= '</div>';
|
| 90 |
+
$output .= '</form>';
|
| 91 |
+
$output .= '</div>';
|
| 92 |
+
return $output;
|
| 93 |
}
|
| 94 |
|
| 95 |
+
function wppp_render_paypal_button_form($args) {
|
| 96 |
+
extract(shortcode_atts(array(
|
| 97 |
+
'email' => '',
|
| 98 |
+
'currency' => 'USD',
|
| 99 |
+
'options' => 'Payment for Service 1:15.50|Payment for Service 2:30.00|Payment for Service 3:47.00',
|
| 100 |
+
'return' => site_url(),
|
| 101 |
+
'cbt' => '',
|
| 102 |
+
'reference' => 'Your Email Address',
|
| 103 |
+
'other_amount' => '',
|
| 104 |
+
'other_amount_label' => 'Other Amount:',
|
| 105 |
+
'country_code' => '',
|
| 106 |
+
'payment_subject' => '',
|
| 107 |
+
'button_image' => '',
|
| 108 |
+
'button_text' => '',
|
| 109 |
+
'cancel_url' => '',
|
| 110 |
+
'new_window' => '',
|
| 111 |
+
'tax' => '',
|
| 112 |
+
'rm' => '0',
|
| 113 |
+
'validate_ipn' => '',
|
| 114 |
+
), $args));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
+
$email = apply_filters('wppp_widget_email', $email);
|
| 117 |
+
if (empty($email)) {
|
| 118 |
+
$output = '<p style="color: red;">Error! Please enter your PayPal email address for the payment using the "email" parameter in the shortcode</p>';
|
| 119 |
+
return $output;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
$options = explode('|', $options);
|
| 123 |
+
$html_options = '';
|
| 124 |
+
foreach ($options as $option) {
|
| 125 |
+
$option = explode(':', $option);
|
| 126 |
+
$name = esc_attr($option[0]);
|
| 127 |
+
$price = esc_attr($option[1]);
|
| 128 |
+
$html_options .= "<option data-product_name='{$name}' value='{$price}'>{$name} - {$price}</option>";
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
$payment_button_img_src = get_option('payment_button_type');
|
| 132 |
+
if (!empty($button_image)) {
|
| 133 |
+
$payment_button_img_src = $button_image;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
$window_target = '';
|
| 137 |
+
if (!empty($new_window)) {
|
| 138 |
+
$window_target = 'target="_blank"';
|
| 139 |
+
}
|
| 140 |
+
?>
|
| 141 |
+
<div class="wp_paypal_button_widget">
|
| 142 |
+
<form name="_xclick" class="wp_accept_pp_button_form" action="https://www.paypal.com/cgi-bin/webscr" method="post" <?php echo $window_target; ?> >
|
| 143 |
+
<div class="wp_pp_button_selection_section">
|
| 144 |
+
<select class="wp_paypal_button_options">
|
| 145 |
+
<?php echo $html_options; ?>
|
| 146 |
+
</select>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<?php
|
| 150 |
+
if (!empty($other_amount)) {
|
| 151 |
+
echo '<div class="wp_pp_button_other_amt_section">';
|
| 152 |
+
echo $other_amount_label.' <input type="number" min="1" step="any" name="other_amount" value="" style="max-width:60px;"> ' . $currency;
|
| 153 |
+
echo '</div>';
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
if (!empty($reference)) {
|
| 157 |
+
echo '<div class="wp_pp_button_reference_section">';
|
| 158 |
+
echo '<label for="wp_pp_button_reference">' . $reference . '</label>';
|
| 159 |
+
echo '<br />';
|
| 160 |
+
echo '<input type="hidden" name="on0" value="' . apply_filters('wp_pp_button_reference_name', 'Reference') . '" />';
|
| 161 |
+
echo '<input type="text" name="os0" value="' . apply_filters('wp_pp_button_reference_value', '') . '" class="wp_pp_button_reference" />';
|
| 162 |
+
echo '</div>';
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
if (!empty($payment_subject)) {
|
| 166 |
+
?>
|
| 167 |
+
<input type="hidden" name="on1" value="Payment Subject" />
|
| 168 |
+
<input type="hidden" name="os1" value="<?php echo $payment_subject; ?>" />
|
| 169 |
+
<?php } ?>
|
| 170 |
+
|
| 171 |
+
<input type="hidden" name="cmd" value="_xclick">
|
| 172 |
+
<input type="hidden" name="bn" value="TipsandTricks_SP" />
|
| 173 |
+
<input type="hidden" name="business" value="<?php echo $email; ?>">
|
| 174 |
+
<input type="hidden" name="currency_code" value="<?php echo $currency; ?>">
|
| 175 |
+
<input type="hidden" name="item_name" value="">
|
| 176 |
+
<input type="hidden" name="amount" value="">
|
| 177 |
+
<input type="hidden" name="return" value="<?php echo $return; ?>" />
|
| 178 |
+
<input type="hidden" name="rm" value="<?php echo $rm; ?>" />
|
| 179 |
+
<input type="hidden" name="email" value="" />
|
| 180 |
+
<?php
|
| 181 |
+
if (!empty($cbt)) {
|
| 182 |
+
echo '<input type="hidden" name="cbt" value="' . $cbt . '" />';
|
| 183 |
+
}
|
| 184 |
+
if (is_numeric($tax)) {
|
| 185 |
+
echo '<input type="hidden" name="tax" value="' . $tax . '" />';
|
| 186 |
+
}
|
| 187 |
+
if (!empty($cancel_url)) {
|
| 188 |
+
echo '<input type="hidden" name="cancel_return" value="' . $cancel_url . '" />';
|
| 189 |
+
}
|
| 190 |
+
if (!empty($country_code)) {
|
| 191 |
+
echo '<input type="hidden" name="lc" value="' . $country_code . '" />';
|
| 192 |
+
}
|
| 193 |
+
if (!empty($validate_ipn)) {
|
| 194 |
+
$notify_url = site_url() . '/?wpapp_paypal_ipn=process';
|
| 195 |
+
$output .= '<input type="hidden" name="notify_url" value="' . $notify_url . '" />';
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
echo '<div class="wp_pp_button_submit_btn">';
|
| 199 |
+
if (!empty($button_text)) {//Use text button
|
| 200 |
+
$button_class = apply_filters('wppp_text_button_class', '');
|
| 201 |
+
echo '<input type="submit" name="submit" class="' . $button_class . '" value="' . $button_text . '" />';
|
| 202 |
+
} else {//Use image button
|
| 203 |
+
echo '<input type="image" id="buy_now_button" class="buy_now_button_image" src="' . $payment_button_img_src . '" border="0" name="submit" alt="Make payments with PayPal">';
|
| 204 |
+
}
|
| 205 |
+
echo '</div>';
|
| 206 |
+
?>
|
| 207 |
+
</form>
|
| 208 |
+
</div>
|
| 209 |
+
|
| 210 |
+
<script type="text/javascript">
|
| 211 |
+
jQuery(document).ready(function($) {
|
| 212 |
+
$('.wp_accept_pp_button_form').submit(function(e) {
|
| 213 |
+
var form_obj = $(this);
|
| 214 |
+
var options_name = form_obj.find('.wp_paypal_button_options :selected').attr('data-product_name');
|
| 215 |
+
form_obj.find('input[name=item_name]').val(options_name);
|
| 216 |
+
|
| 217 |
+
var options_val = form_obj.find('.wp_paypal_button_options').val();
|
| 218 |
+
var other_amt = form_obj.find('input[name=other_amount]').val();
|
| 219 |
+
if (!isNaN(other_amt) && other_amt.length > 0) {
|
| 220 |
+
options_val = other_amt;
|
| 221 |
}
|
| 222 |
+
form_obj.find('input[name=amount]').val(options_val);
|
| 223 |
+
return;
|
| 224 |
+
});
|
| 225 |
+
});
|
| 226 |
+
</script>
|
| 227 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|
wpapp-styles.css
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
.wp_pp_button_selection_section, .wp_pp_button_other_amt_section, .wp_pp_button_reference_section{
|
| 2 |
-
margin-bottom: 10px;
|
| 3 |
}
|
| 4 |
.wp_paypal_button_widget{
|
| 5 |
-
margin: 10px 0;
|
| 6 |
}
|
| 7 |
.wp_accept_pp_button_form input{
|
| 8 |
-
width: auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 1 |
.wp_pp_button_selection_section, .wp_pp_button_other_amt_section, .wp_pp_button_reference_section{
|
| 2 |
+
margin-bottom: 10px;
|
| 3 |
}
|
| 4 |
.wp_paypal_button_widget{
|
| 5 |
+
margin: 10px 0;
|
| 6 |
}
|
| 7 |
.wp_accept_pp_button_form input{
|
| 8 |
+
width: auto !important;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.buy_now_button_image {
|
| 12 |
+
max-width: 100%;
|
| 13 |
}
|
wpapp_admin_menu.php
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
// Displays PayPal Payment Accept Options menu
|
| 4 |
+
function paypal_payment_add_option_pages() {
|
| 5 |
+
if (function_exists('add_options_page')) {
|
| 6 |
+
add_options_page('WP Paypal Payment Accept', 'WP PayPal Payment', 'manage_options', __FILE__, 'paypal_payment_options_page');
|
| 7 |
+
}
|
| 8 |
+
}
|
| 9 |
+
// Insert the paypal_payment_add_option_pages in the 'admin_menu'
|
| 10 |
+
add_action('admin_menu', 'paypal_payment_add_option_pages');
|
| 11 |
+
|
| 12 |
+
function paypal_payment_options_page() {
|
| 13 |
+
|
| 14 |
+
if (isset($_POST['info_update'])) {
|
| 15 |
+
echo '<div id="message" class="updated fade"><p><strong>';
|
| 16 |
+
|
| 17 |
+
update_option('wp_paypal_widget_title_name', (string) $_POST["wp_paypal_widget_title_name"]);
|
| 18 |
+
update_option('wp_pp_payment_email', (string) $_POST["wp_pp_payment_email"]);
|
| 19 |
+
update_option('paypal_payment_currency', (string) $_POST["paypal_payment_currency"]);
|
| 20 |
+
update_option('wp_pp_payment_subject', (string) $_POST["wp_pp_payment_subject"]);
|
| 21 |
+
update_option('wp_pp_payment_item1', (string) $_POST["wp_pp_payment_item1"]);
|
| 22 |
+
update_option('wp_pp_payment_value1', (double) $_POST["wp_pp_payment_value1"]);
|
| 23 |
+
update_option('wp_pp_payment_item2', (string) $_POST["wp_pp_payment_item2"]);
|
| 24 |
+
update_option('wp_pp_payment_value2', (double) $_POST["wp_pp_payment_value2"]);
|
| 25 |
+
update_option('wp_pp_payment_item3', (string) $_POST["wp_pp_payment_item3"]);
|
| 26 |
+
update_option('wp_pp_payment_value3', (double) $_POST["wp_pp_payment_value3"]);
|
| 27 |
+
update_option('wp_pp_payment_item4', (string) $_POST["wp_pp_payment_item4"]);
|
| 28 |
+
update_option('wp_pp_payment_value4', (double) $_POST["wp_pp_payment_value4"]);
|
| 29 |
+
update_option('wp_pp_payment_item5', (string) $_POST["wp_pp_payment_item5"]);
|
| 30 |
+
update_option('wp_pp_payment_value5', (double) $_POST["wp_pp_payment_value5"]);
|
| 31 |
+
update_option('wp_pp_payment_item6', (string) $_POST["wp_pp_payment_item6"]);
|
| 32 |
+
update_option('wp_pp_payment_value6', (double) $_POST["wp_pp_payment_value6"]);
|
| 33 |
+
update_option('payment_button_type', (string) $_POST["payment_button_type"]);
|
| 34 |
+
update_option('wp_pp_show_other_amount', ($_POST['wp_pp_show_other_amount'] == '1') ? '1' : '-1' );
|
| 35 |
+
update_option('wp_pp_show_ref_box', ($_POST['wp_pp_show_ref_box'] == '1') ? '1' : '-1' );
|
| 36 |
+
update_option('wp_pp_ref_title', (string) $_POST["wp_pp_ref_title"]);
|
| 37 |
+
update_option('wp_pp_return_url', (string) $_POST["wp_pp_return_url"]);
|
| 38 |
+
|
| 39 |
+
echo 'Options Updated!';
|
| 40 |
+
echo '</strong></p></div>';
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
$paypal_payment_currency = stripslashes(get_option('paypal_payment_currency'));
|
| 44 |
+
$payment_button_type = stripslashes(get_option('payment_button_type'));
|
| 45 |
+
?>
|
| 46 |
+
|
| 47 |
+
<div class=wrap>
|
| 48 |
+
<div id="poststuff"><div id="post-body">
|
| 49 |
+
|
| 50 |
+
<h2>Accept Paypal Payment Settings v<?php echo WP_PAYPAL_PAYMENT_ACCEPT_PLUGIN_VERSION; ?></h2>
|
| 51 |
+
|
| 52 |
+
<div style="background: none repeat scroll 0 0 #ECECEC;border: 1px solid #CFCFCF;color: #363636;margin: 10px 0 15px;padding:15px;text-shadow: 1px 1px #FFFFFF;">
|
| 53 |
+
For usage documentation and updates, please visit the plugin page at the following URL:<br />
|
| 54 |
+
<a href="https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120" target="_blank">https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120</a>
|
| 55 |
+
</div>
|
| 56 |
+
|
| 57 |
+
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
|
| 58 |
+
<input type="hidden" name="info_update" id="info_update" value="true" />
|
| 59 |
+
|
| 60 |
+
<div class="postbox">
|
| 61 |
+
<h3 class="hndle"><label for="title">Plugin Usage</label></h3>
|
| 62 |
+
<div class="inside">
|
| 63 |
+
<p>There are a few ways you can use this plugin:</p>
|
| 64 |
+
<ol>
|
| 65 |
+
<li>Configure the options below and then add the shortcode <strong>[wp_paypal_payment]</strong> to a post or page (where you want the payment button)</li>
|
| 66 |
+
<li>Call the function from a template file: <strong><?php echo Paypal_payment_accept(); ?></strong></li>
|
| 67 |
+
<li>Use the <strong>WP Paypal Payment</strong> Widget from the Widgets menu</li>
|
| 68 |
+
<li>Use the shortcode with custom parameter options to add multiple different payment widgets in different areas of the site.
|
| 69 |
+
<a href="https://www.tipsandtricks-hq.com/wordpress-easy-paypal-payment-or-donation-accept-plugin-120#shortcode_with_custom_parameters" target="_blank">View shortcode documentation</a></li>
|
| 70 |
+
</ol>
|
| 71 |
+
</div></div>
|
| 72 |
+
|
| 73 |
+
<div class="postbox">
|
| 74 |
+
<h3 class="hndle"><label for="title">WP Paypal Payment or Donation Accept Plugin Options</label></h3>
|
| 75 |
+
<div class="inside">
|
| 76 |
+
|
| 77 |
+
<table class="form-table">
|
| 78 |
+
|
| 79 |
+
<tr valign="top"><td width="25%" align="left">
|
| 80 |
+
<strong>WP Paypal Payment Widget Title:</strong>
|
| 81 |
+
</td><td align="left">
|
| 82 |
+
<input name="wp_paypal_widget_title_name" type="text" size="30" value="<?php echo get_option('wp_paypal_widget_title_name'); ?>"/>
|
| 83 |
+
<br /><i>This will be the title of the Widget on the Sidebar if you use it.</i><br />
|
| 84 |
+
</td></tr>
|
| 85 |
+
|
| 86 |
+
<tr valign="top"><td width="25%" align="left">
|
| 87 |
+
<strong>Paypal Email address:</strong>
|
| 88 |
+
</td><td align="left">
|
| 89 |
+
<input name="wp_pp_payment_email" type="text" size="35" value="<?php echo get_option('wp_pp_payment_email'); ?>"/>
|
| 90 |
+
<br /><i>This is the Paypal Email address where the payments will go</i><br />
|
| 91 |
+
</td></tr>
|
| 92 |
+
|
| 93 |
+
<tr valign="top"><td width="25%" align="left">
|
| 94 |
+
<strong>Choose Payment Currency: </strong>
|
| 95 |
+
</td><td align="left">
|
| 96 |
+
<select id="paypal_payment_currency" name="paypal_payment_currency">
|
| 97 |
+
<?php _e('<option value="USD"') ?><?php if ($paypal_payment_currency == "USD") echo " selected " ?><?php _e('>US Dollar</option>') ?>
|
| 98 |
+
<?php _e('<option value="GBP"') ?><?php if ($paypal_payment_currency == "GBP") echo " selected " ?><?php _e('>Pound Sterling</option>') ?>
|
| 99 |
+
<?php _e('<option value="EUR"') ?><?php if ($paypal_payment_currency == "EUR") echo " selected " ?><?php _e('>Euro</option>') ?>
|
| 100 |
+
<?php _e('<option value="AUD"') ?><?php if ($paypal_payment_currency == "AUD") echo " selected " ?><?php _e('>Australian Dollar</option>') ?>
|
| 101 |
+
<?php _e('<option value="CAD"') ?><?php if ($paypal_payment_currency == "CAD") echo " selected " ?><?php _e('>Canadian Dollar</option>') ?>
|
| 102 |
+
<?php _e('<option value="NZD"') ?><?php if ($paypal_payment_currency == "NZD") echo " selected " ?><?php _e('>New Zealand Dollar</option>') ?>
|
| 103 |
+
<?php _e('<option value="HKD"') ?><?php if ($paypal_payment_currency == "HKD") echo " selected " ?><?php _e('>Hong Kong Dollar</option>') ?>
|
| 104 |
+
</select>
|
| 105 |
+
<br /><i>This is the currency for your visitors to make Payments or Donations in.</i><br />
|
| 106 |
+
</td></tr>
|
| 107 |
+
|
| 108 |
+
<tr valign="top"><td width="25%" align="left">
|
| 109 |
+
<strong>Payment Subject:</strong>
|
| 110 |
+
</td><td align="left">
|
| 111 |
+
<input name="wp_pp_payment_subject" type="text" size="35" value="<?php echo get_option('wp_pp_payment_subject'); ?>"/>
|
| 112 |
+
<br /><i>Enter the Product or service name or the reason for the payment here. The visitors will see this text</i><br />
|
| 113 |
+
</td></tr>
|
| 114 |
+
|
| 115 |
+
<tr valign="top"><td width="25%" align="left">
|
| 116 |
+
<strong>Payment Option 1:</strong>
|
| 117 |
+
</td><td align="left">
|
| 118 |
+
<input name="wp_pp_payment_item1" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item1'); ?>"/>
|
| 119 |
+
<strong>Price :</strong>
|
| 120 |
+
<input name="wp_pp_payment_value1" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value1'); ?>"/>
|
| 121 |
+
<br />
|
| 122 |
+
</td></tr>
|
| 123 |
+
|
| 124 |
+
<tr valign="top"><td width="25%" align="left">
|
| 125 |
+
<strong>Payment Option 2:</strong>
|
| 126 |
+
</td><td align="left">
|
| 127 |
+
<input name="wp_pp_payment_item2" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item2'); ?>"/>
|
| 128 |
+
<strong>Price :</strong>
|
| 129 |
+
<input name="wp_pp_payment_value2" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value2'); ?>"/>
|
| 130 |
+
<br />
|
| 131 |
+
</td></tr>
|
| 132 |
+
|
| 133 |
+
<tr valign="top"><td width="25%" align="left">
|
| 134 |
+
<strong>Payment Option 3:</strong>
|
| 135 |
+
</td><td align="left">
|
| 136 |
+
<input name="wp_pp_payment_item3" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item3'); ?>"/>
|
| 137 |
+
<strong>Price :</strong>
|
| 138 |
+
<input name="wp_pp_payment_value3" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value3'); ?>"/>
|
| 139 |
+
<br />
|
| 140 |
+
</td></tr>
|
| 141 |
+
|
| 142 |
+
<tr valign="top"><td width="25%" align="left">
|
| 143 |
+
<strong>Payment Option 4:</strong>
|
| 144 |
+
</td><td align="left">
|
| 145 |
+
<input name="wp_pp_payment_item4" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item4'); ?>"/>
|
| 146 |
+
<strong>Price :</strong>
|
| 147 |
+
<input name="wp_pp_payment_value4" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value4'); ?>"/>
|
| 148 |
+
<br />
|
| 149 |
+
</td></tr>
|
| 150 |
+
|
| 151 |
+
<tr valign="top"><td width="25%" align="left">
|
| 152 |
+
<strong>Payment Option 5:</strong>
|
| 153 |
+
</td><td align="left">
|
| 154 |
+
<input name="wp_pp_payment_item5" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item5'); ?>"/>
|
| 155 |
+
<strong>Price :</strong>
|
| 156 |
+
<input name="wp_pp_payment_value5" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value5'); ?>"/>
|
| 157 |
+
<br />
|
| 158 |
+
</td></tr>
|
| 159 |
+
|
| 160 |
+
<tr valign="top"><td width="25%" align="left">
|
| 161 |
+
<strong>Payment Option 6:</strong>
|
| 162 |
+
</td><td align="left">
|
| 163 |
+
<input name="wp_pp_payment_item6" type="text" size="25" value="<?php echo get_option('wp_pp_payment_item6'); ?>"/>
|
| 164 |
+
<strong>Price :</strong>
|
| 165 |
+
<input name="wp_pp_payment_value6" type="text" size="10" value="<?php echo get_option('wp_pp_payment_value6'); ?>"/>
|
| 166 |
+
<br /><i>Enter the name of the service or product and the price. eg. Enter "Basic service - $10" in the Payment Option text box and "10.00" in the price text box to accept a payment of $10 for "Basic service". Leave the Payment Option and Price fields empty if u don't want to use that option. For example, if you have 3 price options then fill in the top 3 and leave the rest empty.</i>
|
| 167 |
+
</td></tr>
|
| 168 |
+
|
| 169 |
+
<tr valign="top"><td width="25%" align="left">
|
| 170 |
+
<strong>Show Other Amount:</strong>
|
| 171 |
+
</td><td align="left">
|
| 172 |
+
<input name="wp_pp_show_other_amount" type="checkbox"<?php if (get_option('wp_pp_show_other_amount') != '-1') echo ' checked="checked"'; ?> value="1"/>
|
| 173 |
+
<i> Tick this checkbox if you want to show ohter amount text box to your visitors so they can enter custom amount.</i>
|
| 174 |
+
</td></tr>
|
| 175 |
+
|
| 176 |
+
<tr valign="top"><td width="25%" align="left">
|
| 177 |
+
<strong>Show Reference Text Box:</strong>
|
| 178 |
+
</td><td align="left">
|
| 179 |
+
<input name="wp_pp_show_ref_box" type="checkbox"<?php if (get_option('wp_pp_show_ref_box') != '-1') echo ' checked="checked"'; ?> value="1"/>
|
| 180 |
+
<i> Tick this checkbox if you want your visitors to be able to enter a reference text like email or web address.</i>
|
| 181 |
+
</td></tr>
|
| 182 |
+
|
| 183 |
+
<tr valign="top"><td width="25%" align="left">
|
| 184 |
+
<strong>Reference Text Box Title:</strong>
|
| 185 |
+
</td><td align="left">
|
| 186 |
+
<input name="wp_pp_ref_title" type="text" size="35" value="<?php echo get_option('wp_pp_ref_title'); ?>"/>
|
| 187 |
+
<br /><i>Enter a title for the Reference text box (ie. Your Web Address). The visitors will see this text.</i><br />
|
| 188 |
+
</td></tr>
|
| 189 |
+
|
| 190 |
+
<tr valign="top"><td width="25%" align="left">
|
| 191 |
+
<strong>Return URL from PayPal:</strong>
|
| 192 |
+
</td><td align="left">
|
| 193 |
+
<input name="wp_pp_return_url" type="text" size="60" value="<?php echo get_option('wp_pp_return_url'); ?>"/>
|
| 194 |
+
<br /><i>Enter a return URL (could be a Thank You page). PayPal will redirect visitors to this page after Payment.</i><br />
|
| 195 |
+
</td></tr>
|
| 196 |
+
|
| 197 |
+
</table>
|
| 198 |
+
|
| 199 |
+
<br /><br />
|
| 200 |
+
<strong>Choose a Submit Button Type :</strong>
|
| 201 |
+
<br /><i>This is the button the visitors will click on to make Payments or Donations.</i><br />
|
| 202 |
+
<table style="width:50%; border-spacing:0; padding:0; text-align:center;">
|
| 203 |
+
<tr>
|
| 204 |
+
<td>
|
| 205 |
+
<?php _e('<input type="radio" name="payment_button_type" value="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"') ?>
|
| 206 |
+
<?php if ($payment_button_type == "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif") echo " checked " ?>
|
| 207 |
+
<?php _e('/>') ?>
|
| 208 |
+
</td>
|
| 209 |
+
<td>
|
| 210 |
+
<?php _e('<input type="radio" name="payment_button_type" value="https://www.paypal.com/en_US/i/btn/x-click-but11.gif"') ?>
|
| 211 |
+
<?php if ($payment_button_type == "https://www.paypal.com/en_US/i/btn/x-click-but11.gif") echo " checked " ?>
|
| 212 |
+
<?php _e('/>') ?>
|
| 213 |
+
</td>
|
| 214 |
+
</tr>
|
| 215 |
+
<tr>
|
| 216 |
+
<td><img border="0" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" alt="" /></td>
|
| 217 |
+
<td><img border="0" src="https://www.paypal.com/en_US/i/btn/x-click-but11.gif" alt="" /></td>
|
| 218 |
+
</tr>
|
| 219 |
+
</table>
|
| 220 |
+
|
| 221 |
+
</div></div><!-- end of postbox -->
|
| 222 |
+
|
| 223 |
+
<div class="submit">
|
| 224 |
+
<input type="submit" class="button-primary" name="info_update" value="<?php _e('Update options'); ?> »" />
|
| 225 |
+
</div>
|
| 226 |
+
</form>
|
| 227 |
+
|
| 228 |
+
<div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;">
|
| 229 |
+
<p>If you need a feature rich and supported plugin for accepting PayPal payment then check out our <a href="https://www.tipsandtricks-hq.com/wordpress-estore-plugin-complete-solution-to-sell-digital-products-from-your-wordpress-blog-securely-1059" target="_blank">WP eStore Plugin</a> (You will love the WP eStore Plugin).
|
| 230 |
+
</p>
|
| 231 |
+
</div>
|
| 232 |
+
|
| 233 |
+
</div></div> <!-- end of .poststuff and post-body -->
|
| 234 |
+
</div><!-- end of .wrap -->
|
| 235 |
+
<?php
|
| 236 |
+
}
|
wpapp_paypal_utility.php
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
function wpapp_validate_paypl_ipn() {
|
| 4 |
+
|
| 5 |
+
$wpapp_ipn_validated = true;
|
| 6 |
+
|
| 7 |
+
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
|
| 8 |
+
// Instead, read raw POST data from the input stream.
|
| 9 |
+
$raw_post_data = file_get_contents('php://input');
|
| 10 |
+
$raw_post_array = explode('&', $raw_post_data);
|
| 11 |
+
$myPost = array();
|
| 12 |
+
foreach ($raw_post_array as $keyval) {
|
| 13 |
+
$keyval = explode('=', $keyval);
|
| 14 |
+
if (count($keyval) == 2)
|
| 15 |
+
$myPost[$keyval[0]] = urldecode($keyval[1]);
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
|
| 19 |
+
$req = 'cmd=_notify-validate';
|
| 20 |
+
if (function_exists('get_magic_quotes_gpc')) {
|
| 21 |
+
$get_magic_quotes_exists = true;
|
| 22 |
+
}
|
| 23 |
+
foreach ($myPost as $key => $value) {
|
| 24 |
+
if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
|
| 25 |
+
$value = urlencode(stripslashes($value));
|
| 26 |
+
} else {
|
| 27 |
+
$value = urlencode($value);
|
| 28 |
+
}
|
| 29 |
+
$req .= "&$key=$value";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
// Step 2: POST IPN data back to PayPal to validate
|
| 34 |
+
$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
|
| 35 |
+
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
| 36 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
| 37 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 38 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
|
| 39 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
| 40 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
|
| 41 |
+
|
| 42 |
+
if (!($res = curl_exec($ch))) {
|
| 43 |
+
// error_log("Got " . curl_error($ch) . " when processing IPN data");
|
| 44 |
+
curl_close($ch);
|
| 45 |
+
exit;
|
| 46 |
+
}
|
| 47 |
+
curl_close($ch);
|
| 48 |
+
|
| 49 |
+
// Inspect IPN validation result and act accordingly
|
| 50 |
+
if (strcmp ($res, "VERIFIED") == 0) {
|
| 51 |
+
// The IPN is verified, process it
|
| 52 |
+
$wpapp_ipn_validated = true;
|
| 53 |
+
} else if (strcmp ($res, "INVALID") == 0) {
|
| 54 |
+
// IPN invalid, log for manual investigation
|
| 55 |
+
$wpapp_ipn_validated = false;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
if (!$wpapp_ipn_validated) {
|
| 60 |
+
// IPN validation failed. Email the admin to notify this event.
|
| 61 |
+
$admin_email = get_bloginfo('admin_email');
|
| 62 |
+
$subject = 'IPN validation failed for a payment';
|
| 63 |
+
$body = "This is a notification email from the WP Accept PayPal Payment plugin letting you know that a payment verification failed." .
|
| 64 |
+
"\n\nPlease check your paypal account to make sure you received the correct amount in your account before proceeding" .
|
| 65 |
+
wp_mail($admin_email, $subject, $body);
|
| 66 |
+
exit;
|
| 67 |
+
}
|
| 68 |
+
}
|
