Real Testimonials - Version 2.5.10

Version Description

  • Oct 14, 2022 =
  • Improved: Load dynamic style according to shortcode on the page.
Download this release

Release Info

Developer rubel_miah
Plugin Icon 128x128 Real Testimonials
Version 2.5.10
Comparing to
See all releases

Code changes from version 2.5.9 to 2.5.10

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shapedplugin.com/donate
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews, real testimonials
5
  Requires at least: 4.0
6
  Tested up to: 6.0.2
7
- Stable tag: 2.5.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -318,6 +318,9 @@ Thank you!
318
 
319
  == Changelog ==
320
 
 
 
 
321
  = 2.5.9 - Oct 03, 2022 =
322
  * New: The Free mode of the Slider layout.
323
  * Fix: The AutoPlay doesn't work on mobile.
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews, real testimonials
5
  Requires at least: 4.0
6
  Tested up to: 6.0.2
7
+ Stable tag: 2.5.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
318
 
319
  == Changelog ==
320
 
321
+ = 2.5.10 - Oct 14, 2022 =
322
+ * Improved: Load dynamic style according to shortcode on the page.
323
+
324
  = 2.5.9 - Oct 03, 2022 =
325
  * New: The Free mode of the Slider layout.
326
  * Fix: The AutoPlay doesn't work on mobile.
src/Admin/GutenbergBlock/Sp_Testimonial_Free_Gutenberg_Block_Init.php CHANGED
@@ -61,13 +61,14 @@ if ( ! class_exists( 'Sp_Testimonial_Free_Gutenberg_Block_Init' ) ) {
61
  $custom_css = isset( $setting_options['custom_css'] ) ? $setting_options['custom_css'] : '';
62
  // CSS Files.
63
  if ( $dequeue_swiper_css ) {
64
- wp_enqueue_style( 'tfree-swiper', SP_TFREE_URL . 'Frontend/assets/css/swiper.min.css', array(), SP_TFREE_VERSION );
65
  }
66
  if ( $dequeue_fa_css ) {
67
- wp_enqueue_style( 'tfree-font-awesome', SP_TFREE_URL . 'Frontend/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
68
  }
69
- wp_enqueue_style( 'tfree-deprecated-style', SP_TFREE_URL . 'Frontend/assets/css/deprecated-style.min.css', array(), SP_TFREE_VERSION );
70
- wp_enqueue_style( 'tfree-style', SP_TFREE_URL . 'Frontend/assets/css/style.min.css', array(), SP_TFREE_VERSION );
 
71
 
72
  }
73
 
@@ -107,11 +108,6 @@ if ( ! class_exists( 'Sp_Testimonial_Free_Gutenberg_Block_Init' ) ) {
107
  /**
108
  * Register block editor js file enqueue for backend.
109
  */
110
- $setting_options = get_option( 'sp_testimonial_pro_options' );
111
- $dequeue_swiper_js = isset( $setting_options['tf_dequeue_slick_js'] ) ? $setting_options['tf_dequeue_slick_js'] : true;
112
- if ( $dequeue_swiper_js ) {
113
- wp_register_script( 'tfree-swiper-min-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
114
- }
115
  wp_register_script( 'tfree-swiper-active', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
116
 
117
  wp_localize_script(
@@ -156,7 +152,7 @@ if ( ! class_exists( 'Sp_Testimonial_Free_Gutenberg_Block_Init' ) ) {
156
  ),
157
  // Enqueue blocks.editor.build.js in the editor only.
158
  'editor_script' => array(
159
- 'tfree-swiper-min-js',
160
  'tfree-swiper-active',
161
  ),
162
  // Enqueue blocks.editor.build.css in the editor only.
61
  $custom_css = isset( $setting_options['custom_css'] ) ? $setting_options['custom_css'] : '';
62
  // CSS Files.
63
  if ( $dequeue_swiper_css ) {
64
+ wp_enqueue_style( 'sp-testimonial-swiper' );
65
  }
66
  if ( $dequeue_fa_css ) {
67
+ wp_enqueue_style( 'tfree-font-awesome' );
68
  }
69
+
70
+ wp_enqueue_style( 'tfree-deprecated-style' );
71
+ wp_enqueue_style( 'tfree-style' );
72
 
73
  }
74
 
108
  /**
109
  * Register block editor js file enqueue for backend.
110
  */
 
 
 
 
 
111
  wp_register_script( 'tfree-swiper-active', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
112
 
113
  wp_localize_script(
152
  ),
153
  // Enqueue blocks.editor.build.js in the editor only.
154
  'editor_script' => array(
155
+ 'sp-testimonial-swiper-js',
156
  'tfree-swiper-active',
157
  ),
158
  // Enqueue blocks.editor.build.css in the editor only.
src/Admin/Sp_Testimonial_Free_Element_Shortcode_Block.php CHANGED
@@ -11,6 +11,9 @@
11
 
12
  namespace ShapedPlugin\TestimonialFree\Admin;
13
 
 
 
 
14
  /**
15
  * Elementor shortcode block.
16
  */
@@ -57,7 +60,8 @@ class Sp_Testimonial_Free_Element_Shortcode_Block {
57
  */
58
  public function __construct() {
59
  $this->on_plugins_loaded();
60
- add_action( 'wp_enqueue_scripts', array( $this, 'sprtp_block_enqueue_scripts' ) );
 
61
  add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'sprtp_element_block_icon' ) );
62
  }
63
 
@@ -76,16 +80,51 @@ class Sp_Testimonial_Free_Element_Shortcode_Block {
76
  *
77
  * @since 2.5.2
78
  */
79
- public function sprtp_block_enqueue_scripts() {
80
- // JS Files.
81
- wp_register_script( 'sp-testimonial-swiper-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
82
- wp_register_script( 'sp-testimonial-scripts', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.js', array( 'jquery' ), SP_TFREE_VERSION, true );
83
- $setting_options = get_option( 'sp_testimonial_pro_options' );
84
- $dequeue_swiper_js = isset( $setting_options['tf_dequeue_slick_js'] ) ? $setting_options['tf_dequeue_slick_js'] : true;
85
- if ( $dequeue_swiper_js && \Elementor\Plugin::$instance->preview->is_preview_mode()) {
86
- wp_enqueue_script( 'sp-testimonial-swiper-js' );
87
- wp_enqueue_script( 'sp-testimonial-scripts' );
 
 
 
 
 
 
 
 
 
 
 
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
 
91
  /**
11
 
12
  namespace ShapedPlugin\TestimonialFree\Admin;
13
 
14
+ use ShapedPlugin\TestimonialFree\Frontend\Helper;
15
+
16
+
17
  /**
18
  * Elementor shortcode block.
19
  */
60
  */
61
  public function __construct() {
62
  $this->on_plugins_loaded();
63
+ add_action( 'elementor/preview/enqueue_styles', array( $this, 'tfree_block_enqueue_style' ) );
64
+ add_action( 'elementor/preview/enqueue_scripts', array( $this, 'tfree_block_enqueue_scripts' ) );
65
  add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'sprtp_element_block_icon' ) );
66
  }
67
 
80
  *
81
  * @since 2.5.2
82
  */
83
+ public function tfree_block_enqueue_style() {
84
+ wp_enqueue_style( 'sp-testimonial-swiper' );
85
+ wp_enqueue_style( 'tfree-font-awesome' );
86
+
87
+ wp_enqueue_style( 'tfree-deprecated-style' );
88
+ wp_enqueue_style( 'tfree-style' );
89
+ $tfree_posts = new \WP_Query(
90
+ array(
91
+ 'post_type' => 'spt_shortcodes',
92
+ 'post_status' => 'publish',
93
+ 'posts_per_page' => 1000,
94
+ 'fields' => 'ids',
95
+ )
96
+ );
97
+ $post_ids = $tfree_posts->posts;
98
+ $outline = '';
99
+ foreach ( $post_ids as $post_id ) {
100
+ $setting_options = get_option( 'sp_testimonial_pro_options' );
101
+ $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
102
+ include SP_TFREE_PATH . 'Frontend/Views/partials/dynamic-style.php';
103
  }
104
+ if ( ! empty( $custom_css ) ) {
105
+ $outline .= $custom_css;
106
+ }
107
+ $css = Helper::minify_output( $outline );
108
+ wp_add_inline_style( 'tfree-style', $css );
109
+ }
110
+
111
+ /**
112
+ * Enqueue the JavaScript for the elementor block area.
113
+ *
114
+ * @since 2.2.5
115
+ */
116
+ public function tfree_block_enqueue_scripts() {
117
+ /**
118
+ * An instance of this class should be passed to the run() function
119
+ * defined in tfree_Loader as all of the hooks are defined
120
+ * in that particular class.
121
+ *
122
+ * The Team_Pro_Loader will then create the relationship
123
+ * between the defined hooks and the functions defined in this
124
+ * class.
125
+ */
126
+ wp_enqueue_script( 'sp-testimonial-swiper-js' );
127
+ wp_enqueue_script( 'sp-testimonial-scripts' );
128
  }
129
 
130
  /**
src/Admin/Sp_Testimonial_Free_Element_Shortcode_Block_Deprecated.php CHANGED
@@ -11,6 +11,9 @@
11
 
12
  namespace ShapedPlugin\TestimonialFree\Admin;
13
 
 
 
 
14
  /**
15
  * Elementor shortcode block.
16
  */
@@ -57,7 +60,8 @@ class Sp_Testimonial_Free_Element_Shortcode_Block_Deprecated {
57
  */
58
  public function __construct() {
59
  $this->on_plugins_loaded();
60
- add_action( 'wp_enqueue_scripts', array( $this, 'sprtp_block_enqueue_scripts' ) );
 
61
  add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'sprtp_element_block_icon' ) );
62
  }
63
 
@@ -76,15 +80,51 @@ class Sp_Testimonial_Free_Element_Shortcode_Block_Deprecated {
76
  *
77
  * @since 2.5.2
78
  */
79
- public function sprtp_block_enqueue_scripts() {
80
- wp_register_script( 'sp-testimonial-swiper-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
81
- wp_register_script( 'sp-testimonial-scripts', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.js', array( 'jquery' ), SP_TFREE_VERSION, true );
82
- $setting_options = get_option( 'sp_testimonial_pro_options' );
83
- $dequeue_swiper_js = isset( $setting_options['tf_dequeue_slick_js'] ) ? $setting_options['tf_dequeue_slick_js'] : true;
84
- if ( $dequeue_swiper_js && \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
85
- wp_enqueue_script( 'sp-testimonial-swiper-js' );
86
- wp_enqueue_script( 'sp-testimonial-scripts' );
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  /**
11
 
12
  namespace ShapedPlugin\TestimonialFree\Admin;
13
 
14
+ use ShapedPlugin\TestimonialFree\Frontend\Helper;
15
+
16
+
17
  /**
18
  * Elementor shortcode block.
19
  */
60
  */
61
  public function __construct() {
62
  $this->on_plugins_loaded();
63
+ add_action( 'elementor/preview/enqueue_styles', array( $this, 'tfree_block_enqueue_style' ) );
64
+ add_action( 'elementor/preview/enqueue_scripts', array( $this, 'tfree_block_enqueue_scripts' ) );
65
  add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'sprtp_element_block_icon' ) );
66
  }
67
 
80
  *
81
  * @since 2.5.2
82
  */
83
+ public function tfree_block_enqueue_style() {
84
+ wp_enqueue_style( 'sp-testimonial-swiper' );
85
+ wp_enqueue_style( 'tfree-font-awesome' );
86
+
87
+ wp_enqueue_style( 'tfree-deprecated-style' );
88
+ wp_enqueue_style( 'tfree-style' );
89
+ $tfree_posts = new \WP_Query(
90
+ array(
91
+ 'post_type' => 'spt_shortcodes',
92
+ 'post_status' => 'publish',
93
+ 'posts_per_page' => 1000,
94
+ 'fields' => 'ids',
95
+ )
96
+ );
97
+ $post_ids = $tfree_posts->posts;
98
+ $outline = '';
99
+ foreach ( $post_ids as $post_id ) {
100
+ $setting_options = get_option( 'sp_testimonial_pro_options' );
101
+ $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
102
+ include SP_TFREE_PATH . 'Frontend/Views/partials/dynamic-style.php';
103
  }
104
+ if ( ! empty( $custom_css ) ) {
105
+ $outline .= $custom_css;
106
+ }
107
+ $css = Helper::minify_output( $outline );
108
+ wp_add_inline_style( 'tfree-style', $css );
109
+ }
110
+
111
+ /**
112
+ * Enqueue the JavaScript for the elementor block area.
113
+ *
114
+ * @since 2.2.5
115
+ */
116
+ public function tfree_block_enqueue_scripts() {
117
+ /**
118
+ * An instance of this class should be passed to the run() function
119
+ * defined in tfree_Loader as all of the hooks are defined
120
+ * in that particular class.
121
+ *
122
+ * The Team_Pro_Loader will then create the relationship
123
+ * between the defined hooks and the functions defined in this
124
+ * class.
125
+ */
126
+ wp_enqueue_script( 'sp-testimonial-swiper-js' );
127
+ wp_enqueue_script( 'sp-testimonial-scripts' );
128
  }
129
 
130
  /**
src/Admin/Views/Notices/Testimonial_Offer.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The admin offer notice.
4
+ *
5
+ * @since 2.5.10
6
+ * @version 2.5.10
7
+ *
8
+ * @package Testimonial
9
+ * @subpackage Testimonial/admin/views/notices
10
+ * @author ShapedPlugin<support@shapedplugin.com>
11
+ */
12
+
13
+ namespace ShapedPlugin\TestimonialFree\Admin\Views\Notices;
14
+
15
+ /**
16
+ * Admin offer notice class.
17
+ */
18
+ class Testimonial_Offer {
19
+
20
+ /**
21
+ * Constructor
22
+ *
23
+ * @since 2.5.10
24
+ */
25
+ public function __construct() {
26
+ add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
27
+ add_action( 'wp_ajax_sp-tfree-never-show-offer-notice', array( $this, 'dismiss_offer_notice' ) );
28
+ }
29
+
30
+ /**
31
+ * Display admin notice.
32
+ *
33
+ * @return void
34
+ */
35
+ public function display_admin_notice() {
36
+
37
+ // Show only to Admins.
38
+ if ( ! current_user_can( 'manage_options' ) ) {
39
+ return;
40
+ }
41
+
42
+ // Variable default value.
43
+ $offer = get_option( 'sp_testimonial_offer_notice_dismiss' );
44
+ $time = time();
45
+ $load = false;
46
+
47
+ if ( ! $offer ) {
48
+ $offer = array(
49
+ 'time' => $time,
50
+ 'dismissed' => false,
51
+ );
52
+ add_option( 'sp_testimonial_offer_notice_dismiss', $offer );
53
+ } else {
54
+ // Check if it has been dismissed or not.
55
+ if ( ( isset( $offer['dismissed'] ) && ! $offer['dismissed'] ) && ( isset( $offer['time'] ) ) ) {
56
+ $load = true;
57
+ }
58
+ }
59
+
60
+ // If we cannot load, return early.
61
+ if ( ! $load ) {
62
+ return;
63
+ }
64
+ ?>
65
+ <div id="sp-testimonial-offer-notice" class="sp-testimonial-offer-notice" style="margin: 20px 20px 0 0;display: inline-block;position:relative;">
66
+ <a href="#" class="offer-notice-dismissed" style="text-decoration: none;position: absolute;right: 0;top: 0;padding: 5px;color: #fff;"><span class="dashicons dashicons-no-alt"></span></a>
67
+ <a href="https://shapedplugin.com/real-testimonials/pricing/?utm_source=real_testimonials_free&utm_medium=get_special_offer_banner&utm_campaign=special_offer" target="_blank"><img src="<?php echo esc_url( SP_TFREE_URL . 'Admin/assets/images/special-offer.jpg' ); ?>" alt="Special Offer" style="width:100%;display: block;"></a>
68
+ </div>
69
+
70
+ <script type='text/javascript'>
71
+
72
+ jQuery(document).ready( function($) {
73
+ $(document).on('click', '#sp-testimonial-offer-notice.sp-testimonial-offer-notice .offer-notice-dismissed', function( event ) {
74
+ var notice_dismissed_value = "3";
75
+ event.preventDefault();
76
+
77
+ $.post( ajaxurl, {
78
+ action: 'sp-tfree-never-show-offer-notice',
79
+ notice_dismissed_data : notice_dismissed_value,
80
+ nonce: '<?php echo esc_attr( wp_create_nonce( 'sp_tfree_offer_notice' ) ); ?>'
81
+ });
82
+
83
+ $('#sp-testimonial-offer-notice.sp-testimonial-offer-notice').hide();
84
+ });
85
+ });
86
+
87
+ </script>
88
+ <?php
89
+ }
90
+
91
+ /**
92
+ * Dismiss offer notice
93
+ *
94
+ * @since 2.5.10
95
+ *
96
+ * @return void
97
+ **/
98
+ public function dismiss_offer_notice() {
99
+ $post_data = wp_unslash( $_POST );
100
+
101
+ if ( ! isset( $post_data['nonce'] ) || ! wp_verify_nonce( sanitize_key( $post_data['nonce'] ), 'sp_tfree_offer_notice' ) ) {
102
+ return;
103
+ }
104
+ // Variable default value.
105
+ $offer = get_option( 'sp_testimonial_offer_notice_dismiss' );
106
+ if ( ! $offer ) {
107
+ $offer = array();
108
+ }
109
+ switch ( isset( $post_data['notice_dismissed_data'] ) ? $post_data['notice_dismissed_data'] : '' ) {
110
+ case '3':
111
+ $offer['time'] = time();
112
+ $offer['dismissed'] = true;
113
+ break;
114
+ }
115
+ update_option( 'sp_testimonial_offer_notice_dismiss', $offer );
116
+ die;
117
+ }
118
+ }
src/Admin/assets/images/special-offer.jpg ADDED
Binary file
src/Frontend/Frontend.php CHANGED
@@ -47,10 +47,12 @@ class Frontend {
47
  * Initialize the class
48
  */
49
  public function __construct() {
50
-
51
  add_action( 'wp_enqueue_scripts', array( $this, 'front_scripts' ) );
52
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_front_scripts' ) );
53
  add_shortcode( 'sp_testimonial', array( $this, 'shortcode_render' ) );
 
 
54
  }
55
 
56
  /**
@@ -75,8 +77,57 @@ class Frontend {
75
  $setting_options = get_option( 'sp_testimonial_pro_options' );
76
  $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
77
  $main_section_title = get_the_title( $post_id );
78
-
 
 
79
  ob_start();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  Helper::sp_testimonial_html_show( $post_id, $setting_options, $shortcode_data, $main_section_title );
81
  return Helper::minify_output( ob_get_clean() );
82
  }
@@ -89,40 +140,40 @@ class Frontend {
89
  $dequeue_swiper_css = isset( $setting_options['tf_dequeue_slick_css'] ) ? $setting_options['tf_dequeue_slick_css'] : true;
90
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
91
  $custom_css = isset( $setting_options['custom_css'] ) ? $setting_options['custom_css'] : '';
92
- // CSS Files.
93
- if ( $dequeue_swiper_css ) {
94
- wp_enqueue_style( 'sp-testimonial-swiper', SP_TFREE_URL . 'Frontend/assets/css/swiper.min.css', array(), SP_TFREE_VERSION );
95
- }
96
- if ( $dequeue_fa_css ) {
97
- wp_enqueue_style( 'tfree-font-awesome', SP_TFREE_URL . 'Frontend/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
98
- }
99
- wp_enqueue_style( 'tfree-deprecated-style', SP_TFREE_URL . 'Frontend/assets/css/deprecated-style.min.css', array(), SP_TFREE_VERSION );
100
- wp_enqueue_style( 'tfree-style', SP_TFREE_URL . 'Frontend/assets/css/style.min.css', array(), SP_TFREE_VERSION );
101
 
102
- $sptp_posts = new \WP_Query(
103
- array(
104
- 'post_type' => 'spt_shortcodes',
105
- 'post_status' => 'publish',
106
- 'posts_per_page' => 1000,
107
- )
108
- );
109
- $post_ids = wp_list_pluck( $sptp_posts->posts, 'ID' );
110
- $outline = '';
111
- foreach ( $post_ids as $post_id ) {
112
- $setting_options = get_option( 'sp_testimonial_pro_options' );
113
- $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
114
- include SP_TFREE_PATH . 'Frontend/Views/partials/dynamic-style.php';
115
- }
116
- if ( ! empty( $custom_css ) ) {
117
- $outline .= $custom_css;
118
  }
 
 
119
 
120
- $css = Helper::minify_output( $outline );
121
- wp_add_inline_style( 'tfree-style', $css );
122
-
123
- // JS Files.
124
- wp_register_script( 'sp-testimonial-swiper-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
125
- wp_register_script( 'sp-testimonial-scripts', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.js', array( 'jquery' ), SP_TFREE_VERSION, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  }
128
  /**
@@ -136,17 +187,59 @@ class Frontend {
136
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
137
  // CSS Files.
138
  if ( $dequeue_swiper_css ) {
139
- wp_enqueue_style( 'admin-tfree-swiper', SP_TFREE_URL . 'Frontend/assets/css/swiper.min.css', array(), SP_TFREE_VERSION );
140
  }
141
  if ( $dequeue_fa_css ) {
142
- wp_enqueue_style( 'admin-tfree-font-awesome', SP_TFREE_URL . 'Frontend/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
143
  }
144
 
145
- wp_enqueue_style( 'admin-tfree-deprecated-style', SP_TFREE_URL . 'Frontend/assets/css/deprecated-style.min.css', array(), SP_TFREE_VERSION );
146
- wp_enqueue_style( 'admin-tfree-style', SP_TFREE_URL . 'Frontend/assets/css/style.min.css', array(), SP_TFREE_VERSION );
147
- wp_enqueue_script( 'tfree-swiper-min-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
148
  }
149
 
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
47
  * Initialize the class
48
  */
49
  public function __construct() {
50
+ add_action( 'wp_loaded', array( $this, 'register_all_scripts' ) );
51
  add_action( 'wp_enqueue_scripts', array( $this, 'front_scripts' ) );
52
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_front_scripts' ) );
53
  add_shortcode( 'sp_testimonial', array( $this, 'shortcode_render' ) );
54
+ add_action( 'save_post', array( $this, 'delete_page_testimonial_option_on_save' ) );
55
+
56
  }
57
 
58
  /**
77
  $setting_options = get_option( 'sp_testimonial_pro_options' );
78
  $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
79
  $main_section_title = get_the_title( $post_id );
80
+ $dequeue_swiper_css = isset( $setting_options['tf_dequeue_slick_css'] ) ? $setting_options['tf_dequeue_slick_css'] : true;
81
+ $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
82
+ $custom_css = isset( $setting_options['custom_css'] ) ? $setting_options['custom_css'] : '';
83
  ob_start();
84
+ // Stylesheet loading problem solving here. Shortcode id to push page id option for getting how many shortcode in the page.
85
+ $current_page_id = get_queried_object_id();
86
+ $option_key = 'sp-testimonial_page_id' . $current_page_id;
87
+ $found_generator_id = get_option( $option_key );
88
+
89
+ if ( is_multisite() ) {
90
+ $option_key = 'sp-testimonial_page_id' . get_current_blog_id() . $current_page_id;
91
+ $found_generator_id = get_site_option( $option_key );
92
+ }
93
+ // This shortcode id not in page id option. Enqueue stylesheets in shortcode.
94
+ if ( ! is_array( $found_generator_id ) || ! $found_generator_id || ! in_array( $post_id, $found_generator_id ) ) {
95
+ if ( $dequeue_swiper_css ) {
96
+ wp_enqueue_style( 'sp-testimonial-swiper' );
97
+ }
98
+ if ( $dequeue_fa_css ) {
99
+ wp_enqueue_style( 'tfree-font-awesome' );
100
+ }
101
+ wp_enqueue_style( 'tfree-deprecated-style' );
102
+ wp_enqueue_style( 'tfree-style' );
103
+ $outline = '';
104
+ include SP_TFREE_PATH . 'Frontend/Views/partials/dynamic-style.php';
105
+ if ( ! empty( $custom_css ) ) {
106
+ $outline .= $custom_css;
107
+ }
108
+ $css = Helper::minify_output( $outline );
109
+ echo '<style id="sp_testimonial_dynamic_css' . $post_id . '">' . $css . '</style>';
110
+ }
111
+ if ( $found_generator_id ) {
112
+ $found_generator_id = is_array( $found_generator_id ) ? $found_generator_id : array( $found_generator_id );
113
+ if ( ! in_array( $post_id, $found_generator_id ) || empty( $found_generator_id ) ) { // If not found the shortcode id in the page options.
114
+ array_push( $found_generator_id, $post_id );
115
+ if ( is_multisite() ) {
116
+ update_site_option( $option_key, $found_generator_id );
117
+ } else {
118
+ update_option( $option_key, $found_generator_id );
119
+ }
120
+ }
121
+ } else { // If option not set in current page add option.
122
+ if ( $current_page_id ) {
123
+ if ( is_multisite() ) {
124
+ add_site_option( $option_key, array( $post_id ) );
125
+ } else {
126
+ add_option( $option_key, array( $post_id ) );
127
+ }
128
+ }
129
+ }
130
+
131
  Helper::sp_testimonial_html_show( $post_id, $setting_options, $shortcode_data, $main_section_title );
132
  return Helper::minify_output( ob_get_clean() );
133
  }
140
  $dequeue_swiper_css = isset( $setting_options['tf_dequeue_slick_css'] ) ? $setting_options['tf_dequeue_slick_css'] : true;
141
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
142
  $custom_css = isset( $setting_options['custom_css'] ) ? $setting_options['custom_css'] : '';
 
 
 
 
 
 
 
 
 
143
 
144
+ $current_page_id = get_queried_object_id();
145
+ $option_key = 'sp-testimonial_page_id' . $current_page_id;
146
+ $found_generator_id = get_option( $option_key );
147
+ if ( is_multisite() ) {
148
+ $option_key = 'sp-testimonial_page_id' . get_current_blog_id() . $current_page_id;
149
+ $found_generator_id = get_site_option( $option_key );
 
 
 
 
 
 
 
 
 
 
150
  }
151
+ // CSS Files.
152
+ if ( $found_generator_id ) {
153
 
154
+ if ( $dequeue_swiper_css ) {
155
+ wp_enqueue_style( 'sp-testimonial-swiper' );
156
+ }
157
+ if ( $dequeue_fa_css ) {
158
+ wp_enqueue_style( 'tfree-font-awesome' );
159
+ }
160
+ wp_enqueue_style( 'tfree-deprecated-style' );
161
+ wp_enqueue_style( 'tfree-style' );
162
+
163
+ $outline = '';
164
+ foreach ( $found_generator_id as $post_id ) {
165
+ if ( $post_id && is_numeric( $post_id ) && get_post_status( $post_id ) !== 'trash' ) {
166
+ $setting_options = get_option( 'sp_testimonial_pro_options' );
167
+ $shortcode_data = get_post_meta( $post_id, 'sp_tpro_shortcode_options', true );
168
+ include SP_TFREE_PATH . 'Frontend/Views/partials/dynamic-style.php';
169
+ }
170
+ }
171
+ if ( ! empty( $custom_css ) ) {
172
+ $outline .= $custom_css;
173
+ }
174
+ $css = Helper::minify_output( $outline );
175
+ wp_add_inline_style( 'tfree-style', $css );
176
+ }
177
 
178
  }
179
  /**
187
  $dequeue_fa_css = isset( $setting_options['tf_dequeue_fa_css'] ) ? $setting_options['tf_dequeue_fa_css'] : true;
188
  // CSS Files.
189
  if ( $dequeue_swiper_css ) {
190
+ wp_enqueue_style( 'sp-testimonial-swiper' );
191
  }
192
  if ( $dequeue_fa_css ) {
193
+ wp_enqueue_style( 'tfree-font-awesome' );
194
  }
195
 
196
+ wp_enqueue_style( 'tfree-deprecated-style' );
197
+ wp_enqueue_style( 'tfree-style' );
198
+ wp_enqueue_script( 'sp-testimonial-swiper-js' );
199
  }
200
 
201
  }
202
 
203
+ /**
204
+ * Register the All scripts for the public-facing side of the site.
205
+ *
206
+ * @since 2.0
207
+ */
208
+ public function register_all_scripts() {
209
+ /**
210
+ * Register the All style for the public-facing side of the site.
211
+ */
212
+ wp_register_style( 'sp-testimonial-swiper', SP_TFREE_URL . 'Frontend/assets/css/swiper.min.css', array(), SP_TFREE_VERSION );
213
+ wp_register_style( 'tfree-font-awesome', SP_TFREE_URL . 'Frontend/assets/css/font-awesome.min.css', array(), SP_TFREE_VERSION );
214
+ wp_register_style( 'tfree-deprecated-style', SP_TFREE_URL . 'Frontend/assets/css/deprecated-style.min.css', array(), SP_TFREE_VERSION );
215
+ wp_register_style( 'tfree-style', SP_TFREE_URL . 'Frontend/assets/css/style.min.css', array(), SP_TFREE_VERSION );
216
+
217
+ /**
218
+ * Register the All scripts for the public-facing side of the site.
219
+ */
220
+ wp_register_script( 'sp-testimonial-swiper-js', SP_TFREE_URL . 'Frontend/assets/js/swiper.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
221
+ wp_register_script( 'sp-testimonial-scripts', SP_TFREE_URL . 'Frontend/assets/js/sp-scripts.min.js', array( 'jquery' ), SP_TFREE_VERSION, true );
222
+
223
+ }
224
+ /**
225
+ * Delete page shortcode ids array option on save
226
+ *
227
+ * @param int $post_ID current post id.
228
+ * @return void
229
+ */
230
+ public function delete_page_testimonial_option_on_save( $post_ID ) {
231
+ if ( is_multisite() ) {
232
+ $option_key = 'sp-testimonial_page_id' . get_current_blog_id() . $post_ID;
233
+ if ( get_site_option( $option_key ) ) {
234
+ delete_site_option( $option_key );
235
+ }
236
+ } else {
237
+ if ( delete_option( 'sp-testimonial_page_id' . $post_ID ) ) {
238
+ delete_option( 'sp-testimonial_page_id' . $post_ID );
239
+ }
240
+ }
241
+
242
+ }
243
+
244
+
245
  }
testimonial-free.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Real Testimonials
13
  * Plugin URI: https://shapedplugin.com/real-testimonials/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
- * Version: 2.5.9
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
@@ -37,12 +37,13 @@ function is_testimonial_pro_active() {
37
  }
38
 
39
  define( 'SP_TFREE_NAME', 'Real Testimonials' );
40
- define( 'SP_TFREE_VERSION', '2.5.9' );
41
  define( 'SP_TFREE_PATH', plugin_dir_path( __FILE__ ) . 'src/' );
42
  define( 'SP_TFREE_URL', plugin_dir_url( __FILE__ ) . 'src/' );
43
  define( 'SP_TFREE_BASENAME', plugin_basename( __FILE__ ) );
44
 
45
  if ( ! is_testimonial_pro_active() ) {
 
46
  new ShapedPlugin\TestimonialFree\Admin\Views\Notices\Testimonial_Review();
47
  new ShapedPlugin\TestimonialFree\Admin\Views\Framework\Classes\SPFTESTIMONIAL();
48
  }
12
  * Plugin Name: Real Testimonials
13
  * Plugin URI: https://shapedplugin.com/real-testimonials/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
+ * Version: 2.5.10
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
37
  }
38
 
39
  define( 'SP_TFREE_NAME', 'Real Testimonials' );
40
+ define( 'SP_TFREE_VERSION', '2.5.10' );
41
  define( 'SP_TFREE_PATH', plugin_dir_path( __FILE__ ) . 'src/' );
42
  define( 'SP_TFREE_URL', plugin_dir_url( __FILE__ ) . 'src/' );
43
  define( 'SP_TFREE_BASENAME', plugin_basename( __FILE__ ) );
44
 
45
  if ( ! is_testimonial_pro_active() ) {
46
+ new ShapedPlugin\TestimonialFree\Admin\Views\Notices\Testimonial_Offer();
47
  new ShapedPlugin\TestimonialFree\Admin\Views\Notices\Testimonial_Review();
48
  new ShapedPlugin\TestimonialFree\Admin\Views\Framework\Classes\SPFTESTIMONIAL();
49
  }