Envato Elements – Template Kits (Beta) - Version 0.1.7

Version Description

  • 2019-01-30 =
  • Fixes: Compatibility with Astra theme
Download this release

Release Info

Developer dtbaker
Plugin Icon 128x128 Envato Elements – Template Kits (Beta)
Version 0.1.7
Comparing to
See all releases

Code changes from version 0.1.6 to 0.1.7

assets/images/elements-banner.jpg DELETED
Binary file
envato-elements.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: Beautifully designed, Free templates, Handcrafted for popular WordPress page builders.
5
  * Author: Envato
6
  * Author URI: https://envato.com
7
- * Version: 0.1.6
8
  * License: GPLv3 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  *
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
28
  }
29
 
30
  define( 'ENVATO_ELEMENTS_SLUG', 'envato-elements' );
31
- define( 'ENVATO_ELEMENTS_VER', '0.1.6' );
32
  define( 'ENVATO_ELEMENTS_FILE', __FILE__ );
33
  define( 'ENVATO_ELEMENTS_DIR', plugin_dir_path( ENVATO_ELEMENTS_FILE ) );
34
  define( 'ENVATO_ELEMENTS_URI', plugins_url( '/', ENVATO_ELEMENTS_FILE ) );
4
  * Description: Beautifully designed, Free templates, Handcrafted for popular WordPress page builders.
5
  * Author: Envato
6
  * Author URI: https://envato.com
7
+ * Version: 0.1.7
8
  * License: GPLv3 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  *
28
  }
29
 
30
  define( 'ENVATO_ELEMENTS_SLUG', 'envato-elements' );
31
+ define( 'ENVATO_ELEMENTS_VER', '0.1.7' );
32
  define( 'ENVATO_ELEMENTS_FILE', __FILE__ );
33
  define( 'ENVATO_ELEMENTS_DIR', plugin_dir_path( ENVATO_ELEMENTS_FILE ) );
34
  define( 'ENVATO_ELEMENTS_URI', plugins_url( '/', ENVATO_ELEMENTS_FILE ) );
inc/class-cpt-kits.php CHANGED
@@ -363,6 +363,9 @@ class CPT_Kits extends CPT {
363
  $template = get_post_meta( $local_cache_post_id, 'template_data', true );
364
  if ( $template && ! empty( $template['import'] ) ) {
365
 
 
 
 
366
  $template['import']['Update_Existing_ID'] = $local_cache_post_id;
367
  $import_settings['post_type'] = $this->cpt_slug;
368
  $post = get_post( $local_cache_post_id );
363
  $template = get_post_meta( $local_cache_post_id, 'template_data', true );
364
  if ( $template && ! empty( $template['import'] ) ) {
365
 
366
+ // Astra compatibility: Make sure post_content is empty.
367
+ $template['import']['post_content'] = '';
368
+
369
  $template['import']['Update_Existing_ID'] = $local_cache_post_id;
370
  $import_settings['post_type'] = $this->cpt_slug;
371
  $post = get_post( $local_cache_post_id );
inc/class-import.php CHANGED
@@ -39,7 +39,7 @@ class Import extends Base {
39
  $this->_import_id_namespace = ! empty( $import_settings['transient_namespace'] ) ? $import_settings['transient_namespace'] : 'all';
40
  $this->log( "Setting transient namespace: " . $this->_import_id_namespace );
41
 
42
- if ( $template && ! empty( $template['post_content'] ) ) {
43
 
44
  if ( ! empty( $template['media'] ) ) {
45
 
39
  $this->_import_id_namespace = ! empty( $import_settings['transient_namespace'] ) ? $import_settings['transient_namespace'] : 'all';
40
  $this->log( "Setting transient namespace: " . $this->_import_id_namespace );
41
 
42
+ if ( $template ) {
43
 
44
  if ( ! empty( $template['media'] ) ) {
45
 
inc/class-plugin.php CHANGED
@@ -101,7 +101,7 @@ class Plugin extends Base {
101
  ENVATO_ELEMENTS_SLUG,
102
  [ License::get_instance(), 'admin_menu_open' ],
103
  '',
104
- 99
105
  );
106
  add_action( 'admin_print_scripts-' . $page, [ $this, 'admin_page_assets' ] );
107
  }
101
  ENVATO_ELEMENTS_SLUG,
102
  [ License::get_instance(), 'admin_menu_open' ],
103
  '',
104
+ '58.6'
105
  );
106
  add_action( 'admin_print_scripts-' . $page, [ $this, 'admin_page_assets' ] );
107
  }
inc/elementor/templatelibrary/class-source-elements-remote.php DELETED
@@ -1,251 +0,0 @@
1
- <?php
2
- /**
3
- * Elementor Template Library: Source_Elements_Remote class
4
- *
5
- * This class is used to manage remote templates.
6
- *
7
- * @package Envato/Envato_Elements
8
- * @since 0.1.1
9
- */
10
-
11
- namespace Elementor\TemplateLibrary;
12
-
13
- use Elementor\Plugin;
14
-
15
- if ( ! defined( 'ABSPATH' ) ) {
16
- exit; // Exit if accessed directly.
17
- }
18
-
19
- /**
20
- * Elementor template library remote source.
21
- *
22
- * @since 0.0.2
23
- */
24
- class Source_Elements_Remote extends Source_Base {
25
-
26
- /**
27
- * ID used in Elementor template integration.
28
- *
29
- * @var string ID.
30
- */
31
- private $_our_id = 'elements-kits';
32
-
33
- /**
34
- * Source_Elements_Remote constructor.
35
- *
36
- * @param array $args args.
37
- */
38
- public function __construct( $args ) {
39
- if ( ! empty( $args['id'] ) ) {
40
- $this->_our_id = $args['id'];
41
- }
42
- parent::__construct();
43
- }
44
-
45
- /**
46
- * Get remote template ID.
47
- *
48
- * Retrieve the remote template ID.
49
- *
50
- * @since 0.0.2
51
- * @access public
52
- *
53
- * @return string The remote template ID.
54
- */
55
- public function get_id() {
56
- return $this->_our_id;
57
- }
58
-
59
- /**
60
- * Get remote template title.
61
- *
62
- * Retrieve the remote template title.
63
- *
64
- * @since 0.0.2
65
- * @access public
66
- *
67
- * @return string The remote template title.
68
- */
69
- public function get_title() {
70
- return __( 'Envato Elements', 'elementor' );
71
- }
72
-
73
- /**
74
- * Register remote template data.
75
- *
76
- * Used to register custom template data like a post type, a taxonomy or any
77
- * other data.
78
- *
79
- * @since 0.0.2
80
- * @access public
81
- */
82
- public function register_data() {
83
- }
84
-
85
- /**
86
- * Get remote templates.
87
- *
88
- * @since 0.0.2
89
- * @access public
90
- *
91
- * @param array $args Optional. Filter templates list based on a set of
92
- * arguments. Default is an empty array.
93
- *
94
- * @return array Remote templates.
95
- */
96
- public function get_items( $args = [] ) {
97
-
98
- $block_manager = new \Envato_Elements\Collection_Elementor_Blocks();
99
- $all_blocks = $block_manager->get_all_blocks();
100
-
101
- $templates = [];
102
-
103
- // Testing memory limit issue.
104
- // todo: remove this and find out if our filter below can be improved
105
- \Envato_Elements\Collection_Elementor_Blocks::get_instance()->check_memory_limit();
106
-
107
- if ( $all_blocks ) {
108
- foreach ( $all_blocks['data'] as $template_data ) {
109
- $template = \Envato_Elements\Collection_Elementor_Blocks::get_instance()->filter_template( $template_data, [ 'collectionId' => $template_data['collection_id'] ] );
110
- if ( $template ) {
111
- $templates[] = [
112
- 'template_id' => $template['templateId'],
113
- 'collection_id' => $template_data['collection_id'],
114
- 'source' => 'remote',
115
- 'type' => 'block',
116
- // This is the category shown in Elementor UI:
117
- 'subtype' => ! empty( $template['templateType'] ) ? strtolower( current( $template['templateType'] ) ) : 'envato elements',
118
- 'title' => $template['templateName'],
119
- 'thumbnail' => ! empty( $template['previewThumb2x'] ) ? $template['previewThumb2x'] : $template['previewThumb'],
120
- 'date' => time(),
121
- 'human_date' => date( 'Y-m-d' ),
122
- 'author' => 'Envato',
123
- 'tags' => [ 'Envato' ],
124
- 'isPro' => ! empty( $template['templateFeatures'] ) && ! empty( $template['templateFeatures']['elementor-pro'] ),
125
- 'popularityIndex' => 9999,
126
- 'trendIndex' => 0,
127
- 'hasPageSettings' => 0,
128
- 'url' => $template['previewUrl'],
129
- 'favorite' => ! empty( $template['templateInstalled'] ),
130
- ];
131
- }
132
- }
133
- }
134
-
135
- return $templates;
136
- }
137
-
138
- /**
139
- * Get remote template.
140
- *
141
- * @since 0.0.2
142
- * @access public
143
- *
144
- * @param array $template_data Remote template data.
145
- *
146
- * @return array Remote template.
147
- */
148
- public function get_item( $template_data ) {
149
-
150
- return [];
151
- }
152
-
153
- /**
154
- * Save remote template.
155
- *
156
- * @since 0.0.2
157
- * @access public
158
- *
159
- * @param array $template_data Remote template data.
160
- *
161
- * @return bool Return false.
162
- */
163
- public function save_item( $template_data ) {
164
- return false;
165
- }
166
-
167
- /**
168
- * Update remote template.
169
- *
170
- * @since 0.0.2
171
- * @access public
172
- *
173
- * @param array $new_data New template data.
174
- *
175
- * @return bool Return false.
176
- */
177
- public function update_item( $new_data ) {
178
- return false;
179
- }
180
-
181
- /**
182
- * Delete remote template.
183
- *
184
- * @since 0.0.2
185
- * @access public
186
- *
187
- * @param int $template_id The template ID.
188
- *
189
- * @return bool Return false.
190
- */
191
- public function delete_template( $template_id ) {
192
- return false;
193
- }
194
-
195
- /**
196
- * Export remote template.
197
- *
198
- * @since 0.0.2
199
- * @access public
200
- *
201
- * @param int $template_id The template ID.
202
- *
203
- * @return bool Return false.
204
- */
205
- public function export_template( $template_id ) {
206
- return false;
207
- }
208
-
209
- /**
210
- * Get remote template data.
211
- *
212
- * @since 0.0.2
213
- * @access public
214
- *
215
- * @param array $args Custom template arguments.
216
- * @param string $context Optional. The context. Default is `display`.
217
- *
218
- * @return array Remote Template data.
219
- */
220
- public function get_data( array $args, $context = 'display' ) {
221
- // we're requesting data for a template ID, but we're unsure what collection it is in.
222
- $data = [];
223
- $template_id = $args['template_id'];
224
-
225
- $all = $this->get_items();
226
- $collection_id = false;
227
- foreach ( $all as $template ) {
228
- if ( ! empty( $template['template_id'] ) && $template['template_id'] === $template_id ) {
229
- $collection_id = $template['collection_id'];
230
- }
231
- }
232
-
233
- if ( $template_id && $collection_id ) {
234
- // we're good to pull this data down from our API.
235
- $collection = new \Envato_Elements\Collection_Elementor_Blocks();
236
- $local_template_id = $collection->schedule_remote_template_install( $collection_id, $template_id );
237
- if ( ! is_wp_error( $local_template_id ) && $local_template_id ) {
238
- $result = $collection->install_remote_template( $collection_id, $template_id );
239
-
240
- if ( $result && ! is_wp_error( $result ) && ! empty( $result['post_id'] ) ) {
241
- $document = Plugin::$instance->documents->get( $result['post_id'] );
242
- if ( $document ) {
243
- $data['content'] = $document->get_elements_raw_data( null, true );
244
- }
245
- }
246
- }
247
- }
248
-
249
- return $data;
250
- }
251
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: envato
3
  Tags: elementor, beaver builder, elements, templates
4
  Requires at least: 4.6
5
- Tested up to: 5.0.2
6
  Requires PHP: 5.6
7
- Stable tag: 0.1.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -117,6 +117,9 @@ If you have any questions or feedback for the team, please send an email to exte
117
 
118
  == Changelog ==
119
 
 
 
 
120
  = 0.1.6 - 2019-01-21 =
121
  * Feature: Popups for Elementor Pro
122
  * Improvement: Plugin menu location
@@ -163,4 +166,4 @@ If you have any questions or feedback for the team, please send an email to exte
163
  * Added a 'Photos and More' page
164
 
165
  = 0.0.6 - 2018-07-31 =
166
- * Initial release.
2
  Contributors: envato
3
  Tags: elementor, beaver builder, elements, templates
4
  Requires at least: 4.6
5
+ Tested up to: 5.1
6
  Requires PHP: 5.6
7
+ Stable tag: 0.1.7
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
117
 
118
  == Changelog ==
119
 
120
+ = 0.1.7 - 2019-01-30 =
121
+ * Fixes: Compatibility with Astra theme
122
+
123
  = 0.1.6 - 2019-01-21 =
124
  * Feature: Popups for Elementor Pro
125
  * Improvement: Plugin menu location
166
  * Added a 'Photos and More' page
167
 
168
  = 0.0.6 - 2018-07-31 =
169
+ * Initial release.
views/license/settings.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit; // Exit if accessed directly.
5
- }
6
-
7
- ?>
8
-
9
- <div>
10
-
11
- <p>
12
- Thank you for registering this product.
13
- </p>
14
-
15
- <p>
16
- <a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?action=envato_elements_deactivate' ), 'deactivate' ) ); ?>">Deactivate Website</a>
17
- </p>
18
-
19
- </div>