From bd636e15bceb62c9cc9cd9e3e953598227797c07 Mon Sep 17 00:00:00 2001 From: Rodrigo Iloro Date: Mon, 21 May 2018 13:23:02 -0300 Subject: [PATCH 1/3] Widgets: adds default properties to prevent undefined index warnings --- modules/widgets/simple-payments.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/widgets/simple-payments.php b/modules/widgets/simple-payments.php index f54389607384f..f25e243cfaa47 100644 --- a/modules/widgets/simple-payments.php +++ b/modules/widgets/simple-payments.php @@ -258,6 +258,20 @@ function get_first_product_id() { return ! empty( $product_posts ) ? $product_posts[0]->ID : null; } + /** + * Return an associative array of default values. + * + * These values are used in new widgets. + * + * @return array Default values for the widget options. + */ + public function defaults() { + return array( + 'title' => '', + 'product_post_id' => 0, + ); + } + /** * Front-end display of widget. * From a3485369d5abecb7239862741734471185180bd3 Mon Sep 17 00:00:00 2001 From: Rodrigo Iloro Date: Tue, 26 Jun 2018 11:53:49 -0300 Subject: [PATCH 2/3] Widget: adds plan checks to the Simple Payments Widget --- modules/widgets/simple-payments.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/widgets/simple-payments.php b/modules/widgets/simple-payments.php index f25e243cfaa47..c402710e4ac7d 100644 --- a/modules/widgets/simple-payments.php +++ b/modules/widgets/simple-payments.php @@ -456,7 +456,8 @@ function form( $instance ) { // Register Jetpack_Simple_Payments_Widget widget. function register_widget_jetpack_simple_payments() { - if ( ! Jetpack::is_active() ) { + $jetpack_simple_payments = Jetpack_Simple_Payments::getInstance(); + if ( ! $jetpack_simple_payments->is_enabled_jetpack_simple_payments() ) { return; } From c71c89e342d151eb446738d3a45da456a202eae4 Mon Sep 17 00:00:00 2001 From: Rodrigo Iloro Date: Tue, 26 Jun 2018 11:57:05 -0300 Subject: [PATCH 3/3] Widgets: fixes merge conflicts on the Simple Payments Widget --- modules/widgets/simple-payments.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/modules/widgets/simple-payments.php b/modules/widgets/simple-payments.php index c402710e4ac7d..ff0d73d3a93ef 100644 --- a/modules/widgets/simple-payments.php +++ b/modules/widgets/simple-payments.php @@ -258,20 +258,6 @@ function get_first_product_id() { return ! empty( $product_posts ) ? $product_posts[0]->ID : null; } - /** - * Return an associative array of default values. - * - * These values are used in new widgets. - * - * @return array Default values for the widget options. - */ - public function defaults() { - return array( - 'title' => '', - 'product_post_id' => 0, - ); - } - /** * Front-end display of widget. *