AdditionalOptions.class.php
2 months ago
CampaignInfo.class.php
2 months ago
Campaigns.class.php
2 months ago
ClickTracking.class.php
2 months ago
ContactForm7.class.php
2 months ago
Debugging.class.php
3 weeks ago
EDD.class.php
3 weeks ago
General.class.php
3 weeks ago
Integrations.class.php
2 months ago
LifterLMS.class.php
2 months ago
Marketpress.class.php
3 weeks ago
MemberPress.class.php
2 months ago
Membership2.class.php
2 months ago
PMPro.class.php
2 months ago
PPBuyNowButton.class.php
2 months ago
RestrictContentPro.class.php
2 months ago
S2Member.class.php
2 months ago
Signup.class.php
2 months ago
SimplePayPro.class.php
2 months ago
StripePayments.class.php
3 weeks ago
SureCart.class.php
2 months ago
WPEasyCart.class.php
2 months ago
WPPayForms.class.php
2 months ago
WishListMember.class.php
2 months ago
WooComm.class.php
3 weeks ago
PPBuyNowButton.class.php
70 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | |
| 4 | class postaffiliatepro_Form_Settings_PPBuyNowButton extends postaffiliatepro_Form_Base { |
| 5 | const WPECPP_COMMISSION_ENABLED = 'wpecpp-commission-enabled'; |
| 6 | const WPECPP_CONFIG_PAGE = 'wpecpp-config-page'; |
| 7 | |
| 8 | public function __construct() { |
| 9 | parent::__construct(self::WPECPP_CONFIG_PAGE, 'options.php'); |
| 10 | } |
| 11 | |
| 12 | public function initSettings() { |
| 13 | register_setting(postaffiliatepro::INTEGRATIONS_SETTINGS_PAGE_NAME, self::WPECPP_COMMISSION_ENABLED); |
| 14 | } |
| 15 | |
| 16 | protected function initForm() { |
| 17 | } |
| 18 | |
| 19 | protected function getTemplateFile() { |
| 20 | return WP_PLUGIN_DIR . '/postaffiliatepro/Template/PPBuyNowButtonConfig.xtpl'; |
| 21 | } |
| 22 | |
| 23 | public function addPrimaryConfigMenu() { |
| 24 | if (get_option(self::WPECPP_COMMISSION_ENABLED) === 'true') { |
| 25 | add_submenu_page('integrations-config-page-handle', 'PayPal Buy Now Button', 'PayPal Buy Now Button', 'manage_options', 'wpecppintegration-settings-page', array( |
| 26 | $this, |
| 27 | 'printConfigPage' |
| 28 | )); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | public function printConfigPage() { |
| 33 | $this->render(); |
| 34 | } |
| 35 | |
| 36 | public function integratePayPalButton($output, $shortcode, $attr){ |
| 37 | if('wpecpp' !== $shortcode){ |
| 38 | return $output; |
| 39 | } |
| 40 | if (get_option(self::WPECPP_COMMISSION_ENABLED) !== 'true') { |
| 41 | return $output; |
| 42 | } |
| 43 | $url = postaffiliatepro::parseServerPathForClickTrackingCode(); |
| 44 | $integration = '<input id="pap_dx8vc2s5" type="hidden" name="custom" value="">'; |
| 45 | $integration .= "<input type='hidden' name='notify_url' value='http://{$url}plugins/PayPal/paypal.php'>"; |
| 46 | |
| 47 | $async = ''; |
| 48 | if (get_option(postaffiliatepro::ASYNC_ENABLED) == 'true') { |
| 49 | $async = ' async'; |
| 50 | } |
| 51 | |
| 52 | $integration .= "<script$async id='pap_x2s6df8d' src='//{$url}scripts/notifysale.php' type='text/javascript'></script>"; |
| 53 | $output = substr_replace($output, $integration, strpos($output, '</form>'), 0); |
| 54 | return $output; |
| 55 | } |
| 56 | } |
| 57 | $papSubmenuPriority = 30; |
| 58 | $papIntegrationPPBuyNowButton = new postaffiliatepro_Form_Settings_PPBuyNowButton(); |
| 59 | add_action('admin_init', array( |
| 60 | $papIntegrationPPBuyNowButton, |
| 61 | 'initSettings' |
| 62 | ), 99); |
| 63 | add_action('admin_menu', array( |
| 64 | $papIntegrationPPBuyNowButton, |
| 65 | 'addPrimaryConfigMenu' |
| 66 | ), $papSubmenuPriority); |
| 67 | add_filter( 'do_shortcode_tag', array( |
| 68 | $papIntegrationPPBuyNowButton, |
| 69 | 'integratePayPalButton' |
| 70 | ),10,3); |