From 485304735a4b1dac32555449c0cce19dc1d9d4c7 Mon Sep 17 00:00:00 2001 From: Deepak Maurya Date: Thu, 24 Sep 2020 14:59:52 +0530 Subject: [PATCH 1/2] Removes the Version string from HTML header, PFW-694 --- paypal-for-woocommerce.php | 56 ++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index 38c835a51..a7dc22746 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -130,7 +130,7 @@ public function __construct() add_action( 'admin_enqueue_scripts', array( $this , 'admin_scripts' ) ); add_action( 'admin_print_styles', array( $this , 'admin_styles' ) ); - add_action( 'admin_menu', array( $this, 'angelleye_admin_menu_own' ) ); + add_action( 'admin_menu', array( $this, 'angelleye_admin_menu_own' ) ); add_action( 'product_type_options', array( $this, 'angelleye_product_type_options_own' ), 10, 1); add_action( 'woocommerce_process_product_meta', array( $this, 'angelleye_woocommerce_process_product_meta_own' ), 10, 1 ); add_filter( 'woocommerce_add_to_cart_sold_individually_quantity', array( $this, 'angelleye_woocommerce_add_to_cart_sold_individually_quantity' ), 10, 5 ); @@ -162,19 +162,57 @@ public function __construct() add_filter( 'woocommerce_email_classes', array($this, 'angelleye_woocommerce_email_classes'), 10, 1); add_filter( 'wc_get_template', array($this, 'own_angelleye_wc_get_template'), 10, 5); add_filter( 'woocommerce_email_actions', array($this, 'own_angelleye_woocommerce_email_actions'), 10); + add_filter( 'woocommerce_general_settings', array($this, 'include_pfw_settings'), 10, 1); $this->customer_id; } + /** + * Injects the PFW Version number in frontend HTML header + */ public function paypal_for_woo_head_mark() { - echo sprintf( - '', - esc_html( 'PayPal for WooCommerce' ), - ( 'v' . VERSION_PFW ), - esc_url( 'https://www.angelleye.com/product/woocommerce-paypal-plugin/' ) - ); - echo chr(10) . chr(13); + $hide_watermark = get_option('pfw_hide_frontend_mark', 'no'); + if($hide_watermark != 'yes'){ + echo sprintf( + '', + esc_html( 'PayPal for WooCommerce' ), + ( 'v' . VERSION_PFW ), + esc_url( 'https://www.angelleye.com/product/woocommerce-paypal-plugin/' ) + ); + echo chr(10) . chr(13); + } } - + + /** + * Extends PFW Setting in WooCommerce Setting -> General tab + * @param array $general_settings + * + * @return array + */ + public function include_pfw_settings( $general_settings = [] ) { + $pfw_settings = [ + array( + 'title' => __( 'PayPal for WooCommerce Options', 'woocommerce' ), + 'type' => 'title', + 'desc' => '', + 'id' => 'pfw_options', + ), + array( + 'title' => __( 'Version Mark', 'woocommerce' ), + 'desc' => __( 'Remove PFW Version mark from frontend', 'woocommerce' ), + 'id' => 'pfw_hide_frontend_mark', + 'default' => 'no', + 'type' => 'checkbox', + 'desc_tip' => __( 'Removes the PayPal for WooCommerce version description from the frontend HTML source.', 'woocommerce' ), + ), + array( + 'type' => 'sectionend', + 'id' => 'pfw_options', + ), + ]; + + return array_merge($general_settings, $pfw_settings); + } + /* * Adds class name to HTML body to enable easy conditional CSS styling * @access public From de287df60743a8de1f8d635652b8bc1bb12afd26 Mon Sep 17 00:00:00 2001 From: Deepak Maurya Date: Thu, 24 Sep 2020 15:07:59 +0530 Subject: [PATCH 2/2] Updated the labels for PFW General Options, PFW-694 --- paypal-for-woocommerce.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index a7dc22746..afa04e4fe 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -197,12 +197,12 @@ public function include_pfw_settings( $general_settings = [] ) { 'id' => 'pfw_options', ), array( - 'title' => __( 'Version Mark', 'woocommerce' ), - 'desc' => __( 'Remove PFW Version mark from frontend', 'woocommerce' ), + 'title' => __( 'Hide Version Tag', 'woocommerce' ), + 'desc' => __( 'Hide plugin version tag from front end source code.', 'woocommerce' ), 'id' => 'pfw_hide_frontend_mark', 'default' => 'no', 'type' => 'checkbox', - 'desc_tip' => __( 'Removes the PayPal for WooCommerce version description from the frontend HTML source.', 'woocommerce' ), + 'desc_tip' => __( 'Removes the PayPal for WooCommerce plugin version from front end source code.', 'woocommerce' ), ), array( 'type' => 'sectionend',