Carousel, Slider, Gallery by WP Carousel – Image Carousel & Photo Gallery, Post Carousel & Post Grid, Product Carousel & Product Grid for WooCommerce - Version 2.1.14

Version Description

Nov 25, 2020 = * Tested: WooCommerce 4.7.1 version.

Download this release

Release Info

Developer shapedplugin
Plugin Icon 128x128 Carousel, Slider, Gallery by WP Carousel – Image Carousel & Photo Gallery, Post Carousel & Post Grid, Product Carousel & Product Grid for WooCommerce
Version 2.1.14
Comparing to
See all releases

Code changes from version 2.1.13 to 2.1.14

admin/views/notices/class-wp-carousel-free-promotion.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Promotion class
4
+ *
5
+ * For displaying limited time promotion in admin panel
6
+ *
7
+ * @since 2.1.14
8
+ *
9
+ * @package WP_Carousel_Free
10
+ */
11
+ class WP_Carousel_Free_Promotion {
12
+
13
+ /**
14
+ * Option key for limited time promo
15
+ *
16
+ * @var string
17
+ */
18
+ public $promo_option_key = '_wp_carousel_limited_time_promo';
19
+
20
+ /**
21
+ * WP_Carousel_Free_Promotion constructor
22
+ */
23
+ public function __construct() {
24
+ add_action( 'admin_notices', [ $this, 'show_promotions' ] );
25
+ add_action( 'wp_ajax_sp_wpcf_dismiss_promotional_notice', [ $this, 'dismiss_limited_time_promo' ] );
26
+ }
27
+
28
+ /**
29
+ * Shows promotions
30
+ */
31
+ public function show_promotions() {
32
+ if ( ! current_user_can( 'manage_options' ) ) {
33
+ return;
34
+ }
35
+
36
+ $notices = [
37
+ [
38
+ 'key' => 'black-friday-2020',
39
+ 'start_date' => '2020-11-24 14:00:00 EST',
40
+ 'end_date' => '2020-11-30 23:59:00 EST',
41
+ 'title' => 'Enjoy Black Friday Deals <strong>30% OFF</strong> on <strong>WordPress Carousel Pro!</strong>',
42
+ 'content' => ' Discount Code: <strong>BF2020</strong>',
43
+ 'link' => 'https://shapedplugin.com/plugin/wordpress-carousel-pro/?utm_source=wordpress-wpcf&utm_medium=get-it-now&utm_campaign=BlackFriday2020',
44
+ ],
45
+ ];
46
+
47
+ if ( empty( $notices ) ) {
48
+ return;
49
+ }
50
+
51
+ $current_time_est = $this->get_current_time_est();
52
+ $notice = [];
53
+
54
+ $already_displayed_promo = get_option( $this->promo_option_key, [] );
55
+
56
+ foreach ( $notices as $ntc ) {
57
+ if ( in_array( $ntc['key'], $already_displayed_promo, true ) ) {
58
+ continue;
59
+ }
60
+
61
+ if ( strtotime( $ntc['start_date'] ) < strtotime( $current_time_est ) && strtotime( $current_time_est ) < strtotime( $ntc['end_date'] ) ) {
62
+ $notice = $ntc;
63
+ }
64
+ }
65
+
66
+ if ( empty( $notice ) ) {
67
+ return;
68
+ }
69
+
70
+ ?>
71
+ <div class="notice sp-wpcf-promotional-notice">
72
+ <div class="content">
73
+ <h2><?php echo $notice['title'] . $notice['content']; ?></h2><a href="<?php echo esc_url( $notice['link'] ); ?>" class="button button-primary" target="_blank"><?php echo esc_html__( 'Get it Now', 'wp-carousel-free' ); ?></a>
74
+ </div>
75
+ <span class="promotional-close-icon notice-dismiss" data-key="<?php echo esc_attr( $notice['key'] ); ?>"></span>
76
+ <div class="clear"></div>
77
+ </div>
78
+
79
+ <style>
80
+ .sp-wpcf-promotional-notice {
81
+ padding: 14px 18px;
82
+ box-sizing: border-box;
83
+ position: relative;
84
+ }
85
+ .sp-wpcf-promotional-notice .content {
86
+ float: left;
87
+ width: 75%;
88
+ }
89
+ .sp-wpcf-promotional-notice .content h2 {
90
+ margin: 3px 0px 5px;
91
+ font-size: 20px;
92
+ font-weight: 400;
93
+ color: #444;
94
+ line-height: 25px;
95
+ float: left;
96
+ margin-right: 15px;
97
+ }
98
+ .sp-wpcf-promotional-notice .content a {
99
+ border: none;
100
+ box-shadow: none;
101
+ height: 31px;
102
+ line-height: 30px;
103
+ border-radius: 3px;
104
+ background: #18afb9;
105
+ text-shadow: none;
106
+ font-weight: 600;
107
+ width: 95px;
108
+ text-align: center;
109
+ float: left;
110
+ }
111
+ .sp-wpcf-promotional-notice .content a:hover {
112
+ background: #089fa9;
113
+ }
114
+ </style>
115
+
116
+ <script type='text/javascript'>
117
+ jQuery( document ).ready( function ( $ ) {
118
+ $( 'body' ).on( 'click', '.sp-wpcf-promotional-notice span.promotional-close-icon', function ( e ) {
119
+ e.preventDefault();
120
+
121
+ var self = $( this ),
122
+ key = self.data( 'key' );
123
+
124
+ wp.ajax.send( 'sp_wpcf_dismiss_promotional_notice', {
125
+ data: {
126
+ sp_wpcf_promotion_dismissed: true,
127
+ key: key,
128
+ nonce: '<?php echo esc_attr( wp_create_nonce( 'wp_carousel_admin' ) ); ?>'
129
+ },
130
+ complete: function ( resp ) {
131
+ self.closest( '.sp-wpcf-promotional-notice' ).fadeOut( 200 );
132
+ }
133
+ } );
134
+ } );
135
+ } );
136
+ </script>
137
+
138
+ <?php
139
+ }
140
+
141
+ /**
142
+ * Dismisses limited time promo notice
143
+ */
144
+ public function dismiss_limited_time_promo() {
145
+ $post_data = wp_unslash( $_POST );
146
+
147
+ if ( ! current_user_can( 'manage_woocommerce' ) ) {
148
+ wp_send_json_error( __( 'You have no permission to do that', 'wp-carousel-free' ) );
149
+ }
150
+
151
+ if ( ! wp_verify_nonce( $post_data['nonce'], 'wp_carousel_admin' ) ) {
152
+ wp_send_json_error( __( 'Invalid nonce', 'wp-carousel-free' ) );
153
+ }
154
+
155
+ if ( isset( $post_data['sp_wpcf_promotion_dismissed'] ) && $post_data['sp_wpcf_promotion_dismissed'] ) {
156
+ $already_displayed_promo = get_option( $this->promo_option_key, [] );
157
+ $already_displayed_promo[] = $post_data['key'];
158
+
159
+ update_option( $this->promo_option_key, $already_displayed_promo );
160
+ wp_send_json_success();
161
+ }
162
+ }
163
+
164
+
165
+ /**
166
+ * Gets current time and converts to EST timezone.
167
+ * @return string
168
+ */
169
+ private function get_current_time_est() {
170
+ $dt = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
171
+ $dt->setTimezone( new \DateTimeZone( 'EST' ) );
172
+
173
+ return $dt->format( 'Y-m-d H:i:s T' );
174
+ }
175
+
176
+ }
177
+ new WP_Carousel_Free_Promotion();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: shapedplugin
3
  Donate link: http://shapedplugin.com/donate
4
  Tags: wordpress carousel, best carousel plugin, image carousel, image slider, post carousel, custom post carousel, custom taxonomy carousel, woocommerce product carousel, content carousel, video carousel, video slider, video lightbox, youtube carousel, video gallery, carousel, slider, responsive slider, responsive carousel, carousel slider, ticker carousel, center mode carousel, slide anything, image gallery, image lightbox, wordpress image gallery, photo gallery, gallery slider, wordpress gallery plugin, gallery, post slider, vimeo slider, self hosted video carousel, content slider, wordpress slider, featured content slider, html slider, horizontal carousel slider, posts content slider, product carousel, woocommerce slider, woocommerce product slider
5
  Requires at least: 4.3
6
- Tested up to: 5.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -326,6 +326,9 @@ Thank you!
326
 
327
  == Changelog ==
328
 
 
 
 
329
  = 2.1.13 – Oct 15, 2020 =
330
  * Fix: Section title issue.
331
  * Fix: Dynamic CSS issue.
3
  Donate link: http://shapedplugin.com/donate
4
  Tags: wordpress carousel, best carousel plugin, image carousel, image slider, post carousel, custom post carousel, custom taxonomy carousel, woocommerce product carousel, content carousel, video carousel, video slider, video lightbox, youtube carousel, video gallery, carousel, slider, responsive slider, responsive carousel, carousel slider, ticker carousel, center mode carousel, slide anything, image gallery, image lightbox, wordpress image gallery, photo gallery, gallery slider, wordpress gallery plugin, gallery, post slider, vimeo slider, self hosted video carousel, content slider, wordpress slider, featured content slider, html slider, horizontal carousel slider, posts content slider, product carousel, woocommerce slider, woocommerce product slider
5
  Requires at least: 4.3
6
+ Tested up to: 5.5.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
326
 
327
  == Changelog ==
328
 
329
+ = 2.1.14 – Nov 25, 2020 =
330
+ * Tested: WooCommerce 4.7.1 version.
331
+
332
  = 2.1.13 – Oct 15, 2020 =
333
  * Fix: Section title issue.
334
  * Fix: Dynamic CSS issue.
wp-carousel-free.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: WordPress Carousel
10
  * Plugin URI: https://shapedplugin.com/plugin/wordpress-carousel-pro/
11
  * Description: The Most Powerful and User-friendly WordPress Carousel Plugin. Create beautiful carousels in minutes using Images, Posts, WooCommerce Products etc.
12
- * Version: 2.1.13
13
  * Author: ShapedPlugin
14
  * Author URI: https://shapedplugin.com/
15
  * License: GPL-2.0+
@@ -17,7 +17,7 @@
17
  * Text Domain: wp-carousel-free
18
  * Domain Path: /languages
19
  * WC requires at least: 3.0
20
- * WC tested up to: 4.6.0
21
  */
22
 
23
  // If this file is called directly, abort.
@@ -43,8 +43,7 @@ register_activation_hook(__FILE__, 'activate_wp_carousel_free');
43
  * @package WP_Carousel_Free
44
  * @author Shamim Mia <shamhagh@gmail.com>
45
  */
46
- class SP_WP_Carousel_Free
47
- {
48
 
49
 
50
  /**
@@ -134,7 +133,7 @@ class SP_WP_Carousel_Free
134
  public function setup()
135
  {
136
  $this->plugin_name = 'wp-carousel-free';
137
- $this->version = '2.1.13';
138
  $this->define_constants();
139
  $this->includes();
140
  $this->load_dependencies();
@@ -186,6 +185,7 @@ class SP_WP_Carousel_Free
186
  include_once WPCAROUSELF_INCLUDES . '/class-wp-carousel-free-post-types.php';
187
  include_once WPCAROUSELF_PATH . '/admin/views/wpcfree-metabox/classes/setup.class.php';
188
  include_once WPCAROUSELF_PATH . '/admin/views/notices/review.php';
 
189
  include_once WPCAROUSELF_PATH . '/admin/views/metabox-config.php';
190
  include_once WPCAROUSELF_PATH . '/admin/views/option-config.php';
191
  include_once WPCAROUSELF_INCLUDES . '/class-wp-carousel-free-shortcode.php';
9
  * Plugin Name: WordPress Carousel
10
  * Plugin URI: https://shapedplugin.com/plugin/wordpress-carousel-pro/
11
  * Description: The Most Powerful and User-friendly WordPress Carousel Plugin. Create beautiful carousels in minutes using Images, Posts, WooCommerce Products etc.
12
+ * Version: 2.1.14
13
  * Author: ShapedPlugin
14
  * Author URI: https://shapedplugin.com/
15
  * License: GPL-2.0+
17
  * Text Domain: wp-carousel-free
18
  * Domain Path: /languages
19
  * WC requires at least: 3.0
20
+ * WC tested up to: 4.7.1
21
  */
22
 
23
  // If this file is called directly, abort.
43
  * @package WP_Carousel_Free
44
  * @author Shamim Mia <shamhagh@gmail.com>
45
  */
46
+ class SP_WP_Carousel_Free {
 
47
 
48
 
49
  /**
133
  public function setup()
134
  {
135
  $this->plugin_name = 'wp-carousel-free';
136
+ $this->version = '2.1.14';
137
  $this->define_constants();
138
  $this->includes();
139
  $this->load_dependencies();
185
  include_once WPCAROUSELF_INCLUDES . '/class-wp-carousel-free-post-types.php';
186
  include_once WPCAROUSELF_PATH . '/admin/views/wpcfree-metabox/classes/setup.class.php';
187
  include_once WPCAROUSELF_PATH . '/admin/views/notices/review.php';
188
+ include_once WPCAROUSELF_PATH . '/admin/views/notices/class-wp-carousel-free-promotion.php';
189
  include_once WPCAROUSELF_PATH . '/admin/views/metabox-config.php';
190
  include_once WPCAROUSELF_PATH . '/admin/views/option-config.php';
191
  include_once WPCAROUSELF_INCLUDES . '/class-wp-carousel-free-shortcode.php';