Elementor Addons & Templates – Sizzify Lite - Version 1.0.2

Version Description

= * New: Recent Posts By Category * Tweaks: CSS adjustments so that widget title when set does not break column layout

=

Download this release

Release Info

Developer WPDevHQ
Plugin Icon wp plugin Elementor Addons & Templates – Sizzify Lite
Version 1.0.2
Comparing to
See all releases

Version 1.0.2

README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Elementor Addon Widgets
2
+
3
+
4
+ **Contributors:** [WPDevHQ](http://www.wpdevhq.com)
5
+ **Tags:** elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
6
+ **Requires at least:** 4.4
7
+ **Tested up to:** 4.6.1
8
+ **Stable tag:** 1.0.2
9
+ **License:** GPLv3
10
+ **License URI:** https://www.gnu.org/licenses/gpl-3.0.html
11
+
12
+ Widgets that are specifically designed to be used in conjunction with the [Elementor Pagebuilder](https://github.com/pojome/elementor)
13
+
14
+ ## Description ##
15
+ Native WordPress widgets specifically designed for use with the Elementor Page Builder
16
+
17
+ Initial version contains 8 widgets - more to come.
18
+ - 1: WooCommerce Product Categories
19
+ - 2: WooCommerce Recent Products
20
+ - 3: WooCommerce Best Selling Products
21
+ - 4: WooCommerce Featured Products
22
+ - 5: WooCommerce On Sale Products
23
+ - 6: WooComemrce Popular Products
24
+
25
+ - 7: New: EAW: Elementor Recent Posts
26
+ - 8: New: EAW: Elementor Posts By Category
27
+
28
+ ## Themes ##
29
+ Minimal support is included for almost any theme therefore leaving most of the desing to be carried out in the themes themselves.
30
+ The plugin does however inherit some design spects of the current theme.
31
+
32
+ If you are a theme author you are encouraged to test the plugin making necessary adjustments and providing design options where necessary.
33
+
34
+ If you find any issues with your particula theme not playing nice with the templates please let us know so that we can do our best
35
+ to accommodate you.
36
+
37
+ ## Installation ##
38
+ * These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated.
39
+
40
+ 1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
41
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
42
+ 3. Go to Pages > Add New
43
+ 4. Select the desired template from the Page Attributes section
44
+ 4. Press the 'Edit with Elementor' button.
45
+ 5. Scroll down the left pane to the WordPress section and you should see the new widgets that you can drag and drop on to your page.
46
+
47
+ ## Frequently Asked Questions ##
48
+
49
+ **Why is it after draging the required widget, making the necessary adjustments to settings and save the layout goes all wonky?**
50
+
51
+ There is a known bug/conflict with WooCommerce assets not being loaded upon saving the edits, however refreshing the page puts things back to normal.
52
+ See this [issue #495](https://github.com/pojome/elementor/issues/495) for current status.
53
+
54
+
55
+ ## Changelog ##
56
+
57
+ ### 1.0.2 ###
58
+ * New: Recent Posts By Category
59
+ * Tweaks: CSS adjustments so that widget title when set does not break column layout
60
+
61
+ ### 1.0.1 ###
62
+ * New: Recent Posts Widget
63
+
64
+ ### 1.0.0 ###
65
+ * Initial release.
66
+
67
+ Copyright: WPDevHQ http://www.wpdevhq.com
css/eaw.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Elementor CSS support
3
+ */
4
+
5
+ .eaw-product-section .section-title {
6
+ margin-bottom: 20px;
7
+ }
8
+
9
+ .elementor-widget-wp-widget-eaw-recent-posts h5,
10
+ .elementor-widget-wp-widget-eaw-recent-posts-plus h5 {
11
+ font-size: 1.75rem;
12
+ line-height: 1.75;
13
+ text-align: center;
14
+ }
15
+
16
+ .eaw-recent-posts,
17
+ .eaw-recent-posts-plus {
18
+ width: 32.3333%;
19
+ padding: 0;
20
+ margin: 0;
21
+ margin-right: 1.3333%;
22
+ float: left;
23
+ }
24
+
25
+ .eaw-recent-posts:last-child,
26
+ .eaw-recent-posts-plus:last-child {
27
+ margin-right: 0;
28
+ }
29
+
30
+ .eaw-recent-posts img {
31
+ width: 100%;
32
+ height: 250px;
33
+ margin: 10px 0;
34
+ border-radius: 6px;
35
+ }
36
+
37
+ .eaw-recent-posts .eaw-content {
38
+ padding: 1% 2%;
39
+ }
40
+
41
+ @media screen and (max-width: 768px) {
42
+ .eaw-recent-posts {
43
+ width: 48%;
44
+ padding: 0;
45
+ margin: 0 1%;
46
+ }
47
+
48
+ .eaw-recent-posts img {
49
+ height: 300px;
50
+ margin: 0 auto;
51
+ }
52
+ }
53
+
54
+ @media screen and (max-width: 667px) {
55
+ .eaw-recent-posts {
56
+ width: 100%;
57
+ margin: 0;
58
+ }
59
+
60
+ .eaw-recent-posts img {
61
+ height: 300px;
62
+ margin: 0 auto;
63
+ }
64
+ }
eaw-class.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Elementor_Addon_Widgets {
4
+
5
+ /**
6
+ * A reference to an instance of this class.
7
+ */
8
+ private static $instance;
9
+
10
+ /**
11
+ * Returns an instance of this class.
12
+ */
13
+ public static function get_instance() {
14
+
15
+ if( null == self::$instance ) {
16
+ self::$instance = new Elementor_Addon_Widgets();
17
+ }
18
+
19
+ return self::$instance;
20
+
21
+ }
22
+
23
+ public function eaw_load_plugin_textdomain() {
24
+ load_plugin_textdomain( 'elementor-addon-widgets' );
25
+ }
26
+
27
+ /**
28
+ * Cloning is forbidden.
29
+ *
30
+ * @since 1.0.0
31
+ */
32
+ public function __clone() {
33
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'elementor-addon-widgets' ), '1.0.0' );
34
+ }
35
+
36
+ /**
37
+ * Unserializing instances of this class is forbidden.
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ public function __wakeup() {
42
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'elementor-addon-widgets' ), '1.0.0' );
43
+ }
44
+
45
+ /**
46
+ * Initializes the plugin by setting filters and administration functions.
47
+ */
48
+ private function __construct() {
49
+
50
+ add_action( 'init', array( $this, 'eaw_load_plugin_textdomain' ) );
51
+
52
+ add_action( 'widgets_init', array( $this, 'eaw_addon_woo_widgets' ) );
53
+
54
+ add_action( 'widgets_init', array( $this, 'eaw_addon_posts_widgets' ) );
55
+
56
+ add_action( 'wp_enqueue_scripts', array( $this, 'eaw_styles' ), 999 );
57
+
58
+ }
59
+
60
+ /**
61
+ * WooCommerce Widget section
62
+ * @since 1.0.0
63
+ * @return void
64
+ */
65
+ public static function eaw_addon_woo_widgets() {
66
+ if ( is_woocommerce_activated() ) { // Lets not do anything unless WooCommerce is active!
67
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/products-categories.php' );
68
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/recent-products.php' );
69
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/featured-products.php' );
70
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/popular-products.php' );
71
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/sale-products.php' );
72
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/woo/best-products.php' );
73
+
74
+ register_widget( 'Woo_Product_Categories' );
75
+ register_widget( 'Woo_Recent_Products' );
76
+ register_widget( 'Woo_Featured_Products' );
77
+ register_widget( 'Woo_Popular_Products' );
78
+ register_widget( 'Woo_Sale_Products' );
79
+ register_widget( 'Woo_Best_Products' );
80
+ }
81
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/wp/eaw-posts-widget.php');
82
+ register_widget( 'EAW_Recent_Posts' );
83
+
84
+ include_once( plugin_dir_path( __FILE__ ) . 'widgets/wp/eaw-posts-widget-plus.php');
85
+ register_widget( 'EAW_Recent_Posts_Plus' );
86
+ }
87
+
88
+ /**
89
+ * Posts Widget section
90
+ * @since 1.0.0
91
+ * @return void
92
+ */
93
+ public static function eaw_addon_posts_widgets() {
94
+
95
+ }
96
+
97
+ /**
98
+ * Enqueue CSS and custom styles.
99
+ * @since 1.0.0
100
+ * @return void
101
+ */
102
+ public function eaw_styles() {
103
+ wp_enqueue_style( 'eaw-styles', plugins_url( '/css/eaw.css', __FILE__ ) );
104
+ }
105
+ }
106
+ add_action( 'plugins_loaded', array( 'Elementor_Addon_Widgets', 'get_instance' ) );
elementor-addon-widgets.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Plugin Name: Elementor Addon Widgets
5
+ * Plugin URI: http://www.wpdevhq.com/plugins/elementor-addon-widgets
6
+ * Description: A helper plugin for users of Elementor Pagebuilder.
7
+ * Version: 1.0.2
8
+ * Author: WPDevHQ
9
+ * Author URI: http://www.wpdevhq.com/
10
+ * Requires at least: 4.4
11
+ * Tested up to: 4.6.1
12
+ */
13
+
14
+ /* Do not access this file directly */
15
+ if ( ! defined( 'WPINC' ) ) { die; }
16
+
17
+ /* Constants
18
+ ------------------------------------------ */
19
+
20
+ /* Set plugin version constant. */
21
+ define( 'EA_VERSION', '1.0.0' );
22
+
23
+ /* Set constant path to the plugin directory. */
24
+ define( 'EA_PATH', trailingslashit( plugin_dir_path(__FILE__) ) );
25
+
26
+ /* Set the constant path to the plugin directory URI. */
27
+ define( 'EA_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
28
+
29
+ /* ElemenTemplater Class */
30
+ require_once( EA_PATH . 'eaw-class.php' );
31
+
32
+ /**
33
+ * Query WooCommerce activation
34
+ */
35
+ if ( ! function_exists( 'is_woocommerce_activated' ) ) {
36
+
37
+ function is_woocommerce_activated() {
38
+ return class_exists( 'woocommerce' ) ? true : false;
39
+ }
40
+
41
+ }
42
+
43
+ /**
44
+ * Call a shortcode function by tag name.
45
+ *
46
+ * @since 1.0.0
47
+ *
48
+ * @param string $tag The shortcode whose function to call.
49
+ * @param array $atts The attributes to pass to the shortcode function. Optional.
50
+ * @param array $content The shortcode's content. Default is null (none).
51
+ *
52
+ * @return string|bool False on failure, the result of the shortcode on success.
53
+ */
54
+ function eaw_do_shortcode( $tag, array $atts = array(), $content = null ) {
55
+
56
+ global $shortcode_tags;
57
+
58
+ if ( ! isset( $shortcode_tags[ $tag ] ) ) {
59
+ return false;
60
+ }
61
+
62
+ return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
63
+ }
readme.txt ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Elementor Addon Widgets ===
2
+
3
+ Contributors: WPDevHQ
4
+ Tags: elementor, pagebuilder, page builder, page builder template, page builder templates, woocommerce, template builder, builder templates
5
+ Requires at least: 4.4
6
+ Tested up to: 4.6.1
7
+ Stable tag: 1.0.2
8
+ License: GPLv3
9
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
+
11
+ Adds Native Custom Wordpress Widgets that are specifically designed to be used in conjunction with the Elementor Page Builder
12
+
13
+ == Description ==
14
+ Native WordPress widgets specifically designed for use with the [Elementor Page Builder](https://wordpress.org/plugins/elementor/)
15
+
16
+ Initial version contains 6(+2) widgets - more to come.
17
+ * 1: WooCommerce Product Categories
18
+ * 2: WooCommerce Recent Products
19
+ * 3: WooCommerce Best Selling Products
20
+ * 4: WooCommerce Featured Products
21
+ * 5: WooCommerce On Sale Products
22
+ * 6: WooComemrce Popular Products
23
+
24
+ * 7: New: EAW: Elementor Recent Posts
25
+ * 8: New: EAW: Elementor Posts By Category
26
+
27
+ == Themes ==
28
+ Minimal support is included for almost any theme therefore leaving most of the desing to be carried out in the themes themselves.
29
+ The plugin does however inherit some design spects of the current theme.
30
+
31
+ If you are a theme author you are encouraged to test the plugin making necessary adjustments and providing design options where necessary.
32
+
33
+ If you find any issues with your particula theme not playing nice with the templates please let us know so that we can do our best
34
+ to accommodate you.
35
+
36
+ == Installation ==
37
+ * These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated.
38
+
39
+ 1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation.
40
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
41
+ 3. Go to Pages > Add New
42
+ 4. Select the desired template from the Page Attributes section
43
+ 4. Press the 'Edit with Elementor' button.
44
+ 5. Scroll down the left pane to the WordPress section and you should see the new widgets that you can drag and drop on to your page.
45
+
46
+ == Frequently Asked Questions ==
47
+
48
+ Why is it after draging the required widget, making the necessary adjustments to settings and save the layout goes all wonky?
49
+
50
+ There is a known bug/conflict with WooCommerce assets not being loaded upon saving the edits, however refreshing the page puts things back to normal.
51
+ See this [issue #495](https://github.com/pojome/elementor/issues/495) for current status.
52
+
53
+ == Screenshots ==
54
+
55
+ 1. Widgets Panel
56
+
57
+ 2. Editor View
58
+
59
+ 3. Frontend View Products And Posts
60
+
61
+ 4. Frontend view posts with custom title.
62
+
63
+ == Changelog ==
64
+
65
+ == 1.0.2 ==
66
+ * New: Recent Posts By Category
67
+ * Tweaks: CSS adjustments so that widget title when set does not break column layout
68
+
69
+ == 1.0.1 ==
70
+ * New: Recent Posts Widget
71
+
72
+ == 1.0.0 ==
73
+ * Initial release.
74
+
75
+ Copyright: WPDevHQ http://www.wpdevhq.com
widgets/woo/best-products.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Best_Products extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_best_products',
13
+ 'description' => __( 'Woo Best Selling Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-best-products', __('Woo Best Selling Products', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_best_products';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_best_products', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'Best Sellers', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
57
+ if ( '' == $limit )
58
+ $limit = 4;
59
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
60
+
61
+ if ( '' == $columns )
62
+ $columns = 4;
63
+
64
+ $args = apply_filters( 'elementor-addon-widgets_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'title' => $title,
68
+ 'orderby' => 'date',
69
+ 'order' => 'desc',
70
+ ) );
71
+
72
+ echo $args['before_widget'];
73
+ //echo '<div class="woo-best-products">';
74
+ echo '<section class="eaw-product-section woo-best-products">';
75
+
76
+ do_action( 'storepage_homepage_before_best_selling_products' );
77
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
78
+
79
+ do_action( 'storepage_homepage_after_best_selling_products_title' );
80
+ echo eaw_do_shortcode( 'best_selling_products', array(
81
+ 'per_page' => intval( $args['limit'] ),
82
+ 'columns' => intval( $args['columns'] ),
83
+ ) );
84
+ do_action( 'storepage_homepage_after_best_selling_products' );
85
+
86
+ echo '</section>';
87
+ //echo '</div>';
88
+
89
+ echo $args['after_widget'];
90
+
91
+ if ( ! $this->is_preview() ) {
92
+ $cache[ $args['widget_id'] ] = ob_get_flush();
93
+ wp_cache_set( 'woo_best_products', $cache, 'widget' );
94
+ } else {
95
+ ob_end_flush();
96
+ }
97
+ }
98
+
99
+ public function update( $new_instance, $old_instance ) {
100
+ $instance = $old_instance;
101
+ $instance['title'] = strip_tags($new_instance['title']);
102
+ $instance['limit'] = (int) $new_instance['limit'];
103
+ $instance['columns'] = (int) ( $new_instance['columns'] );
104
+ $this->flush_widget_cache();
105
+
106
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
107
+ if ( isset($alloptions['woo_best_products']) )
108
+ delete_option('woo_best_products');
109
+
110
+ return $instance;
111
+ }
112
+
113
+ /**
114
+ * @access public
115
+ */
116
+ public function flush_widget_cache() {
117
+ wp_cache_delete('woo_best_products', 'widget');
118
+ }
119
+
120
+ /**
121
+ * @param array $instance
122
+ */
123
+ public function form( $instance ) {
124
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
125
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
126
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
127
+ ?>
128
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
129
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
130
+
131
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
132
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
133
+
134
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
135
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
136
+
137
+
138
+ <?php
139
+ }
140
+ }
widgets/woo/featured-products.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Featured_Products extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_featured_products',
13
+ 'description' => __( 'Woo Featured Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-featured-products', __('Woo Featured Products', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_featured_products';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_featured_products', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'Recommended For You', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
57
+ if ( '' == $limit )
58
+ $limit = 4;
59
+
60
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
61
+ if ( '' == $columns )
62
+ $columns = 4;
63
+
64
+ $args = apply_filters( 'elementor-addon-widgets_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'title' => $title,
68
+ 'orderby' => 'date',
69
+ 'order' => 'desc',
70
+ ) );
71
+
72
+ echo $args['before_widget'];
73
+ echo '<section class="eaw-product-section woo-featured-products">';
74
+
75
+ do_action( 'storepage_homepage_before_featured_products' );
76
+
77
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
78
+
79
+ do_action( 'storepage_homepage_after_featured_products_title' );
80
+
81
+ echo eaw_do_shortcode( 'featured_products', array(
82
+ 'per_page' => intval( $args['limit'] ),
83
+ 'columns' => intval( $args['columns'] ),
84
+ 'orderby' => esc_attr( $args['orderby'] ),
85
+ 'order' => esc_attr( $args['order'] ),
86
+ ) );
87
+
88
+ do_action( 'storepage_homepage_after_featured_products' );
89
+
90
+ echo '</section>';
91
+
92
+ echo $args['after_widget'];
93
+
94
+ if ( ! $this->is_preview() ) {
95
+ $cache[ $args['widget_id'] ] = ob_get_flush();
96
+ wp_cache_set( 'woo_featured_products', $cache, 'widget' );
97
+ } else {
98
+ ob_end_flush();
99
+ }
100
+ }
101
+
102
+ public function update( $new_instance, $old_instance ) {
103
+ $instance = $old_instance;
104
+ $instance['title'] = strip_tags($new_instance['title']);
105
+ $instance['limit'] = (int) $new_instance['limit'];
106
+ $instance['columns'] = (int) $new_instance['columns'];
107
+ $this->flush_widget_cache();
108
+
109
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
110
+ if ( isset($alloptions['woo_featured_products']) )
111
+ delete_option('woo_featured_products');
112
+
113
+ return $instance;
114
+ }
115
+
116
+ /**
117
+ * @access public
118
+ */
119
+ public function flush_widget_cache() {
120
+ wp_cache_delete('woo_featured_products', 'widget');
121
+ }
122
+
123
+ /**
124
+ * @param array $instance
125
+ */
126
+ public function form( $instance ) {
127
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
128
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
129
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
130
+ ?>
131
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
132
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
133
+
134
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
135
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
136
+
137
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
138
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
139
+
140
+
141
+ <?php
142
+ }
143
+ }
widgets/woo/popular-products.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Popular_Products extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_popular_products',
13
+ 'description' => __( 'Woo Popular Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-popular-products', __('Woo Popular Products', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_popular_products';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_popular_products', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'Fan Favorites', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
57
+ if ( '' == $limit )
58
+ $limit = 4;
59
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
60
+
61
+ if ( '' == $columns )
62
+ $columns = 4;
63
+
64
+ $args = apply_filters( 'elementor-addon-widgets_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'title' => $title,
68
+ 'orderby' => 'date',
69
+ 'order' => 'desc',
70
+ ) );
71
+
72
+ echo $args['before_widget'];
73
+ //echo '<div class="woo-popular-products">';
74
+ echo '<section class="eaw-product-section woo-popular-products">';
75
+
76
+ do_action( 'storepage_homepage_before_popular_products' );
77
+
78
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
79
+
80
+ do_action( 'storepage_homepage_after_popular_products_title' );
81
+
82
+ echo eaw_do_shortcode( 'top_rated_products', array(
83
+ 'per_page' => intval( $args['limit'] ),
84
+ 'columns' => intval( $args['columns'] ),
85
+ ) );
86
+
87
+ do_action( 'storepage_homepage_after_popular_products' );
88
+
89
+ echo '</section>';
90
+ //echo '</div>';
91
+
92
+ echo $args['after_widget'];
93
+
94
+ if ( ! $this->is_preview() ) {
95
+ $cache[ $args['widget_id'] ] = ob_get_flush();
96
+ wp_cache_set( 'woo_popular_products', $cache, 'widget' );
97
+ } else {
98
+ ob_end_flush();
99
+ }
100
+ }
101
+
102
+ public function update( $new_instance, $old_instance ) {
103
+ $instance = $old_instance;
104
+ $instance['title'] = strip_tags($new_instance['title']);
105
+ $instance['limit'] = (int) $new_instance['limit'];
106
+ $instance['columns'] = (int) ( $new_instance['columns'] );
107
+ $this->flush_widget_cache();
108
+
109
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
110
+ if ( isset($alloptions['woo_popular_products']) )
111
+ delete_option('woo_popular_products');
112
+
113
+ return $instance;
114
+ }
115
+
116
+ /**
117
+ * @access public
118
+ */
119
+ public function flush_widget_cache() {
120
+ wp_cache_delete('woo_popular_products', 'widget');
121
+ }
122
+
123
+ /**
124
+ * @param array $instance
125
+ */
126
+ public function form( $instance ) {
127
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
128
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
129
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
130
+ ?>
131
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
132
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
133
+
134
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
135
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
136
+
137
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
138
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
139
+
140
+
141
+ <?php
142
+ }
143
+ }
widgets/woo/products-categories.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Product_Categories extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_product_categories',
13
+ 'description' => __( 'Woo Product Categories - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-product-categories', __('Woo Product Categories', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_product_categories';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_product_categories', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'Shop By Categories', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 3;
57
+ if ( '' == $limit )
58
+ $limit = 3;
59
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 3;
60
+
61
+ if ( '' == $columns )
62
+ $columns = 3;
63
+
64
+ $args = apply_filters( 'eaw_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'child_categories' => 0,
68
+ 'orderby' => 'name',
69
+ 'title' => $title,
70
+ ) );
71
+
72
+ echo $args['before_widget'];
73
+ //echo '<div class="widget-woo-categories">';
74
+ echo '<section class="eaw-product-section widget-woo-categories">';
75
+
76
+ do_action( 'storepage_homepage_before_product_categories' );
77
+
78
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
79
+
80
+ do_action( 'storepage_homepage_after_product_categories_title' );
81
+
82
+ echo eaw_do_shortcode( 'product_categories', array(
83
+ 'number' => intval( $args['limit'] ),
84
+ 'columns' => intval( $args['columns'] ),
85
+ 'orderby' => esc_attr( $args['orderby'] ),
86
+ 'parent' => esc_attr( $args['child_categories'] ),
87
+ ) );
88
+
89
+ do_action( 'storepage_homepage_after_product_categories' );
90
+
91
+ echo '</section>';
92
+ //echo '</div>';
93
+
94
+ echo $args['after_widget'];
95
+
96
+ if ( ! $this->is_preview() ) {
97
+ $cache[ $args['widget_id'] ] = ob_get_flush();
98
+ wp_cache_set( 'woo_product_categories', $cache, 'widget' );
99
+ } else {
100
+ ob_end_flush();
101
+ }
102
+ }
103
+
104
+ public function update( $new_instance, $old_instance ) {
105
+ $instance = $old_instance;
106
+ $instance['title'] = strip_tags($new_instance['title']);
107
+ $instance['limit'] = (int) $new_instance['limit'];
108
+ $instance['columns'] = (int) ( $new_instance['columns'] );
109
+ $this->flush_widget_cache();
110
+
111
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
112
+ if ( isset($alloptions['woo_product_categories']) )
113
+ delete_option('woo_product_categories');
114
+
115
+ return $instance;
116
+ }
117
+
118
+ /**
119
+ * @access public
120
+ */
121
+ public function flush_widget_cache() {
122
+ wp_cache_delete('woo_product_categories', 'widget');
123
+ }
124
+
125
+ /**
126
+ * @param array $instance
127
+ */
128
+ public function form( $instance ) {
129
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
130
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 3;
131
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 3;
132
+ ?>
133
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
134
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
135
+
136
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of categories to show:', 'elementor-addon-widgets' ); ?></label>
137
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
138
+
139
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
140
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns ?>" size="3" /></p>
141
+
142
+ <?php
143
+ }
144
+ }
widgets/woo/recent-products.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Recent_Products extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_recent_products',
13
+ 'description' => __( 'Woo Recent Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-recent-products', __('Woo Recent Products', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_recent_products';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_recent_products', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'New In', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
57
+ if ( '' == $limit )
58
+ $limit = 4;
59
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
60
+
61
+ if ( '' == $columns )
62
+ $columns = 4;
63
+
64
+ $args = apply_filters( 'elementor-addon-widgets_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'title' => $title,
68
+ ) );
69
+
70
+ echo $args['before_widget'];
71
+ //echo '<div class="woo-recent-products">';
72
+ echo '<section class="eaw-product-section woo-recent-products">';
73
+
74
+ do_action( 'elementor-addon-widgets_homepage_before_recent_products' );
75
+
76
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
77
+
78
+ do_action( 'elementor-addon-widgets_homepage_after_recent_products_title' );
79
+
80
+ echo eaw_do_shortcode( 'recent_products', array(
81
+ 'per_page' => intval( $args['limit'] ),
82
+ 'columns' => intval( $args['columns'] ),
83
+ ) );
84
+
85
+ do_action( 'elementor-addon-widgets_homepage_after_recent_products' );
86
+
87
+ echo '</section>';
88
+ //echo '</div>';
89
+
90
+ echo $args['after_widget'];
91
+
92
+ if ( ! $this->is_preview() ) {
93
+ $cache[ $args['widget_id'] ] = ob_get_flush();
94
+ wp_cache_set( 'woo_recent_products', $cache, 'widget' );
95
+ } else {
96
+ ob_end_flush();
97
+ }
98
+ }
99
+
100
+ public function update( $new_instance, $old_instance ) {
101
+ $instance = $old_instance;
102
+ $instance['title'] = strip_tags($new_instance['title']);
103
+ $instance['limit'] = (int) $new_instance['limit'];
104
+ $instance['columns'] = (int) ( $new_instance['columns'] );
105
+ $this->flush_widget_cache();
106
+
107
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
108
+ if ( isset($alloptions['woo_recent_products']) )
109
+ delete_option('woo_recent_products');
110
+
111
+ return $instance;
112
+ }
113
+
114
+ /**
115
+ * @access public
116
+ */
117
+ public function flush_widget_cache() {
118
+ wp_cache_delete('woo_recent_products', 'widget');
119
+ }
120
+
121
+ /**
122
+ * @param array $instance
123
+ */
124
+ public function form( $instance ) {
125
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
126
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
127
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
128
+ ?>
129
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
130
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
131
+
132
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
133
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
134
+
135
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
136
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
137
+
138
+
139
+ <?php
140
+ }
141
+ }
widgets/woo/sale-products.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent Woo Products
4
+ *
5
+ * @package Woo Recent Products
6
+ */
7
+
8
+ class Woo_Sale_Products extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'woo_sale_products',
13
+ 'description' => __( 'Woo On Sale Products - designed for use with the Elementor Page Builder plugin', 'elementor-addon-widgets'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('woo-sale-products', __('Woo On Sale Products', 'elementor-addon-widgets'), $widget_ops);
18
+ $this->alt_option_name = 'woo_sale_products';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'woo_sale_products', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ if ( '' == $title )
54
+ $title = __( 'On Sale', 'elementor-addon-widgets' );
55
+
56
+ $limit = ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 4;
57
+ if ( '' == $limit )
58
+ $limit = 4;
59
+ $columns = ( ! empty( $instance['columns'] ) ) ? absint( $instance['columns'] ) : 4;
60
+
61
+ if ( '' == $columns )
62
+ $columns = 4;
63
+
64
+ $args = apply_filters( 'elementor-addon-widgets_product_categories_args', array(
65
+ 'limit' => $limit,
66
+ 'columns' => $columns,
67
+ 'title' => $title,
68
+ ) );
69
+
70
+ echo $args['before_widget'];
71
+ //echo '<div class="woo-sale-products">';
72
+ echo '<section class="eaw-product-section woo-sale-products">';
73
+
74
+ do_action( 'storepage_homepage_before_on_sale_products' );
75
+
76
+ echo '<h2 class="section-title">' . wp_kses_post( $args['title'] ) . '</h2>';
77
+
78
+ do_action( 'storepage_homepage_after_on_sale_products_title' );
79
+
80
+ echo eaw_do_shortcode( 'sale_products', array(
81
+ 'per_page' => intval( $args['limit'] ),
82
+ 'columns' => intval( $args['columns'] ),
83
+ ) );
84
+
85
+ do_action( 'storepage_homepage_after_on_sale_products' );
86
+
87
+ echo '</section>';
88
+ //echo '</div>';
89
+
90
+ echo $args['after_widget'];
91
+
92
+ if ( ! $this->is_preview() ) {
93
+ $cache[ $args['widget_id'] ] = ob_get_flush();
94
+ wp_cache_set( 'woo_sale_products', $cache, 'widget' );
95
+ } else {
96
+ ob_end_flush();
97
+ }
98
+ }
99
+
100
+ public function update( $new_instance, $old_instance ) {
101
+ $instance = $old_instance;
102
+ $instance['title'] = strip_tags($new_instance['title']);
103
+ $instance['limit'] = (int) $new_instance['limit'];
104
+ $instance['columns'] = (int) ( $new_instance['columns'] );
105
+ $this->flush_widget_cache();
106
+
107
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
108
+ if ( isset($alloptions['woo_sale_products']) )
109
+ delete_option('woo_sale_products');
110
+
111
+ return $instance;
112
+ }
113
+
114
+ /**
115
+ * @access public
116
+ */
117
+ public function flush_widget_cache() {
118
+ wp_cache_delete('woo_sale_products', 'widget');
119
+ }
120
+
121
+ /**
122
+ * @param array $instance
123
+ */
124
+ public function form( $instance ) {
125
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
126
+ $limit = isset( $instance['limit'] ) ? absint( $instance['limit'] ) : 4;
127
+ $columns = isset( $instance['columns '] ) ? absint( $instance['columns '] ) : 4;
128
+ ?>
129
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'elementor-addon-widgets' ); ?></label>
130
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
131
+
132
+ <p><label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Number of products to show:', 'elementor-addon-widgets' ); ?></label>
133
+ <input id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="text" value="<?php echo $limit; ?>" size="3" /></p>
134
+
135
+ <p><label for="<?php echo $this->get_field_id( 'columns' ); ?>"><?php _e( 'Number of Columns:', 'elementor-addon-widgets' ); ?></label>
136
+ <input id="<?php echo $this->get_field_id( 'columns' ); ?>" name="<?php echo $this->get_field_name( 'columns' ); ?>" type="text" value="<?php echo $columns; ?>" size="3" /></p>
137
+
138
+
139
+ <?php
140
+ }
141
+ }
widgets/wp/eaw-posts-widget-plus.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent posts with featured image
4
+ *
5
+ * @package Elementor Addon Widgets
6
+ */
7
+
8
+ class EAW_Recent_Posts_Plus extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'widget_recent_posts_plus',
13
+ 'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', 'eaw'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('eaw-recent-posts-plus', __('EAW: Elementor Posts By Category', 'eaw'), $widget_ops);
18
+ $this->alt_option_name = 'widget_recent_entries_plus';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'widget_recent_posts_plus', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
54
+ if ( ! $number )
55
+ $number = 3;
56
+
57
+ $category = isset( $instance['category'] ) ? $instance['category'] : '';
58
+
59
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
60
+ $excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
61
+
62
+ if ( '' == $excerptcount || '0' == $excerptcount )
63
+ $excerptcount = 20;
64
+
65
+ $eawp = new WP_Query( apply_filters( 'eaw_widget_posts_plus_args', array(
66
+ 'posts_per_page' => $number,
67
+ 'cat' => $category,
68
+ 'no_found_rows' => true,
69
+ 'post_status' => 'publish',
70
+ 'ignore_sticky_posts' => true
71
+ ) ) );
72
+
73
+ if ($eawp->have_posts()) {
74
+
75
+ echo $args['before_widget'];
76
+ if ( $title ) {
77
+ echo $args['before_title'] . $title . $args['after_title'];
78
+ }
79
+ while ( $eawp->have_posts() ) : $eawp->the_post(); ?>
80
+ <div class="eaw-recent-posts">
81
+ <?php
82
+ if ( has_post_thumbnail() ) {
83
+ the_post_thumbnail('medium');
84
+ } ?>
85
+ <div class="eaw-content">
86
+ <h3><a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a></h3>
87
+ <p><?php if ( $show_excerpt ) {
88
+ echo wp_trim_words( get_the_excerpt(), $excerptcount, ' &hellip;' );
89
+ } ?></p>
90
+ </div>
91
+ </div>
92
+ <?php endwhile;
93
+
94
+ echo $args['after_widget'];
95
+
96
+ wp_reset_postdata();
97
+
98
+ }
99
+
100
+ if ( ! $this->is_preview() ) {
101
+ $cache[ $args['widget_id'] ] = ob_get_flush();
102
+ wp_cache_set( 'widget_recent_posts_plus', $cache, 'widget' );
103
+ } else {
104
+ ob_end_flush();
105
+ }
106
+ }
107
+
108
+ public function update( $new_instance, $old_instance ) {
109
+ $instance = $old_instance;
110
+ $instance['title'] = strip_tags($new_instance['title']);
111
+ $instance['number'] = (int) $new_instance['number'];
112
+ $instance['category'] = wp_strip_all_tags( $new_instance['category'] );
113
+ $instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
114
+ $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false;
115
+ $this->flush_widget_cache();
116
+
117
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
118
+ if ( isset($alloptions['widget_recent_entries_plus']) )
119
+ delete_option('widget_recent_entries_plus');
120
+
121
+ return $instance;
122
+ }
123
+
124
+ /**
125
+ * @access public
126
+ */
127
+ public function flush_widget_cache() {
128
+ wp_cache_delete('widget_recent_posts_plus', 'widget');
129
+ }
130
+
131
+ /**
132
+ * @param array $instance
133
+ */
134
+ public function form( $instance ) {
135
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
136
+ $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 3;
137
+ $excerptcount = isset( $instance['excerptcount '] ) ? absint( $instance['excerptcount '] ) : 20;
138
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
139
+ $category = isset( $instance['category'] ) ? $instance['category'] : '';
140
+ ?>
141
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'eaw' ); ?></label>
142
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
143
+
144
+ <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'eaw' ); ?></label>
145
+ <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
146
+
147
+ <p>
148
+ <label for="rpjc_widget_cat_recent_posts_category"><?php _e( 'Category' ); ?>:</label>
149
+
150
+ <?php
151
+
152
+ wp_dropdown_categories( array(
153
+
154
+ 'orderby' => 'title',
155
+ 'hide_empty' => false,
156
+ 'name' => $this->get_field_name( 'category' ),
157
+ 'id' => 'rpjc_widget_cat_recent_posts_category',
158
+ 'class' => 'widefat',
159
+ 'selected' => $category
160
+
161
+ ) );
162
+
163
+ ?>
164
+
165
+ </p>
166
+
167
+ <p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
168
+ <label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', 'eaw' ); ?></label></p>
169
+
170
+ <p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', 'eaw' ); ?></label>
171
+ <input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
172
+ <?php
173
+ }
174
+ }
widgets/wp/eaw-posts-widget.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Recent posts with featured image
4
+ *
5
+ * @package Elementor Addon Widgets
6
+ */
7
+
8
+ class EAW_Recent_Posts extends WP_Widget {
9
+
10
+ public function __construct() {
11
+ $widget_ops = array(
12
+ 'classname' => 'widget_recent_posts',
13
+ 'description' => __( 'Recent posts with featured image - ideal for use with Elementor Page Builder plugin', 'eaw'),
14
+ 'customize_selective_refresh' => true,
15
+ );
16
+
17
+ parent::__construct('eaw-recent-posts', __('EAW: Elementor Recent Posts', 'eaw'), $widget_ops);
18
+ $this->alt_option_name = 'widget_recent_entries';
19
+
20
+ add_action( 'save_post', array($this, 'flush_widget_cache') );
21
+ add_action( 'deleted_post', array($this, 'flush_widget_cache') );
22
+ add_action( 'switch_theme', array($this, 'flush_widget_cache') );
23
+ }
24
+
25
+ /**
26
+ * @param array $args
27
+ * @param array $instance
28
+ */
29
+ public function widget( $args, $instance ) {
30
+ $cache = array();
31
+ if ( ! $this->is_preview() ) {
32
+ $cache = wp_cache_get( 'widget_recent_posts', 'widget' );
33
+ }
34
+
35
+ if ( ! is_array( $cache ) ) {
36
+ $cache = array();
37
+ }
38
+
39
+ if ( ! isset( $args['widget_id'] ) ) {
40
+ $args['widget_id'] = $this->id;
41
+ }
42
+
43
+ if ( isset( $cache[ $args['widget_id'] ] ) ) {
44
+ echo $cache[ $args['widget_id'] ];
45
+ return;
46
+ }
47
+
48
+ ob_start();
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : '';
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 3;
54
+ if ( ! $number )
55
+ $number = 3;
56
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : false;
57
+ $excerptcount = ( ! empty( $instance['excerptcount'] ) ) ? absint( $instance['excerptcount'] ) : 20;
58
+
59
+ if ( '' == $excerptcount || '0' == $excerptcount )
60
+ $excerptcount = 20;
61
+
62
+ $eawp = new WP_Query( apply_filters( 'eaw_widget_posts_args', array(
63
+ 'posts_per_page' => $number,
64
+ 'no_found_rows' => true,
65
+ 'post_status' => 'publish',
66
+ 'ignore_sticky_posts' => true
67
+ ) ) );
68
+
69
+ if ($eawp->have_posts()) {
70
+
71
+ echo $args['before_widget'];
72
+ if ( $title ) {
73
+ echo $args['before_title'] . $title . $args['after_title'];
74
+ }
75
+ while ( $eawp->have_posts() ) : $eawp->the_post(); ?>
76
+ <div class="eaw-recent-posts">
77
+ <?php
78
+ if ( has_post_thumbnail() ) {
79
+ the_post_thumbnail('medium');
80
+ } ?>
81
+ <div class="eaw-content">
82
+ <h3><a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a></h3>
83
+ <p><?php if ( $show_excerpt ) {
84
+ echo wp_trim_words( get_the_excerpt(), $excerptcount, ' &hellip;' );
85
+ } ?></p>
86
+ </div>
87
+ </div>
88
+ <?php endwhile;
89
+
90
+ echo $args['after_widget'];
91
+
92
+ wp_reset_postdata();
93
+
94
+ }
95
+
96
+ if ( ! $this->is_preview() ) {
97
+ $cache[ $args['widget_id'] ] = ob_get_flush();
98
+ wp_cache_set( 'widget_recent_posts', $cache, 'widget' );
99
+ } else {
100
+ ob_end_flush();
101
+ }
102
+ }
103
+
104
+ public function update( $new_instance, $old_instance ) {
105
+ $instance = $old_instance;
106
+ $instance['title'] = strip_tags($new_instance['title']);
107
+ $instance['number'] = (int) $new_instance['number'];
108
+ $instance['excerptcount'] = (int) ( $new_instance['excerptcount'] );
109
+ $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false;
110
+ $this->flush_widget_cache();
111
+
112
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
113
+ if ( isset($alloptions['widget_recent_entries']) )
114
+ delete_option('widget_recent_entries');
115
+
116
+ return $instance;
117
+ }
118
+
119
+ /**
120
+ * @access public
121
+ */
122
+ public function flush_widget_cache() {
123
+ wp_cache_delete('widget_recent_posts', 'widget');
124
+ }
125
+
126
+ /**
127
+ * @param array $instance
128
+ */
129
+ public function form( $instance ) {
130
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
131
+ $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 3;
132
+ $excerptcount = isset( $instance['excerptcount '] ) ? absint( $instance['excerptcount '] ) : 20;
133
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? (bool) $instance['show_excerpt'] : false;
134
+ ?>
135
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'eaw' ); ?></label>
136
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
137
+
138
+ <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'eaw' ); ?></label>
139
+ <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
140
+
141
+ <p><input class="checkbox" type="checkbox" <?php checked( $show_excerpt ); ?> id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
142
+ <label for="<?php echo $this->get_field_id( 'show_dexcerpt' ); ?>"><?php _e( 'Display post excerpt?', 'eaw' ); ?></label></p>
143
+
144
+ <p><label for="<?php echo $this->get_field_id( 'excerptcount' ); ?>"><?php _e( 'Excerpt length to show:', 'eaw' ); ?></label>
145
+ <input id="<?php echo $this->get_field_id( 'excerptcount' ); ?>" name="<?php echo $this->get_field_name( 'excerptcount' ); ?>" type="text" value="<?php echo $excerptcount; ?>" size="3" /></p>
146
+ <?php
147
+ }
148
+ }