Cherry Services List - Version 1.3.0

Version Description

  • ADD: Integrate with Elementor page builder
Download this release

Release Info

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

Code changes from version 1.2.0 to 1.3.0

admin/includes/class-cherry-services-options-page.php CHANGED
@@ -97,7 +97,7 @@ class Cherry_Services_Options_Page extends Cherry_Services_List {
97
  ),
98
  'archive-page-shows' => array(
99
  'type' => 'select',
100
- 'title' => esc_html__( 'Archive page shows', 'cherry-team' ),
101
  'label' => '',
102
  'description' => '',
103
  'value' => $this->default_options['archive-page-shows'],
97
  ),
98
  'archive-page-shows' => array(
99
  'type' => 'select',
100
+ 'title' => esc_html__( 'Archive page shows', 'cherry-services' ),
101
  'label' => '',
102
  'description' => '',
103
  'value' => $this->default_options['archive-page-shows'],
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.2.0
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.2.0';
96
 
97
  /**
98
  * Plugin CPT name
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.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.3.0';
96
 
97
  /**
98
  * Plugin CPT name
public/includes/class-cherry-services-list-shortcode.php CHANGED
@@ -60,6 +60,23 @@ class Cherry_Services_List_Shortcode {
60
 
61
  add_shortcode( $this->tag(), array( $this, 'do_shortcode' ) );
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  if ( is_admin() ) {
64
  $this->register_shrtcode_for_builder();
65
  }
60
 
61
  add_shortcode( $this->tag(), array( $this, 'do_shortcode' ) );
62
 
63
+ $base = cherry_services_list();
64
+
65
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
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' ),
73
+ 'class' => 'Cherry_Services_Elementor_Widget',
74
+ 'icon' => 'eicon-favorite',
75
+ 'atts' => $this->shortcode_args(),
76
+ ),
77
+ ) );
78
+ }
79
+
80
  if ( is_admin() ) {
81
  $this->register_shrtcode_for_builder();
82
  }
public/includes/class-cherry-services-list-tools.php CHANGED
@@ -127,7 +127,7 @@ class Cherry_Services_List_Tools extends Cherry_Services_List {
127
  public function get_pages() {
128
 
129
  $pages = get_pages();
130
- $pages_list = array( esc_html__( 'Select page...', 'cherry-team' ) );
131
 
132
  foreach ( $pages as $page ) {
133
  $pages_list[ $page->ID ] = $page->post_title;
127
  public function get_pages() {
128
 
129
  $pages = get_pages();
130
+ $pages_list = array( esc_html__( 'Select page...', 'cherry-services' ) );
131
 
132
  foreach ( $pages as $page ) {
133
  $pages_list[ $page->ID ] = $page->post_title;
public/includes/ext/class-cherry-services-list-elementor-compat.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class description
4
+ *
5
+ * @package package_name
6
+ * @author Cherry Team
7
+ * @license GPL-2.0+
8
+ */
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ if ( ! class_exists( 'Cherry_Services_List_Elementor_Compat' ) ) {
16
+
17
+ /**
18
+ * Define Cherry_Services_List_Elementor_Compat class
19
+ */
20
+ class Cherry_Services_List_Elementor_Compat {
21
+
22
+ /**
23
+ * A reference to an instance of this class.
24
+ *
25
+ * @since 1.0.0
26
+ * @var object
27
+ */
28
+ private static $instance = null;
29
+
30
+ /**
31
+ * Registered shortcodes array
32
+ *
33
+ * @var array
34
+ */
35
+ public $shortcodes = array();
36
+
37
+ /**
38
+ * Constructor for the class
39
+ */
40
+ function __construct( $shortcodes = array() ) {
41
+
42
+ $this->shortcodes = $shortcodes;
43
+
44
+ add_action( 'elementor/init', array( $this, 'register_category' ) );
45
+ add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
46
+
47
+ }
48
+
49
+ /**
50
+ * Register elementor widget
51
+ *
52
+ * @return void
53
+ */
54
+ public function register_widgets( $widgets_manager ) {
55
+
56
+ foreach ( $this->shortcodes as $data ) {
57
+ require $data['file'];
58
+ unset( $data['file'] );
59
+ $widgets_manager->register_widget_type( call_user_func( array( $data['class'], 'get_instance' ) ) );
60
+ }
61
+
62
+ }
63
+
64
+ /**
65
+ * Register cherry category for elementor if not exists
66
+ *
67
+ * @return void
68
+ */
69
+ public function register_category() {
70
+
71
+ $elements_manager = Elementor\Plugin::instance()->elements_manager;
72
+ $existing = $elements_manager->get_categories();
73
+ $cherry_cat = 'cherry';
74
+
75
+ if ( array_key_exists( $cherry_cat, $existing ) ) {
76
+ return;
77
+ }
78
+
79
+ $elements_manager->add_category(
80
+ $cherry_cat,
81
+ array(
82
+ 'title' => esc_html__( 'Cherry Addons', 'cherry-services' ),
83
+ 'icon' => 'font',
84
+ ),
85
+ 1
86
+ );
87
+ }
88
+
89
+ /**
90
+ * Returns the instance.
91
+ *
92
+ * @since 1.0.0
93
+ * @return object
94
+ */
95
+ public static function get_instance( $shortcodes = array() ) {
96
+
97
+ // If the single instance hasn't been set, set it now.
98
+ if ( null == self::$instance ) {
99
+ self::$instance = new self( $shortcodes );
100
+ }
101
+ return self::$instance;
102
+ }
103
+ }
104
+
105
+ }
106
+
107
+ /**
108
+ * Returns instance of Cherry_Services_List_Elementor_Compat
109
+ *
110
+ * @return object
111
+ */
112
+ function cherry_services_list_elementor_compat( $shortcodes = array() ) {
113
+ return Cherry_Services_List_Elementor_Compat::get_instance( $shortcodes );
114
+ }
public/includes/ext/class-cherry-services-list-elementor-module.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class Cherry_Services_Elementor_Widget extends Elementor\Widget_Base {
6
+
7
+ /**
8
+ * Shortcode tag
9
+ *
10
+ * @var string
11
+ */
12
+ protected $tag = 'cherry_services';
13
+
14
+ /**
15
+ * Rewritten shortcode arguments
16
+ *
17
+ * @var array
18
+ */
19
+ protected $rewrite = array(
20
+ 'id' => 'post_id',
21
+ );
22
+
23
+ /**
24
+ * Get shortcode data by name
25
+ *
26
+ * @param string $name Data name to get.
27
+ * @return mixed
28
+ */
29
+ public function get_shortcode( $name ) {
30
+
31
+ if ( ! isset( cherry_services_list_elementor_compat()->shortcodes[ $this->tag ] ) ) {
32
+ return;
33
+ }
34
+
35
+ $shortcode = wp_parse_args( cherry_services_list_elementor_compat()->shortcodes[ $this->tag ], array(
36
+ 'title' => null,
37
+ 'icon' => 'eicon-shortcode',
38
+ 'atts' => array(),
39
+ ) );
40
+
41
+ return isset( $shortcode[ $name ] ) ? $shortcode[ $name ] : false;
42
+ }
43
+
44
+ public function get_name() {
45
+ return $this->tag;
46
+ }
47
+
48
+ public function get_title() {
49
+ return $this->get_shortcode( 'title' );
50
+ }
51
+
52
+ public function get_icon() {
53
+ return $this->get_shortcode( 'icon' );
54
+ }
55
+
56
+ public function get_categories() {
57
+ return array( 'cherry' );
58
+ }
59
+
60
+ public function is_reload_preview_required() {
61
+ return true;
62
+ }
63
+
64
+ /**
65
+ * Map controls
66
+ *
67
+ * @param string $name Default control name.
68
+ * @return string
69
+ */
70
+ protected function _get_mapped_control( $name = null ) {
71
+
72
+ $mapped_controls = array(
73
+ 'media' => Elementor\Controls_Manager::MEDIA,
74
+ 'text' => Elementor\Controls_Manager::TEXT,
75
+ 'textarea' => Elementor\Controls_Manager::TEXTAREA,
76
+ 'select' => Elementor\Controls_Manager::SELECT,
77
+ 'switcher' => Elementor\Controls_Manager::SWITCHER,
78
+ 'slider' => Elementor\Controls_Manager::SLIDER,
79
+ );
80
+
81
+ if ( isset( $mapped_controls[ $name ] ) ) {
82
+ return $mapped_controls[ $name ];
83
+ } else {
84
+ return false;
85
+ }
86
+
87
+ }
88
+
89
+ /**
90
+ * Sanitize attribute arguments data.
91
+ *
92
+ * @param array $data Input arguments.
93
+ * @param string $type Attribute control type.
94
+ * @return array
95
+ */
96
+ protected function _sanitize_attr_data( $data ) {
97
+
98
+ $type = $this->_get_mapped_control( $data['type'] );
99
+
100
+ if ( ! $type ) {
101
+ return;
102
+ }
103
+
104
+ $mapped_args = array(
105
+ 'label' => $data['title'],
106
+ 'type' => $type,
107
+ 'default' => array( $data['value'] ),
108
+ );
109
+
110
+ if ( 'switcher' === $data['type'] ) {
111
+ $mapped_args['default'] = ( 'true' === $data['value'] ) ? 'yes' : '';
112
+ }
113
+
114
+ if ( isset( $data['options'] ) ) {
115
+ $mapped_args['options'] = $data['options'];
116
+ }
117
+
118
+ if ( isset( $data['options_cb'] ) ) {
119
+ $mapped_args['options'] = call_user_func( $data['options_cb'] );
120
+ }
121
+
122
+ if ( isset( $data['min_value'] ) && isset( $data['max_value'] ) ) {
123
+ $mapped_args['default'] = array(
124
+ 'size' => $data['value'],
125
+ );
126
+ $mapped_args['range'] = array(
127
+ 'px' => array(
128
+ 'min' => $data['min_value'],
129
+ 'max' => $data['max_value'],
130
+ ),
131
+ );
132
+ }
133
+
134
+ return $mapped_args;
135
+ }
136
+
137
+ /**
138
+ * Sanitize attribute name
139
+ *
140
+ * @param string $name Attribute name.
141
+ * @return string
142
+ */
143
+ protected function _sanitize_attr_name( $name ) {
144
+ return isset( $this->rewrite[ $name ] ) ? $this->rewrite[ $name ] : $name;
145
+ }
146
+
147
+ protected function _register_controls() {
148
+
149
+ $args = $this->get_shortcode( 'atts' );
150
+
151
+ if ( ! $args ) {
152
+ return;
153
+ }
154
+
155
+ $this->start_controls_section(
156
+ 'section_main',
157
+ array(
158
+ 'label' => $this->get_shortcode( 'title' ),
159
+ )
160
+ );
161
+
162
+ foreach ( $args as $name => $arg ) {
163
+
164
+ $name = $this->_sanitize_attr_name( $name );
165
+ $mapped_args = $this->_sanitize_attr_data( $arg );
166
+
167
+ $this->add_control( $name, $mapped_args );
168
+
169
+ }
170
+
171
+ $this->end_controls_section();
172
+
173
+ }
174
+
175
+ protected function render() {
176
+
177
+ $settings = $this->get_settings();
178
+ $shortcode = '[%1$s%2$s]';
179
+ $shortcode_atts = '';
180
+ $args = $this->get_shortcode( 'atts' );
181
+
182
+ foreach ( $args as $name => $arg ) {
183
+
184
+ if ( ! is_array( $settings[ $name ] ) ) {
185
+ $val = $settings[ $name ];
186
+ } else {
187
+ if ( isset( $settings[ $name ]['size'] ) ) {
188
+ $val = $settings[ $name ]['size'];
189
+ } else {
190
+ $val = $settings[ $name ][0];
191
+ }
192
+ }
193
+
194
+ $shortcode_atts .= sprintf( ' %1$s="%2$s"', $name, $val );
195
+ }
196
+
197
+ ?>
198
+ <div class="elementor-<?php $this->tag; ?>"><?php
199
+ echo do_shortcode( sprintf( $shortcode, $this->tag, $shortcode_atts ) );
200
+ ?></div>
201
+ <?php
202
+ }
203
+
204
+ protected function _content_template() {}
205
+
206
+ /**
207
+ * Returns widget instance for register function
208
+ *
209
+ * @return object
210
+ */
211
+ public static function get_instance() {
212
+ return new self();
213
+ }
214
+
215
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Cherry Services List ===
2
 
3
  Contributors: TemplateMonster 2002
4
- Tags: custom post type, services, service, cherry-framework
5
  Requires at least: 4.5
6
  Tested up to: 4.7.4
7
- Stable tag: 1.2.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -14,13 +14,15 @@ Cherry Services is a flexible WordPress plugin that lets you display your compan
14
 
15
  Cherry Services is a flexible WordPress plugin that lets you display your company’s services in a variety of ways: as single pages, galleries, and even as embedded content blocks on the homepage of your website with the help of custom shortcodes.
16
 
 
 
17
  The plugin adds a custom post type named “Services”, which you can use to display what your company offers – in a professional way.
18
 
19
  == Installation ==
20
 
21
- 1. Upload "Cherry Team Members" folder to the "/wp-content/plugins/" directory
22
  2. Activate the plugin through the "Plugins" menu in WordPress
23
- 3. Navigate to the "Cherry Team Members" page available through the left menu
24
 
25
  == Screenshots ==
26
  1. Settings page.
@@ -42,6 +44,10 @@ If you have Cherry Testimonials plugin installed on your website, you can also i
42
 
43
  == Changelog ==
44
 
 
 
 
 
45
  = 1.2.0 =
46
 
47
  * ADD: New option - 'Archive page shows'
1
  === Cherry Services List ===
2
 
3
  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.4
7
+ Stable tag: 1.3.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
14
 
15
  Cherry Services is a flexible WordPress plugin that lets you display your company’s services in a variety of ways: as single pages, galleries, and even as embedded content blocks on the homepage of your website with the help of custom shortcodes.
16
 
17
+ **Completely integrated with Elementor page builder!**
18
+
19
  The plugin adds a custom post type named “Services”, which you can use to display what your company offers – in a professional way.
20
 
21
  == Installation ==
22
 
23
+ 1. Upload "Cherry Services List" folder to the "/wp-content/plugins/" directory
24
  2. Activate the plugin through the "Plugins" menu in WordPress
25
+ 3. Navigate to the "Cherry Services List" page available through the left menu
26
 
27
  == Screenshots ==
28
  1. Settings page.
44
 
45
  == Changelog ==
46
 
47
+ = 1.3.0 =
48
+
49
+ * ADD: Integrate with Elementor page builder
50
+
51
  = 1.2.0 =
52
 
53
  * ADD: New option - 'Archive page shows'