Cherry Services List - Version 1.4.0

Version Description

Download this release

Release Info

Developer TemplateMonster 2002
Plugin Icon 128x128 Cherry Services List
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.2 to 1.4.0

admin/includes/class-cherry-services-ajax.php CHANGED
@@ -68,6 +68,7 @@ if ( ! class_exists( 'Cherry_Services_Ajax' ) ) {
68
  'show_position',
69
  'show_social',
70
  'show_filters',
 
71
  'ajax_more',
72
  'more',
73
  'pager',
68
  'show_position',
69
  'show_social',
70
  'show_filters',
71
+ 'show_item_more',
72
  'ajax_more',
73
  'more',
74
  'pager',
cherry-services-list.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Cherry Services List
4
  * Plugin URI: http://www.cherryframework.com/plugins/
5
  * Description: Cherry Services is a flexible WordPress plugin that lets you display your company’s services in a variety of ways.
6
- * Version: 1.3.2
7
  * Author: TemplateMonster
8
  * Author URI: http://cherryframework.com/
9
  * Text Domain: cherry-services
@@ -92,7 +92,7 @@ if ( ! class_exists( 'Cherry_Services_List' ) ) {
92
  * @access private
93
  * @var string
94
  */
95
- private $version = '1.3.2';
96
 
97
  /**
98
  * Plugin CPT name
@@ -144,6 +144,13 @@ if ( ! class_exists( 'Cherry_Services_List' ) ) {
144
  */
145
  private $options_val = null;
146
 
 
 
 
 
 
 
 
147
  /**
148
  * Sets up needed actions/filters for the plugin to initialize.
149
  *
@@ -164,11 +171,11 @@ if ( ! class_exists( 'Cherry_Services_List' ) ) {
164
  add_action( 'after_setup_theme', array( $this, 'load_files' ), 3 );
165
 
166
  // Internationalize the text strings used.
167
- add_action( 'init', array( $this, 'lang' ), 1 );
168
  // Load the admin files.
169
- add_action( 'init', array( $this, 'admin' ), 2 );
170
  // Load the admin files.
171
- add_action( 'init', array( $this, 'init_modules' ), 2 );
172
 
173
  // Load public-facing stylesheets.
174
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
3
  * Plugin Name: Cherry Services List
4
  * Plugin URI: http://www.cherryframework.com/plugins/
5
  * Description: Cherry Services is a flexible WordPress plugin that lets you display your company’s services in a variety of ways.
6
+ * Version: 1.4.0
7
  * Author: TemplateMonster
8
  * Author URI: http://cherryframework.com/
9
  * Text Domain: cherry-services
92
  * @access private
93
  * @var string
94
  */
95
+ private $version = '1.4.0';
96
 
97
  /**
98
  * Plugin CPT name
144
  */
145
  private $options_val = null;
146
 
147
+ /**
148
+ * Elemntor compat instance
149
+ *
150
+ * @var object
151
+ */
152
+ public $elementor_compat = null;
153
+
154
  /**
155
  * Sets up needed actions/filters for the plugin to initialize.
156
  *
171
  add_action( 'after_setup_theme', array( $this, 'load_files' ), 3 );
172
 
173
  // Internationalize the text strings used.
174
+ add_action( 'after_setup_theme', array( $this, 'lang' ), 11 );
175
  // Load the admin files.
176
+ add_action( 'after_setup_theme', array( $this, 'admin' ), 12 );
177
  // Load the admin files.
178
+ add_action( 'after_setup_theme', array( $this, 'init_modules' ), 13 );
179
 
180
  // Load public-facing stylesheets.
181
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
public/includes/class-cherry-services-list-data.php CHANGED
@@ -96,6 +96,8 @@ class Cherry_Services_List_Data {
96
  'show_title' => true,
97
  'show_media' => true,
98
  'show_content' => true,
 
 
99
  'show_filters' => false,
100
  'use_space' => true,
101
  'use_rows_space' => true,
96
  'show_title' => true,
97
  'show_media' => true,
98
  'show_content' => true,
99
+ 'show_item_more' => true,
100
+ 'item_more_text' => '',
101
  'show_filters' => false,
102
  'use_space' => true,
103
  'use_rows_space' => true,
public/includes/class-cherry-services-list-shortcode.php CHANGED
@@ -47,7 +47,7 @@ class Cherry_Services_List_Shortcode {
47
  public function __construct() {
48
 
49
  // Register shortcode on 'init'.
50
- add_action( 'init', array( $this, 'register_shortcode' ) );
51
 
52
  }
53
 
@@ -66,7 +66,7 @@ class Cherry_Services_List_Shortcode {
66
 
67
  require $base->plugin_path( 'public/includes/ext/class-cherry-services-list-elementor-compat.php' );
68
 
69
- cherry_services_list_elementor_compat( array(
70
  $this->tag() => array(
71
  'title' => esc_html__( 'Cherry Services', 'cherry-services' ),
72
  'file' => $base->plugin_path( 'public/includes/ext/class-cherry-services-list-elementor-module.php' ),
@@ -204,7 +204,7 @@ class Cherry_Services_List_Shortcode {
204
  ),
205
  'more_url' => array(
206
  'type' => 'text',
207
- 'title' => esc_html__( 'More button text', 'cherry-services' ),
208
  'value' => '#',
209
  'master' => 'services-more-filter-visible-true',
210
  ),
@@ -256,6 +256,20 @@ class Cherry_Services_List_Shortcode {
256
  'false_toggle' => esc_html__( 'No', 'cherry-services' ),
257
  ),
258
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  'show_filters' => array(
260
  'type' => 'switcher',
261
  'title' => esc_html__( 'Show filter by category before services listing', 'cherry-services' ),
@@ -315,6 +329,8 @@ class Cherry_Services_List_Shortcode {
315
  $categories = array();
316
  }
317
 
 
 
318
  return $categories;
319
  }
320
 
@@ -402,6 +418,7 @@ class Cherry_Services_List_Shortcode {
402
  'show_title',
403
  'show_media',
404
  'show_content',
 
405
  'show_filters',
406
  'ajax_more',
407
  'more',
@@ -437,6 +454,8 @@ class Cherry_Services_List_Shortcode {
437
  'show_title' => 'show_title',
438
  'show_media' => 'show_media',
439
  'show_content' => 'show_content',
 
 
440
  'show_filters' => 'show_filters',
441
  'template' => 'template',
442
  'pager' => 'pagination',
47
  public function __construct() {
48
 
49
  // Register shortcode on 'init'.
50
+ add_action( 'init', array( $this, 'register_shortcode' ), -1 );
51
 
52
  }
53
 
66
 
67
  require $base->plugin_path( 'public/includes/ext/class-cherry-services-list-elementor-compat.php' );
68
 
69
+ cherry_services_list()->elementor_compat = cherry_services_list_elementor_compat( array(
70
  $this->tag() => array(
71
  'title' => esc_html__( 'Cherry Services', 'cherry-services' ),
72
  'file' => $base->plugin_path( 'public/includes/ext/class-cherry-services-list-elementor-module.php' ),
204
  ),
205
  'more_url' => array(
206
  'type' => 'text',
207
+ 'title' => esc_html__( 'More button URL', 'cherry-services' ),
208
  'value' => '#',
209
  'master' => 'services-more-filter-visible-true',
210
  ),
256
  'false_toggle' => esc_html__( 'No', 'cherry-services' ),
257
  ),
258
  ),
259
+ 'show_item_more' => array(
260
+ 'type' => 'switcher',
261
+ 'title' => esc_html__( 'Show service item Read More button (if allowed in template)', 'cherry-services' ),
262
+ 'value' => 'true',
263
+ 'toggle' => array(
264
+ 'true_toggle' => esc_html__( 'Yes', 'cherry-services' ),
265
+ 'false_toggle' => esc_html__( 'No', 'cherry-services' ),
266
+ ),
267
+ ),
268
+ 'item_more_text' => array(
269
+ 'type' => 'text',
270
+ 'title' => esc_html__( 'Item Read More button text (if empty - used default value from template)', 'cherry-services' ),
271
+ 'value' => '',
272
+ ),
273
  'show_filters' => array(
274
  'type' => 'switcher',
275
  'title' => esc_html__( 'Show filter by category before services listing', 'cherry-services' ),
329
  $categories = array();
330
  }
331
 
332
+ $categories = array_merge( array( 0 => esc_html__( 'Get From All', 'cherry-services' ) ), $categories );
333
+
334
  return $categories;
335
  }
336
 
418
  'show_title',
419
  'show_media',
420
  'show_content',
421
+ 'show_item_more',
422
  'show_filters',
423
  'ajax_more',
424
  'more',
454
  'show_title' => 'show_title',
455
  'show_media' => 'show_media',
456
  'show_content' => 'show_content',
457
+ 'show_item_more' => 'show_item_more',
458
+ 'item_more_text' => 'item_more_text',
459
  'show_filters' => 'show_filters',
460
  'template' => 'template',
461
  'pager' => 'pagination',
public/includes/class-cherry-services-list-template-callbacks.php CHANGED
@@ -641,17 +641,29 @@ class Cherry_Services_List_Template_Callbacks {
641
  */
642
  public function get_button( $args = array() ) {
643
 
 
 
 
 
 
 
 
 
 
 
644
  $args = wp_parse_args( $args, array(
645
  'class' => 'btn btn-primary',
646
  'label' => __( 'Read more', 'cherry-services' ),
647
  ) );
648
 
 
 
649
  $format = apply_filters(
650
  'cherry_services_button_format',
651
  '<a href="%1$s" class="%2$s">%3$s</a>'
652
  );
653
 
654
- return sprintf( $format, get_permalink(), $args['class'], $args['label'] );
655
  }
656
 
657
  /**
641
  */
642
  public function get_button( $args = array() ) {
643
 
644
+ if ( ! isset( $this->atts['show_item_more'] ) ) {
645
+ $this->atts['show_item_more'] = true;
646
+ }
647
+
648
+ $this->atts['show_item_more'] = filter_var( $this->atts['show_item_more'], FILTER_VALIDATE_BOOLEAN );
649
+
650
+ if ( ! $this->atts['show_item_more'] ) {
651
+ return;
652
+ }
653
+
654
  $args = wp_parse_args( $args, array(
655
  'class' => 'btn btn-primary',
656
  'label' => __( 'Read more', 'cherry-services' ),
657
  ) );
658
 
659
+ $label = ! empty( $this->atts['item_more_text'] ) ? $this->atts['item_more_text'] : $args['label'];
660
+
661
  $format = apply_filters(
662
  'cherry_services_button_format',
663
  '<a href="%1$s" class="%2$s">%3$s</a>'
664
  );
665
 
666
+ return sprintf( $format, get_permalink(), $args['class'], wp_kses_post( $label ) );
667
  }
668
 
669
  /**
public/includes/ext/class-cherry-services-list-elementor-compat.php CHANGED
@@ -34,6 +34,13 @@ if ( ! class_exists( 'Cherry_Services_List_Elementor_Compat' ) ) {
34
  */
35
  public $shortcodes = array();
36
 
 
 
 
 
 
 
 
37
  /**
38
  * Constructor for the class
39
  */
@@ -44,6 +51,36 @@ if ( ! class_exists( 'Cherry_Services_List_Elementor_Compat' ) ) {
44
  add_action( 'elementor/init', array( $this, 'register_category' ) );
45
  add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  /**
34
  */
35
  public $shortcodes = array();
36
 
37
+ /**
38
+ * Check if processing elementor widget
39
+ *
40
+ * @var boolean
41
+ */
42
+ private $is_elementor_ajax = false;
43
+
44
  /**
45
  * Constructor for the class
46
  */
51
  add_action( 'elementor/init', array( $this, 'register_category' ) );
52
  add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
53
 
54
+ add_action( 'wp_ajax_elementor_render_widget', array( $this, 'set_elementor_ajax' ), 10, -1 );
55
+
56
+ }
57
+
58
+ /**
59
+ * Set $this->is_elementor_ajax to true on Elementor AJAX processing
60
+ *
61
+ * @return void
62
+ */
63
+ public function set_elementor_ajax() {
64
+ $this->is_elementor_ajax = true;
65
+ }
66
+
67
+ /**
68
+ * Check if we currently in Elementor mode
69
+ *
70
+ * @return void
71
+ */
72
+ public function in_elementor() {
73
+
74
+ $result = false;
75
+
76
+ if ( wp_doing_ajax() ) {
77
+ $result = $this->is_elementor_ajax;
78
+ } elseif ( Elementor\Plugin::instance()->editor->is_edit_mode()
79
+ || Elementor\Plugin::instance()->preview->is_preview_mode() ) {
80
+ $result = true;
81
+ }
82
+
83
+ return $result;
84
  }
85
 
86
  /**
public/includes/ext/class-cherry-services-list-elementor-module.php CHANGED
@@ -179,6 +179,11 @@ class Cherry_Services_Elementor_Widget extends Elementor\Widget_Base {
179
  $shortcode_atts = '';
180
  $args = $this->get_shortcode( 'atts' );
181
 
 
 
 
 
 
182
  foreach ( $args as $name => $arg ) {
183
 
184
  if ( empty( $settings[ $name ] ) ) {
@@ -205,7 +210,11 @@ class Cherry_Services_Elementor_Widget extends Elementor\Widget_Base {
205
 
206
  ?>
207
  <div class="elementor-<?php $this->tag; ?>"><?php
208
- echo do_shortcode( sprintf( $shortcode, $this->tag, $shortcode_atts ) );
 
 
 
 
209
  ?></div>
210
  <?php
211
  }
179
  $shortcode_atts = '';
180
  $args = $this->get_shortcode( 'atts' );
181
 
182
+ // fix rewritten
183
+ foreach ( $this->rewrite as $before => $after ) {
184
+ $settings[ $before ] = isset( $settings[ $after ] ) ? $settings[ $after ] : false;
185
+ }
186
+
187
  foreach ( $args as $name => $arg ) {
188
 
189
  if ( empty( $settings[ $name ] ) ) {
210
 
211
  ?>
212
  <div class="elementor-<?php $this->tag; ?>"><?php
213
+ if ( cherry_services_list()->elementor_compat->in_elementor() ) {
214
+ echo do_shortcode( sprintf( $shortcode, $this->tag, $shortcode_atts ) );
215
+ } else {
216
+ echo sprintf( $shortcode, $this->tag, $shortcode_atts );
217
+ }
218
  ?></div>
219
  <?php
220
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: TemplateMonster 2002
4
  Tags: custom post type, services, service, cherry-framework, elementor, elementor builder
5
  Requires at least: 4.5
6
  Tested up to: 4.7.5
7
- Stable tag: 1.3.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -41,54 +41,3 @@ The plugin is highly customizable, so you can apply it to any WordPress theme. I
41
  * Select a page that will be used as an archive for services posts.
42
 
43
  If you have Cherry Testimonials plugin installed on your website, you can also incorporate them into your services posts.
44
-
45
- == Changelog ==
46
-
47
- = 1.3.2 =
48
-
49
- * FIX: Minor fixes
50
-
51
- = 1.3.1 =
52
-
53
- * FIX: Prevent PHP notices in Elementor module
54
-
55
- = 1.3.0 =
56
-
57
- * ADD: Integrate with Elementor page builder
58
-
59
- = 1.2.0 =
60
-
61
- * ADD: New option - 'Archive page shows'
62
- * UPD: Rewrite URLs logic
63
-
64
- = 1.1.0 =
65
-
66
- * ADD: Insert shortcode button in editor
67
- * ADD: Add 'link' argument into %%ICON%% macros
68
- * FIX: prevent errors on PHP < 5.3
69
-
70
- = 1.0.5 =
71
-
72
- * FIX: Rename serialize script to prevent conflicts with other plugins
73
- * ADD: compatibility with Cherry Search
74
-
75
- = 1.0.4 =
76
-
77
- * FIX: Size attribute for image macros
78
- * ADD: columns_laptop shortcode attribute
79
-
80
- = 1.0.3 =
81
-
82
- * FIX: Minor fixes
83
-
84
- = 1.0.2 =
85
-
86
- * UPD: Allow to crop description macros
87
-
88
- = 1.0.1 =
89
-
90
- * SYS: Added cherry-framework tag
91
-
92
- = 1.0.0 =
93
-
94
- * Initial release
4
  Tags: custom post type, services, service, cherry-framework, elementor, elementor builder
5
  Requires at least: 4.5
6
  Tested up to: 4.7.5
7
+ Stable tag: 1.4.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
41
  * Select a page that will be used as an archive for services posts.
42
 
43
  If you have Cherry Testimonials plugin installed on your website, you can also incorporate them into your services posts.