From e94ef35aae9fb325154ea38e7fcfddcb26d65eda Mon Sep 17 00:00:00 2001 From: jigneshkaila Date: Tue, 16 Jun 2015 18:20:59 +0530 Subject: [PATCH] Plugin Settings Panel, ref #214 --- paypal-for-woocommerce.php | 21 ++++++++++++ template/admin.php | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 template/admin.php diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index 30c688d52..2ebb1f1ef 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -39,9 +39,15 @@ $pp_settings = get_option( 'woocommerce_paypal_express_settings' ); $pp_pro = get_option('woocommerce_paypal_pro_settings'); $pp_payflow = get_option('woocommerce_paypal_pro_payflow_settings'); + + if(!class_exists('AngellEYE_Gateway_Paypal')){ class AngellEYE_Gateway_Paypal { + + protected $plugin_screen_hook_suffix = null; + protected $plugin_slug = 'paypal-for-woocommerce'; + /** * General class constructor where we'll setup our actions, hooks, and shortcodes. * @@ -82,6 +88,7 @@ public function __construct() add_action( 'woocommerce_cart_calculate_fees', array($this, 'woocommerce_custom_surcharge') ); add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'add_div_before_add_to_cart_button' ), 25); add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_div_after_add_to_cart_button' ), 35); + add_action( 'admin_menu', array( $this, 'angelleye_admin_menu_own' ) ); } /** @@ -559,6 +566,20 @@ function add_div_after_add_to_cart_button(){ plugin_screen_hook_suffix = add_submenu_page( + 'options-general.php', + __( 'PayPal for WooCommerce - Settings', 'paypal-for-woocommerce' ), + __( 'PayPal for WooCommerce', 'paypal-for-woocommerce' ), + 'manage_options', + 'paypal-for-woocommerce', + array( $this, 'display_plugin_admin_page')); + } + + public function display_plugin_admin_page(){ + include_once( 'template/admin.php' ); + } } } new AngellEYE_Gateway_Paypal(); \ No newline at end of file diff --git a/template/admin.php b/template/admin.php new file mode 100644 index 000000000..d72b28146 --- /dev/null +++ b/template/admin.php @@ -0,0 +1,65 @@ + + + +
+ +

+ + + + + + + + + +
+

plugin_slug); ?>

+ plugin_slug); ?> +
+ + + +
+

plugin_slug); ?>

+ plugin_slug); ?> +
+ + + +
+

plugin_slug); ?>

+ plugin_slug); ?> +
+ + + +
+
+ +
\ No newline at end of file