Cloud Templates & Patterns collection - Version 1.1.11

Version Description

Download this release

Release Info

Developer themeisle
Plugin Icon 128x128 Cloud Templates & Patterns collection
Version 1.1.11
Comparing to
See all releases

Code changes from version 1.1.10 to 1.1.11

Files changed (34) hide show
  1. CHANGELOG.md +5 -0
  2. README.md +24 -4
  3. includes/Admin.php +95 -84
  4. includes/Elementor.php +38 -38
  5. includes/Main.php +41 -34
  6. includes/TI_Beaver.php +264 -243
  7. languages/templates-patterns-collection.pot +269 -62
  8. readme.txt +24 -4
  9. templates-patterns-collection.php +24 -10
  10. vendor/autoload.php +1 -1
  11. vendor/codeinwp/themeisle-sdk/CHANGELOG.md +257 -0
  12. vendor/codeinwp/themeisle-sdk/LICENSE +674 -0
  13. vendor/codeinwp/themeisle-sdk/index.php +3 -0
  14. vendor/codeinwp/themeisle-sdk/load.php +72 -0
  15. vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php +83 -0
  16. vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php +108 -0
  17. vendor/codeinwp/themeisle-sdk/src/Loader.php +147 -0
  18. vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php +470 -0
  19. vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php +1041 -0
  20. vendor/codeinwp/themeisle-sdk/src/Modules/Logger.php +179 -0
  21. vendor/codeinwp/themeisle-sdk/src/Modules/Notification.php +463 -0
  22. vendor/codeinwp/themeisle-sdk/src/Modules/Recommendation.php +377 -0
  23. vendor/codeinwp/themeisle-sdk/src/Modules/Review.php +117 -0
  24. vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php +384 -0
  25. vendor/codeinwp/themeisle-sdk/src/Modules/Translate.php +918 -0
  26. vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php +858 -0
  27. vendor/codeinwp/themeisle-sdk/src/Product.php +421 -0
  28. vendor/codeinwp/themeisle-sdk/start.php +49 -0
  29. vendor/composer/InstalledVersions.php +16 -5
  30. vendor/composer/autoload_files.php +10 -0
  31. vendor/composer/autoload_real.php +22 -4
  32. vendor/composer/autoload_static.php +8 -4
  33. vendor/composer/installed.json +45 -1
  34. vendor/composer/installed.php +13 -4
CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
2
 
3
  - Allow user-made templates to save metadata
1
+ ##### [Version 1.1.11](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.10...v1.1.11) (2021-05-13)
2
+
3
+ * Improve translations
4
+ * Improve texts and descriptions
5
+
6
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
7
 
8
  - Allow user-made templates to save metadata
README.md CHANGED
@@ -12,12 +12,15 @@ A cloud based service with 100+ templates and starter sites for Neve theme.
12
 
13
  ## Description ##
14
 
15
- ### TEMPLATE SERVICE FOR ELEMENTOR, BEAVER BUILDER, BRIZY AND GUTENBERG, DIVI and THRIVE ###
16
 
 
 
 
17
 
18
- A cloud based templates library which enables you to create ready-made website in no time.
19
-
20
- All templates can be previewed on [demosites.io](https://demosites.io/), their import into your site is facilitated by this plugin.
21
 
22
  The plugin is relying on the service behind api.themeisle.com for accessing the template collection list and their individual structure on import.
23
 
@@ -25,8 +28,25 @@ No account is required to access the service template collection and the privacy
25
 
26
  ## Frequently Asked Questions ##
27
 
 
 
 
 
 
 
 
 
 
28
  ## Changelog ##
29
 
 
 
 
 
 
 
 
 
30
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
31
 
32
  - Allow user-made templates to save metadata
12
 
13
  ## Description ##
14
 
15
+ ### A cloud based templates library which enables you to create or use existing ready-made website with 1-click. ###
16
 
17
+ ### More than 100 Starter Sites and Templates available for the most popular page builders ###
18
+ Free and premium templates and starter sites available for top 5 page builders: Elementor, Beaver Builder, Brizy, Gutenberg, Divi and Thrive.
19
+ All templates can be previewed on [demosites.io](https://demosites.io/) and you can seamlessly import to any of your site.
20
 
21
+ ### Your own private Templates Cloud [PRO] ###
22
+ Boost productivity and speed up your workflow by saving all your designs and share them automatically to all your sites in 1-click.
23
+ Check more details about this in our [documentation](https://docs.themeisle.com/article/1354-neve-template-cloud-library) guide.
24
 
25
  The plugin is relying on the service behind api.themeisle.com for accessing the template collection list and their individual structure on import.
26
 
28
 
29
  ## Frequently Asked Questions ##
30
 
31
+ ### Does it work with any WordPress theme? ###
32
+ Right now we are supporting only [Neve](https://wordpress.org/themes/neve/) theme
33
+
34
+ ### Which starter sites and templates are free and which are not? ###
35
+ You can check the full collection on [demosites.io](https://demosites.io/)
36
+
37
+ ### Can I import just one page from one starter site? ###
38
+ Yes, you can. You can either chose to import one template or the entire starter site.
39
+
40
  ## Changelog ##
41
 
42
+ ##### [Version 1.1.11](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.10...v1.1.11) (2021-05-13)
43
+
44
+ * Improve translations
45
+ * Improve texts and descriptions
46
+
47
+
48
+
49
+
50
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
51
 
52
  - Allow user-made templates to save metadata
includes/Admin.php CHANGED
@@ -66,12 +66,43 @@ class Admin {
66
  }
67
 
68
  $prefix = defined( 'NEVE_VERSION' ) ? '<span style="' . esc_attr( $style ) . '">&crarr;</span>' : '';
69
- add_theme_page( __( 'Starter Sites', 'templates-patterns-collection' ), $prefix . __( 'Starter Sites', 'templates-patterns-collection' ), 'activate_plugins', $this->page_slug, array( $this, 'render_starter_sites' ) );
 
 
 
 
 
 
 
 
 
70
  if ( $this->is_agency_plan() ) {
71
  add_theme_page( __( 'My Library', 'templates-patterns-collection' ), $prefix . __( 'My Library', 'templates-patterns-collection' ), 'activate_plugins', 'themes.php?page=' . $this->page_slug . '#library' );
72
  }
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Render method for the starter sites page.
77
  */
@@ -105,6 +136,62 @@ class Admin {
105
  wp_enqueue_script( 'tiob' );
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  /**
109
  * Memorize the previous theme to later display the import template for it.
110
  */
@@ -154,8 +241,8 @@ class Admin {
154
  $page_was_visited = (bool) get_transient( 'tiob_library_visited' );
155
  if ( $this->is_agency_plan() && ! $page_was_visited ) {
156
  $array['notifications']['template-cloud'] = array(
157
- 'text' => __( 'Great news! Now you can export your own custom designs to the cloud and then reuse them on other sites.', 'neve' ),
158
- 'cta' => __( 'Open Templates Cloud', 'neve' ),
159
  'url' => 'themes.php?page=' . $this->page_slug . '&dismiss_notice=yes#library',
160
  );
161
  }
@@ -163,27 +250,6 @@ class Admin {
163
  return $array;
164
  }
165
 
166
- /**
167
- * Check if current subscription is agency.
168
- *
169
- * @return bool
170
- */
171
- private function is_agency_plan() {
172
- $category = apply_filters( 'product_neve_license_plan', -1 );
173
- $category_mapping = array(
174
- 1 => 1,
175
- 2 => 1,
176
- 3 => 2,
177
- 4 => 2,
178
- 5 => 3,
179
- 6 => 3,
180
- 7 => 1,
181
- 8 => 2,
182
- 9 => 3,
183
- );
184
- return isset( $category_mapping[ $category ] ) && $category_mapping[ $category ] === 3;
185
- }
186
-
187
  /**
188
  * Get all the sites data.
189
  *
@@ -296,7 +362,6 @@ class Admin {
296
  return $theme_object->get( 'Template' );
297
  }
298
 
299
-
300
  /**
301
  * Get strings.
302
  *
@@ -332,84 +397,30 @@ class Admin {
332
  'download_error_log' => __( 'Download error log', 'templates-patterns-collection' ),
333
  'external_plugins_notice' => __( 'To import this demo you have to install the following plugins:', 'templates-patterns-collection' ),
334
  'rest_not_working' => sprintf(
335
- /* translators: 1 - 'here'. */
336
  __( 'It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s.', 'templates-patterns-collection' ),
337
  sprintf( '<a href="https://docs.themeisle.com/article/1157-starter-sites-library-import-is-not-working#rest-api">%1$s<i class="dashicons dashicons-external"></i></a>', __( 'here', 'templates-patterns-collection' ) )
338
  ),
339
  'error_report' => sprintf(
340
- /* translators: 1 - 'get in touch'. */
341
  __( 'Hi! It seems there is a configuration issue with your server that\'s causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this.', 'templates-patterns-collection' ),
342
  sprintf( '<a href="https://themeisle.com/contact">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'get in touch', 'templates-patterns-collection' ) )
343
  ),
344
  'troubleshooting' => sprintf(
345
- /* translators: 1 - 'troubleshooting guide'. */
346
  __( 'Hi! It seems there is a configuration issue with your server that\'s causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work.', 'templates-patterns-collection' ),
347
  sprintf( '<a href="https://docs.themeisle.com/article/1157-starter-sites-library-import-is-not-working">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'troubleshooting guide', 'templates-patterns-collection' ) )
348
  ),
349
  'support' => sprintf(
350
- /* translators: 1 - 'get in touch'. */
351
  __( 'If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this.', 'templates-patterns-collection' ),
352
  sprintf( '<a href="https://themeisle.com/contact">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'get in touch', 'templates-patterns-collection' ) )
353
  ),
354
  'fsDown' => sprintf(
355
- /* translators: %s - 'WP_Filesystem'. */
356
  __( 'It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it.', 'templates-patterns-collection' ),
357
  sprintf( '<code>WP_Filesystem</code>' )
358
  ),
359
  );
360
  }
361
-
362
- /**
363
- * Get localization data for the dashboard script.
364
- *
365
- * @return array
366
- */
367
- private function get_localization() {
368
- $theme_name = apply_filters( 'ti_wl_theme_name', 'Neve' );
369
- return array(
370
- 'nonce' => wp_create_nonce( 'wp_rest' ),
371
- 'assets' => TIOB_URL . '/assets/',
372
- 'upgradeURL' => esc_url( apply_filters( 'neve_upgrade_link_from_child_theme_filter', 'https://themeisle.com/themes/neve/upgrade/?utm_medium=aboutneve&utm_source=freevspro&utm_campaign=neve' ) ),
373
- 'strings' => array(
374
- /* translators: %s - Theme name */
375
- 'starterSitesTabDescription' => __( 'Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else.', 'templates-patterns-collection' ),
376
- ),
377
- 'onboarding' => array(),
378
- 'hasFileSystem' => WP_Filesystem(),
379
- 'themesURL' => admin_url( 'themes.php' ),
380
- 'themeAction' => $this->get_theme_action(),
381
- 'brandedTheme' => isset( $this->wl_config['theme_name'] ) ? $this->wl_config['theme_name'] : false,
382
- 'endpoint' => TPC_TEMPLATES_CLOUD_ENDPOINT,
383
- 'params' => array(
384
- 'site_url' => get_site_url(),
385
- 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
386
- ),
387
- );
388
- }
389
-
390
- /**
391
- * Gets theme action.
392
- */
393
- private function get_theme_action() {
394
- if ( defined( 'NEVE_VERSION' ) ) {
395
- return false;
396
- }
397
-
398
- $themes = wp_get_themes();
399
- foreach ( $themes as $theme_slug => $args ) {
400
- $theme = wp_get_theme( $theme_slug );
401
- if ( $theme->get( 'TextDomain' ) === 'neve' ) {
402
- return array(
403
- 'action' => 'activate',
404
- 'slug' => $theme_slug,
405
- 'nonce' => wp_create_nonce( 'switch-theme_' . $theme_slug ),
406
- );
407
- }
408
- }
409
- return array(
410
- 'action' => 'install',
411
- 'slug' => 'neve',
412
- 'nonce' => wp_create_nonce( 'switch-theme_neve' ),
413
- );
414
- }
415
  }
66
  }
67
 
68
  $prefix = defined( 'NEVE_VERSION' ) ? '<span style="' . esc_attr( $style ) . '">&crarr;</span>' : '';
69
+ add_theme_page(
70
+ __( 'Starter Sites', 'templates-patterns-collection' ),
71
+ $prefix . __( 'Starter Sites', 'templates-patterns-collection' ),
72
+ 'activate_plugins',
73
+ $this->page_slug,
74
+ array(
75
+ $this,
76
+ 'render_starter_sites',
77
+ )
78
+ );
79
  if ( $this->is_agency_plan() ) {
80
  add_theme_page( __( 'My Library', 'templates-patterns-collection' ), $prefix . __( 'My Library', 'templates-patterns-collection' ), 'activate_plugins', 'themes.php?page=' . $this->page_slug . '#library' );
81
  }
82
  }
83
 
84
+ /**
85
+ * Check if current subscription is agency.
86
+ *
87
+ * @return bool
88
+ */
89
+ private function is_agency_plan() {
90
+ $category = apply_filters( 'product_neve_license_plan', - 1 );
91
+ $category_mapping = array(
92
+ 1 => 1,
93
+ 2 => 1,
94
+ 3 => 2,
95
+ 4 => 2,
96
+ 5 => 3,
97
+ 6 => 3,
98
+ 7 => 1,
99
+ 8 => 2,
100
+ 9 => 3,
101
+ );
102
+
103
+ return isset( $category_mapping[ $category ] ) && $category_mapping[ $category ] === 3;
104
+ }
105
+
106
  /**
107
  * Render method for the starter sites page.
108
  */
136
  wp_enqueue_script( 'tiob' );
137
  }
138
 
139
+ /**
140
+ * Get localization data for the dashboard script.
141
+ *
142
+ * @return array
143
+ */
144
+ private function get_localization() {
145
+ $theme_name = apply_filters( 'ti_wl_theme_name', 'Neve' );
146
+
147
+ return array(
148
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
149
+ 'assets' => TIOB_URL . '/assets/',
150
+ 'upgradeURL' => esc_url( apply_filters( 'neve_upgrade_link_from_child_theme_filter', 'https://themeisle.com/themes/neve/upgrade/?utm_medium=aboutneve&utm_source=freevspro&utm_campaign=neve' ) ),
151
+ 'strings' => array(
152
+ /* translators: %s - Theme name */
153
+ 'starterSitesTabDescription' => __( 'Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else.', 'templates-patterns-collection' ),
154
+ ),
155
+ 'onboarding' => array(),
156
+ 'hasFileSystem' => WP_Filesystem(),
157
+ 'themesURL' => admin_url( 'themes.php' ),
158
+ 'themeAction' => $this->get_theme_action(),
159
+ 'brandedTheme' => isset( $this->wl_config['theme_name'] ) ? $this->wl_config['theme_name'] : false,
160
+ 'endpoint' => TPC_TEMPLATES_CLOUD_ENDPOINT,
161
+ 'params' => array(
162
+ 'site_url' => get_site_url(),
163
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
164
+ ),
165
+ );
166
+ }
167
+
168
+ /**
169
+ * Gets theme action.
170
+ */
171
+ private function get_theme_action() {
172
+ if ( defined( 'NEVE_VERSION' ) ) {
173
+ return false;
174
+ }
175
+
176
+ $themes = wp_get_themes();
177
+ foreach ( $themes as $theme_slug => $args ) {
178
+ $theme = wp_get_theme( $theme_slug );
179
+ if ( $theme->get( 'TextDomain' ) === 'neve' ) {
180
+ return array(
181
+ 'action' => 'activate',
182
+ 'slug' => $theme_slug,
183
+ 'nonce' => wp_create_nonce( 'switch-theme_' . $theme_slug ),
184
+ );
185
+ }
186
+ }
187
+
188
+ return array(
189
+ 'action' => 'install',
190
+ 'slug' => 'neve',
191
+ 'nonce' => wp_create_nonce( 'switch-theme_neve' ),
192
+ );
193
+ }
194
+
195
  /**
196
  * Memorize the previous theme to later display the import template for it.
197
  */
241
  $page_was_visited = (bool) get_transient( 'tiob_library_visited' );
242
  if ( $this->is_agency_plan() && ! $page_was_visited ) {
243
  $array['notifications']['template-cloud'] = array(
244
+ 'text' => __( 'Great news! Now you can export your own custom designs to the cloud and then reuse them on other sites.', 'templates-patterns-collection' ),
245
+ 'cta' => sprintf( __( 'Open %s', 'templates-patterns-collection' ), 'Templates Cloud' ),
246
  'url' => 'themes.php?page=' . $this->page_slug . '&dismiss_notice=yes#library',
247
  );
248
  }
250
  return $array;
251
  }
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  /**
254
  * Get all the sites data.
255
  *
362
  return $theme_object->get( 'Template' );
363
  }
364
 
 
365
  /**
366
  * Get strings.
367
  *
397
  'download_error_log' => __( 'Download error log', 'templates-patterns-collection' ),
398
  'external_plugins_notice' => __( 'To import this demo you have to install the following plugins:', 'templates-patterns-collection' ),
399
  'rest_not_working' => sprintf(
400
+ /* translators: 1 - 'here'. */
401
  __( 'It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s.', 'templates-patterns-collection' ),
402
  sprintf( '<a href="https://docs.themeisle.com/article/1157-starter-sites-library-import-is-not-working#rest-api">%1$s<i class="dashicons dashicons-external"></i></a>', __( 'here', 'templates-patterns-collection' ) )
403
  ),
404
  'error_report' => sprintf(
405
+ /* translators: 1 - 'get in touch'. */
406
  __( 'Hi! It seems there is a configuration issue with your server that\'s causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this.', 'templates-patterns-collection' ),
407
  sprintf( '<a href="https://themeisle.com/contact">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'get in touch', 'templates-patterns-collection' ) )
408
  ),
409
  'troubleshooting' => sprintf(
410
+ /* translators: 1 - 'troubleshooting guide'. */
411
  __( 'Hi! It seems there is a configuration issue with your server that\'s causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work.', 'templates-patterns-collection' ),
412
  sprintf( '<a href="https://docs.themeisle.com/article/1157-starter-sites-library-import-is-not-working">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'troubleshooting guide', 'templates-patterns-collection' ) )
413
  ),
414
  'support' => sprintf(
415
+ /* translators: 1 - 'get in touch'. */
416
  __( 'If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this.', 'templates-patterns-collection' ),
417
  sprintf( '<a href="https://themeisle.com/contact">%1$s <i class="dashicons dashicons-external"></i></a>', __( 'get in touch', 'templates-patterns-collection' ) )
418
  ),
419
  'fsDown' => sprintf(
420
+ /* translators: %s - 'WP_Filesystem'. */
421
  __( 'It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it.', 'templates-patterns-collection' ),
422
  sprintf( '<code>WP_Filesystem</code>' )
423
  ),
424
  );
425
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  }
includes/Elementor.php CHANGED
@@ -56,55 +56,55 @@ class Elementor {
56
  'postType' => get_post_type(),
57
  'placeholderIndex' => '-1',
58
  'exporter' => array(
59
- 'exportLabel' => __( 'Save to Neve Cloud' ),
60
- 'modalLabel' => __( 'Save Templates' ),
61
- 'textLabel' => __( 'Template Name' ),
62
- 'textPlaceholder' => __( 'Template' ),
63
- 'buttonLabel' => __( 'Save' ),
64
- 'toggleLabel' => __( 'Automatically sync to the cloud' ),
65
- 'templateSaved' => __( 'Template Saved.' ),
66
- 'templatePublished' => __( 'Template Published.' ),
67
- 'templateUnpublished' => __( 'Template Unpublished.' ),
68
  ),
69
  'library' => array(
70
- 'libraryButton' => __( 'Import from Templates Cloud' ),
71
- 'templatesCloud' => __( 'Templates Cloud' ),
72
- 'historyMessage' => __( 'Add Template from Templates Cloud:' ),
73
  'tabs' => array(
74
- 'templates' => __( 'Page Templates' ),
75
- 'library' => __( 'My Library' ),
76
  ),
77
  'actions' => array(
78
- 'sync' => __( 'Sync Library' ),
79
- 'save' => __( 'Save to Neve Cloud' ),
80
- 'close' => __( 'Close' ),
81
- 'cancel' => __( 'Cancel' ),
82
- 'edit' => __( 'Edit' ),
83
- 'duplicate' => __( 'Duplicate' ),
84
- 'delete' => __( 'Delete' ),
85
- 'insert' => __( 'Insert' ),
86
- 'back' => __( 'Back to Library' ),
87
  ),
88
  'filters' => array(
89
- 'sortLabel' => __( 'Sory by' ),
90
  'sortLabels' => array(
91
- 'name' => __( 'Name' ),
92
- 'date' => __( 'Date' ),
93
- 'modified' => __( 'Last Modified' ),
94
- 'actions' => __( 'Actions' ),
95
  ),
96
- 'search' => __( 'Search' ),
97
- 'searchLabel' => __( 'Search Templates' ),
98
  ),
99
  'export' => array(
100
- 'save' => __( 'Save' ),
101
- 'title' => __( 'Save your page to Templates Cloud' ),
102
- 'placeholder' => __( 'Enter Template Name' ),
103
- 'labelScreenshot' => __( 'Screenshot URL' ),
104
- 'labelSlug' => __( 'Site Slug' ),
105
- 'publish' => __( 'Publish' ),
106
- 'unpublish' => __( 'Unpublish' ),
107
- 'defaultTitle' => __( 'Template' ),
108
  ),
109
  ),
110
  )
56
  'postType' => get_post_type(),
57
  'placeholderIndex' => '-1',
58
  'exporter' => array(
59
+ 'exportLabel' => sprintf( __( 'Save to %s', 'templates-patterns-collection' ), 'Neve Cloud' ),
60
+ 'modalLabel' => __( 'Save Templates', 'templates-patterns-collection' ),
61
+ 'textLabel' => __( 'Template Name', 'templates-patterns-collection' ),
62
+ 'textPlaceholder' => __( 'Template', 'templates-patterns-collection' ),
63
+ 'buttonLabel' => __( 'Save', 'templates-patterns-collection' ),
64
+ 'toggleLabel' => __( 'Automatically sync to the cloud', 'templates-patterns-collection' ),
65
+ 'templateSaved' => __( 'Template Saved.', 'templates-patterns-collection' ),
66
+ 'templatePublished' => __( 'Template Published.', 'templates-patterns-collection' ),
67
+ 'templateUnpublished' => __( 'Template Unpublished.', 'templates-patterns-collection' ),
68
  ),
69
  'library' => array(
70
+ 'libraryButton' => sprintf( __( 'Import from %s', 'templates-patterns-collection' ), 'Templates Cloud' ),
71
+ 'templatesCloud' => 'Templates Cloud',
72
+ 'historyMessage' => sprintf( __( 'Add Template from %s:', 'templates-patterns-collection' ), 'Templates Cloud' ),
73
  'tabs' => array(
74
+ 'templates' => __( 'Page Templates', 'templates-patterns-collection' ),
75
+ 'library' => __( 'My Library', 'templates-patterns-collection' ),
76
  ),
77
  'actions' => array(
78
+ 'sync' => __( 'Sync Library', 'templates-patterns-collection' ),
79
+ 'save' => sprintf( __( 'Save to %s', 'templates-patterns-collection' ), 'Neve Cloud' ),
80
+ 'close' => __( 'Close', 'templates-patterns-collection' ),
81
+ 'cancel' => __( 'Cancel', 'templates-patterns-collection' ),
82
+ 'edit' => __( 'Edit', 'templates-patterns-collection' ),
83
+ 'duplicate' => __( 'Duplicate', 'templates-patterns-collection' ),
84
+ 'delete' => __( 'Delete', 'templates-patterns-collection' ),
85
+ 'insert' => __( 'Insert', 'templates-patterns-collection' ),
86
+ 'back' => __( 'Back to Library', 'templates-patterns-collection' ),
87
  ),
88
  'filters' => array(
89
+ 'sortLabel' => __( 'Sort by', 'templates-patterns-collection' ),
90
  'sortLabels' => array(
91
+ 'name' => __( 'Name', 'templates-patterns-collection' ),
92
+ 'date' => __( 'Date', 'templates-patterns-collection' ),
93
+ 'modified' => __( 'Last Modified', 'templates-patterns-collection' ),
94
+ 'actions' => __( 'Actions', 'templates-patterns-collection' ),
95
  ),
96
+ 'search' => __( 'Search', 'templates-patterns-collection' ),
97
+ 'searchLabel' => __( 'Search Templates', 'templates-patterns-collection' ),
98
  ),
99
  'export' => array(
100
+ 'save' => __( 'Save', 'templates-patterns-collection' ),
101
+ 'title' => sprintf( __( 'Save your page to %s', 'templates-patterns-collection' ), 'Templates Cloud' ),
102
+ 'placeholder' => __( 'Enter Template Name', 'templates-patterns-collection' ),
103
+ 'labelScreenshot' => __( 'Screenshot URL', 'templates-patterns-collection' ),
104
+ 'labelSlug' => __( 'Site Slug', 'templates-patterns-collection' ),
105
+ 'publish' => __( 'Publish', 'templates-patterns-collection' ),
106
+ 'unpublish' => __( 'Unpublish', 'templates-patterns-collection' ),
107
+ 'defaultTitle' => __( 'Template', 'templates-patterns-collection' ),
108
  ),
109
  ),
110
  )
includes/Main.php CHANGED
@@ -18,7 +18,7 @@ class Main {
18
  *
19
  * @var string Version string.
20
  */
21
- const VERSION = '1.1.10';
22
  /**
23
  * Sites Library API URL.
24
  *
@@ -99,7 +99,15 @@ class Main {
99
  $this->setup_beaver();
100
  $this->setup_elementor();
101
  $this->setup_sites_listing();
102
-
 
 
 
 
 
 
 
 
103
  if ( ! $this->should_load() ) {
104
  return;
105
  }
@@ -108,71 +116,70 @@ class Main {
108
  }
109
 
110
  /**
111
- * Utility to check if sites library should be loaded.
112
  *
113
- * @return bool
114
  */
115
- private function should_load() {
116
- if ( ! current_user_can( 'manage_options' ) ) {
117
- return false;
118
- }
119
-
120
- return true;
121
  }
122
 
123
  /**
124
- * Setup sites listing.
125
  *
126
  * @return void
127
  */
128
- private function setup_sites_listing() {
129
- $this->sites_listing = new Sites_Listing();
130
- $this->sites_listing->init();
 
 
 
 
131
  }
132
 
133
  /**
134
- * Setup admin functionality.
135
  *
136
  * @return void
137
  */
138
- private function setup_admin() {
139
- $this->admin = new Admin();
140
- $this->admin->init();
141
  }
142
 
143
  /**
144
- * Setup editor functionality.
145
  *
146
  * @return void
147
  */
148
- private function setup_editor() {
149
- $this->editor = new Editor();
150
- $this->editor->init();
151
  }
152
 
153
-
154
  /**
155
- * Setup beaver functionality.
156
  *
157
- * @return void
158
  */
159
- private function setup_beaver() {
160
- if ( ! class_exists( 'FLBuilder' ) ) {
161
- return;
162
  }
163
 
164
- $this->beaver = new TI_Beaver();
165
- $this->beaver->init();
166
  }
167
 
168
  /**
169
- * Setup Elementor functionality.
170
  *
171
  * @return void
172
  */
173
- private function setup_elementor() {
174
- $this->elementor = new Elementor();
175
- $this->elementor->init();
176
  }
177
 
178
  /**
18
  *
19
  * @var string Version string.
20
  */
21
+ const VERSION = '1.1.11';
22
  /**
23
  * Sites Library API URL.
24
  *
99
  $this->setup_beaver();
100
  $this->setup_elementor();
101
  $this->setup_sites_listing();
102
+ add_filter( 'themeisle_sdk_hide_dashboard_widget', '__return_true' );
103
+ add_filter(
104
+ 'templates_patterns_collection_feedback_review_message',
105
+ function ( $message ) {
106
+ $message = "Hey, it's great to see you are using <strong>Neve</strong>'s Starter Sites and Templates for a few days now. Which one is your favourite? If you can spare a few moments to rate our work on WordPress.org it would help us a lot (and boost our motivation). Cheers!<br/><br/>
107
+ ~ Mihai, curator of Neve's Starter Sites";
108
+ return $message;
109
+ }
110
+ );
111
  if ( ! $this->should_load() ) {
112
  return;
113
  }
116
  }
117
 
118
  /**
119
+ * Setup editor functionality.
120
  *
121
+ * @return void
122
  */
123
+ private function setup_editor() {
124
+ $this->editor = new Editor();
125
+ $this->editor->init();
 
 
 
126
  }
127
 
128
  /**
129
+ * Setup beaver functionality.
130
  *
131
  * @return void
132
  */
133
+ private function setup_beaver() {
134
+ if ( ! class_exists( 'FLBuilder' ) ) {
135
+ return;
136
+ }
137
+
138
+ $this->beaver = new TI_Beaver();
139
+ $this->beaver->init();
140
  }
141
 
142
  /**
143
+ * Setup Elementor functionality.
144
  *
145
  * @return void
146
  */
147
+ private function setup_elementor() {
148
+ $this->elementor = new Elementor();
149
+ $this->elementor->init();
150
  }
151
 
152
  /**
153
+ * Setup sites listing.
154
  *
155
  * @return void
156
  */
157
+ private function setup_sites_listing() {
158
+ $this->sites_listing = new Sites_Listing();
159
+ $this->sites_listing->init();
160
  }
161
 
 
162
  /**
163
+ * Utility to check if sites library should be loaded.
164
  *
165
+ * @return bool
166
  */
167
+ private function should_load() {
168
+ if ( ! current_user_can( 'manage_options' ) ) {
169
+ return false;
170
  }
171
 
172
+ return true;
 
173
  }
174
 
175
  /**
176
+ * Setup admin functionality.
177
  *
178
  * @return void
179
  */
180
+ private function setup_admin() {
181
+ $this->admin = new Admin();
182
+ $this->admin->init();
183
  }
184
 
185
  /**
includes/TI_Beaver.php CHANGED
@@ -47,148 +47,18 @@ class TI_Beaver extends FLBuilderModule {
47
  $this->add_css( 'ti-tpc-beaver', $this->url . 'build/index.css', array( 'wp-components' ), $deps['version'] );
48
  }
49
 
50
- /**
51
- * Initialize the Editor.
52
- */
53
- public function init() {
54
- FLBuilderAJAX::add_action( 'ti_get_position', __CLASS__ . '::get_position', array( 'node' ) );
55
- FLBuilderAJAX::add_action( 'ti_apply_template', __CLASS__ . '::apply_template', array( 'template', 'position' ) );
56
- FLBuilderAJAX::add_action( 'ti_export_template', __CLASS__ . '::export_template', array( 'node', 'title' ) );
57
- FLBuilderAJAX::add_action( 'ti_export_page_template', __CLASS__ . '::export_page_template', array( 'is_sync' ) );
58
- FLBuilderAJAX::add_action( 'ti_publish_template', __CLASS__ . '::publish_template', array( 'slug', 'screenshot', 'premade' ) );
59
-
60
- add_action( 'wp_head', array( $this, 'inline_script' ), 9 );
61
- add_action( 'fl_builder_before_save_layout', array( $this, 'update_published_template' ), 10, 4 );
62
-
63
- $is_pro = apply_filters( 'product_neve_license_key', 'free' );
64
-
65
- if ( $is_pro === 'free' ) {
66
- return;
67
- }
68
-
69
- add_filter( 'fl_builder_main_menu', array( $this, 'add_export_menu' ), 10, 1 );
70
- }
71
-
72
- /**
73
- * Template Meta.
74
- */
75
- static public function get_template_meta() {
76
- $post_id = FLBuilderModel::get_post_id();
77
- return Main::get_meta_fields( $post_id, $type = 'beaver' );
78
- }
79
-
80
- /**
81
- * Add strings as global variable.
82
- */
83
- public function inline_script() {
84
- $ti_tpc = apply_filters(
85
- 'ti_tpc_editor_data',
86
- array(
87
- 'endpoint' => TPC_TEMPLATES_CLOUD_ENDPOINT,
88
- 'params' => array(
89
- 'site_url' => get_site_url(),
90
- 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
91
- 'type' => 'beaver',
92
- ),
93
- 'canPredefine' => apply_filters( 'ti_tpc_can_predefine', false ),
94
- 'pageTitle' => get_the_title(),
95
- 'postType' => get_post_type(),
96
- 'postTypes' => FLBuilderModel::get_post_types(),
97
- 'postMeta' => array(
98
- '_ti_tpc_template_sync' => get_post_meta( get_the_ID(), '_ti_tpc_template_sync', true ),
99
- '_ti_tpc_screenshot_url' => get_post_meta( get_the_ID(), '_ti_tpc_screenshot_url', true ),
100
- '_ti_tpc_site_slug' => get_post_meta( get_the_ID(), '_ti_tpc_site_slug', true ),
101
- '_ti_tpc_published' => get_post_meta( get_the_ID(), '_ti_tpc_published', true ),
102
- ),
103
- 'exporter' => array(
104
- 'modalLabel' => __( 'Save Templates' ),
105
- 'textLabel' => __( 'Template Name' ),
106
- 'textPlaceholder' => __( 'Template' ),
107
- 'buttonLabel' => __( 'Save' ),
108
- 'toggleLabel' => __( 'Automatically sync to the cloud' ),
109
- 'cancelLabel' => __( 'Cancel' ),
110
- 'importFailed' => __( 'Import Failed' ),
111
- 'exportFailed' => __( 'Export Failed' ),
112
- ),
113
- 'library' => array(
114
- 'templatesCloud' => __( 'Templates Cloud' ),
115
- '404' => __( 'No templates available. Add a new one?' ),
116
- 'deleteItem' => __( 'Are you sure you want to delete this template?' ),
117
- 'synced' => __( 'This template is synced to a page.' ),
118
- 'tabs' => array(
119
- 'templates' => __( 'Page Templates' ),
120
- 'library' => __( 'My Library' ),
121
- ),
122
- 'actions' => array(
123
- 'sync' => __( 'Sync Library' ),
124
- 'save' => __( 'Save to Neve Cloud' ),
125
- 'update' => __( 'Update' ),
126
- 'close' => __( 'Close' ),
127
- 'edit' => __( 'Edit' ),
128
- 'delete' => __( 'Delete' ),
129
- 'deleting' => __( 'Deleting' ),
130
- 'preview' => __( 'Preview' ),
131
- 'import' => __( 'Import' ),
132
- ),
133
- 'filters' => array(
134
- 'sortLabel' => __( 'Sort by' ),
135
- 'sortLabels' => array(
136
- 'name' => __( 'Name' ),
137
- 'date' => __( 'Date' ),
138
- 'modified' => __( 'Last Modified' ),
139
- 'actions' => __( 'Actions' ),
140
- 'list' => __( 'List View' ),
141
- 'grid' => __( 'Grid View' ),
142
- ),
143
- 'search' => __( 'Search' ),
144
- 'searchLabel' => __( 'Search Templates' ),
145
- 'clearSearch' => __( 'Clear search query' ),
146
- ),
147
- 'export' => array(
148
- 'save' => __( 'Save' ),
149
- 'title' => __( 'Save your page to Templates Cloud' ),
150
- 'labelScreenshot' => __( 'Screenshot URL' ),
151
- 'labelSlug' => __( 'Site Slug' ),
152
- 'publish' => __( 'Publish' ),
153
- 'unpublish' => __( 'Unpublish' ),
154
- ),
155
- ),
156
- )
157
- );
158
- ?>
159
- <script type="text/javascript">
160
- window.tiTpc = <?php echo json_encode( $ti_tpc ); ?>;
161
- </script>
162
- <?php
163
- }
164
-
165
- /**
166
- * Properly serialize JSON output.
167
- */
168
- static public function serialize_corrector( $serialized_string ) {
169
- // at first, check if "fixing" is really needed at all. After that, security checkup.
170
- if ( @unserialize( $serialized_string ) !== true && preg_match( '/^[aOs]:/', $serialized_string ) ) {
171
- $serialized_string = preg_replace_callback(
172
- '/s\:(\d+)\:\"(.*?)\";/s',
173
- function ( $matches ) {
174
- return 's:' . strlen( $matches[2] ) . ':"' . $matches[2] . '";';
175
- },
176
- $serialized_string
177
- );
178
- }
179
- return $serialized_string;
180
- }
181
-
182
  /**
183
  * Get position of node.
184
  */
185
  static public function get_position( $node ) {
186
  if ( empty( $node ) ) {
187
  $row_position = FLBuilderModel::next_node_position( 'row' );
 
188
  return $row_position;
189
  }
190
 
191
  $row = FLBuilderModel::get_node_parent_by_type( $node, 'row' );
 
192
  return $row->position;
193
  }
194
 
@@ -216,7 +86,7 @@ class TI_Beaver extends FLBuilderModule {
216
  foreach ( $response->nodes as $node_id => $node ) {
217
  if ( 'row' === $node->type ) {
218
  $response->nodes[ $node_id ]->position += $row_position;
219
- $new_items_count++;
220
  }
221
  }
222
 
@@ -262,69 +132,48 @@ class TI_Beaver extends FLBuilderModule {
262
  }
263
 
264
  /**
265
- * Add export menu to Beaver Row's context.
266
  */
267
- public function add_export_menu( $views ) {
268
- if ( in_array( get_post_type(), FLBuilderModel::get_post_types() ) ) {
269
- $views['main']['items'][15] = array(
270
- 'label' => __( 'Save to Neve Cloud', 'templates-patterns-collection' ),
271
- 'type' => 'event',
272
- 'eventName' => 'tiTpcExport',
273
- );
274
- }
 
275
 
276
- return $views;
277
- }
 
278
 
279
- /**
280
- * Export row template.
281
- */
282
- static public function export_template( $node, $title ) {
283
- $row = FLBuilderModel::get_node( $node );
284
- $nodes = FLBuilderModel::get_nested_nodes( $node );
285
- $post_id = FLBuilderModel::get_post_id();
286
- $nodes[ $row->node ] = $row;
287
- $obj = new \stdClass();
288
- $obj->nodes = $nodes;
289
- $body = serialize( $obj );
290
- return self::save_template( $title, $body );
291
- }
292
 
293
- /**
294
- * Export page template.
295
- */
296
- static public function export_page_template( $is_sync ) {
297
- $title = get_the_title();
298
- $title = empty( $title ) ? __( 'Template', 'templates-patterns-collection' ) : $title;
299
- $nodes = FLBuilderModel::get_layout_data();
300
- $settings = FLBuilderModel::get_layout_settings();
301
- $obj = new \stdClass();
302
- $obj->nodes = $nodes;
303
- $obj->settings = $settings;
304
- $body = serialize( $obj );
305
- $post_id = FLBuilderModel::get_post_id();
306
- $template_id = get_post_meta( $post_id, '_ti_tpc_template_id', true );
307
 
308
- if ( ! empty( $template_id ) && self::get_template( $template_id ) ) {
309
- return self::update_template( $template_id, $title, $body, $is_sync );
310
- } else {
311
- return self::save_template( $title, $body, true, $is_sync );
312
- }
313
  }
314
 
315
  /**
316
- * Update published templates.
317
  */
318
- public function update_published_template( $post_id, $publish, $data, $settings ) {
319
- if ( ! $publish ) {
320
- return false;
 
 
 
 
 
 
 
321
  }
322
 
323
- $is_sync = get_post_meta( intval( $post_id ), '_ti_tpc_template_sync', true );
324
-
325
- if ( $is_sync ) {
326
- return self::export_page_template( true );
327
- }
328
  }
329
 
330
  /**
@@ -356,29 +205,18 @@ class TI_Beaver extends FLBuilderModule {
356
  }
357
 
358
  /**
359
- * Get template content by ID.
360
  */
361
- static public function get_template_content( $template_id ) {
362
- $url = add_query_arg(
363
- array(
364
- 'site_url' => get_site_url(),
365
- 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
366
- 'cache' => uniqid(),
367
- ),
368
- TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . $template_id . '/import'
369
- );
370
-
371
- $response = wp_remote_get( esc_url_raw( $url ) );
372
- $response = wp_remote_retrieve_body( $response );
373
- $response = json_decode( $response, true );
374
-
375
- if ( isset( $response['message'] ) ) {
376
- return wp_send_json_error( $response['message'] );
377
- }
378
 
379
- $response = self::serialize_corrector( $response );
380
- $response = unserialize( $response );
381
- return $response;
382
  }
383
 
384
  /**
@@ -426,46 +264,12 @@ class TI_Beaver extends FLBuilderModule {
426
  }
427
 
428
  /**
429
- * Update Beaver template to Templates Cloud.
430
  */
431
- static public function update_template( $template_id, $title, $body, $is_sync = false ) {
432
- $post_id = FLBuilderModel::get_post_id();
433
-
434
- $premade = get_post_meta( get_the_ID(), '_ti_tpc_published', true );
435
-
436
- $url = add_query_arg(
437
- array(
438
- 'site_url' => get_site_url(),
439
- 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
440
- 'template_name' => esc_attr( $title ),
441
- 'template_type' => 'beaver',
442
- 'link' => get_permalink( $post_id ),
443
- 'cache' => uniqid(),
444
- 'meta' => json_encode( self::get_template_meta() ),
445
- ),
446
- TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . esc_attr( $template_id )
447
- );
448
-
449
- $response = wp_safe_remote_post(
450
- $url,
451
- array(
452
- 'body' => json_encode( $body ),
453
- )
454
- );
455
-
456
- $response = wp_remote_retrieve_body( $response );
457
- $response = json_decode( $response, true );
458
-
459
- if ( isset( $response['message'] ) ) {
460
- return wp_send_json_error( $response['message'] );
461
- }
462
-
463
  $post_id = FLBuilderModel::get_post_id();
464
 
465
- update_post_meta( $post_id, '_ti_tpc_template_sync', $is_sync );
466
- update_post_meta( $post_id, '_ti_tpc_template_id', $template_id );
467
-
468
- return $response;
469
  }
470
 
471
  /**
@@ -513,6 +317,223 @@ class TI_Beaver extends FLBuilderModule {
513
 
514
  return $response;
515
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
 
518
  FLBuilder::register_module( 'TIOB\TI_Beaver', array() );
47
  $this->add_css( 'ti-tpc-beaver', $this->url . 'build/index.css', array( 'wp-components' ), $deps['version'] );
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Get position of node.
52
  */
53
  static public function get_position( $node ) {
54
  if ( empty( $node ) ) {
55
  $row_position = FLBuilderModel::next_node_position( 'row' );
56
+
57
  return $row_position;
58
  }
59
 
60
  $row = FLBuilderModel::get_node_parent_by_type( $node, 'row' );
61
+
62
  return $row->position;
63
  }
64
 
86
  foreach ( $response->nodes as $node_id => $node ) {
87
  if ( 'row' === $node->type ) {
88
  $response->nodes[ $node_id ]->position += $row_position;
89
+ $new_items_count ++;
90
  }
91
  }
92
 
132
  }
133
 
134
  /**
135
+ * Get template content by ID.
136
  */
137
+ static public function get_template_content( $template_id ) {
138
+ $url = add_query_arg(
139
+ array(
140
+ 'site_url' => get_site_url(),
141
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
142
+ 'cache' => uniqid(),
143
+ ),
144
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . $template_id . '/import'
145
+ );
146
 
147
+ $response = wp_remote_get( esc_url_raw( $url ) );
148
+ $response = wp_remote_retrieve_body( $response );
149
+ $response = json_decode( $response, true );
150
 
151
+ if ( isset( $response['message'] ) ) {
152
+ return wp_send_json_error( $response['message'] );
153
+ }
 
 
 
 
 
 
 
 
 
 
154
 
155
+ $response = self::serialize_corrector( $response );
156
+ $response = unserialize( $response );
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
+ return $response;
 
 
 
 
159
  }
160
 
161
  /**
162
+ * Properly serialize JSON output.
163
  */
164
+ static public function serialize_corrector( $serialized_string ) {
165
+ // at first, check if "fixing" is really needed at all. After that, security checkup.
166
+ if ( @unserialize( $serialized_string ) !== true && preg_match( '/^[aOs]:/', $serialized_string ) ) {
167
+ $serialized_string = preg_replace_callback(
168
+ '/s\:(\d+)\:\"(.*?)\";/s',
169
+ function ( $matches ) {
170
+ return 's:' . strlen( $matches[2] ) . ':"' . $matches[2] . '";';
171
+ },
172
+ $serialized_string
173
+ );
174
  }
175
 
176
+ return $serialized_string;
 
 
 
 
177
  }
178
 
179
  /**
205
  }
206
 
207
  /**
208
+ * Export row template.
209
  */
210
+ static public function export_template( $node, $title ) {
211
+ $row = FLBuilderModel::get_node( $node );
212
+ $nodes = FLBuilderModel::get_nested_nodes( $node );
213
+ $post_id = FLBuilderModel::get_post_id();
214
+ $nodes[ $row->node ] = $row;
215
+ $obj = new \stdClass();
216
+ $obj->nodes = $nodes;
217
+ $body = serialize( $obj );
 
 
 
 
 
 
 
 
 
218
 
219
+ return self::save_template( $title, $body );
 
 
220
  }
221
 
222
  /**
264
  }
265
 
266
  /**
267
+ * Template Meta.
268
  */
269
+ static public function get_template_meta() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  $post_id = FLBuilderModel::get_post_id();
271
 
272
+ return Main::get_meta_fields( $post_id, $type = 'beaver' );
 
 
 
273
  }
274
 
275
  /**
317
 
318
  return $response;
319
  }
320
+
321
+ /**
322
+ * Initialize the Editor.
323
+ */
324
+ public function init() {
325
+ FLBuilderAJAX::add_action( 'ti_get_position', __CLASS__ . '::get_position', array( 'node' ) );
326
+ FLBuilderAJAX::add_action(
327
+ 'ti_apply_template',
328
+ __CLASS__ . '::apply_template',
329
+ array(
330
+ 'template',
331
+ 'position',
332
+ )
333
+ );
334
+ FLBuilderAJAX::add_action( 'ti_export_template', __CLASS__ . '::export_template', array( 'node', 'title' ) );
335
+ FLBuilderAJAX::add_action( 'ti_export_page_template', __CLASS__ . '::export_page_template', array( 'is_sync' ) );
336
+ FLBuilderAJAX::add_action(
337
+ 'ti_publish_template',
338
+ __CLASS__ . '::publish_template',
339
+ array(
340
+ 'slug',
341
+ 'screenshot',
342
+ 'premade',
343
+ )
344
+ );
345
+
346
+ add_action( 'wp_head', array( $this, 'inline_script' ), 9 );
347
+ add_action( 'fl_builder_before_save_layout', array( $this, 'update_published_template' ), 10, 4 );
348
+
349
+ $is_pro = apply_filters( 'product_neve_license_key', 'free' );
350
+
351
+ if ( $is_pro === 'free' ) {
352
+ return;
353
+ }
354
+
355
+ add_filter( 'fl_builder_main_menu', array( $this, 'add_export_menu' ), 10, 1 );
356
+ }
357
+
358
+ /**
359
+ * Add strings as global variable.
360
+ */
361
+ public function inline_script() {
362
+ $ti_tpc = apply_filters(
363
+ 'ti_tpc_editor_data',
364
+ array(
365
+ 'endpoint' => TPC_TEMPLATES_CLOUD_ENDPOINT,
366
+ 'params' => array(
367
+ 'site_url' => get_site_url(),
368
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
369
+ 'type' => 'beaver',
370
+ ),
371
+ 'canPredefine' => apply_filters( 'ti_tpc_can_predefine', false ),
372
+ 'pageTitle' => get_the_title(),
373
+ 'postType' => get_post_type(),
374
+ 'postTypes' => FLBuilderModel::get_post_types(),
375
+ 'postMeta' => array(
376
+ '_ti_tpc_template_sync' => get_post_meta( get_the_ID(), '_ti_tpc_template_sync', true ),
377
+ '_ti_tpc_screenshot_url' => get_post_meta( get_the_ID(), '_ti_tpc_screenshot_url', true ),
378
+ '_ti_tpc_site_slug' => get_post_meta( get_the_ID(), '_ti_tpc_site_slug', true ),
379
+ '_ti_tpc_published' => get_post_meta( get_the_ID(), '_ti_tpc_published', true ),
380
+ ),
381
+ 'exporter' => array(
382
+ 'modalLabel' => __( 'Save Templates', 'templates-patterns-collection' ),
383
+ 'textLabel' => __( 'Template Name', 'templates-patterns-collection' ),
384
+ 'textPlaceholder' => __( 'Template', 'templates-patterns-collection' ),
385
+ 'buttonLabel' => __( 'Save', 'templates-patterns-collection' ),
386
+ 'toggleLabel' => __( 'Automatically sync to the cloud', 'templates-patterns-collection' ),
387
+ 'cancelLabel' => __( 'Cancel', 'templates-patterns-collection' ),
388
+ 'importFailed' => __( 'Import Failed', 'templates-patterns-collection' ),
389
+ 'exportFailed' => __( 'Export Failed', 'templates-patterns-collection' ),
390
+ ),
391
+ 'library' => array(
392
+ 'templatesCloud' => 'Templates Cloud',
393
+ '404' => __( 'No templates available. Add a new one?', 'templates-patterns-collection' ),
394
+ 'deleteItem' => __( 'Are you sure you want to delete this template?', 'templates-patterns-collection' ),
395
+ 'synced' => __( 'This template is synced to a page.', 'templates-patterns-collection' ),
396
+ 'tabs' => array(
397
+ 'templates' => __( 'Page Templates', 'templates-patterns-collection' ),
398
+ 'library' => __( 'My Library', 'templates-patterns-collection' ),
399
+ ),
400
+ 'actions' => array(
401
+ 'sync' => __( 'Sync Library', 'templates-patterns-collection' ),
402
+ 'save' => sprintf( __( 'Save to %s', 'templates-patterns-collection' ), 'templates-patterns-collection' ),
403
+ 'update' => __( 'Update', 'templates-patterns-collection' ),
404
+ 'close' => __( 'Close', 'templates-patterns-collection' ),
405
+ 'edit' => __( 'Edit', 'templates-patterns-collection' ),
406
+ 'delete' => __( 'Delete', 'templates-patterns-collection' ),
407
+ 'deleting' => __( 'Deleting', 'templates-patterns-collection' ),
408
+ 'preview' => __( 'Preview', 'templates-patterns-collection' ),
409
+ 'import' => __( 'Import', 'templates-patterns-collection' ),
410
+ ),
411
+ 'filters' => array(
412
+ 'sortLabel' => __( 'Sort by', 'templates-patterns-collection' ),
413
+ 'sortLabels' => array(
414
+ 'name' => __( 'Name', 'templates-patterns-collection' ),
415
+ 'date' => __( 'Date', 'templates-patterns-collection' ),
416
+ 'modified' => __( 'Last Modified', 'templates-patterns-collection' ),
417
+ 'actions' => __( 'Actions', 'templates-patterns-collection' ),
418
+ 'list' => __( 'List View', 'templates-patterns-collection' ),
419
+ 'grid' => __( 'Grid View', 'templates-patterns-collection' ),
420
+ ),
421
+ 'search' => __( 'Search', 'templates-patterns-collection' ),
422
+ 'searchLabel' => __( 'Search Templates', 'templates-patterns-collection' ),
423
+ 'clearSearch' => __( 'Clear search query', 'templates-patterns-collection' ),
424
+ ),
425
+ 'export' => array(
426
+ 'save' => __( 'Save', 'templates-patterns-collection' ),
427
+ 'title' => sprintf( __( 'Save your page to %s', 'templates-patterns-collection' ), 'Templates Cloud' ),
428
+ 'labelScreenshot' => __( 'Screenshot URL', 'templates-patterns-collection' ),
429
+ 'labelSlug' => __( 'Site Slug', 'templates-patterns-collection' ),
430
+ 'publish' => __( 'Publish', 'templates-patterns-collection' ),
431
+ 'unpublish' => __( 'Unpublish', 'templates-patterns-collection' ),
432
+ ),
433
+ ),
434
+ )
435
+ );
436
+ ?>
437
+ <script type="text/javascript">
438
+ window.tiTpc = <?php echo json_encode( $ti_tpc ); ?>;
439
+ </script>
440
+ <?php
441
+ }
442
+
443
+ /**
444
+ * Add export menu to Beaver Row's context.
445
+ */
446
+ public function add_export_menu( $views ) {
447
+ if ( in_array( get_post_type(), FLBuilderModel::get_post_types() ) ) {
448
+ $views['main']['items'][15] = array(
449
+ 'label' => __( 'Save to Neve Cloud', 'templates-patterns-collection' ),
450
+ 'type' => 'event',
451
+ 'eventName' => 'tiTpcExport',
452
+ );
453
+ }
454
+
455
+ return $views;
456
+ }
457
+
458
+ /**
459
+ * Update published templates.
460
+ */
461
+ public function update_published_template( $post_id, $publish, $data, $settings ) {
462
+ if ( ! $publish ) {
463
+ return false;
464
+ }
465
+
466
+ $is_sync = get_post_meta( intval( $post_id ), '_ti_tpc_template_sync', true );
467
+
468
+ if ( $is_sync ) {
469
+ return self::export_page_template( true );
470
+ }
471
+ }
472
+
473
+ /**
474
+ * Export page template.
475
+ */
476
+ static public function export_page_template( $is_sync ) {
477
+ $title = get_the_title();
478
+ $title = empty( $title ) ? __( 'Template', 'templates-patterns-collection' ) : $title;
479
+ $nodes = FLBuilderModel::get_layout_data();
480
+ $settings = FLBuilderModel::get_layout_settings();
481
+ $obj = new \stdClass();
482
+ $obj->nodes = $nodes;
483
+ $obj->settings = $settings;
484
+ $body = serialize( $obj );
485
+ $post_id = FLBuilderModel::get_post_id();
486
+ $template_id = get_post_meta( $post_id, '_ti_tpc_template_id', true );
487
+
488
+ if ( ! empty( $template_id ) && self::get_template( $template_id ) ) {
489
+ return self::update_template( $template_id, $title, $body, $is_sync );
490
+ } else {
491
+ return self::save_template( $title, $body, true, $is_sync );
492
+ }
493
+ }
494
+
495
+ /**
496
+ * Update Beaver template to Templates Cloud.
497
+ */
498
+ static public function update_template( $template_id, $title, $body, $is_sync = false ) {
499
+ $post_id = FLBuilderModel::get_post_id();
500
+
501
+ $premade = get_post_meta( get_the_ID(), '_ti_tpc_published', true );
502
+
503
+ $url = add_query_arg(
504
+ array(
505
+ 'site_url' => get_site_url(),
506
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
507
+ 'template_name' => esc_attr( $title ),
508
+ 'template_type' => 'beaver',
509
+ 'link' => get_permalink( $post_id ),
510
+ 'cache' => uniqid(),
511
+ 'meta' => json_encode( self::get_template_meta() ),
512
+ ),
513
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . esc_attr( $template_id )
514
+ );
515
+
516
+ $response = wp_safe_remote_post(
517
+ $url,
518
+ array(
519
+ 'body' => json_encode( $body ),
520
+ )
521
+ );
522
+
523
+ $response = wp_remote_retrieve_body( $response );
524
+ $response = json_decode( $response, true );
525
+
526
+ if ( isset( $response['message'] ) ) {
527
+ return wp_send_json_error( $response['message'] );
528
+ }
529
+
530
+ $post_id = FLBuilderModel::get_post_id();
531
+
532
+ update_post_meta( $post_id, '_ti_tpc_template_sync', $is_sync );
533
+ update_post_meta( $post_id, '_ti_tpc_template_id', $template_id );
534
+
535
+ return $response;
536
+ }
537
  }
538
 
539
  FLBuilder::register_module( 'TIOB\TI_Beaver', array() );
languages/templates-patterns-collection.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Templates Patterns Collection plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Templates Patterns Collection 1.1.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-05-05T17:48:04+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: templates-patterns-collection\n"
@@ -30,50 +30,70 @@ msgstr ""
30
  msgid "https://themeisle.com"
31
  msgstr ""
32
 
33
- #: includes/Admin.php:69
 
34
  msgid "Starter Sites"
35
  msgstr ""
36
 
37
- #: includes/Admin.php:71
 
 
38
  msgid "My Library"
39
  msgstr ""
40
 
41
- #: includes/Admin.php:276
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  msgid "Hi! We've noticed you were using a child theme of Zelle before. To make your transition easier, we can help you keep the same homepage settings you had before but in original Zelle's style, by converting it into an Elementor template."
43
  msgstr ""
44
 
45
- #: includes/Admin.php:307
 
46
  #: assets/build/app.js:10
47
  #: assets/src/Components/StarterSiteCard.js:60
48
  msgid "Preview"
49
  msgstr ""
50
 
51
- #: includes/Admin.php:308
 
52
  #: assets/build/app.js:10
53
  #: assets/src/Components/PreviewFrame.js:102
54
  #: assets/src/Components/StarterSiteCard.js:68
55
  msgid "Import"
56
  msgstr ""
57
 
58
- #: includes/Admin.php:309
59
  msgid "Get the PRO version!"
60
  msgstr ""
61
 
62
- #: includes/Admin.php:310
63
  msgid "Importing"
64
  msgstr ""
65
 
66
- #: includes/Admin.php:311
 
 
67
  #: assets/build/app.js:2
68
  #: assets/src/Components/Migration.js:165
69
  msgid "Cancel"
70
  msgstr ""
71
 
72
- #: includes/Admin.php:312
73
  msgid "Loading"
74
  msgstr ""
75
 
76
- #: includes/Admin.php:313
77
  #: assets/build/app.js:2
78
  #: assets/build/app.js:10
79
  #: assets/src/Components/ImportModal.js:603
@@ -81,141 +101,298 @@ msgstr ""
81
  msgid "View Website"
82
  msgstr ""
83
 
84
- #: includes/Admin.php:314
85
  #: assets/build/app.js:10
86
  #: assets/src/Components/ImportModal.js:613
87
  msgid "Add your own content"
88
  msgstr ""
89
 
90
- #: includes/Admin.php:315
91
  #: assets/build/app.js:10
92
  #: assets/src/Components/ImportModal.js:594
93
  msgid "Back to Sites Library"
94
  msgstr ""
95
 
96
- #: includes/Admin.php:316
97
  msgid "Note"
98
  msgstr ""
99
 
100
- #: includes/Admin.php:317
101
  msgid "Advanced Options"
102
  msgstr ""
103
 
104
- #: includes/Admin.php:318
105
  #: assets/build/app.js:10
106
  #: assets/src/Components/ImportModal.js:272
107
  msgid "Plugins"
108
  msgstr ""
109
 
110
- #: includes/Admin.php:319
111
  msgid "General"
112
  msgstr ""
113
 
114
- #: includes/Admin.php:320
115
  msgid "Keep current layout"
116
  msgstr ""
117
 
118
- #: includes/Admin.php:321
 
 
119
  msgid "Search"
120
  msgstr ""
121
 
122
- #: includes/Admin.php:322
123
  #: assets/build/app.js:10
124
  #: assets/src/Components/ImportModal.js:200
125
  msgid "Content"
126
  msgstr ""
127
 
128
- #: includes/Admin.php:323
129
  #: assets/build/app.js:10
130
  #: assets/src/Components/ImportModal.js:204
131
  msgid "Customizer"
132
  msgstr ""
133
 
134
- #: includes/Admin.php:324
135
  #: assets/build/app.js:10
136
  #: assets/src/Components/ImportModal.js:208
137
  msgid "Widgets"
138
  msgstr ""
139
 
140
- #: includes/Admin.php:325
141
  msgid "We recommend you backup your website content before attempting a full site import."
142
  msgstr ""
143
 
144
- #: includes/Admin.php:326
145
  msgid "Due to copyright issues, some of the demo images will not be imported and will be replaced by placeholder images."
146
  msgstr ""
147
 
148
- #: includes/Admin.php:327
149
  msgid "Some of the demo images will not be imported and will be replaced by placeholder images."
150
  msgstr ""
151
 
152
- #: includes/Admin.php:328
153
  msgid "Here is our own collection of related images you can use for your site."
154
  msgstr ""
155
 
156
- #: includes/Admin.php:329
157
  #: assets/build/app.js:8
158
  #: assets/src/Components/ImportModal.js:542
159
  msgid "Content was successfully imported. Enjoy your new site!"
160
  msgstr ""
161
 
162
- #: includes/Admin.php:330
163
  msgid "Available in the PRO version"
164
  msgstr ""
165
 
166
- #: includes/Admin.php:331
167
  msgid "Copy error code"
168
  msgstr ""
169
 
170
- #: includes/Admin.php:332
171
  msgid "Download error log"
172
  msgstr ""
173
 
174
- #: includes/Admin.php:333
175
  msgid "To import this demo you have to install the following plugins:"
176
  msgstr ""
177
 
178
  #. translators: 1 - 'here'.
179
- #: includes/Admin.php:336
180
  msgid "It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s."
181
  msgstr ""
182
 
183
- #: includes/Admin.php:337
184
  msgid "here"
185
  msgstr ""
186
 
187
  #. translators: 1 - 'get in touch'.
188
- #: includes/Admin.php:341
189
  msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this."
190
  msgstr ""
191
 
192
- #: includes/Admin.php:342
193
- #: includes/Admin.php:352
194
  msgid "get in touch"
195
  msgstr ""
196
 
197
  #. translators: 1 - 'troubleshooting guide'.
198
- #: includes/Admin.php:346
199
  msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work."
200
  msgstr ""
201
 
202
- #: includes/Admin.php:347
203
  msgid "troubleshooting guide"
204
  msgstr ""
205
 
206
  #. translators: 1 - 'get in touch'.
207
- #: includes/Admin.php:351
208
  msgid "If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this."
209
  msgstr ""
210
 
211
  #. translators: %s - 'WP_Filesystem'.
212
- #: includes/Admin.php:356
213
  msgid "It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it."
214
  msgstr ""
215
 
216
- #. translators: %s - Theme name
217
- #: includes/Admin.php:375
218
- msgid "Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  msgstr ""
220
 
221
  #: includes/Sites_Listing.php:46
@@ -237,12 +414,57 @@ msgstr ""
237
  msgid "Templates Cloud by Neve."
238
  msgstr ""
239
 
240
- #: includes/TI_Beaver.php:270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  msgid "Save to Neve Cloud"
242
  msgstr ""
243
 
244
- #: includes/TI_Beaver.php:298
245
- msgid "Template"
 
 
 
 
 
246
  msgstr ""
247
 
248
  #: tests/rest-test.php:59
@@ -295,16 +517,6 @@ msgstr ""
295
  msgid "Activate"
296
  msgstr ""
297
 
298
- #: assets/build/app.js:2
299
- #: assets/build/app.js:10
300
- #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:206
301
- #: assets/src/Components/InstallModal.js:163
302
- #: assets/src/Components/Migration.js:161
303
- #: assets/src/Components/OnboardingContent.js:153
304
- #: assets/src/Components/PreviewFrame.js:54
305
- msgid "Close"
306
- msgstr ""
307
-
308
  #: assets/build/app.js:2
309
  #: assets/src/Components/ImportModalError.js:26
310
  msgid "Error code"
@@ -371,11 +583,6 @@ msgstr ""
371
  msgid "Visit"
372
  msgstr ""
373
 
374
- #: assets/build/app.js:2
375
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:183
376
- msgid "Edit"
377
- msgstr ""
378
-
379
  #. translators: name of starter site
380
  #: assets/build/app.js:4
381
  #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:277
2
  # This file is distributed under the same license as the Templates Patterns Collection plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Templates Patterns Collection 1.1.10\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-05-13T16:59:31+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: templates-patterns-collection\n"
30
  msgid "https://themeisle.com"
31
  msgstr ""
32
 
33
+ #: includes/Admin.php:70
34
+ #: includes/Admin.php:71
35
  msgid "Starter Sites"
36
  msgstr ""
37
 
38
+ #: includes/Admin.php:80
39
+ #: includes/Elementor.php:75
40
+ #: includes/TI_Beaver.php:398
41
  msgid "My Library"
42
  msgstr ""
43
 
44
+ #. translators: %s - Theme name
45
+ #: includes/Admin.php:153
46
+ msgid "Choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else."
47
+ msgstr ""
48
+
49
+ #: includes/Admin.php:244
50
+ msgid "Great news! Now you can export your own custom designs to the cloud and then reuse them on other sites."
51
+ msgstr ""
52
+
53
+ #: includes/Admin.php:245
54
+ msgid "Open %s"
55
+ msgstr ""
56
+
57
+ #: includes/Admin.php:342
58
  msgid "Hi! We've noticed you were using a child theme of Zelle before. To make your transition easier, we can help you keep the same homepage settings you had before but in original Zelle's style, by converting it into an Elementor template."
59
  msgstr ""
60
 
61
+ #: includes/Admin.php:372
62
+ #: includes/TI_Beaver.php:408
63
  #: assets/build/app.js:10
64
  #: assets/src/Components/StarterSiteCard.js:60
65
  msgid "Preview"
66
  msgstr ""
67
 
68
+ #: includes/Admin.php:373
69
+ #: includes/TI_Beaver.php:409
70
  #: assets/build/app.js:10
71
  #: assets/src/Components/PreviewFrame.js:102
72
  #: assets/src/Components/StarterSiteCard.js:68
73
  msgid "Import"
74
  msgstr ""
75
 
76
+ #: includes/Admin.php:374
77
  msgid "Get the PRO version!"
78
  msgstr ""
79
 
80
+ #: includes/Admin.php:375
81
  msgid "Importing"
82
  msgstr ""
83
 
84
+ #: includes/Admin.php:376
85
+ #: includes/Elementor.php:81
86
+ #: includes/TI_Beaver.php:387
87
  #: assets/build/app.js:2
88
  #: assets/src/Components/Migration.js:165
89
  msgid "Cancel"
90
  msgstr ""
91
 
92
+ #: includes/Admin.php:377
93
  msgid "Loading"
94
  msgstr ""
95
 
96
+ #: includes/Admin.php:378
97
  #: assets/build/app.js:2
98
  #: assets/build/app.js:10
99
  #: assets/src/Components/ImportModal.js:603
101
  msgid "View Website"
102
  msgstr ""
103
 
104
+ #: includes/Admin.php:379
105
  #: assets/build/app.js:10
106
  #: assets/src/Components/ImportModal.js:613
107
  msgid "Add your own content"
108
  msgstr ""
109
 
110
+ #: includes/Admin.php:380
111
  #: assets/build/app.js:10
112
  #: assets/src/Components/ImportModal.js:594
113
  msgid "Back to Sites Library"
114
  msgstr ""
115
 
116
+ #: includes/Admin.php:381
117
  msgid "Note"
118
  msgstr ""
119
 
120
+ #: includes/Admin.php:382
121
  msgid "Advanced Options"
122
  msgstr ""
123
 
124
+ #: includes/Admin.php:383
125
  #: assets/build/app.js:10
126
  #: assets/src/Components/ImportModal.js:272
127
  msgid "Plugins"
128
  msgstr ""
129
 
130
+ #: includes/Admin.php:384
131
  msgid "General"
132
  msgstr ""
133
 
134
+ #: includes/Admin.php:385
135
  msgid "Keep current layout"
136
  msgstr ""
137
 
138
+ #: includes/Admin.php:386
139
+ #: includes/Elementor.php:96
140
+ #: includes/TI_Beaver.php:421
141
  msgid "Search"
142
  msgstr ""
143
 
144
+ #: includes/Admin.php:387
145
  #: assets/build/app.js:10
146
  #: assets/src/Components/ImportModal.js:200
147
  msgid "Content"
148
  msgstr ""
149
 
150
+ #: includes/Admin.php:388
151
  #: assets/build/app.js:10
152
  #: assets/src/Components/ImportModal.js:204
153
  msgid "Customizer"
154
  msgstr ""
155
 
156
+ #: includes/Admin.php:389
157
  #: assets/build/app.js:10
158
  #: assets/src/Components/ImportModal.js:208
159
  msgid "Widgets"
160
  msgstr ""
161
 
162
+ #: includes/Admin.php:390
163
  msgid "We recommend you backup your website content before attempting a full site import."
164
  msgstr ""
165
 
166
+ #: includes/Admin.php:391
167
  msgid "Due to copyright issues, some of the demo images will not be imported and will be replaced by placeholder images."
168
  msgstr ""
169
 
170
+ #: includes/Admin.php:392
171
  msgid "Some of the demo images will not be imported and will be replaced by placeholder images."
172
  msgstr ""
173
 
174
+ #: includes/Admin.php:393
175
  msgid "Here is our own collection of related images you can use for your site."
176
  msgstr ""
177
 
178
+ #: includes/Admin.php:394
179
  #: assets/build/app.js:8
180
  #: assets/src/Components/ImportModal.js:542
181
  msgid "Content was successfully imported. Enjoy your new site!"
182
  msgstr ""
183
 
184
+ #: includes/Admin.php:395
185
  msgid "Available in the PRO version"
186
  msgstr ""
187
 
188
+ #: includes/Admin.php:396
189
  msgid "Copy error code"
190
  msgstr ""
191
 
192
+ #: includes/Admin.php:397
193
  msgid "Download error log"
194
  msgstr ""
195
 
196
+ #: includes/Admin.php:398
197
  msgid "To import this demo you have to install the following plugins:"
198
  msgstr ""
199
 
200
  #. translators: 1 - 'here'.
201
+ #: includes/Admin.php:401
202
  msgid "It seems that Rest API is not working properly on your website. Read about how you can fix it %1$s."
203
  msgstr ""
204
 
205
+ #: includes/Admin.php:402
206
  msgid "here"
207
  msgstr ""
208
 
209
  #. translators: 1 - 'get in touch'.
210
+ #: includes/Admin.php:406
211
  msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Please %1$s with us with the error code below, so we can help you fix this."
212
  msgstr ""
213
 
214
+ #: includes/Admin.php:407
215
+ #: includes/Admin.php:417
216
  msgid "get in touch"
217
  msgstr ""
218
 
219
  #. translators: 1 - 'troubleshooting guide'.
220
+ #: includes/Admin.php:411
221
  msgid "Hi! It seems there is a configuration issue with your server that's causing the import to fail. Take a look at our %1$s to see if any of the proposed solutions work."
222
  msgstr ""
223
 
224
+ #: includes/Admin.php:412
225
  msgid "troubleshooting guide"
226
  msgstr ""
227
 
228
  #. translators: 1 - 'get in touch'.
229
+ #: includes/Admin.php:416
230
  msgid "If none of the solutions in the guide work, please %1$s with us with the error code below, so we can help you fix this."
231
  msgstr ""
232
 
233
  #. translators: %s - 'WP_Filesystem'.
234
+ #: includes/Admin.php:421
235
  msgid "It seems that %s is not available. You can contact your site administrator or hosting provider to help you enable it."
236
  msgstr ""
237
 
238
+ #: includes/Elementor.php:59
239
+ #: includes/Elementor.php:79
240
+ #: includes/TI_Beaver.php:402
241
+ msgid "Save to %s"
242
+ msgstr ""
243
+
244
+ #: includes/Elementor.php:60
245
+ #: includes/TI_Beaver.php:382
246
+ msgid "Save Templates"
247
+ msgstr ""
248
+
249
+ #: includes/Elementor.php:61
250
+ #: includes/TI_Beaver.php:383
251
+ msgid "Template Name"
252
+ msgstr ""
253
+
254
+ #: includes/Elementor.php:62
255
+ #: includes/Elementor.php:107
256
+ #: includes/TI_Beaver.php:384
257
+ #: includes/TI_Beaver.php:478
258
+ msgid "Template"
259
+ msgstr ""
260
+
261
+ #: includes/Elementor.php:63
262
+ #: includes/Elementor.php:100
263
+ #: includes/TI_Beaver.php:385
264
+ #: includes/TI_Beaver.php:426
265
+ msgid "Save"
266
+ msgstr ""
267
+
268
+ #: includes/Elementor.php:64
269
+ #: includes/TI_Beaver.php:386
270
+ msgid "Automatically sync to the cloud"
271
+ msgstr ""
272
+
273
+ #: includes/Elementor.php:65
274
+ msgid "Template Saved."
275
+ msgstr ""
276
+
277
+ #: includes/Elementor.php:66
278
+ msgid "Template Published."
279
+ msgstr ""
280
+
281
+ #: includes/Elementor.php:67
282
+ msgid "Template Unpublished."
283
+ msgstr ""
284
+
285
+ #: includes/Elementor.php:70
286
+ msgid "Import from %s"
287
+ msgstr ""
288
+
289
+ #: includes/Elementor.php:72
290
+ msgid "Add Template from %s:"
291
+ msgstr ""
292
+
293
+ #: includes/Elementor.php:74
294
+ #: includes/TI_Beaver.php:397
295
+ msgid "Page Templates"
296
+ msgstr ""
297
+
298
+ #: includes/Elementor.php:78
299
+ #: includes/TI_Beaver.php:401
300
+ msgid "Sync Library"
301
+ msgstr ""
302
+
303
+ #: includes/Elementor.php:80
304
+ #: includes/TI_Beaver.php:404
305
+ #: assets/build/app.js:2
306
+ #: assets/build/app.js:10
307
+ #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:206
308
+ #: assets/src/Components/InstallModal.js:163
309
+ #: assets/src/Components/Migration.js:161
310
+ #: assets/src/Components/OnboardingContent.js:153
311
+ #: assets/src/Components/PreviewFrame.js:54
312
+ msgid "Close"
313
+ msgstr ""
314
+
315
+ #: includes/Elementor.php:82
316
+ #: includes/TI_Beaver.php:405
317
+ #: assets/build/app.js:2
318
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:183
319
+ msgid "Edit"
320
+ msgstr ""
321
+
322
+ #: includes/Elementor.php:83
323
+ msgid "Duplicate"
324
+ msgstr ""
325
+
326
+ #: includes/Elementor.php:84
327
+ #: includes/TI_Beaver.php:406
328
+ msgid "Delete"
329
+ msgstr ""
330
+
331
+ #: includes/Elementor.php:85
332
+ msgid "Insert"
333
+ msgstr ""
334
+
335
+ #: includes/Elementor.php:86
336
+ msgid "Back to Library"
337
+ msgstr ""
338
+
339
+ #: includes/Elementor.php:89
340
+ #: includes/TI_Beaver.php:412
341
+ msgid "Sort by"
342
+ msgstr ""
343
+
344
+ #: includes/Elementor.php:91
345
+ #: includes/TI_Beaver.php:414
346
+ msgid "Name"
347
+ msgstr ""
348
+
349
+ #: includes/Elementor.php:92
350
+ #: includes/TI_Beaver.php:415
351
+ msgid "Date"
352
+ msgstr ""
353
+
354
+ #: includes/Elementor.php:93
355
+ #: includes/TI_Beaver.php:416
356
+ msgid "Last Modified"
357
+ msgstr ""
358
+
359
+ #: includes/Elementor.php:94
360
+ #: includes/TI_Beaver.php:417
361
+ msgid "Actions"
362
+ msgstr ""
363
+
364
+ #: includes/Elementor.php:97
365
+ #: includes/TI_Beaver.php:422
366
+ msgid "Search Templates"
367
+ msgstr ""
368
+
369
+ #: includes/Elementor.php:101
370
+ #: includes/TI_Beaver.php:427
371
+ msgid "Save your page to %s"
372
+ msgstr ""
373
+
374
+ #: includes/Elementor.php:102
375
+ msgid "Enter Template Name"
376
+ msgstr ""
377
+
378
+ #: includes/Elementor.php:103
379
+ #: includes/TI_Beaver.php:428
380
+ msgid "Screenshot URL"
381
+ msgstr ""
382
+
383
+ #: includes/Elementor.php:104
384
+ #: includes/TI_Beaver.php:429
385
+ msgid "Site Slug"
386
+ msgstr ""
387
+
388
+ #: includes/Elementor.php:105
389
+ #: includes/TI_Beaver.php:430
390
+ msgid "Publish"
391
+ msgstr ""
392
+
393
+ #: includes/Elementor.php:106
394
+ #: includes/TI_Beaver.php:431
395
+ msgid "Unpublish"
396
  msgstr ""
397
 
398
  #: includes/Sites_Listing.php:46
414
  msgid "Templates Cloud by Neve."
415
  msgstr ""
416
 
417
+ #: includes/TI_Beaver.php:388
418
+ msgid "Import Failed"
419
+ msgstr ""
420
+
421
+ #: includes/TI_Beaver.php:389
422
+ msgid "Export Failed"
423
+ msgstr ""
424
+
425
+ #: includes/TI_Beaver.php:393
426
+ msgid "No templates available. Add a new one?"
427
+ msgstr ""
428
+
429
+ #: includes/TI_Beaver.php:394
430
+ msgid "Are you sure you want to delete this template?"
431
+ msgstr ""
432
+
433
+ #: includes/TI_Beaver.php:395
434
+ msgid "This template is synced to a page."
435
+ msgstr ""
436
+
437
+ #: includes/TI_Beaver.php:403
438
+ msgid "Update"
439
+ msgstr ""
440
+
441
+ #: includes/TI_Beaver.php:407
442
+ msgid "Deleting"
443
+ msgstr ""
444
+
445
+ #: includes/TI_Beaver.php:418
446
+ msgid "List View"
447
+ msgstr ""
448
+
449
+ #: includes/TI_Beaver.php:419
450
+ msgid "Grid View"
451
+ msgstr ""
452
+
453
+ #: includes/TI_Beaver.php:423
454
+ msgid "Clear search query"
455
+ msgstr ""
456
+
457
+ #: includes/TI_Beaver.php:449
458
  msgid "Save to Neve Cloud"
459
  msgstr ""
460
 
461
+ #: templates-patterns-collection.php:42
462
+ msgid "You need to have %1$s installed and activated to use %2$s."
463
+ msgstr ""
464
+
465
+ #. translators: %s Neve theme name.
466
+ #: templates-patterns-collection.php:50
467
+ msgid "Install and Activate %s"
468
  msgstr ""
469
 
470
  #: tests/rest-test.php:59
517
  msgid "Activate"
518
  msgstr ""
519
 
 
 
 
 
 
 
 
 
 
 
520
  #: assets/build/app.js:2
521
  #: assets/src/Components/ImportModalError.js:26
522
  msgid "Error code"
583
  msgid "Visit"
584
  msgstr ""
585
 
 
 
 
 
 
586
  #. translators: name of starter site
587
  #: assets/build/app.js:4
588
  #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:277
readme.txt CHANGED
@@ -12,12 +12,15 @@ A cloud based service with 100+ templates and starter sites for Neve theme.
12
 
13
  == Description ==
14
 
15
- = TEMPLATE SERVICE FOR ELEMENTOR, BEAVER BUILDER, BRIZY AND GUTENBERG, DIVI and THRIVE =
16
 
 
 
 
17
 
18
- A cloud based templates library which enables you to create ready-made website in no time.
19
-
20
- All templates can be previewed on [demosites.io](https://demosites.io/), their import into your site is facilitated by this plugin.
21
 
22
  The plugin is relying on the service behind api.themeisle.com for accessing the template collection list and their individual structure on import.
23
 
@@ -25,8 +28,25 @@ No account is required to access the service template collection and the privacy
25
 
26
  == Frequently Asked Questions ==
27
 
 
 
 
 
 
 
 
 
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
 
30
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
31
 
32
  - Allow user-made templates to save metadata
12
 
13
  == Description ==
14
 
15
+ = A cloud based templates library which enables you to create or use existing ready-made website with 1-click. =
16
 
17
+ ### More than 100 Starter Sites and Templates available for the most popular page builders ###
18
+ Free and premium templates and starter sites available for top 5 page builders: Elementor, Beaver Builder, Brizy, Gutenberg, Divi and Thrive.
19
+ All templates can be previewed on [demosites.io](https://demosites.io/) and you can seamlessly import to any of your site.
20
 
21
+ ### Your own private Templates Cloud [PRO] ###
22
+ Boost productivity and speed up your workflow by saving all your designs and share them automatically to all your sites in 1-click.
23
+ Check more details about this in our [documentation](https://docs.themeisle.com/article/1354-neve-template-cloud-library) guide.
24
 
25
  The plugin is relying on the service behind api.themeisle.com for accessing the template collection list and their individual structure on import.
26
 
28
 
29
  == Frequently Asked Questions ==
30
 
31
+ = Does it work with any WordPress theme? =
32
+ Right now we are supporting only [Neve](https://wordpress.org/themes/neve/) theme
33
+
34
+ = Which starter sites and templates are free and which are not? =
35
+ You can check the full collection on [demosites.io](https://demosites.io/)
36
+
37
+ = Can I import just one page from one starter site? =
38
+ Yes, you can. You can either chose to import one template or the entire starter site.
39
+
40
  == Changelog ==
41
 
42
+ ##### [Version 1.1.11](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.10...v1.1.11) (2021-05-13)
43
+
44
+ * Improve translations
45
+ * Improve texts and descriptions
46
+
47
+
48
+
49
+
50
  ##### [Version 1.1.10](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.9...v1.1.10) (2021-05-05)
51
 
52
  - Allow user-made templates to save metadata
templates-patterns-collection.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Templates Patterns Collection
4
  * Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
5
- * Version: 1.1.10
6
  * Author: ThemeIsle
7
  * Author URI: https://themeisle.com
8
  * License: GPLv3
@@ -39,14 +39,15 @@ function ti_tpc_plugins_page_notice() {
39
  $notice = '<div class="notice notice-warning">';
40
  $notice .= '<p>';
41
  $notice .= sprintf(
42
- __( 'You need to have %1$s installed and activated to use %2$s.' ),
43
- '<strong>' . __( 'Neve Theme' ) . '</strong>',
44
- '<strong>' . __( 'Templates Patterns Collection' ) . '</strong>'
45
  );
46
  $notice .= '</p>';
47
  $notice .= '<p class="actions">';
48
  $notice .= '<a class="button button-primary" href="' . esc_url( admin_url( 'theme-install.php?theme=neve' ) ) . '">';
49
- $notice .= __( 'Install and Activate Neve' );
 
50
  $notice .= '</a>';
51
  $notice .= '</p>';
52
  $notice .= '</div>';
@@ -67,9 +68,23 @@ function ti_tpc_flush_premalinks() {
67
 
68
  flush_rewrite_rules();
69
  delete_transient( 'ti_tpc_should_flush_permalinks' );
 
70
  return true;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Load the localisation file.
75
  */
@@ -77,6 +92,10 @@ function ti_tpc_load_textdomain() {
77
  load_plugin_textdomain( 'templates-patterns-collection', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
78
  }
79
 
 
 
 
 
80
  add_action( 'init', 'ti_tpc_run', 999 );
81
 
82
  function ti_tpc_run() {
@@ -87,11 +106,6 @@ function ti_tpc_run() {
87
  define( 'TIOB_URL', plugin_dir_url( __FILE__ ) );
88
  define( 'TIOB_PATH', dirname( __FILE__ ) . '/' );
89
 
90
- $autoload_path = __DIR__ . '/vendor/autoload.php';
91
- if ( is_file( $autoload_path ) ) {
92
- require_once $autoload_path;
93
- }
94
-
95
  if ( class_exists( 'WP_CLI' ) ) {
96
  require_once 'includes/WP_Cli.php';
97
  }
2
  /**
3
  * Plugin Name: Templates Patterns Collection
4
  * Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
5
+ * Version: 1.1.11
6
  * Author: ThemeIsle
7
  * Author URI: https://themeisle.com
8
  * License: GPLv3
39
  $notice = '<div class="notice notice-warning">';
40
  $notice .= '<p>';
41
  $notice .= sprintf(
42
+ __( 'You need to have %1$s installed and activated to use %2$s.', 'templates-patterns-collection' ),
43
+ '<strong>' . ( 'Neve Theme' ) . '</strong>',
44
+ '<strong>' . ( 'Templates Patterns Collection' ) . '</strong>'
45
  );
46
  $notice .= '</p>';
47
  $notice .= '<p class="actions">';
48
  $notice .= '<a class="button button-primary" href="' . esc_url( admin_url( 'theme-install.php?theme=neve' ) ) . '">';
49
+ /* translators: %s Neve theme name. */
50
+ $notice .= sprintf( __( 'Install and Activate %s', 'templates-patterns-collection' ), 'Neve' );
51
  $notice .= '</a>';
52
  $notice .= '</p>';
53
  $notice .= '</div>';
68
 
69
  flush_rewrite_rules();
70
  delete_transient( 'ti_tpc_should_flush_permalinks' );
71
+
72
  return true;
73
  }
74
 
75
+ add_filter( 'themeisle_sdk_products', 'tpc_load_sdk' );
76
+
77
+ /**
78
+ * Filter products array.
79
+ *
80
+ * @param array $products products array.
81
+ *
82
+ * @return array
83
+ */
84
+ function tpc_load_sdk( $products ) {
85
+ $products[] = __FILE__;
86
+ return $products;
87
+ }
88
  /**
89
  * Load the localisation file.
90
  */
92
  load_plugin_textdomain( 'templates-patterns-collection', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
93
  }
94
 
95
+ $autoload_path = __DIR__ . '/vendor/autoload.php';
96
+ if ( is_file( $autoload_path ) ) {
97
+ require_once $autoload_path;
98
+ }
99
  add_action( 'init', 'ti_tpc_run', 999 );
100
 
101
  function ti_tpc_run() {
106
  define( 'TIOB_URL', plugin_dir_url( __FILE__ ) );
107
  define( 'TIOB_PATH', dirname( __FILE__ ) . '/' );
108
 
 
 
 
 
 
109
  if ( class_exists( 'WP_CLI' ) ) {
110
  require_once 'includes/WP_Cli.php';
111
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit012ecd39ee10d42e943a09dc55e81c26::getLoader();
vendor/codeinwp/themeisle-sdk/CHANGELOG.md ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### [Version 3.2.20](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.19...v3.2.20) (2021-03-30)
2
+
3
+ add wp-config support
4
+
5
+ ##### [Version 3.2.19](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.18...v3.2.19) (2021-03-12)
6
+
7
+ * Adds compatibility with latest PHPCS coding standards.
8
+ * Adds compatibility with core auto-update.
9
+
10
+ ##### [Version 3.2.18](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.17...v3.2.18) (2021-03-04)
11
+
12
+ * Fix regression on rollback order
13
+
14
+ ##### [Version 3.2.17](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.16...v3.2.17) (2021-03-04)
15
+
16
+ * Fix compatibility with PHP 8 due to usort
17
+
18
+ ##### [Version 3.2.16](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.15...v3.2.16) (2020-11-17)
19
+
20
+ * Fix long texts on rollback.
21
+ * Fix RTL mode for uninstall feedback.
22
+
23
+ ##### [Version 3.2.15](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.14...v3.2.15) (2020-07-23)
24
+
25
+ * remove no redundant module
26
+
27
+ ##### [Version 3.2.14](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.13...v3.2.14) (2020-06-10)
28
+
29
+ > Things are getting better every day. 🚀
30
+
31
+ ##### [Version 3.2.13](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.12...v3.2.13) (2020-06-10)
32
+
33
+ Adds plan logic and expiration
34
+
35
+ ##### [Version 3.2.12](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.11...v3.2.12) (2020-06-10)
36
+
37
+ Adds key filter
38
+
39
+ ##### [Version 3.2.11](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.10...v3.2.11) (2020-06-04)
40
+
41
+ * remove non-printable chars
42
+
43
+ ##### [Version 3.2.10](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.9...v3.2.10) (2020-05-28)
44
+
45
+ * Remove extra files on export
46
+
47
+ ##### [Version 3.2.9](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.8...v3.2.9) (2020-05-18)
48
+
49
+ adds new endpoints
50
+
51
+ ##### [Version 3.2.8](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.7...v3.2.8) (2020-03-24)
52
+
53
+ * change license handler method access
54
+
55
+ ##### [Version 3.2.7](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.6...v3.2.7) (2020-03-24)
56
+
57
+ * fix callback for license processing hook
58
+
59
+ ##### [Version 3.2.6](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.5...v3.2.6) (2020-03-23)
60
+
61
+ * Fix notice on license deactivation
62
+
63
+ ##### [Version 3.2.5](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.4...v3.2.5) (2020-03-23)
64
+
65
+ * always load notification manager last
66
+
67
+ ##### [Version 3.2.4](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.3...v3.2.4) (2020-03-21)
68
+
69
+ * Cast version response to array for icons
70
+
71
+ ##### [Version 3.2.3](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.2...v3.2.3) (2020-03-21)
72
+
73
+ * use product slug instead of the one from api
74
+
75
+ ##### [Version 3.2.2](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.1...v3.2.2) (2020-03-13)
76
+
77
+ * improve notice dismiss mechanism
78
+
79
+ ##### [Version 3.2.1](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.0...v3.2.1) (2020-03-05)
80
+
81
+ Fix rollback call for private products
82
+
83
+ #### [Version 3.2.0](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.9...v3.2.0) (2020-03-04)
84
+
85
+ * adds license activation/deactivation handlers for wp cli
86
+ * adds compatibility with the newest license API
87
+
88
+ ##### [Version 3.1.9](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.8...v3.1.9) (2020-02-24)
89
+
90
+ * Add integration with GitHub actions
91
+
92
+ ## [3.1.8](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.7...v3.1.8) (2019-11-18)
93
+
94
+
95
+ ### Bug Fixes
96
+
97
+ * update developers name ([6aca63e](https://github.com/Codeinwp/themeisle-sdk/commit/6aca63e))
98
+
99
+ ## [3.1.7](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.6...v3.1.7) (2019-11-07)
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * license field style on wp5.3 ([0239997](https://github.com/Codeinwp/themeisle-sdk/commit/0239997))
105
+ * license field style on wp5.3 ([86d3a1b](https://github.com/Codeinwp/themeisle-sdk/commit/86d3a1b))
106
+
107
+ ## [3.1.6](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.5...v3.1.6) (2019-09-24)
108
+
109
+
110
+ ### Bug Fixes
111
+
112
+ * remove license related options when deactivated ([02cd6ce](https://github.com/Codeinwp/themeisle-sdk/commit/02cd6ce))
113
+ * remove license related options when deactivated ([d3c1a1f](https://github.com/Codeinwp/themeisle-sdk/commit/d3c1a1f))
114
+
115
+ ## [3.1.5](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.4...v3.1.5) (2019-09-11)
116
+
117
+
118
+ ### Bug Fixes
119
+
120
+ * allow unloading certain module features ([2a2559a](https://github.com/Codeinwp/themeisle-sdk/commit/2a2559a))
121
+ * license activation workflow, show error message when failed to a… ([ade795c](https://github.com/Codeinwp/themeisle-sdk/commit/ade795c))
122
+ * license activation workflow, show error message when failed to activate ([2f5cbae](https://github.com/Codeinwp/themeisle-sdk/commit/2f5cbae))
123
+
124
+ ## [3.1.4](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.3...v3.1.4) (2019-08-23)
125
+
126
+
127
+ ### Bug Fixes
128
+
129
+ * license key was missing on get_version call ([365cde6](https://github.com/Codeinwp/themeisle-sdk/commit/365cde6))
130
+ * license key was missing on get_version call ([c02f225](https://github.com/Codeinwp/themeisle-sdk/commit/c02f225))
131
+
132
+ ## [3.1.3](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.2...v3.1.3) (2019-08-20)
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * license deactivation behaviour https://github.com/Codeinwp/visua… ([59c4afe](https://github.com/Codeinwp/themeisle-sdk/commit/59c4afe))
138
+ * license deactivation behaviour https://github.com/Codeinwp/visualizer-pro/issues/192 ([f641e18](https://github.com/Codeinwp/themeisle-sdk/commit/f641e18))
139
+
140
+ ## [3.1.2](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.1...v3.1.2) (2019-08-12)
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * phpunit test case ([efe851c](https://github.com/Codeinwp/themeisle-sdk/commit/efe851c))
146
+ * url format for license endpoint, improve changelog handling and license checks ([a492c68](https://github.com/Codeinwp/themeisle-sdk/commit/a492c68))
147
+
148
+ ## [3.1.1](https://github.com/Codeinwp/themeisle-sdk/compare/v3.1.0...v3.1.1) (2019-08-08)
149
+
150
+
151
+ ### Bug Fixes
152
+
153
+ * adds is_file for file existence check ([d1205c4](https://github.com/Codeinwp/themeisle-sdk/commit/d1205c4))
154
+ * adds is_file for file existence check ([be119c1](https://github.com/Codeinwp/themeisle-sdk/commit/be119c1))
155
+
156
+ # [3.1.0](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.10...v3.1.0) (2019-08-05)
157
+
158
+
159
+ ### Bug Fixes
160
+
161
+ * adds extra comments for rest of the options, fix [#64](https://github.com/Codeinwp/themeisle-sdk/issues/64) ([018b22f](https://github.com/Codeinwp/themeisle-sdk/commit/018b22f))
162
+ * hide license key when active under a password mask, fix [#67](https://github.com/Codeinwp/themeisle-sdk/issues/67) ([c0633c2](https://github.com/Codeinwp/themeisle-sdk/commit/c0633c2))
163
+ * new uninstall feedback popup issues ([5bda4bd](https://github.com/Codeinwp/themeisle-sdk/commit/5bda4bd))
164
+ * phpcs indentation errors ([d59ed4f](https://github.com/Codeinwp/themeisle-sdk/commit/d59ed4f))
165
+ * undefined notices on license check, fix [#60](https://github.com/Codeinwp/themeisle-sdk/issues/60) ([7f56a97](https://github.com/Codeinwp/themeisle-sdk/commit/7f56a97))
166
+ * uninstall feedback popup placement [[#61](https://github.com/Codeinwp/themeisle-sdk/issues/61)] ([1102d6c](https://github.com/Codeinwp/themeisle-sdk/commit/1102d6c))
167
+
168
+
169
+ ### Features
170
+
171
+ * new product feedback popup ([f0dbab3](https://github.com/Codeinwp/themeisle-sdk/commit/f0dbab3))
172
+ * new uninstall feedback form for themes ([8a29f21](https://github.com/Codeinwp/themeisle-sdk/commit/8a29f21))
173
+
174
+ ## [3.0.10](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.9...v3.0.10) (2019-07-16)
175
+
176
+
177
+ ### Bug Fixes
178
+
179
+ * compatibility with lower PHP versions ([065ac8e](https://github.com/Codeinwp/themeisle-sdk/commit/065ac8e))
180
+ * not loading licenser when SDK comes from theme [[#62](https://github.com/Codeinwp/themeisle-sdk/issues/62)] ([b706ca7](https://github.com/Codeinwp/themeisle-sdk/commit/b706ca7))
181
+ * not loading licenser when SDK comes from theme [[#65](https://github.com/Codeinwp/themeisle-sdk/issues/65) ([419d8e6](https://github.com/Codeinwp/themeisle-sdk/commit/419d8e6))
182
+ * preserve loaded when adding the licenser one ([cd50434](https://github.com/Codeinwp/themeisle-sdk/commit/cd50434))
183
+
184
+ ## [3.0.9](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.8...v3.0.9) (2019-06-26)
185
+
186
+
187
+ ### Bug Fixes
188
+
189
+ * adds new icon for dashboard widget ([de78068](https://github.com/Codeinwp/themeisle-sdk/commit/de78068))
190
+ * anchor element on license activation message which should link to the license field, fix [#57](https://github.com/Codeinwp/themeisle-sdk/issues/57) ([2e78856](https://github.com/Codeinwp/themeisle-sdk/commit/2e78856))
191
+ * change uninstall feedback logo with new version, fix [#58](https://github.com/Codeinwp/themeisle-sdk/issues/58) ([2554a4f](https://github.com/Codeinwp/themeisle-sdk/commit/2554a4f))
192
+ * remove soon to expire notice, fix https://github.com/Codeinwp/themeisle/issues/752 ([a126225](https://github.com/Codeinwp/themeisle-sdk/commit/a126225))
193
+
194
+ ## [3.0.8](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.7...v3.0.8) (2019-05-28)
195
+
196
+
197
+ ### Bug Fixes
198
+
199
+ * undefined class on diff module which should check the class on global namespace ([df6bb12](https://github.com/Codeinwp/themeisle-sdk/commit/df6bb12))
200
+
201
+ ## [3.0.7](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.6...v3.0.7) (2019-05-27)
202
+
203
+
204
+ ### Bug Fixes
205
+
206
+ * change store url with the new domain ([6bdbe1e](https://github.com/Codeinwp/themeisle-sdk/commit/6bdbe1e))
207
+
208
+ ## [3.0.6](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.5...v3.0.6) (2019-05-21)
209
+
210
+
211
+ ### Bug Fixes
212
+
213
+ * build php version for deployment stage ([a785699](https://github.com/Codeinwp/themeisle-sdk/commit/a785699))
214
+ * uninstall feedback should load only on the proper pages ([259e78f](https://github.com/Codeinwp/themeisle-sdk/commit/259e78f))
215
+
216
+ ## [3.0.5](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.4...v3.0.5) (2019-03-07)
217
+
218
+
219
+ ### Bug Fixes
220
+
221
+ * dashboard widget issues and recommended module inconsistency fix [#50](https://github.com/Codeinwp/themeisle-sdk/issues/50), [#49](https://github.com/Codeinwp/themeisle-sdk/issues/49), [#47](https://github.com/Codeinwp/themeisle-sdk/issues/47) ([757eb02](https://github.com/Codeinwp/themeisle-sdk/commit/757eb02))
222
+
223
+ ## [3.0.4](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.3...v3.0.4) (2019-01-28)
224
+
225
+
226
+ ### Bug Fixes
227
+
228
+ * uninstall feedback disclosure issues when one of the feedback fields is open ([4631eef](https://github.com/Codeinwp/themeisle-sdk/commit/4631eef))
229
+
230
+ ## [3.0.3](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.2...v3.0.3) (2019-01-07)
231
+
232
+
233
+ ### Bug Fixes
234
+
235
+ * **build:** fix exit code when is running outside wordpress context ([d298bb5](https://github.com/Codeinwp/themeisle-sdk/commit/d298bb5))
236
+
237
+ ## [3.0.2](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.1...v3.0.2) (2018-12-28)
238
+
239
+
240
+ ### Bug Fixes
241
+
242
+ * remove composer/installers from package requirements ([a0ad543](https://github.com/Codeinwp/themeisle-sdk/commit/a0ad543))
243
+
244
+ ## [3.0.1](https://github.com/Codeinwp/themeisle-sdk/compare/v3.0.0...v3.0.1) (2018-12-24)
245
+
246
+
247
+ ### Bug Fixes
248
+
249
+ * notifications setup triggers after all products register their n… ([999a944](https://github.com/Codeinwp/themeisle-sdk/commit/999a944))
250
+ * notifications setup triggers after all products register their notices ([ec3cacc](https://github.com/Codeinwp/themeisle-sdk/commit/ec3cacc))
251
+
252
+ # 1.0.0 (2018-12-21)
253
+
254
+
255
+ ### Features
256
+
257
+ * adds uninstall feedback privacy policy info ([ed17943](https://github.com/Codeinwp/themeisle-sdk/commit/ed17943))
vendor/codeinwp/themeisle-sdk/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ {one line to give the program's name and a brief idea of what it does.}
635
+ Copyright (C) {year} {name of author}
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ {project} Copyright (C) {year} {fullname}
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
vendor/codeinwp/themeisle-sdk/index.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ // phpcs:ignoreFile
3
+ // Nothing here.
vendor/codeinwp/themeisle-sdk/load.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loader for the ThemeIsleSDK
4
+ *
5
+ * Logic for loading always the latest SDK from the installed themes/plugins.
6
+ *
7
+ * @package ThemeIsleSDK
8
+ * @copyright Copyright (c) 2017, Marius Cristea
9
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
+ * @since 1.1.0
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ return;
15
+ }
16
+ // Current SDK version and path.
17
+ $themeisle_sdk_version = '3.2.20';
18
+ $themeisle_sdk_path = dirname( __FILE__ );
19
+
20
+ global $themeisle_sdk_max_version;
21
+ global $themeisle_sdk_max_path;
22
+
23
+ // If this is the latest SDK and it comes from a theme, we should load licenser separately.
24
+ $themeisle_sdk_relative_licenser_path = '/src/Modules/Licenser.php';
25
+
26
+ global $themeisle_sdk_abs_licenser_path;
27
+ if ( ! is_file( $themeisle_sdk_path . $themeisle_sdk_relative_licenser_path ) && is_file( $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path ) ) {
28
+ $themeisle_sdk_abs_licenser_path = $themeisle_sdk_max_path . $themeisle_sdk_relative_licenser_path;
29
+ add_filter( 'themeisle_sdk_required_files', 'themeisle_sdk_load_licenser_if_present' );
30
+ }
31
+ if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_path ) == 0 &&
32
+ apply_filters( 'themeisle_sdk_should_overwrite_path', false, $themeisle_sdk_path, $themeisle_sdk_max_path ) ) {
33
+ $themeisle_sdk_max_path = $themeisle_sdk_path;
34
+ }
35
+
36
+ if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) > 0 ) {
37
+ $themeisle_sdk_max_version = $themeisle_sdk_version;
38
+ $themeisle_sdk_max_path = $themeisle_sdk_path;
39
+ }
40
+
41
+ // load the latest sdk version from the active Themeisle products.
42
+ if ( ! function_exists( 'themeisle_sdk_load_licenser_if_present' ) ) :
43
+ /**
44
+ * Always load the licenser, if present.
45
+ *
46
+ * @param array $to_load Previously files to load.
47
+ */
48
+ function themeisle_sdk_load_licenser_if_present( $to_load ) {
49
+ global $themeisle_sdk_abs_licenser_path;
50
+ $to_load[] = $themeisle_sdk_abs_licenser_path;
51
+
52
+ return $to_load;
53
+ }
54
+ endif;
55
+
56
+ // load the latest sdk version from the active Themeisle products.
57
+ if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) :
58
+ /**
59
+ * Always load the latest sdk version.
60
+ */
61
+ function themeisle_sdk_load_latest() {
62
+ /**
63
+ * Don't load the library if we are on < 5.4.
64
+ */
65
+ if ( version_compare( PHP_VERSION, '5.4.32', '<' ) ) {
66
+ return;
67
+ }
68
+ global $themeisle_sdk_max_path;
69
+ require_once $themeisle_sdk_max_path . '/start.php';
70
+ }
71
+ endif;
72
+ add_action( 'init', 'themeisle_sdk_load_latest' );
vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The abstract class for module definition.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Loader
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 3.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Common;
13
+
14
+ use ThemeisleSDK\Product;
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ exit;
18
+ }
19
+
20
+ /**
21
+ * Class Abstract_Module.
22
+ *
23
+ * @package ThemeisleSDK\Common
24
+ */
25
+ abstract class Abstract_Module {
26
+ /**
27
+ * Product which use the module.
28
+ *
29
+ * @var Product $product Product object.
30
+ */
31
+ protected $product = null;
32
+
33
+ /**
34
+ * Can load the module for the selected product.
35
+ *
36
+ * @param Product $product Product data.
37
+ *
38
+ * @return bool Should load module?
39
+ */
40
+ abstract public function can_load( $product );
41
+
42
+ /**
43
+ * Bootstrap the module.
44
+ *
45
+ * @param Product $product Product object.
46
+ */
47
+ abstract public function load( $product );
48
+
49
+ /**
50
+ * Check if the product is from partner.
51
+ *
52
+ * @param Product $product Product data.
53
+ *
54
+ * @return bool Is product from partner.
55
+ */
56
+ public function is_from_partner( $product ) {
57
+
58
+ foreach ( Module_Factory::$domains as $partner_domain ) {
59
+ if ( strpos( $product->get_store_url(), $partner_domain ) !== false ) {
60
+ return true;
61
+ }
62
+ }
63
+
64
+ return array_key_exists( $product->get_slug(), Module_Factory::$slugs );
65
+ }
66
+
67
+ /**
68
+ * Wrapper for wp_remote_get on VIP environments.
69
+ *
70
+ * @param string $url Url to check.
71
+ * @param array $args Option params.
72
+ *
73
+ * @return array|\WP_Error
74
+ */
75
+ public function safe_get( $url, $args = array() ) {
76
+ return function_exists( 'vip_safe_wp_remote_get' )
77
+ ? vip_safe_wp_remote_get( $url )
78
+ : wp_remote_get( //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, Already used.
79
+ $url,
80
+ $args
81
+ );
82
+ }
83
+ }
vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The module factory class.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Loader
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 3.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Common;
13
+
14
+ use ThemeisleSDK\Product;
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ exit;
18
+ }
19
+
20
+ /**
21
+ * Class Job_Factory
22
+ *
23
+ * @package ThemeisleSDK\Common
24
+ */
25
+ class Module_Factory {
26
+ /**
27
+ * Partners slugs.
28
+ *
29
+ * @var array $SLUGS Partners product slugs.
30
+ */
31
+ public static $slugs = [
32
+ 'zermatt' => true,
33
+ 'neto' => true,
34
+ 'olsen' => true,
35
+ 'benson' => true,
36
+ 'romero' => true,
37
+ 'carmack' => true,
38
+ 'puzzle' => true,
39
+ 'broadsheet' => true,
40
+ 'girlywp' => true,
41
+ 'veggie' => true,
42
+ 'zeko' => true,
43
+ 'maishawp' => true,
44
+ 'didi' => true,
45
+ 'liber' => true,
46
+ 'medicpress-pt' => true,
47
+ 'adrenaline-pt' => true,
48
+ 'consultpress-pt' => true,
49
+ 'legalpress-pt' => true,
50
+ 'gympress-pt' => true,
51
+ 'readable-pt' => true,
52
+ 'bolts-pt' => true,
53
+ ];
54
+ /**
55
+ * Partners domains.
56
+ *
57
+ * @var array $DOMAINS Partners domains.
58
+ */
59
+ public static $domains = [
60
+ 'proteusthemes.com',
61
+ 'anarieldesign.com',
62
+ 'prothemedesign.com',
63
+ 'cssigniter.com',
64
+ ];
65
+ /**
66
+ * Map which contains all the modules loaded for each product.
67
+ *
68
+ * @var array Mapping array.
69
+ */
70
+ private static $modules_attached = [];
71
+
72
+ /**
73
+ * Load availabe modules for the selected product.
74
+ *
75
+ * @param Product $product Loaded product.
76
+ * @param array $modules List of modules.
77
+ */
78
+ public static function attach( $product, $modules ) {
79
+
80
+ if ( ! isset( self::$modules_attached[ $product->get_slug() ] ) ) {
81
+ self::$modules_attached[ $product->get_slug() ] = [];
82
+ }
83
+
84
+ foreach ( $modules as $module ) {
85
+ $class = 'ThemeisleSDK\\Modules\\' . ucwords( $module, '_' );
86
+ /**
87
+ * Module object.
88
+ *
89
+ * @var Abstract_Module $module_object Module instance.
90
+ */
91
+ $module_object = new $class( $product );
92
+
93
+ if ( ! $module_object->can_load( $product ) ) {
94
+ continue;
95
+ }
96
+ self::$modules_attached[ $product->get_slug() ][ $module ] = $module_object->load( $product );
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Products/Modules loaded map.
102
+ *
103
+ * @return array Modules map.
104
+ */
105
+ public static function get_modules_map() {
106
+ return self::$modules_attached;
107
+ }
108
+ }
vendor/codeinwp/themeisle-sdk/src/Loader.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main loader class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Loader
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK;
13
+
14
+ use ThemeisleSDK\Common\Module_Factory;
15
+
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ exit;
18
+ }
19
+
20
+
21
+ /**
22
+ * Singleton loader for ThemeIsle SDK.
23
+ */
24
+ final class Loader {
25
+ /**
26
+ * Singleton instance.
27
+ *
28
+ * @var Loader instance The singleton instance
29
+ */
30
+ private static $instance;
31
+ /**
32
+ * Current loader version.
33
+ *
34
+ * @var string $version The class version.
35
+ */
36
+ private static $version = '2.0.0';
37
+ /**
38
+ * Holds registered products.
39
+ *
40
+ * @var array The products which use the SDK.
41
+ */
42
+ private static $products = [];
43
+ /**
44
+ * Holds available modules to load.
45
+ *
46
+ * @var array The modules which SDK will be using.
47
+ */
48
+ private static $available_modules = [
49
+ 'dashboard_widget',
50
+ 'rollback',
51
+ 'uninstall_feedback',
52
+ 'licenser',
53
+ 'logger',
54
+ 'translate',
55
+ 'review',
56
+ 'recommendation',
57
+ 'notification',
58
+
59
+ ];
60
+
61
+ /**
62
+ * Initialize the sdk logic.
63
+ */
64
+ public static function init() {
65
+ if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
66
+ self::$instance = new Loader();
67
+ $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) );
68
+ foreach ( $modules as $key => $module ) {
69
+ if ( ! class_exists( 'ThemeisleSDK\\Modules\\' . ucwords( $module, '_' ) ) ) {
70
+ unset( $modules[ $key ] );
71
+ }
72
+ }
73
+ self::$available_modules = $modules;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Get cache token used in API requests.
79
+ *
80
+ * @return string Cache token.
81
+ */
82
+ public static function get_cache_token() {
83
+ $cache_token = get_transient( 'themeisle_sdk_cache_token' );
84
+ if ( false === $cache_token ) {
85
+ $cache_token = wp_generate_password( 6, false );
86
+ set_transient( $cache_token, WEEK_IN_SECONDS );
87
+ }
88
+
89
+ return $cache_token;
90
+ }
91
+
92
+ /**
93
+ * Clear cache token.
94
+ */
95
+ public static function clear_cache_token() {
96
+ delete_transient( 'themeisle_sdk_cache_token' );
97
+ }
98
+
99
+ /**
100
+ * Register product into SDK.
101
+ *
102
+ * @param string $base_file The product base file.
103
+ *
104
+ * @return Loader The singleton object.
105
+ */
106
+ public static function add_product( $base_file ) {
107
+
108
+ if ( ! is_file( $base_file ) ) {
109
+ return self::$instance;
110
+ }
111
+ $product = new Product( $base_file );
112
+
113
+ Module_Factory::attach( $product, self::get_modules() );
114
+
115
+ self::$products[ $product->get_slug() ] = $product;
116
+
117
+ return self::$instance;
118
+ }
119
+
120
+ /**
121
+ * Get all registered modules by the SDK.
122
+ *
123
+ * @return array Modules available.
124
+ */
125
+ public static function get_modules() {
126
+ return self::$available_modules;
127
+ }
128
+
129
+ /**
130
+ * Get all products using the SDK.
131
+ *
132
+ * @return array Products available.
133
+ */
134
+ public static function get_products() {
135
+ return self::$products;
136
+ }
137
+
138
+ /**
139
+ * Get the version of the SDK.
140
+ *
141
+ * @return string The version.
142
+ */
143
+ public static function get_version() {
144
+ return self::$version;
145
+ }
146
+
147
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The blog dashboard model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Blog dashboard widget module for ThemeIsle SDK.
24
+ */
25
+ class Dashboard_Widget extends Abstract_Module {
26
+
27
+ /**
28
+ * Fetched feeds items.
29
+ *
30
+ * @var array Feed items.
31
+ */
32
+ private $items = array();
33
+
34
+ /**
35
+ * Dashboard widget title.
36
+ *
37
+ * @var string $dashboard_name Dashboard name.
38
+ */
39
+ private $dashboard_name = '';
40
+
41
+ /**
42
+ * Dashboard widget feed sources.
43
+ *
44
+ * @var array $feeds Feed url.
45
+ */
46
+ private $feeds = [];
47
+
48
+ /**
49
+ * Should we load this module.
50
+ *
51
+ * @param Product $product Product object.
52
+ *
53
+ * @return bool
54
+ */
55
+ public function can_load( $product ) {
56
+ if ( $this->is_from_partner( $product ) ) {
57
+ return false;
58
+ }
59
+
60
+ if ( ! apply_filters( $product->get_slug() . '_load_dashboard_widget', true ) ) {
61
+ return false;
62
+ }
63
+
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * Registers the hooks.
69
+ *
70
+ * @param Product $product Product to load.
71
+ *
72
+ * @return Dashboard_Widget Module instance.
73
+ */
74
+ public function load( $product ) {
75
+ if ( apply_filters( 'themeisle_sdk_hide_dashboard_widget', false ) ) {
76
+ return;
77
+ }
78
+ $this->product = $product;
79
+ $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' );
80
+ $this->feeds = apply_filters(
81
+ 'themeisle_sdk_dashboard_widget_feeds',
82
+ [
83
+ 'https://themeisle.com/blog/feed',
84
+ ]
85
+ );
86
+ add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
87
+ add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
88
+ add_filter( 'themeisle_sdk_recommend_plugin_or_theme', array( &$this, 'recommend_plugin_or_theme' ) );
89
+
90
+ return $this;
91
+ }
92
+
93
+
94
+ /**
95
+ * Add widget to the dashboard
96
+ *
97
+ * @return string|void
98
+ */
99
+ public function add_widget() {
100
+ global $wp_meta_boxes;
101
+ if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) {
102
+ return;
103
+ }
104
+ wp_add_dashboard_widget(
105
+ 'themeisle',
106
+ $this->dashboard_name,
107
+ [
108
+ $this,
109
+ 'render_dashboard_widget',
110
+ ]
111
+ );
112
+ }
113
+
114
+ /**
115
+ * Render widget content
116
+ */
117
+ public function render_dashboard_widget() {
118
+ $this->setup_feeds();
119
+ if ( empty( $this->items ) || ! is_array( $this->items ) ) {
120
+ return;
121
+ }
122
+ ?>
123
+ <style type="text/css">
124
+ #themeisle ul li.ti-dw-recommend-item {
125
+ padding-left: 7px;
126
+ border-top: 1px solid #eee;
127
+ margin-bottom: 0px;
128
+ padding-top: 6px;
129
+ }
130
+
131
+ #themeisle h2.hndle {
132
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABbCAMAAADncTNAAAAAtFBMVEVHcEyAgIB/f3+xsbGgoaGBgYGCgoKKioqAgIC1tbW5ubnFx8iAgIDU1taBgYGCgoKAgIC0tLXW19jW2NiAgIC3uLiBgYHLzMy4uLhycnLW19d/f3/T1NW0tLTX19mVlZWvr6+BgYHl5eWKiottbW5JSUnW2Nm5ubnh4eHT1NWVlZVjY2N4eHh9fX6pqqq+v79PT0/39/fu7u7Nzc7Z2ttYWFgBAQHDw8P////JysoZGRk0NTZqJc/sAAAAIXRSTlMA0FL7/oEnEPL6eibivm9gwJya76/enFq2CXI+2lFAyM8GATmPAAADj0lEQVR4Xu2YaW/iOhSGAwRCWDosnXa6znjJvm8svf//f12TuARyhiR2pfnUR6gSEnr0+uT4xK7yRb755pvhHePli5K7Bfpkuhoq8ozRJdMH+WWha6Z3sqYparCSLRJqspjImVbANJU03cNMMpofAwQZCGsmpQYyFvVM0Q00OQ9koMl5IPcCoro+RA1Dt2Ea9n9eZ0+YHJLkgIlkDywQx00wCTyaReiKH8LbNU9ybJOdkchV6QFxyCFLbVvdfaREqgUWg/tx2UbqIcK2Hex2TdGLwFTjIj3XP3YfCZFsb23KRZn/3263oymSFI0/a5S4PqUBjoBIJBDjeEhCN0wxQSRybIxtJ3K5SGzuE/vAwIQc8ZmMMJFAIM4oikZItfEFtorGgoE43FObwqHU68OtPCnOz8KZ2Jbl5LgkSW0Tc7YyIz/EFWmS4jMbiZU5mJOmKRaJpKGGyLZtDJh3iyaNUu/3+xyKnrtFL71EG+FTiMpENhQtxUQ8kSOXCIr2tnCNhg/gTX0SHYFp0t7TCwQZ7U841yoHrW6rtGroUwTWVnLMssxx+H4bgZcSOFf5MYx0Ae8FghomMDyC2EBNImBywPkNTDNqGLQpIg2TjUNU8tBy9DQMo0DAZF16rAi7vJAtFTIYFAHUc6hIRW6OuOhJgaCSwmDEAYK4oa7ro+qIEyJU/US7KTJKPNSFT9tFgVFBu0SF1y7yjX4masRA9Da7EFGj28R/BkQz6xGIOurkx38T/bKs9Uk8aIiMwm/Jw0VP1yLrJwt13xAxvABBgsK4KWLov35DkRF7ZaqgzuZ7MQ8MOntmVYyAqKTwaICKqvSUFnVccMN5sziEP/5+xGDTahbH5Q3ZB76zr8fI+nJtvUUU3t3ml5GKviK/npCg3CGodnuJ4JVkfRFJYGVDBZrqKnn9RLf+CzDTS5PaN5J38+auzX4ykU4Qoj0rdKfcYs5ijfo9OL/uRUgZyQr7NCWtWwiUSLc4arfJa7lpszTA1OJZAQ8w8dXFrR5YHzCWSnS3pZ18tOi4Ps4vl/c7i/6qomjRecN+UubrPyPGn/VEMU3T0UFHkaPzpgjxmJsnjmrtionlMDZiog0TsY/DPtn8SXtlBvbtxKtwopy7lqW3smQO+yoGE1Uu55GJ3pmI8ygoejZNnqj0vnIRCyTKfLstRdtStGQi09myUsvwvlkuzSUXbV+Xz5ryBebV33fln/A/moud69FZiEYAAAAASUVORK5CYII=');
133
+ background-repeat: no-repeat;
134
+ background-position: 92% 50%;
135
+ background-size: 25px;
136
+ }
137
+
138
+ #themeisle .inside {
139
+ padding: 0;
140
+ }
141
+
142
+ .ti-feed-list {
143
+ padding: 0 12px 5px;
144
+ margin-bottom: 10px;
145
+ border-bottom: 1px solid #eee;
146
+ }
147
+
148
+ .ti-dw-feed-item a {
149
+ display: flex;
150
+ align-items: center;
151
+ margin-bottom: 5px;
152
+ padding: 5px;
153
+ transition: .2s ease;
154
+ border-radius: 3px;
155
+ }
156
+
157
+ .ti-dw-feed-item a:hover {
158
+ background-color: #f8f8f8;
159
+ }
160
+
161
+ .ti-dw-feed-item a:hover .ti-dw-date-container {
162
+ opacity: .9;
163
+ }
164
+
165
+ .ti-dw-feed-item .ti-dw-month-container {
166
+ margin-top: -5px;
167
+ text-transform: uppercase;
168
+ font-size: 10px;
169
+ letter-spacing: 1px;
170
+ font-weight: 700;
171
+ }
172
+
173
+ .ti-dw-feed-item .ti-dw-date-container {
174
+ border-radius: 3px;
175
+ transition: .2s ease;
176
+ min-height: 35px;
177
+ margin-right: 5px;
178
+ min-width: 35px;
179
+ text-align: center;
180
+ border: 1px solid #2a6f97;
181
+ color: #fff;
182
+ background: #2ea2cc;
183
+ display: flex;
184
+ flex-direction: column;
185
+ justify-content: center;
186
+ }
187
+
188
+ .ti-dw-footer {
189
+ padding: 0 12px 5px;
190
+ text-align: center;
191
+ }
192
+
193
+ .ti-dw-recommend-item {
194
+ display: block;
195
+ }
196
+
197
+ .ti-dw-recommend-item span {
198
+ color: #72777c;
199
+ }
200
+
201
+ .ti-dw-powered-by {
202
+ font-size: 11px;
203
+ margin-top: 3px;
204
+ display: block;
205
+ color: #72777c;
206
+ }
207
+
208
+ .ti-dw-powered-by span {
209
+ font-weight: 600;
210
+ }
211
+
212
+ </style>
213
+ <?php do_action( 'themeisle_sdk_dashboard_widget_before', $this->product ); ?>
214
+
215
+ <ul class="ti-feed-list">
216
+ <?php
217
+
218
+ foreach ( $this->items as $item ) {
219
+ ?>
220
+ <li class="ti-dw-feed-item">
221
+ <a href="
222
+ <?php
223
+ echo esc_url(
224
+ add_query_arg(
225
+ array(
226
+ 'utm_source' => 'wpadmin',
227
+ 'utm_campaign' => 'feed',
228
+ 'utm_medium' => 'dashboard_widget',
229
+ ),
230
+ $item['link']
231
+ )
232
+ );
233
+ ?>
234
+ " target="_blank">
235
+ <span class="ti-dw-date-container"><span
236
+ class="ti-dw-day-container"><?php echo esc_attr( gmdate( 'd', $item['date'] ) ); ?></span> <span
237
+ class="ti-dw-month-container"><?php echo esc_attr( substr( gmdate( 'M', $item['date'] ), 0, 3 ) ); ?></span></span><?php echo esc_attr( $item['title'] ); ?>
238
+ </a>
239
+ </li>
240
+ <?php
241
+ }
242
+ ?>
243
+ </ul>
244
+ <?php
245
+ $recommend = apply_filters( 'themeisle_sdk_recommend_plugin_or_theme', array() );
246
+ if ( ! is_array( $recommend ) || empty( $recommend ) ) {
247
+ return;
248
+ }
249
+
250
+ $type = $recommend['type'];
251
+
252
+ if ( ( 'theme' === $type && ! current_user_can( 'install_themes' ) ) ) {
253
+ return;
254
+ }
255
+ if ( ( 'plugin' === $type && ! current_user_can( 'install_plugins' ) ) ) {
256
+ return;
257
+ }
258
+
259
+ add_thickbox();
260
+ $url = add_query_arg(
261
+ [
262
+ 'theme' => $recommend['slug'],
263
+ ],
264
+ network_admin_url( 'theme-install.php' )
265
+ );
266
+
267
+ if ( 'plugin' === $type ) {
268
+
269
+ $url = add_query_arg(
270
+ array(
271
+ 'tab' => 'plugin-information',
272
+ 'plugin' => $recommend['slug'],
273
+ ),
274
+ network_admin_url( 'plugin-install.php' )
275
+ );
276
+ }
277
+ ?>
278
+ <div class="ti-dw-footer">
279
+ <span class="ti-dw-recommend-item ">
280
+ <span class="ti-dw-recommend"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ) ); ?>
281
+ : </span>
282
+ <?php
283
+ echo esc_attr(
284
+ trim(
285
+ str_replace(
286
+ array(
287
+ 'lite',
288
+ 'Lite',
289
+ '(Lite)',
290
+ '(lite)',
291
+ ),
292
+ '',
293
+ $recommend['name']
294
+ )
295
+ )
296
+ );
297
+ ?>
298
+ (<a class="thickbox open-plugin-details-modal"
299
+ href="<?php echo esc_url( $url . '&TB_iframe=true&width=600&height=500' ); ?>"><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_install_label', 'Install' ) ); ?></a>)
300
+ </span>
301
+ <span class="ti-dw-powered-by"><span><?php echo esc_attr( apply_filters( 'themeisle_sdk_dashboard_widget_powered_by', sprintf( 'Powered by %s', $this->product->get_friendly_name() ) ) ); ?></span></span>
302
+ </div>
303
+
304
+ <?php
305
+
306
+ }
307
+
308
+ /**
309
+ * Setup feed items.
310
+ */
311
+ private function setup_feeds() {
312
+ if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
313
+ // Load SimplePie Instance.
314
+ $feed = fetch_feed( $this->feeds );
315
+ // TODO report error when is an error loading the feed.
316
+ if ( is_wp_error( $feed ) ) {
317
+ return;
318
+ }
319
+
320
+ $items = $feed->get_items( 0, 5 );
321
+ foreach ( (array) $items as $item ) {
322
+ $items_normalized[] = array(
323
+ 'title' => $item->get_title(),
324
+ 'date' => $item->get_date( 'U' ),
325
+ 'link' => $item->get_permalink(),
326
+ );
327
+ }
328
+ set_transient( 'themeisle_sdk_feed_items', $items_normalized, 48 * HOUR_IN_SECONDS );
329
+ }
330
+ $this->items = $items_normalized;
331
+ }
332
+
333
+ /**
334
+ * Either the current product is installed or not.
335
+ *
336
+ * @param array $val The current recommended product.
337
+ *
338
+ * @return bool Either we should exclude the plugin or not.
339
+ */
340
+ public function remove_current_products( $val ) {
341
+ if ( 'theme' === $val['type'] ) {
342
+ $exist = wp_get_theme( $val['slug'] );
343
+
344
+ return ! $exist->exists();
345
+ } else {
346
+ $all_plugins = array_keys( get_plugins() );
347
+ foreach ( $all_plugins as $slug ) {
348
+ if ( strpos( $slug, $val['slug'] ) !== false ) {
349
+ return false;
350
+ }
351
+ }
352
+
353
+ return true;
354
+ }
355
+ }
356
+
357
+ /**
358
+ * Contact the API and fetch the recommended plugins/themes
359
+ */
360
+ public function recommend_plugin_or_theme() {
361
+ $products = $this->get_product_from_api();
362
+ if ( ! is_array( $products ) ) {
363
+ $products = array();
364
+ }
365
+ $products = array_filter( $products, array( $this, 'remove_current_products' ) );
366
+ $products = array_merge( $products );
367
+ if ( count( $products ) > 1 ) {
368
+ shuffle( $products );
369
+ $products = array_slice( $products, 0, 1 );
370
+ }
371
+ $to_recommend = isset( $products[0] ) ? $products[0] : $products;
372
+
373
+ return $to_recommend;
374
+ }
375
+
376
+ /**
377
+ * Fetch products from the recomended section.
378
+ *
379
+ * @return array|mixed The list of products to use in recomended section.
380
+ */
381
+ public function get_product_from_api() {
382
+ if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
383
+ $products = array();
384
+ $all_themes = $this->get_themes_from_wporg( 'themeisle' );
385
+ $all_plugins = $this->get_plugins_from_wporg( 'themeisle' );
386
+ static $allowed_products = [
387
+ 'hestia' => true,
388
+ 'neve' => true,
389
+ 'visualizer' => true,
390
+ 'feedzy-rss-feeds' => true,
391
+ 'wp-product-review' => true,
392
+ 'otter-blocks' => true,
393
+ 'themeisle-companion' => true,
394
+ ];
395
+ foreach ( $all_themes as $theme ) {
396
+ if ( $theme->active_installs < 4999 ) {
397
+ continue;
398
+ }
399
+ if ( ! isset( $allowed_products[ $theme->slug ] ) ) {
400
+ continue;
401
+ }
402
+ $products[] = array(
403
+ 'name' => $theme->name,
404
+ 'type' => 'theme',
405
+ 'slug' => $theme->slug,
406
+ 'installs' => $theme->active_installs,
407
+ );
408
+ }
409
+ foreach ( $all_plugins as $plugin ) {
410
+ if ( $plugin->active_installs < 4999 ) {
411
+ continue;
412
+ }
413
+ if ( ! isset( $allowed_products[ $plugin->slug ] ) ) {
414
+ continue;
415
+ }
416
+ $products[] = array(
417
+ 'name' => $plugin->name,
418
+ 'type' => 'plugin',
419
+ 'slug' => $plugin->slug,
420
+ 'installs' => $plugin->active_installs,
421
+ );
422
+ }
423
+ set_transient( 'themeisle_sdk_products', $products, 6 * HOUR_IN_SECONDS );
424
+ }
425
+
426
+ return $products;
427
+ }
428
+
429
+ /**
430
+ * Fetch themes from wporg api.
431
+ *
432
+ * @param string $author The author name.
433
+ *
434
+ * @return array The list of themes.
435
+ */
436
+ public function get_themes_from_wporg( $author ) {
437
+ $products = $this->safe_get(
438
+ 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[author]=' . $author . '&request[per_page]=30&request[fields][active_installs]=true'
439
+ );
440
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
441
+ if ( is_object( $products ) ) {
442
+ $products = isset( $products->themes ) ? $products->themes : array();
443
+ } else {
444
+ $products = array();
445
+ }
446
+
447
+ return (array) $products;
448
+ }
449
+
450
+ /**
451
+ * Fetch plugin from wporg api.
452
+ *
453
+ * @param string $author The author slug.
454
+ *
455
+ * @return array The list of plugins for the selected author.
456
+ */
457
+ public function get_plugins_from_wporg( $author ) {
458
+ $products = $this->safe_get(
459
+ 'https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[author]=' . $author . '&request[per_page]=40&request[fields][active_installs]=true'
460
+ );
461
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
462
+ if ( is_object( $products ) ) {
463
+ $products = isset( $products->plugins ) ? $products->plugins : array();
464
+ } else {
465
+ $products = array();
466
+ }
467
+
468
+ return (array) $products;
469
+ }
470
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php ADDED
@@ -0,0 +1,1041 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main loader class for license handling.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ // Exit if accessed directly.
15
+ use ThemeisleSDK\Common\Abstract_Module;
16
+ use ThemeisleSDK\Loader;
17
+ use ThemeisleSDK\Product;
18
+
19
+ if ( ! defined( 'ABSPATH' ) ) {
20
+ exit;
21
+ }
22
+
23
+ /**
24
+ * Licenser module for ThemeIsle SDK.
25
+ */
26
+ class Licenser extends Abstract_Module {
27
+
28
+ /**
29
+ * Number of max failed checks before showing the license message.
30
+ *
31
+ * @var int $max_failed Maximum failed checks allowed before show the notice
32
+ */
33
+ private static $max_failed = 5;
34
+ /**
35
+ * License key string.
36
+ *
37
+ * @var string $license_key The license key string
38
+ */
39
+ public $license_key;
40
+ /**
41
+ * This ensures that the custom API request only runs on the second time that WP fires the update check.
42
+ *
43
+ * @var bool $do_check Flag for request.
44
+ */
45
+ private $do_check = false;
46
+ /**
47
+ * Number of failed checks to the api endpoint.
48
+ *
49
+ * @var bool $failed_checks
50
+ */
51
+ private $failed_checks = 0;
52
+ /**
53
+ * The product update response key.
54
+ *
55
+ * @var string $product_key Product key.
56
+ */
57
+ private $product_key;
58
+
59
+ /**
60
+ * Holds local license object.
61
+ *
62
+ * @var null Local license object.
63
+ */
64
+ private $license_local = null;
65
+ /**
66
+ * Product namespace, used for fixed name filters/cli commands.
67
+ *
68
+ * @var string $namespace Product namespace.
69
+ */
70
+ private $namespace = null;
71
+
72
+ /**
73
+ * Disable wporg updates for premium products.
74
+ *
75
+ * @param string $r Update payload.
76
+ * @param string $url The api url.
77
+ *
78
+ * @return mixed List of themes to check for update.
79
+ */
80
+ public function disable_wporg_update( $r, $url ) {
81
+
82
+ if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/' ) ) {
83
+ return $r;
84
+ }
85
+
86
+ // Decode the JSON response.
87
+ $themes = json_decode( $r['body']['themes'] );
88
+
89
+ unset( $themes->themes->{$this->product->get_slug()} );
90
+
91
+ // Encode the updated JSON response.
92
+ $r['body']['themes'] = wp_json_encode( $themes );
93
+
94
+ return $r;
95
+ }
96
+
97
+ /**
98
+ * Register the setting for the license of the product.
99
+ *
100
+ * @return bool
101
+ */
102
+ public function register_settings() {
103
+ if ( ! is_admin() ) {
104
+ return false;
105
+ }
106
+ if ( apply_filters( $this->product->get_key() . '_hide_license_field', false ) ) {
107
+ return;
108
+ }
109
+ add_settings_field(
110
+ $this->product->get_key() . '_license',
111
+ $this->product->get_name() . ' license',
112
+ array( $this, 'license_view' ),
113
+ 'general'
114
+ );
115
+ }
116
+
117
+ /**
118
+ * The license view field.
119
+ */
120
+ public function license_view() {
121
+ $status = $this->get_license_status();
122
+ $value = $this->license_key;
123
+
124
+ $activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
125
+ $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
126
+ $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
127
+ $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
128
+ $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
129
+ $error_message = $this->get_error();
130
+ ?>
131
+ <style type="text/css">
132
+ input.themeisle-sdk-text-input-valid {
133
+ border: 1px solid #7ad03a;
134
+ }
135
+
136
+ input.themeisle-sdk-license-input {
137
+ width: 300px;
138
+ padding: 0 8px;
139
+ line-height: 2;
140
+ min-height: 30px;
141
+ }
142
+
143
+ .themeisle-sdk-license-deactivate-cta {
144
+ color: #fff;
145
+ background: #7ad03a;
146
+ display: inline-block;
147
+ text-decoration: none;
148
+ font-size: 13px;
149
+ line-height: 30px;
150
+ height: 26px;
151
+ margin-left: 5px;
152
+ padding: 0 10px 3px;
153
+ -webkit-border-radius: 3px;
154
+ border-radius: 3px;
155
+ }
156
+
157
+ .themeisle-sdk-license-activate-cta {
158
+ color: #fff;
159
+ background: #dd3d36;
160
+ display: inline-block;
161
+ text-decoration: none;
162
+ font-size: 13px;
163
+ line-height: 30px;
164
+ height: 26px;
165
+ margin-left: 5px;
166
+ padding: 0 10px 3px;
167
+ -webkit-border-radius: 3px;
168
+ border-radius: 3px;
169
+ }
170
+
171
+ button.button.themeisle-sdk-licenser-button-cta {
172
+ line-height: 26px;
173
+ height: 29px;
174
+ vertical-align: top;
175
+ }
176
+
177
+ </style>
178
+ <?php
179
+ echo sprintf(
180
+ '<p>%s<input class="themeisle-sdk-license-input %s" type="text" id="%s_license" name="%s_license" value="%s" /><a class="%s">%s</a>&nbsp;&nbsp;&nbsp;<button name="%s_btn_trigger" class="button button-primary themeisle-sdk-licenser-button-cta" value="yes" type="submit" >%s</button></p><p class="description">%s</p>%s',
181
+ ( ( 'valid' === $status ) ? sprintf( '<input type="hidden" value="%s" name="%s_license" />', esc_attr( $value ), esc_attr( $this->product->get_key() ) ) : '' ),
182
+ ( ( 'valid' === $status ) ? 'themeisle-sdk-text-input-valid' : '' ),
183
+ esc_attr( $this->product->get_key() ),
184
+ esc_attr( ( ( 'valid' === $status ) ? $this->product->get_key() . '_mask' : $this->product->get_key() ) ),
185
+ esc_attr( ( ( 'valid' === $status ) ? ( str_repeat( '*', 30 ) . substr( $value, - 5 ) ) : $value ) ),
186
+ esc_attr( ( 'valid' === $status ? 'themeisle-sdk-license-deactivate-cta' : 'themeisle-sdk-license-activate-cta' ) ),
187
+ esc_attr( 'valid' === $status ? $valid_string : $invalid_string ),
188
+ esc_attr( $this->product->get_key() ),
189
+ esc_attr( 'valid' === $status ? $deactivate_string : $activate_string ),
190
+ sprintf( wp_kses_data( $license_message ), '<a href="' . esc_url( $this->get_api_url() ) . '">' . esc_attr( $this->get_distributor_name() ) . '</a> ', esc_attr( $this->product->get_type() ) ),
191
+ wp_kses_data( empty( $error_message ) ? '' : sprintf( '<p style="color:#dd3d36">%s</p>', ( $error_message ) ) )
192
+ ) . wp_nonce_field( $this->product->get_key() . 'nonce', $this->product->get_key() . 'nonce_field', false, false );//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
193
+
194
+ }
195
+
196
+ /**
197
+ * Return the license status.
198
+ *
199
+ * @param bool $check_expiration Should check if license is valid, but expired.
200
+ *
201
+ * @return string The License status.
202
+ */
203
+ public function get_license_status( $check_expiration = false ) {
204
+
205
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
206
+
207
+ if ( '' === $license_data ) {
208
+ return get_option( $this->product->get_key() . '_license_status', 'not_active' );
209
+ }
210
+ $status = isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
211
+ if ( false === $check_expiration ) {
212
+ return $status;
213
+ }
214
+
215
+ return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
216
+ }
217
+
218
+ /**
219
+ * Return the last error message.
220
+ *
221
+ * @return mixed Error message.
222
+ */
223
+ public function get_error() {
224
+ return get_transient( $this->product->get_key() . 'act_err' );
225
+ }
226
+
227
+ /**
228
+ * Get remote api url.
229
+ *
230
+ * @return string Remote api url.
231
+ */
232
+ public function get_api_url() {
233
+ if ( $this->is_from_partner( $this->product ) ) {
234
+ return 'https://themeisle.com';
235
+ }
236
+
237
+ return $this->product->get_store_url();
238
+ }
239
+
240
+ /**
241
+ * Get remote api url.
242
+ *
243
+ * @return string Remote api url.
244
+ */
245
+ public function get_distributor_name() {
246
+ if ( $this->is_from_partner( $this->product ) ) {
247
+ return 'ThemeIsle';
248
+ }
249
+
250
+ return $this->product->get_store_name();
251
+ }
252
+
253
+ /**
254
+ * License price id.
255
+ *
256
+ * @return int License plan.
257
+ */
258
+ public function get_plan() {
259
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
260
+ if ( ! isset( $license_data->price_id ) ) {
261
+ return - 1;
262
+ }
263
+
264
+ return (int) $license_data->price_id;
265
+ }
266
+
267
+ /**
268
+ * Show the admin notice regarding the license status.
269
+ *
270
+ * @return bool Should we show the notice ?
271
+ */
272
+ public function show_notice() {
273
+ if ( ! is_admin() ) {
274
+ return false;
275
+ }
276
+
277
+ if ( apply_filters( $this->product->get_key() . '_hide_license_notices', false ) ) {
278
+ return false;
279
+ }
280
+
281
+ $status = $this->get_license_status( true );
282
+ $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.' );
283
+ $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
284
+ $expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', 'Your %s License Key has expired. In order to continue receiving support and software updates you must <a href="%s" target="_blank">renew</a> your license key.' );
285
+ // No activations left for this license.
286
+ if ( 'valid' != $status && $this->check_activation() ) {
287
+ ?>
288
+ <div class="error">
289
+ <p><strong>
290
+ <?php
291
+ echo sprintf(
292
+ wp_kses_data( $no_activations_string ),
293
+ esc_attr( $this->product->get_name() ),
294
+ esc_attr( $this->product->get_name() ),
295
+ '<a href="' . esc_url( $this->get_api_url() ) . '" target="_blank">' . esc_attr( $this->get_distributor_name() ) . '</a>'
296
+ );
297
+ ?>
298
+ </strong>
299
+ </p>
300
+ </div>
301
+ <?php
302
+ return false;
303
+ }
304
+
305
+ // Invalid license key.
306
+ if ( 'active_expired' === $status ) {
307
+ ?>
308
+ <div class="error">
309
+ <p>
310
+ <strong><?php echo sprintf( wp_kses_data( $expired_license_string ), esc_attr( $this->product->get_name() . ' ' . $this->product->get_type() ), esc_url( $this->get_api_url() . '?license=' . $this->license_key ) ); ?> </strong>
311
+ </p>
312
+ </div>
313
+ <?php
314
+
315
+ return false;
316
+ }
317
+ // Invalid license key.
318
+ if ( 'valid' != $status ) {
319
+ ?>
320
+ <div class="error">
321
+ <p>
322
+ <strong><?php echo sprintf( wp_kses_data( $no_valid_string ), esc_attr( $this->product->get_name() . ' ' . $this->product->get_type() ), esc_url( $this->get_api_url() ), esc_url( admin_url( 'options-general.php' ) . '#' . $this->product->get_key() . '_license' ) ); ?> </strong>
323
+ </p>
324
+ </div>
325
+ <?php
326
+
327
+ return false;
328
+ }
329
+
330
+ return true;
331
+ }
332
+
333
+ /**
334
+ * Check if the license is active or not.
335
+ *
336
+ * @return bool
337
+ */
338
+ public function check_activation() {
339
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
340
+ if ( '' === $license_data ) {
341
+ return false;
342
+ }
343
+
344
+ return isset( $license_data->license ) ? ( 'no_activations_left' == $license_data->license ) : false;
345
+
346
+ }
347
+
348
+ /**
349
+ * Check if the license is about to expire in the next month.
350
+ *
351
+ * @return bool
352
+ */
353
+ public function check_expiration() {
354
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
355
+ if ( '' === $license_data ) {
356
+ return false;
357
+ }
358
+ if ( ! isset( $license_data->expires ) ) {
359
+ return false;
360
+ }
361
+ if ( strtotime( $license_data->expires ) - time() > 30 * 24 * 3600 ) {
362
+ return false;
363
+ }
364
+
365
+ return true;
366
+ }
367
+
368
+ /**
369
+ * Return the renew url from the store used.
370
+ *
371
+ * @return string The renew url.
372
+ */
373
+ public function renew_url() {
374
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
375
+ if ( '' === $license_data ) {
376
+ return $this->get_api_url();
377
+ }
378
+ if ( ! isset( $license_data->download_id ) || ! isset( $license_data->key ) ) {
379
+ return $this->get_api_url();
380
+ }
381
+
382
+ return $this->get_api_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
383
+ }
384
+
385
+ /**
386
+ * Run the license check call.
387
+ */
388
+ public function product_valid() {
389
+ if ( false !== ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
390
+ return;
391
+ }
392
+ $license = $this->check_license();
393
+ set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
394
+ update_option( $this->product->get_key() . '_license_data', $license );
395
+ }
396
+
397
+ /**
398
+ * Check the license status.
399
+ *
400
+ * @return object The license data.
401
+ */
402
+ public function check_license() {
403
+ $status = $this->get_license_status();
404
+ if ( 'not_active' === $status ) {
405
+ $license_data = new \stdClass();
406
+ $license_data->license = 'not_active';
407
+
408
+ return $license_data;
409
+ }
410
+ $license = trim( $this->license_key );
411
+
412
+ $response = $this->do_license_process( $license, 'check' );
413
+
414
+ if ( is_wp_error( $response ) ) {
415
+ $license_data = new \stdClass();
416
+ $license_data->license = 'valid';
417
+ } else {
418
+ $license_data = $response;
419
+ }
420
+
421
+ $license_old = get_option( $this->product->get_key() . '_license_data', '' );
422
+
423
+ if ( 'valid' === $license_old->license && ( $license_data->license !== $license_old->license ) ) {
424
+ $this->increment_failed_checks();
425
+ } else {
426
+ $this->reset_failed_checks();
427
+ }
428
+
429
+ if ( $this->failed_checks <= self::$max_failed ) {
430
+ return $license_old;
431
+ }
432
+
433
+ if ( ! isset( $license_data->key ) ) {
434
+ $license_data->key = isset( $license_old->key ) ? $license_old->key : '';
435
+ }
436
+
437
+ return $license_data;
438
+
439
+ }
440
+
441
+ /**
442
+ * Do license activation/deactivation.
443
+ *
444
+ * @param string $license License key.
445
+ * @param string $action What do to.
446
+ *
447
+ * @return bool|\WP_Error
448
+ */
449
+ public function do_license_process( $license, $action = 'toggle' ) {
450
+ if ( strlen( $license ) < 10 ) {
451
+ return new \WP_Error( 'themeisle-license-invalid-format', 'Invalid license.' );
452
+ }
453
+ $status = $this->get_license_status();
454
+
455
+ if ( 'valid' === $status && 'activate' === $action ) {
456
+ return new \WP_Error( 'themeisle-license-already-active', 'License is already active.' );
457
+ }
458
+ if ( 'valid' !== $status && 'deactivate' === $action ) {
459
+ return new \WP_Error( 'themeisle-license-already-deactivate', 'License not active.' );
460
+ }
461
+
462
+ if ( 'toggle' === $action ) {
463
+ $action = ( 'valid' !== $status ? ( 'activate' ) : ( 'deactivate' ) );
464
+ }
465
+
466
+ // Call the custom API.
467
+ if ( 'check' === $action ) {
468
+ $response = $this->safe_get( sprintf( '%slicense/check/%s/%s/%s/%s', Product::API_URL, rawurlencode( $this->product->get_name() ), $license, rawurlencode( home_url() ), Loader::get_cache_token() ) );
469
+ } else {
470
+ $response = wp_remote_post(
471
+ sprintf( '%slicense/%s/%s/%s', Product::API_URL, $action, rawurlencode( $this->product->get_name() ), $license ),
472
+ array(
473
+ 'body' => wp_json_encode(
474
+ array(
475
+ 'url' => rawurlencode( home_url() ),
476
+ )
477
+ ),
478
+ 'headers' => array(
479
+ 'Content-Type' => 'application/json',
480
+ ),
481
+ )
482
+ );
483
+ }
484
+
485
+ // make sure the response came back okay.
486
+ if ( is_wp_error( $response ) ) {
487
+ return new \WP_Error( 'themeisle-license-500', sprintf( 'ERROR: Failed to connect to the license service. Please try again later. Reason: %s', $response->get_error_message() ) );
488
+ }
489
+
490
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
+
492
+ if ( ! is_object( $license_data ) ) {
493
+ return new \WP_Error( 'themeisle-license-404', 'ERROR: Failed to validate license. Please try again in one minute.' );
494
+ }
495
+ if ( 'check' === $action ) {
496
+ return $license_data;
497
+ }
498
+
499
+ Loader::clear_cache_token();
500
+
501
+ if ( ! isset( $license_data->license ) ) {
502
+ $license_data->license = 'invalid';
503
+ }
504
+
505
+ if ( ! isset( $license_data->key ) ) {
506
+ $license_data->key = $license;
507
+ }
508
+ if ( 'valid' === $license_data->license ) {
509
+ $this->reset_failed_checks();
510
+ }
511
+
512
+ if ( 'deactivate' === $action ) {
513
+
514
+ delete_option( $this->product->get_key() . '_license_data' );
515
+ delete_option( $this->product->get_key() . '_license_plan' );
516
+ delete_transient( $this->product->get_key() . '_license_data' );
517
+
518
+ return true;
519
+ }
520
+ if ( isset( $license_data->plan ) ) {
521
+ update_option( $this->product->get_key() . '_license_plan', $license_data->plan );
522
+ }
523
+ update_option( $this->product->get_key() . '_license_data', $license_data );
524
+ set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
525
+ if ( 'activate' === $action && 'valid' !== $license_data->license ) {
526
+ return new \WP_Error( 'themeisle-license-invalid', 'ERROR: Invalid license provided.' );
527
+ }
528
+
529
+ return true;
530
+ }
531
+
532
+ /**
533
+ * Reset the failed checks
534
+ */
535
+ private function reset_failed_checks() {
536
+ $this->failed_checks = 1;
537
+ update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
538
+ }
539
+
540
+ /**
541
+ * Increment the failed checks.
542
+ */
543
+ private function increment_failed_checks() {
544
+ $this->failed_checks ++;
545
+ update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
546
+ }
547
+
548
+ /**
549
+ * Activate the license remotely.
550
+ */
551
+ public function process_license() {
552
+ // listen for our activate button to be clicked.
553
+ if ( ! isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
554
+ return;
555
+ }
556
+ if ( ! isset( $_POST[ $this->product->get_key() . 'nonce_field' ] )
557
+ || ! wp_verify_nonce( $_POST[ $this->product->get_key() . 'nonce_field' ], $this->product->get_key() . 'nonce' ) //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
558
+ ) {
559
+ return;
560
+ }
561
+ if ( ! current_user_can( 'manage_options' ) ) {
562
+ return;
563
+ }
564
+ $license = isset( $_POST[ $this->product->get_key() . '_license' ] )
565
+ ? sanitize_text_field( $_POST[ $this->product->get_key() . '_license' ] )
566
+ : '';
567
+
568
+ $response = $this->do_license_process( $license, 'toggle' );
569
+ if ( is_wp_error( $response ) ) {
570
+ $this->set_error( $response->get_error_message() );
571
+
572
+ return;
573
+ }
574
+ if ( true === $response ) {
575
+ $this->set_error( '' );
576
+ }
577
+ }
578
+
579
+ /**
580
+ * Set license validation error message.
581
+ *
582
+ * @param string $message Error message.
583
+ */
584
+ public function set_error( $message = '' ) {
585
+ set_transient( $this->product->get_key() . 'act_err', $message, MINUTE_IN_SECONDS );
586
+
587
+ }
588
+
589
+ /**
590
+ * Load the Themes screen.
591
+ */
592
+ public function load_themes_screen() {
593
+ add_thickbox();
594
+ add_action( 'admin_notices', array( &$this, 'update_nag' ) );
595
+ }
596
+
597
+ /**
598
+ * Alter the nag for themes update.
599
+ */
600
+ public function update_nag() {
601
+ $theme = wp_get_theme( $this->product->get_slug() );
602
+ $api_response = get_transient( $this->product_key );
603
+ if ( false === $api_response || ! isset( $api_response->new_version ) ) {
604
+ return;
605
+ }
606
+ $update_url = wp_nonce_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
607
+ $update_message = apply_filters( 'themeisle_sdk_license_update_message', 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.' );
608
+ $update_onclick = ' onclick="if ( confirm(\'' . esc_js( $update_message ) . '\') ) {return true;}return false;"';
609
+ if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
610
+ echo '<div id="update-nag">';
611
+ printf(
612
+ '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
613
+ esc_attr( $theme->get( 'Name' ) ),
614
+ esc_attr( $api_response->new_version ),
615
+ esc_url( sprintf( '%s&TB_iframe=true&amp;width=1024&amp;height=800', $this->product->get_changelog() ) ),
616
+ esc_attr( $theme->get( 'Name' ) ),
617
+ esc_url( $update_url ),
618
+ $update_onclick // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Already escaped.
619
+ );
620
+ echo '</div>';
621
+ echo '<div id="' . esc_attr( $this->product->get_slug() ) . '_changelog" style="display:none;">';
622
+ echo wp_kses_data( wpautop( $api_response->sections['changelog'] ) );
623
+ echo '</div>';
624
+ }
625
+ }
626
+
627
+ /**
628
+ * Alter update transient.
629
+ *
630
+ * @param mixed $value The transient data.
631
+ *
632
+ * @return mixed
633
+ */
634
+ public function theme_update_transient( $value ) {
635
+ $update_data = $this->check_for_update();
636
+ if ( $update_data ) {
637
+ $value->response[ $this->product->get_slug() ] = $update_data;
638
+ }
639
+
640
+ return $value;
641
+ }
642
+
643
+ /**
644
+ * Check for updates
645
+ *
646
+ * @return array|bool Either the update data or false in case of failure.
647
+ */
648
+ public function check_for_update() {
649
+ $update_data = get_transient( $this->product_key );
650
+
651
+ if ( false === $update_data ) {
652
+ $failed = false;
653
+ $update_data = $this->get_version_data();
654
+ if ( empty( $update_data ) ) {
655
+ $failed = true;
656
+ }
657
+ // If the response failed, try again in 30 minutes.
658
+ if ( $failed ) {
659
+ $data = new \stdClass();
660
+ $data->new_version = $this->product->get_version();
661
+ set_transient( $this->product_key, $data, 30 * MINUTE_IN_SECONDS );
662
+
663
+ return false;
664
+ }
665
+ $update_data->sections = isset( $update_data->sections ) ? maybe_unserialize( $update_data->sections ) : null;
666
+
667
+ set_transient( $this->product_key, $update_data, 12 * HOUR_IN_SECONDS );
668
+ }
669
+ if ( ! isset( $update_data->new_version ) ) {
670
+ return false;
671
+ }
672
+ if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
673
+ return false;
674
+ }
675
+
676
+ return (array) $update_data;
677
+ }
678
+
679
+ /**
680
+ * Check remote api for latest version.
681
+ *
682
+ * @return bool|mixed Update api response.
683
+ */
684
+ private function get_version_data() {
685
+
686
+ $response = $this->safe_get(
687
+ sprintf(
688
+ '%slicense/version/%s/%s/%s/%s',
689
+ Product::API_URL,
690
+ rawurlencode( $this->product->get_name() ),
691
+ ( empty( $this->license_key ) ? 'free' : $this->license_key ),
692
+ $this->product->get_version(),
693
+ rawurlencode( home_url() )
694
+ ),
695
+ array(
696
+ 'timeout' => 15, //phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout, Inherited by wp_remote_get only, for vip environment we use defaults.
697
+ 'sslverify' => false,
698
+ )
699
+ );
700
+ if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
701
+ return false;
702
+ }
703
+ $update_data = json_decode( wp_remote_retrieve_body( $response ) );
704
+ if ( ! is_object( $update_data ) ) {
705
+ return false;
706
+ }
707
+ if ( isset( $update_data->slug ) ) {
708
+ $update_data->slug = $this->product->get_slug();
709
+ }
710
+ if ( isset( $update_data->icons ) ) {
711
+ $update_data->icons = (array) $update_data->icons;
712
+ }
713
+ if ( isset( $update_data->banners ) ) {
714
+ $update_data->banners = (array) $update_data->banners;
715
+ }
716
+
717
+ return $update_data;
718
+ }
719
+
720
+ /**
721
+ * Delete the update transient
722
+ */
723
+ public function delete_theme_update_transient() {
724
+ return delete_transient( $this->product_key );
725
+ }
726
+
727
+ /**
728
+ * Check for Updates at the defined API endpoint and modify the update array.
729
+ *
730
+ * @param array $_transient_data Update array build by WordPress.
731
+ *
732
+ * @return mixed Modified update array with custom plugin data.
733
+ */
734
+ public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
735
+ if ( empty( $_transient_data ) || ! $this->do_check ) {
736
+ $this->do_check = true;
737
+
738
+ return $_transient_data;
739
+ }
740
+ $api_response = $this->api_request();
741
+ if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
742
+ if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
743
+ $_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
744
+ } else {
745
+ $_transient_data->no_update[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
746
+ }
747
+ }
748
+
749
+ return $_transient_data;
750
+ }
751
+
752
+ /**
753
+ * Calls the API and, if successfull, returns the object delivered by the API.
754
+ *
755
+ * @param string $_action The requested action.
756
+ * @param array $_data Parameters for the API action.
757
+ *
758
+ * @return false||object
759
+ */
760
+ private function api_request( $_action = '', $_data = '' ) {
761
+ $update_data = $this->get_version_data();
762
+ if ( empty( $update_data ) ) {
763
+ return false;
764
+ }
765
+ if ( $update_data && isset( $update_data->sections ) ) {
766
+ $update_data->sections = maybe_unserialize( $update_data->sections );
767
+ }
768
+
769
+ return $update_data;
770
+ }
771
+
772
+ /**
773
+ * Updates information on the "View version x.x details" page with custom data.
774
+ *
775
+ * @param mixed $_data Plugin data.
776
+ * @param string $_action Action to send.
777
+ * @param object $_args Arguments to use.
778
+ *
779
+ * @return object $_data
780
+ */
781
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
782
+ if ( ( 'plugin_information' !== $_action ) || ! isset( $_args->slug ) || ( $_args->slug !== $this->product->get_slug() ) ) {
783
+ return $_data;
784
+ }
785
+ $api_response = $this->api_request();
786
+ if ( false !== $api_response ) {
787
+ $_data = $api_response;
788
+ }
789
+
790
+ return $_data;
791
+ }
792
+
793
+ /**
794
+ * Disable SSL verification in order to prevent download update failures.
795
+ *
796
+ * @param array $args Http args.
797
+ * @param string $url Url to check.
798
+ *
799
+ * @return array $array
800
+ */
801
+ public function http_request_args( $args, $url ) {
802
+ // If it is an https request and we are performing a package download, disable ssl verification.
803
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
804
+ $args['sslverify'] = false;
805
+ }
806
+
807
+ return $args;
808
+ }
809
+
810
+ /**
811
+ * Check if we should load the module for this product.
812
+ *
813
+ * @param Product $product Product data.
814
+ *
815
+ * @return bool Should we load the module?
816
+ */
817
+ public function can_load( $product ) {
818
+
819
+ if ( $product->is_wordpress_available() ) {
820
+ return false;
821
+ }
822
+
823
+ return ( apply_filters( $product->get_key() . '_enable_licenser', true ) === true );
824
+
825
+ }
826
+
827
+ /**
828
+ * Load module logic.
829
+ *
830
+ * @param Product $product Product to load the module for.
831
+ *
832
+ * @return Licenser Module object.
833
+ */
834
+ public function load( $product ) {
835
+ $this->product = $product;
836
+
837
+ $this->product_key = $this->product->get_key() . '-update-response';
838
+
839
+ $this->license_key = $this->product->get_license();
840
+ if ( $this->product->requires_license() ) {
841
+ $this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
842
+ $this->register_license_hooks();
843
+ }
844
+
845
+ $namespace = apply_filters( 'themesle_sdk_namespace_' . md5( $product->get_basefile() ), false );
846
+
847
+ if ( false !== $namespace ) {
848
+ $this->namespace = $namespace;
849
+ add_filter( 'themeisle_sdk_license_process_' . $namespace, [ $this, 'do_license_process' ], 10, 2 );
850
+ add_filter( 'product_' . $namespace . '_license_status', [ $this, 'get_license_status' ], PHP_INT_MAX );
851
+ add_filter( 'product_' . $namespace . '_license_key', [ $this->product, 'get_license' ] );
852
+ add_filter( 'product_' . $namespace . '_license_plan', [ $this, 'get_plan' ], PHP_INT_MAX );
853
+ if ( defined( 'WP_CLI' ) && WP_CLI ) {
854
+ \WP_CLI::add_command( $namespace . ' activate', [ $this, 'cli_activate' ] );
855
+ \WP_CLI::add_command( $namespace . ' deactivate', [ $this, 'cli_deactivate' ] );
856
+ \WP_CLI::add_command( $namespace . ' is-active', [ $this, 'cli_is_active' ] );
857
+ }
858
+ }
859
+
860
+ add_action( 'admin_head', [ $this, 'auto_activate' ] );
861
+ if ( $this->product->is_plugin() ) {
862
+ add_filter(
863
+ 'pre_set_site_transient_update_plugins',
864
+ [
865
+ $this,
866
+ 'pre_set_site_transient_update_plugins_filter',
867
+ ]
868
+ );
869
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
870
+ add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
871
+
872
+ return $this;
873
+ }
874
+ if ( $this->product->is_theme() ) {
875
+ add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
876
+ add_action( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
877
+ add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
878
+ add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
879
+ add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
880
+ add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_args
881
+
882
+ return $this;
883
+
884
+ }
885
+
886
+ return $this;
887
+ }
888
+
889
+ /**
890
+ * Register license fields for the products.
891
+ */
892
+ public function register_license_hooks() {
893
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
894
+ add_action( 'admin_init', array( $this, 'process_license' ) );
895
+ add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
896
+ add_action( 'admin_notices', array( $this, 'show_notice' ) );
897
+ add_filter( $this->product->get_key() . '_license_status', array( $this, 'get_license_status' ) );
898
+ }
899
+
900
+ /**
901
+ * Check license on filesystem.
902
+ *
903
+ * @return mixed License key.
904
+ */
905
+ public function get_file_license() {
906
+
907
+ $license_file = dirname( $this->product->get_basefile() ) . '/license.json';
908
+
909
+ global $wp_filesystem;
910
+ if ( ! is_file( $license_file ) ) {
911
+ return false;
912
+ }
913
+
914
+ require_once ABSPATH . '/wp-admin/includes/file.php';
915
+ \WP_Filesystem();
916
+ $content = json_decode( $wp_filesystem->get_contents( $license_file ) );
917
+ if ( ! is_object( $content ) ) {
918
+ return false;
919
+ }
920
+ if ( ! isset( $content->key ) ) {
921
+ return false;
922
+ }
923
+ return $content->key;
924
+ }
925
+ /**
926
+ * Run license activation on plugin activate.
927
+ */
928
+ public function auto_activate() {
929
+ $status = $this->get_license_status();
930
+ if ( 'not_active' !== $status ) {
931
+ return false;
932
+ }
933
+
934
+ if ( ! empty( $this->namespace ) ) {
935
+ $license_key = apply_filters( 'product_' . $this->namespace . '_license_key_constant', '' );
936
+ }
937
+
938
+ if ( empty( $license_key ) ) {
939
+ $license_key = $this->get_file_license();
940
+ }
941
+ if ( empty( $license_key ) ) {
942
+ return;
943
+ }
944
+
945
+
946
+ $this->license_local = $license_key;
947
+ $lock_key = $this->product->get_key() . '_autoactivated';
948
+
949
+ if ( 'yes' === get_option( $lock_key, '' ) ) {
950
+ return;
951
+ }
952
+ if ( 'yes' === get_transient( $lock_key ) ) {
953
+ return;
954
+ }
955
+ $response = $this->do_license_process( $license_key, 'activate' );
956
+
957
+ set_transient( $lock_key, 'yes', 6 * HOUR_IN_SECONDS );
958
+
959
+ if ( apply_filters( $this->product->get_key() . '_hide_license_notices', false ) ) {
960
+ return;
961
+ }
962
+
963
+ if ( true === $response ) {
964
+ add_action( 'admin_notices', [ $this, 'autoactivate_notice' ] );
965
+ }
966
+ }
967
+
968
+ /**
969
+ * Show auto-activate notice.
970
+ */
971
+ public function autoactivate_notice() {
972
+ ?>
973
+ <div class="notice notice-success is-dismissible">
974
+ <p><?php echo sprintf( '<strong>%s</strong> has been successfully activated using <strong>%s</strong> license !', esc_attr( $this->product->get_name() ), esc_attr( str_repeat( '*', 20 ) . substr( $this->license_local, - 10 ) ) ); ?></p>
975
+ </div>
976
+ <?php
977
+ }
978
+
979
+ /**
980
+ * Activate product license on this site.
981
+ *
982
+ * ## OPTIONS
983
+ *
984
+ * @param array $args Command args.
985
+ *
986
+ * [<license-key>]
987
+ * : Product license key.
988
+ */
989
+ public function cli_activate( $args ) {
990
+ $license_key = isset( $args[0] ) ? trim( $args[0] ) : '';
991
+ $response = $this->do_license_process( $license_key, 'activate' );
992
+ if ( true !== $response ) {
993
+ \WP_CLI::error( $response->get_error_message() );
994
+
995
+ return;
996
+ }
997
+
998
+ \WP_CLI::success( 'Product successfully activated.' );
999
+ }
1000
+
1001
+ /**
1002
+ * Deactivate product license on this site.
1003
+ *
1004
+ * @param array $args Command args.
1005
+ *
1006
+ * ## OPTIONS
1007
+ *
1008
+ * [<license-key>]
1009
+ * : Product license key.
1010
+ */
1011
+ public function cli_deactivate( $args ) {
1012
+ $license_key = isset( $args[0] ) ? trim( $args[0] ) : '';
1013
+ $response = $this->do_license_process( $license_key, 'deactivate' );
1014
+ if ( true !== $response ) {
1015
+ \WP_CLI::error( $response->get_error_message() );
1016
+
1017
+ return;
1018
+ }
1019
+
1020
+ \WP_CLI::success( 'Product successfully deactivated.' );
1021
+ }
1022
+
1023
+ /**
1024
+ * Checks if product has license activated.
1025
+ *
1026
+ * @param array $args Command args.
1027
+ *
1028
+ * @subcommand is-active
1029
+ */
1030
+ public function cli_is_active( $args ) {
1031
+
1032
+ $status = $this->get_license_status();
1033
+ if ( 'valid' === $status ) {
1034
+ \WP_CLI::halt( 0 );
1035
+
1036
+ return;
1037
+ }
1038
+
1039
+ \WP_CLI::halt( 1 );
1040
+ }
1041
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Logger.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The logger model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Loader;
16
+ use ThemeisleSDK\Product;
17
+
18
+ // Exit if accessed directly.
19
+ if ( ! defined( 'ABSPATH' ) ) {
20
+ exit;
21
+ }
22
+
23
+ /**
24
+ * Logger module for ThemeIsle SDK.
25
+ */
26
+ class Logger extends Abstract_Module {
27
+ /**
28
+ * Endpoint where to collect logs.
29
+ */
30
+ const TRACKING_ENDPOINT = 'https://api.themeisle.com/tracking/log';
31
+
32
+
33
+ /**
34
+ * Check if we should load the module for this product.
35
+ *
36
+ * @param Product $product Product to load the module for.
37
+ *
38
+ * @return bool Should we load ?
39
+ */
40
+ public function can_load( $product ) {
41
+
42
+ return apply_filters( $product->get_slug() . '_sdk_enable_logger', true );
43
+ }
44
+
45
+ /**
46
+ * Load module logic.
47
+ *
48
+ * @param Product $product Product to load.
49
+ *
50
+ * @return Logger Module object.
51
+ */
52
+ public function load( $product ) {
53
+ $this->product = $product;
54
+ $this->setup_notification();
55
+ $this->setup_actions();
56
+
57
+ return $this;
58
+ }
59
+
60
+ /**
61
+ * Setup notification on admin.
62
+ */
63
+ public function setup_notification() {
64
+ if ( ! $this->product->is_wordpress_available() ) {
65
+ return;
66
+ }
67
+
68
+ add_filter( 'themeisle_sdk_registered_notifications', [ $this, 'add_notification' ] );
69
+
70
+ }
71
+
72
+ /**
73
+ * Setup tracking actions.
74
+ */
75
+ public function setup_actions() {
76
+ if ( ! $this->is_logger_active() ) {
77
+ return;
78
+ }
79
+ $action_key = $this->product->get_key() . '_log_activity';
80
+ if ( ! wp_next_scheduled( $action_key ) ) {
81
+ wp_schedule_single_event( time() + ( wp_rand( 1, 24 ) * 3600 ), $action_key );
82
+ }
83
+ add_action( $action_key, array( $this, 'send_log' ) );
84
+
85
+ }
86
+
87
+ /**
88
+ * Check if the logger is active.
89
+ *
90
+ * @return bool Is logger active?
91
+ */
92
+ private function is_logger_active() {
93
+ $default = 'no';
94
+
95
+ if ( ! $this->product->is_wordpress_available() ) {
96
+ $default = 'yes';
97
+ } else {
98
+ $pro_slug = $this->product->get_pro_slug();
99
+
100
+ if ( ! empty( $pro_slug ) ) {
101
+ $all_products = Loader::get_products();
102
+ if ( isset( $all_products[ $pro_slug ] ) ) {
103
+ $default = 'yes';
104
+ }
105
+ }
106
+ }
107
+
108
+ return ( get_option( $this->product->get_key() . '_logger_flag', $default ) === 'yes' );
109
+ }
110
+
111
+ /**
112
+ * Add notification to queue.
113
+ *
114
+ * @param array $all_notifications Previous notification.
115
+ *
116
+ * @return array All notifications.
117
+ */
118
+ public function add_notification( $all_notifications ) {
119
+
120
+ $message = apply_filters( $this->product->get_key() . '_logger_heading', 'Do you enjoy <b>{product}</b>? Become a contributor by opting in to our anonymous data tracking. We guarantee no sensitive data is collected.' );
121
+
122
+ $message = str_replace(
123
+ array( '{product}' ),
124
+ $this->product->get_friendly_name(),
125
+ $message
126
+ );
127
+ $button_submit = apply_filters( $this->product->get_key() . '_logger_button_submit', 'Sure, I would love to help.' );
128
+ $button_cancel = apply_filters( $this->product->get_key() . '_logger_button_cancel', 'No, thanks.' );
129
+
130
+ $all_notifications[] = [
131
+ 'id' => $this->product->get_key() . '_logger_flag',
132
+ 'message' => $message,
133
+ 'ctas' => [
134
+ 'confirm' => [
135
+ 'link' => '#',
136
+ 'text' => $button_submit,
137
+ ],
138
+ 'cancel' => [
139
+ 'link' => '#',
140
+ 'text' => $button_cancel,
141
+ ],
142
+ ],
143
+ ];
144
+
145
+ return $all_notifications;
146
+ }
147
+
148
+ /**
149
+ * Send the statistics to the api endpoint.
150
+ */
151
+ public function send_log() {
152
+ $environment = array();
153
+ $theme = wp_get_theme();
154
+ $environment['theme'] = array();
155
+ $environment['theme']['name'] = $theme->get( 'Name' );
156
+ $environment['theme']['author'] = $theme->get( 'Author' );
157
+ $environment['theme']['parent'] = $theme->parent() !== false ? $theme->parent()->get( 'Name' ) : $theme->get( 'Name' );
158
+ $environment['plugins'] = get_option( 'active_plugins' );
159
+ global $wp_version;
160
+ wp_remote_post(
161
+ self::TRACKING_ENDPOINT,
162
+ array(
163
+ 'method' => 'POST',
164
+ 'timeout' => 3,
165
+ 'redirection' => 5,
166
+ 'body' => array(
167
+ 'site' => get_site_url(),
168
+ 'slug' => $this->product->get_slug(),
169
+ 'version' => $this->product->get_version(),
170
+ 'wp_version' => $wp_version,
171
+ 'locale' => get_locale(),
172
+ 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ),
173
+ 'environment' => $environment,
174
+ 'license' => apply_filters( $this->product->get_key() . '_license_status', '' ),
175
+ ),
176
+ )
177
+ );
178
+ }
179
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Notification.php ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The notification model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Notification module for ThemeIsle SDK.
24
+ */
25
+ class Notification extends Abstract_Module {
26
+ /**
27
+ * Show notifications only after the user has the product installed after this amount of time, in hours.
28
+ */
29
+ const MIN_INSTALL_TIME = 100;
30
+ /**
31
+ * How much time should we show the notification, in days.
32
+ */
33
+ const MAX_TIME_TO_LIVE = 7;
34
+
35
+ /**
36
+ * Number of days between notifications.
37
+ */
38
+ const TIME_BETWEEN_NOTIFICATIONS = 5;
39
+
40
+ /**
41
+ * Holds a possible notification list.
42
+ *
43
+ * @var array Notifications list.
44
+ */
45
+ private static $notifications = [];
46
+
47
+ /**
48
+ * Show notification data.
49
+ */
50
+ public static function show_notification() {
51
+
52
+ $current_notification = self::get_last_notification();
53
+
54
+ $notification_details = [];
55
+ // Check if the saved notification is still present among the possible ones.
56
+ if ( ! empty( $current_notification ) ) {
57
+ $notification_details = self::get_notification_details( $current_notification );
58
+ if ( empty( $notification_details ) ) {
59
+ $current_notification = [];
60
+ }
61
+ }
62
+ // Check if the notificatin is expired.
63
+ if ( ! empty( $current_notification ) && self::is_notification_expired( $current_notification ) ) {
64
+ update_option( $current_notification['id'], 'no' );
65
+ self::set_last_active_notification_timestamp();
66
+ $current_notification = [];
67
+ }
68
+ // If we don't have any saved notification, get a new one.
69
+ if ( empty( $current_notification ) ) {
70
+ $notification_details = self::get_random_notification();
71
+ if ( empty( $notification_details ) ) {
72
+ return;
73
+ }
74
+ self::set_active_notification(
75
+ [
76
+ 'id' => $notification_details['id'],
77
+ 'display_at' => time(),
78
+ ]
79
+ );
80
+ }
81
+ if ( empty( $notification_details ) ) {
82
+ return;
83
+ }
84
+ $notification_html = self::get_notification_html( $notification_details );
85
+ do_action( $notification_details['id'] . '_before_render' );
86
+
87
+ echo $notification_html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, already escaped internally.
88
+
89
+ do_action( $notification_details['id'] . '_after_render' );
90
+ self::render_snippets();
91
+ }
92
+
93
+ /**
94
+ * Get last notification details.
95
+ *
96
+ * @return array Last notification details.
97
+ */
98
+ private static function get_last_notification() {
99
+ $notification = self::get_notifications_metadata();
100
+
101
+ return isset( $notification['last_notification'] ) ? $notification['last_notification'] : [];
102
+ }
103
+
104
+ /**
105
+ * Get notification center details.
106
+ *
107
+ * @return array Notification center details.
108
+ */
109
+ private static function get_notifications_metadata() {
110
+
111
+ $data = get_option(
112
+ 'themeisle_sdk_notifications',
113
+ [
114
+ 'last_notification' => [],
115
+ 'last_notification_active' => 0,
116
+ ]
117
+ );
118
+
119
+ return $data;
120
+
121
+ }
122
+
123
+ /**
124
+ * Check if the notification is still possible.
125
+ *
126
+ * @param array $notification Notification to check.
127
+ *
128
+ * @return array Either is still active or not.
129
+ */
130
+ private static function get_notification_details( $notification ) {
131
+ $notifications = array_filter(
132
+ self::$notifications,
133
+ function ( $value ) use ( $notification ) {
134
+ if ( isset( $value['id'] ) && isset( $notification['id'] ) && $value['id'] === $notification['id'] ) {
135
+ return true;
136
+ }
137
+
138
+ return false;
139
+ }
140
+ );
141
+
142
+ return ! empty( $notifications ) ? reset( $notifications ) : [];
143
+ }
144
+
145
+ /**
146
+ * Check if the notification is expired.
147
+ *
148
+ * @param array $notification Notification to check.
149
+ *
150
+ * @return bool Either the notification is due.
151
+ */
152
+ private static function is_notification_expired( $notification ) {
153
+ if ( ! isset( $notification['display_at'] ) ) {
154
+ return true;
155
+ }
156
+
157
+ $notifications = array_filter(
158
+ self::$notifications,
159
+ function ( $value ) use ( $notification ) {
160
+ if ( isset( $value['id'] ) && isset( $notification['id'] ) && $value['id'] === $notification['id'] ) {
161
+ return true;
162
+ }
163
+
164
+ return false;
165
+ }
166
+ );
167
+
168
+ if ( empty( $notifications ) ) {
169
+ return true;
170
+ }
171
+ $notification_definition = reset( $notifications );
172
+
173
+ $when_to_expire = isset( $notification_definition['expires_at'] )
174
+ ? $notification_definition['expires_at'] :
175
+ ( isset( $notification_definition['expires'] )
176
+ ? ( $notification['display_at'] + $notification_definition['expires'] ) :
177
+ ( $notification['display_at'] + self::MAX_TIME_TO_LIVE * DAY_IN_SECONDS )
178
+ );
179
+
180
+ return ( $when_to_expire - time() ) < 0;
181
+ }
182
+
183
+ /**
184
+ * Set last notification details.
185
+ */
186
+ private static function set_last_active_notification_timestamp() {
187
+ $metadata = self::get_notifications_metadata();
188
+ $metadata['last_notification_active'] = time();
189
+ update_option( 'themeisle_sdk_notifications', $metadata );
190
+ }
191
+
192
+ /**
193
+ * Return notification to show.
194
+ *
195
+ * @return array Notification data.
196
+ */
197
+ public static function get_random_notification() {
198
+ if ( ( time() - self::get_last_active_notification_timestamp() ) < self::TIME_BETWEEN_NOTIFICATIONS * DAY_IN_SECONDS ) {
199
+ return [];
200
+ }
201
+
202
+ $notifications = self::$notifications;
203
+ $notifications = array_filter(
204
+ $notifications,
205
+ function ( $value ) {
206
+ if ( isset( $value['sticky'] ) && true === $value['sticky'] ) {
207
+ return true;
208
+ }
209
+
210
+ return false;
211
+ }
212
+ );
213
+ // No priority notifications, use all.
214
+ if ( empty( $notifications ) ) {
215
+ $notifications = self::$notifications;
216
+ }
217
+ if ( empty( $notifications ) ) {
218
+ return [];
219
+ }
220
+ $notifications = array_values( $notifications );
221
+
222
+ return $notifications[ array_rand( $notifications, 1 ) ];
223
+
224
+ }
225
+
226
+ /**
227
+ * Get last notification details.
228
+ *
229
+ * @return int Last notification details.
230
+ */
231
+ private static function get_last_active_notification_timestamp() {
232
+ $notification = self::get_notifications_metadata();
233
+
234
+ return isset( $notification['last_notification_active'] ) ? $notification['last_notification_active'] : 0;
235
+ }
236
+
237
+ /**
238
+ * Get last notification details.
239
+ *
240
+ * @param array $notification Notification data.
241
+ */
242
+ private static function set_active_notification( $notification ) {
243
+ $metadata = self::get_notifications_metadata();
244
+ $metadata['last_notification'] = $notification;
245
+ update_option( 'themeisle_sdk_notifications', $metadata );
246
+ }
247
+
248
+ /**
249
+ * Get notification html.
250
+ *
251
+ * @param array $notification_details Notification details.
252
+ *
253
+ * @return string Html for notice.
254
+ */
255
+ public static function get_notification_html( $notification_details ) {
256
+ $default = [
257
+ 'id' => '',
258
+ 'heading' => '',
259
+ 'message' => '',
260
+ 'ctas' => [
261
+ 'confirm' => [
262
+ 'link' => '#',
263
+ 'text' => '',
264
+ ],
265
+ 'cancel' => [
266
+ 'link' => '#',
267
+ 'text' => '',
268
+ ],
269
+ ],
270
+ ];
271
+ $notification_details = wp_parse_args( $notification_details, $default );
272
+
273
+ $notification_html = '<div class="notice notice-success is-dismissible themeisle-sdk-notice" data-notification-id="' . esc_attr( $notification_details['id'] ) . '" id="' . esc_attr( $notification_details['id'] ) . '-notification"> <div class="themeisle-sdk-notification-box">';
274
+
275
+ if ( ! empty( $notification_details['heading'] ) ) {
276
+ $notification_html .= sprintf( '<h4>%s</h4>', wp_kses_post( $notification_details['heading'] ) );
277
+ }
278
+ if ( ! empty( $notification_details['message'] ) ) {
279
+ $notification_html .= wp_kses_post( $notification_details['message'] );
280
+ }
281
+ $notification_html .= '<div class="actions">';
282
+
283
+ if ( ! empty( $notification_details['ctas']['confirm']['text'] ) ) {
284
+ $notification_html .= sprintf(
285
+ '<a href="%s" target="_blank" class=" button button-primary %s" data-confirm="yes" >%s</a>',
286
+ esc_url( $notification_details['ctas']['confirm']['link'] ),
287
+ esc_attr( $notification_details['id'] . '_confirm' ),
288
+ wp_kses_post( $notification_details['ctas']['confirm']['text'] )
289
+ );
290
+ }
291
+
292
+ if ( ! empty( $notification_details['ctas']['cancel']['text'] ) ) {
293
+ $notification_html .= sprintf(
294
+ '<a href="%s" class=" button %s" data-confirm="no">%s</a>',
295
+ esc_url( $notification_details['ctas']['cancel']['link'] ),
296
+ esc_attr( $notification_details['id'] ) . '_cancel',
297
+ wp_kses_post( $notification_details['ctas']['cancel']['text'] )
298
+ );
299
+ }
300
+
301
+ $notification_html .= '</div>';
302
+ $notification_html .= ' </div>';
303
+ $notification_html .= ' </div>';
304
+
305
+ return $notification_html;
306
+ }
307
+
308
+ /**
309
+ * Adds js snippet for hiding the notice.
310
+ */
311
+ public static function render_snippets() {
312
+
313
+ ?>
314
+ <style type="text/css">
315
+ .themeisle-sdk-notification-box {
316
+ padding: 3px;
317
+ }
318
+
319
+ .themeisle-sdk-notification-box .actions {
320
+ margin-top: 6px;
321
+ margin-bottom: 4px;
322
+ }
323
+
324
+ .themeisle-sdk-notification-box .button {
325
+ margin-right: 5px;
326
+ }
327
+ </style>
328
+ <script type="text/javascript">
329
+ (function ($) {
330
+ $(document).ready(function () {
331
+ $('#wpbody-content').on('click', ".themeisle-sdk-notice a.button, .themeisle-sdk-notice .notice-dismiss", function (e) {
332
+
333
+ var container = $('.themeisle-sdk-notice');
334
+ var link = $(this);
335
+ var notification_id = container.attr('data-notification-id');
336
+ var confirm = link.attr('data-confirm');
337
+ if (typeof confirm === "undefined") {
338
+ confirm = 'no';
339
+ }
340
+ $.post(
341
+ ajaxurl,
342
+ {
343
+ 'nonce': '<?php echo esc_attr( wp_create_nonce( (string) __CLASS__ ) ); ?>',
344
+ 'action': 'themeisle_sdk_dismiss_notice',
345
+ 'id': notification_id,
346
+ 'confirm': confirm
347
+ }
348
+ );
349
+ if (confirm === 'yes') {
350
+ $(this).trigger('themeisle-sdk:confirmed');
351
+ } else {
352
+ $(this).trigger('themeisle-sdk:canceled');
353
+ }
354
+ container.hide();
355
+ if (link.attr('href') === '#') {
356
+ return false;
357
+ }
358
+ });
359
+ });
360
+ })(jQuery);
361
+ </script>
362
+ <?php
363
+ }
364
+
365
+ /**
366
+ * Dismiss the notification.
367
+ */
368
+ public static function dismiss() {
369
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
370
+
371
+ $id = isset( $_POST['id'] ) ? sanitize_text_field( $_POST['id'] ) : '';
372
+ $confirm = isset( $_POST['confirm'] ) ? sanitize_text_field( $_POST['confirm'] ) : 'no';
373
+
374
+ if ( empty( $id ) ) {
375
+ wp_send_json( [] );
376
+ }
377
+ $ids = wp_list_pluck( self::$notifications, 'id' );
378
+ if ( ! in_array( $id, $ids, true ) ) {
379
+ wp_send_json( [] );
380
+ }
381
+ self::set_last_active_notification_timestamp();
382
+ update_option( $id, $confirm );
383
+ do_action( $id . '_process_confirm', $confirm );
384
+ wp_send_json( [] );
385
+ }
386
+
387
+ /**
388
+ * Check if we should load the notification module.
389
+ *
390
+ * @param Product $product Product to check.
391
+ *
392
+ * @return bool Should we load this?
393
+ */
394
+ public function can_load( $product ) {
395
+
396
+ if ( $this->is_from_partner( $product ) ) {
397
+ return false;
398
+ }
399
+ if ( ! current_user_can( 'manage_options' ) ) {
400
+ return false;
401
+ }
402
+ if ( ( time() - $product->get_install_time() ) < ( self::MIN_INSTALL_TIME * HOUR_IN_SECONDS ) ) {
403
+ return false;
404
+ }
405
+
406
+ return true;
407
+ }
408
+
409
+ /**
410
+ * Setup notifications queue.
411
+ */
412
+ public static function setup_notifications() {
413
+ $notifications = apply_filters( 'themeisle_sdk_registered_notifications', [] );
414
+ $notifications = array_filter(
415
+ $notifications,
416
+ function ( $value ) {
417
+ if ( ! isset( $value['id'] ) ) {
418
+ return false;
419
+ }
420
+ if ( get_option( $value['id'], '' ) !== '' ) {
421
+ return false;
422
+ }
423
+
424
+ return apply_filters( $value['id'] . '_should_show', true );
425
+ }
426
+ );
427
+ self::$notifications = $notifications;
428
+ }
429
+ /**
430
+ * Load the module logic.
431
+ *
432
+ * @param Product $product Product to load the module for.
433
+ *
434
+ * @return Notification Module instance.
435
+ */
436
+ public function load( $product ) {
437
+ if ( apply_filters( 'themeisle_sdk_hide_notifications', false ) ) {
438
+ return;
439
+ }
440
+ $this->product = $product;
441
+
442
+ $notifications = apply_filters( 'themeisle_sdk_registered_notifications', [] );
443
+ $notifications = array_filter(
444
+ $notifications,
445
+ function ( $value ) {
446
+ if ( ! isset( $value['id'] ) ) {
447
+ return false;
448
+ }
449
+ if ( get_option( $value['id'], '' ) !== '' ) {
450
+ return false;
451
+ }
452
+
453
+ return apply_filters( $value['id'] . '_should_show', true );
454
+ }
455
+ );
456
+ self::$notifications = $notifications;
457
+ add_action( 'admin_notices', array( __CLASS__, 'show_notification' ) );
458
+ add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', array( __CLASS__, 'dismiss' ) );
459
+ add_action( 'admin_head', array( __CLASS__, 'setup_notifications' ) );
460
+
461
+ return $this;
462
+ }
463
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Recommendation.php ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The class that exposes hooks for recommend.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Rollback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ // Exit if accessed directly.
15
+ use ThemeisleSDK\Common\Abstract_Module;
16
+ use ThemeisleSDK\Product;
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Expose endpoints for ThemeIsle SDK.
24
+ */
25
+ class Recommendation extends Abstract_Module {
26
+
27
+
28
+ /**
29
+ * Load module logic.
30
+ *
31
+ * @param Product $product Product to load.
32
+ */
33
+ public function load( $product ) {
34
+ $this->product = $product;
35
+ $this->setup_hooks();
36
+
37
+ return $this;
38
+ }
39
+
40
+ /**
41
+ * Setup endpoints.
42
+ */
43
+ private function setup_hooks() {
44
+ add_action( $this->product->get_key() . '_recommend_products', array( $this, 'render_products_box' ), 10, 4 );
45
+ add_action( 'admin_head', array( $this, 'enqueue' ) );
46
+ }
47
+
48
+ /**
49
+ * Check if we should load the module for this product.
50
+ *
51
+ * @param Product $product Product data.
52
+ *
53
+ * @return bool Should we load the module?
54
+ */
55
+ public function can_load( $product ) {
56
+ return true;
57
+ }
58
+
59
+ /**
60
+ * Render products box content.
61
+ *
62
+ * @param array $plugins_list - list of useful plugins (in slug => nicename format).
63
+ * @param array $themes_list - list of useful themes (in slug => nicename format).
64
+ * @param array $strings - list of translated strings.
65
+ * @param array $preferences - list of preferences.
66
+ */
67
+ public function render_products_box( $plugins_list, $themes_list, $strings, $preferences = array() ) {
68
+
69
+ if ( empty( $plugins_list ) && empty( $themes_list ) ) {
70
+ return;
71
+ }
72
+
73
+ if ( ! empty( $plugins_list ) && ! current_user_can( 'install_plugins' ) ) {
74
+ return;
75
+ }
76
+
77
+ if ( ! empty( $themes_list ) && ! current_user_can( 'install_themes' ) ) {
78
+ return;
79
+ }
80
+
81
+ add_thickbox();
82
+
83
+ if ( ! empty( $themes_list ) ) {
84
+ $list = $this->get_themes( $themes_list, $preferences );
85
+
86
+ if ( has_action( $this->product->get_key() . '_recommend_products_theme_template' ) ) {
87
+ do_action( $this->product->get_key() . '_recommend_products_theme_template', $list, $strings, $preferences );
88
+ } else {
89
+ echo '<div class="recommend-product">';
90
+
91
+ foreach ( $list as $theme ) {
92
+ echo '<div class="plugin_box">';
93
+ echo ' <img class="theme-banner" src="' . esc_url( $theme->screenshot_url ) . '">';
94
+ echo ' <div class="title-action-wrapper">';
95
+ echo ' <span class="plugin-name">' . esc_html( $theme->custom_name ) . '</span>';
96
+ if ( ! isset( $preferences['description'] ) || ( isset( $preferences['description'] ) && $preferences['description'] ) ) {
97
+ echo '<span class="plugin-desc">' . esc_html( substr( $theme->description, 0, strpos( $theme->description, '.' ) ) ) . '.</span>';
98
+ }
99
+ echo ' </div>';
100
+ echo '<div class="plugin-box-footer">';
101
+ echo ' <div class="button-wrap">';
102
+ echo ' <a class="button button-primary " href="' . esc_url( $theme->custom_url ) . '"><span class="dashicons dashicons-external"></span>' . esc_html( $strings['install'] ) . '</a>';
103
+ echo ' </div>';
104
+ echo ' </div>';
105
+ echo '</div>';
106
+ }
107
+
108
+ echo '</div>';
109
+ }
110
+ }
111
+ if ( ! empty( $plugins_list ) ) {
112
+ $list = $this->get_plugins( $plugins_list, $preferences );
113
+
114
+ if ( has_action( $this->product->get_key() . '_recommend_products_plugin_template' ) ) {
115
+ do_action( $this->product->get_key() . '_recommend_products_plugin_template', $list, $strings, $preferences );
116
+ } else {
117
+ echo '<div class="recommend-product">';
118
+
119
+ foreach ( $list as $current_plugin ) {
120
+ echo '<div class="plugin_box">';
121
+ echo ' <img class="plugin-banner" src="' . esc_url( $current_plugin->custom_image ) . '">';
122
+ echo ' <div class="title-action-wrapper">';
123
+ echo ' <span class="plugin-name">' . esc_html( $current_plugin->custom_name ) . '</span>';
124
+ if ( ! isset( $preferences['description'] ) || ( isset( $preferences['description'] ) && $preferences['description'] ) ) {
125
+ echo '<span class="plugin-desc">' . esc_html( substr( $current_plugin->short_description, 0, strpos( $current_plugin->short_description, '.' ) ) ) . '. </span>';
126
+ }
127
+ echo ' </div>';
128
+ echo ' <div class="plugin-box-footer">';
129
+ echo ' <a class="button button-primary thickbox open-plugin-details-modal" href="' . esc_url( $current_plugin->custom_url ) . '"><span class="dashicons dashicons-external"></span>' . esc_html( $strings['install'] ) . '</a>';
130
+ echo ' </div>';
131
+ echo '</div>';
132
+ }
133
+
134
+ echo '</div>';
135
+ }
136
+ }
137
+
138
+ }
139
+
140
+ /**
141
+ * Collect all the information for the themes list.
142
+ *
143
+ * @param array $themes_list - list of useful themes (in slug => nicename format).
144
+ * @param array $preferences - list of preferences.
145
+ *
146
+ * @return array
147
+ */
148
+ private function get_themes( $themes_list, $preferences ) {
149
+ $list = array();
150
+ foreach ( $themes_list as $slug => $nicename ) {
151
+ $theme = $this->call_theme_api( $slug );
152
+ if ( ! $theme ) {
153
+ continue;
154
+ }
155
+
156
+ $url = add_query_arg(
157
+ array(
158
+ 'theme' => $theme->slug,
159
+ ),
160
+ network_admin_url( 'theme-install.php' )
161
+ );
162
+
163
+ $name = empty( $nicename ) ? $theme->name : $nicename;
164
+
165
+ $theme->custom_url = $url;
166
+ $theme->custom_name = $name;
167
+
168
+ $list[] = $theme;
169
+ }
170
+
171
+ return $list;
172
+ }
173
+
174
+ /**
175
+ * Call theme api
176
+ *
177
+ * @param string $slug theme slug.
178
+ *
179
+ * @return array|mixed|object
180
+ */
181
+ private function call_theme_api( $slug ) {
182
+ $theme = get_transient( 'ti_theme_info_' . $slug );
183
+
184
+ if ( false !== $theme ) {
185
+ return $theme;
186
+ }
187
+
188
+ $products = $this->safe_get(
189
+ 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[theme]=' . $slug . '&request[per_page]=1'
190
+ );
191
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
192
+ if ( is_object( $products ) ) {
193
+ $theme = $products->themes[0];
194
+ set_transient( 'ti_theme_info_' . $slug, $theme, 6 * HOUR_IN_SECONDS );
195
+ }
196
+
197
+ return $theme;
198
+ }
199
+
200
+ /**
201
+ * Collect all the information for the plugins list.
202
+ *
203
+ * @param array $plugins_list - list of useful plugins (in slug => nicename format).
204
+ * @param array $preferences - list of preferences.
205
+ *
206
+ * @return array
207
+ */
208
+ private function get_plugins( $plugins_list, $preferences ) {
209
+ $list = array();
210
+ foreach ( $plugins_list as $plugin => $nicename ) {
211
+ $current_plugin = $this->call_plugin_api( $plugin );
212
+
213
+ $name = empty( $nicename ) ? $current_plugin->name : $nicename;
214
+
215
+ $image = $current_plugin->banners['low'];
216
+ if ( isset( $preferences['image'] ) && 'icon' === $preferences['image'] ) {
217
+ $image = $current_plugin->icons['1x'];
218
+ }
219
+
220
+ $url = add_query_arg(
221
+ array(
222
+ 'tab' => 'plugin-information',
223
+ 'plugin' => $current_plugin->slug,
224
+ 'TB_iframe' => true,
225
+ 'width' => 800,
226
+ 'height' => 800,
227
+ ),
228
+ network_admin_url( 'plugin-install.php' )
229
+ );
230
+
231
+ $current_plugin->custom_url = $url;
232
+ $current_plugin->custom_name = $name;
233
+ $current_plugin->custom_image = $image;
234
+
235
+ $list[] = $current_plugin;
236
+ }
237
+
238
+ return $list;
239
+ }
240
+
241
+ /**
242
+ * Call plugin api
243
+ *
244
+ * @param string $slug plugin slug.
245
+ *
246
+ * @return array|mixed|object
247
+ */
248
+ private function call_plugin_api( $slug ) {
249
+ include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
250
+
251
+ $call_api = get_transient( 'ti_plugin_info_' . $slug );
252
+
253
+ if ( false === $call_api ) {
254
+ $call_api = plugins_api(
255
+ 'plugin_information',
256
+ array(
257
+ 'slug' => $slug,
258
+ 'fields' => array(
259
+ 'downloaded' => false,
260
+ 'rating' => false,
261
+ 'description' => false,
262
+ 'short_description' => true,
263
+ 'donate_link' => false,
264
+ 'tags' => false,
265
+ 'sections' => true,
266
+ 'homepage' => true,
267
+ 'added' => false,
268
+ 'last_updated' => false,
269
+ 'compatibility' => false,
270
+ 'tested' => false,
271
+ 'requires' => false,
272
+ 'downloadlink' => false,
273
+ 'icons' => true,
274
+ 'banners' => true,
275
+ ),
276
+ )
277
+ );
278
+ set_transient( 'ti_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
279
+ }
280
+
281
+ return $call_api;
282
+ }
283
+
284
+ /**
285
+ * Load css and scripts for the plugin recommend page.
286
+ */
287
+ public function enqueue() {
288
+ $screen = get_current_screen();
289
+
290
+ if ( ! isset( $screen->id ) ) {
291
+ return;
292
+ }
293
+ if ( false === apply_filters( $this->product->get_key() . '_enqueue_recommend', false, $screen->id ) ) {
294
+ return;
295
+ }
296
+
297
+ ?>
298
+ <style type="text/css">
299
+ .recommend-product {
300
+ display: flex;
301
+ justify-content: space-between;
302
+ flex-wrap: wrap;
303
+ }
304
+
305
+ .recommend-product .theme-banner {
306
+ width: 200px;
307
+ margin: auto;
308
+ }
309
+
310
+ .recommend-product .plugin-banner {
311
+ width: 100px;
312
+ margin: auto;
313
+ }
314
+
315
+ .recommend-product .plugin_box .button span {
316
+
317
+ margin-top: 2px;
318
+ margin-right: 7px;
319
+ }
320
+
321
+ .recommend-product .plugin_box .button {
322
+ margin-bottom: 10px;
323
+ }
324
+
325
+ .recommend-product .plugin_box {
326
+ margin-bottom: 20px;
327
+ padding-top: 5px;
328
+ display: flex;
329
+ box-shadow: 0px 0px 10px -5px rgba(0, 0, 0, 0.55);
330
+ background: #fff;
331
+ border-radius: 5px;
332
+ flex-direction: column;
333
+ justify-content: flex-start;
334
+ width: 95%;
335
+ }
336
+
337
+ .recommend-product .title-action-wrapper {
338
+ padding: 15px 20px 5px 20px;
339
+ }
340
+
341
+ .recommend-product .plugin-name {
342
+ font-size: 18px;
343
+ display: block;
344
+ white-space: nowrap;
345
+ text-overflow: ellipsis;
346
+ margin-bottom: 10px;
347
+ overflow: hidden;
348
+ line-height: normal;
349
+ }
350
+
351
+
352
+ .recommend-product .plugin-desc {
353
+ display: block;
354
+ margin-bottom: 10px;
355
+ font-size: 13px;
356
+ color: #777;
357
+ line-height: 1.6;
358
+ }
359
+
360
+ .recommend-product .button-wrap > div {
361
+ padding: 0;
362
+ margin: 0;
363
+ }
364
+
365
+ .plugin-box-footer {
366
+ display: flex;
367
+ justify-content: space-around;
368
+ vertical-align: middle;
369
+ align-items: center;
370
+ padding: 0px 10px 5px;
371
+ flex: 1;
372
+ margin-top: auto;
373
+ }
374
+ </style>
375
+ <?php
376
+ }
377
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Review.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Review model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Review module for ThemeIsle SDK.
24
+ */
25
+ class Review extends Abstract_Module {
26
+
27
+ /**
28
+ * Check if we should load module for this.
29
+ *
30
+ * @param Product $product Product to check.
31
+ *
32
+ * @return bool Should load ?
33
+ */
34
+ public function can_load( $product ) {
35
+ if ( $this->is_from_partner( $product ) ) {
36
+ return false;
37
+ }
38
+ if ( ! $product->is_wordpress_available() ) {
39
+ return false;
40
+ }
41
+
42
+ return apply_filters( $product->get_slug() . '_sdk_should_review', true );
43
+ }
44
+
45
+
46
+ /**
47
+ * Add notification to queue.
48
+ *
49
+ * @param array $all_notifications Previous notification.
50
+ *
51
+ * @return array All notifications.
52
+ */
53
+ public function add_notification( $all_notifications ) {
54
+
55
+ $developers = [
56
+ 'Bogdan',
57
+ 'Marius',
58
+ 'Hardeep',
59
+ 'Rodica',
60
+ 'Stefan',
61
+ 'Uriahs',
62
+ 'Madalin',
63
+ 'Cristi',
64
+ 'Silviu',
65
+ 'Andrei',
66
+ ];
67
+
68
+ $link = 'https://wordpress.org/support/' . $this->product->get_type() . '/' . $this->product->get_slug() . '/reviews/#wporg-footer';
69
+
70
+ $message = apply_filters( $this->product->get_key() . '_feedback_review_message', '<p>Hey, it\'s great to see you have <b>{product}</b> active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ {developer}, developer of {product}</p>' );
71
+
72
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_review_button_do', 'Ok, I will gladly help.' );
73
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', 'No, thanks.' );
74
+ $message = str_replace(
75
+ [ '{product}', '{developer}' ],
76
+ [
77
+ $this->product->get_friendly_name(),
78
+ $developers[ strlen( get_site_url() ) % 10 ],
79
+ ],
80
+ $message
81
+ );
82
+
83
+ $all_notifications[] = [
84
+ 'id' => $this->product->get_key() . '_review_flag',
85
+ 'message' => $message,
86
+ 'ctas' => [
87
+ 'confirm' => [
88
+ 'link' => $link,
89
+ 'text' => $button_submit,
90
+ ],
91
+ 'cancel' => [
92
+ 'link' => '#',
93
+ 'text' => $button_cancel,
94
+ ],
95
+ ],
96
+ ];
97
+
98
+ return $all_notifications;
99
+ }
100
+
101
+
102
+ /**
103
+ * Load module logic.
104
+ *
105
+ * @param Product $product Product to load.
106
+ *
107
+ * @return Review Module instance.
108
+ */
109
+ public function load( $product ) {
110
+
111
+ $this->product = $product;
112
+
113
+ add_filter( 'themeisle_sdk_registered_notifications', [ $this, 'add_notification' ] );
114
+
115
+ return $this;
116
+ }
117
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Rollback.php ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The rollback class for ThemeIsle SDK.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Rollback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ // Exit if accessed directly.
15
+ use ThemeisleSDK\Common\Abstract_Module;
16
+ use ThemeisleSDK\Product;
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Rollback for ThemeIsle SDK.
24
+ */
25
+ class Rollback extends Abstract_Module {
26
+
27
+ /**
28
+ * Add js scripts for themes rollback.
29
+ */
30
+ public function add_footer() {
31
+ $screen = get_current_screen();
32
+ if ( ! isset( $screen->parent_file ) ) {
33
+ return;
34
+ }
35
+ if ( 'themes.php' !== $screen->parent_file ) {
36
+ return;
37
+ }
38
+ if ( ! $this->product->is_theme() ) {
39
+ return;
40
+ }
41
+ $version = $this->get_rollback();
42
+ if ( empty( $version ) ) {
43
+ return;
44
+ }
45
+ ?>
46
+ <script type="text/javascript">
47
+ jQuery(document).ready(function ($) {
48
+ setInterval(checkTheme, 500);
49
+
50
+ function checkTheme() {
51
+ var theme = '<?php echo esc_attr( $this->product->get_slug() ); ?>-action';
52
+
53
+ if (jQuery('#' + theme).length > 0) {
54
+ if (jQuery('.theme-overlay.active').is(':visible')) {
55
+ if (jQuery('#' + theme + '-rollback').length === 0) {
56
+ jQuery('.theme-actions .active-theme').prepend('<a class="button" style="float:left" id="' + theme + '-rollback" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=' . $this->product->get_key() . '_rollback' ), $this->product->get_key() . '_rollback' ) ); ?>">Rollback to v<?php echo esc_attr( $version['version'] ); ?></a>')
57
+ }
58
+ }
59
+
60
+ }
61
+ }
62
+ })
63
+
64
+ </script>
65
+ <?php
66
+
67
+ }
68
+
69
+ /**
70
+ * Get the last rollback for this product.
71
+ *
72
+ * @return array The rollback version.
73
+ */
74
+ public function get_rollback() {
75
+ $rollback = array();
76
+ $versions = $this->get_api_versions();
77
+ $versions = apply_filters( $this->product->get_key() . '_rollbacks', $versions );
78
+ if ( empty( $versions ) ) {
79
+ return $rollback;
80
+ }
81
+ if ( $versions ) {
82
+ usort( $versions, array( $this, 'sort_rollback_array' ) );
83
+ foreach ( $versions as $version ) {
84
+ if ( isset( $version['version'] ) && isset( $version['url'] ) && version_compare( $this->product->get_version(), $version['version'], '>' ) ) {
85
+ $rollback = $version;
86
+ break;
87
+ }
88
+ }
89
+ }
90
+
91
+ return $rollback;
92
+ }
93
+
94
+ /**
95
+ * Get versions array from wp.org
96
+ *
97
+ * @return array Array of versions.
98
+ */
99
+ private function get_api_versions() {
100
+
101
+ $cache_key = $this->product->get_key() . '_' . preg_replace( '/[^0-9a-zA-Z ]/m', '', $this->product->get_version() ) . 'versions';
102
+ $cache_versions = get_transient( $cache_key );
103
+ if ( false === $cache_versions ) {
104
+ $versions = $this->get_remote_versions();
105
+ set_transient( $cache_key, $versions, 5 * DAY_IN_SECONDS );
106
+ } else {
107
+ $versions = is_array( $cache_versions ) ? $cache_versions : array();
108
+ }
109
+
110
+ return $versions;
111
+ }
112
+
113
+ /**
114
+ * Get remote versions zips.
115
+ *
116
+ * @return array Array of available versions.
117
+ */
118
+ private function get_remote_versions() {
119
+ $url = $this->get_versions_api_url();
120
+ if ( empty( $url ) ) {
121
+ return [];
122
+ }
123
+ $response = function_exists( 'wp_remote_get_wp_remote_get' )
124
+ ? wp_remote_get_wp_remote_get( $url )
125
+ : wp_remote_get( $url ); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get
126
+ if ( is_wp_error( $response ) ) {
127
+ return array();
128
+ }
129
+ $response = wp_remote_retrieve_body( $response );
130
+
131
+ if ( is_serialized( $response ) ) {
132
+ $response = maybe_unserialize( $response );
133
+ } else {
134
+ $response = json_decode( $response );
135
+ }
136
+
137
+ if ( ! is_object( $response ) ) {
138
+ return array();
139
+ }
140
+ if ( ! isset( $response->versions ) ) {
141
+ return array();
142
+ }
143
+
144
+ $versions = array();
145
+ foreach ( $response->versions as $key => $value ) {
146
+ $versions[] = array(
147
+ 'version' => is_object( $value ) ? $value->version : $key,
148
+ 'url' => is_object( $value ) ? $value->file : $value,
149
+ );
150
+ }
151
+
152
+ return $versions;
153
+ }
154
+
155
+ /**
156
+ * Return url where to check for versions.
157
+ *
158
+ * @return string Url where to check for versions.
159
+ */
160
+ private function get_versions_api_url() {
161
+ if ( $this->product->is_wordpress_available() && $this->product->is_plugin() ) {
162
+ return sprintf( 'https://api.wordpress.org/plugins/info/1.0/%s', $this->product->get_slug() );
163
+ }
164
+ if ( $this->product->is_wordpress_available() && $this->product->is_theme() ) {
165
+ return sprintf( 'https://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]=%s&request[fields][versions]=true', $this->product->get_slug() );
166
+ }
167
+ $license = $this->product->get_license();
168
+ if ( $this->product->requires_license() && strlen( $license ) < 10 ) {
169
+ return '';
170
+ }
171
+
172
+ return sprintf( '%slicense/versions/%s/%s/%s/%s', Product::API_URL, rawurlencode( $this->product->get_name() ), $license, urlencode( get_site_url() ), $this->product->get_version() );
173
+ }
174
+
175
+ /**
176
+ * Show the rollback links in the plugin page.
177
+ *
178
+ * @param array $links Plugin links.
179
+ *
180
+ * @return array $links Altered links.
181
+ */
182
+ public function add_rollback_link( $links ) {
183
+ $version = $this->get_rollback();
184
+ if ( empty( $version ) ) {
185
+ return $links;
186
+ }
187
+ $links[] = '<a href="' . wp_nonce_url( admin_url( 'admin-post.php?action=' . $this->product->get_key() . '_rollback' ), $this->product->get_key() . '_rollback' ) . '">' . sprintf( apply_filters( $this->product->get_key() . '_rollback_label', 'Rollback to v%s' ), $version['version'] ) . '</a>';
188
+
189
+ return $links;
190
+ }
191
+
192
+ /**
193
+ * Start the rollback operation.
194
+ */
195
+ public function start_rollback() {
196
+ if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], $this->product->get_key() . '_rollback' ) ) { //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
197
+ wp_nonce_ays( '' );
198
+ }
199
+
200
+ if ( $this->product->is_plugin() ) {
201
+ $this->start_rollback_plugin();
202
+
203
+ return;
204
+ }
205
+ if ( $this->product->is_theme() ) {
206
+ $this->start_rollback_theme();
207
+
208
+ return;
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Start the rollback operation for the plugin.
214
+ */
215
+ private function start_rollback_plugin() {
216
+ $rollback = $this->get_rollback();
217
+ $plugin_transient = get_site_transient( 'update_plugins' );
218
+ $plugin_folder = $this->product->get_slug();
219
+ $plugin_file = $this->product->get_file();
220
+ $version = $rollback['version'];
221
+ $temp_array = array(
222
+ 'slug' => $plugin_folder,
223
+ 'new_version' => $version,
224
+ 'package' => $rollback['url'],
225
+ );
226
+
227
+ $temp_object = (object) $temp_array;
228
+ $plugin_transient->response[ $plugin_folder . '/' . $plugin_file ] = $temp_object;
229
+ set_site_transient( 'update_plugins', $plugin_transient );
230
+
231
+ $transient = get_transient( $this->product->get_key() . '_warning_rollback' );
232
+
233
+ // Style fix for the api link that gets outside the content.
234
+ echo '<style>body#error-page{word-break:break-word;}</style>';
235
+
236
+ if ( false === $transient ) {
237
+ set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
238
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
239
+ $title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
240
+ $plugin = $plugin_folder . '/' . $plugin_file;
241
+ $nonce = 'upgrade-plugin_' . $plugin;
242
+ $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
243
+ $upgrader_skin = new \Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) );
244
+ $upgrader = new \Plugin_Upgrader( $upgrader_skin );
245
+ $upgrader->upgrade( $plugin );
246
+ delete_transient( $this->product->get_key() . '_warning_rollback' );
247
+ wp_die(
248
+ '',
249
+ esc_attr( $title ),
250
+ array(
251
+ 'response' => 200,
252
+ )
253
+ );
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Start the rollback operation for the theme.
259
+ */
260
+ private function start_rollback_theme() {
261
+ add_filter( 'update_theme_complete_actions', array( $this, 'alter_links_theme_upgrade' ) );
262
+ $rollback = $this->get_rollback();
263
+ $transient = get_site_transient( 'update_themes' );
264
+ $folder = $this->product->get_slug();
265
+ $version = $rollback['version'];
266
+ $temp_array = array(
267
+ 'new_version' => $version,
268
+ 'package' => $rollback['url'],
269
+ );
270
+
271
+ $transient->response[ $folder . '/style.css' ] = $temp_array;
272
+ set_site_transient( 'update_themes', $transient );
273
+
274
+ $transient = get_transient( $this->product->get_key() . '_warning_rollback' );
275
+
276
+ // Style fix for the api link that gets outside the content.
277
+ echo '<style>body#error-page{word-break:break-word;}</style>';
278
+
279
+ if ( false === $transient ) {
280
+ set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
281
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
282
+ $title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
283
+ $theme = $folder . '/style.css';
284
+ $nonce = 'upgrade-theme_' . $theme;
285
+ $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
286
+
287
+ $upgrader = new \Theme_Upgrader( new \Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) );
288
+ $upgrader->upgrade( $theme );
289
+ delete_transient( $this->product->get_key() . '_warning_rollback' );
290
+ wp_die(
291
+ '',
292
+ esc_attr( $title ),
293
+ array(
294
+ 'response' => 200,
295
+ )
296
+ );
297
+ }
298
+ }
299
+
300
+ /**
301
+ * Alter links and remove duplicate customize message.
302
+ *
303
+ * @param array $links Array of old links.
304
+ *
305
+ * @return mixed Array of links.
306
+ */
307
+ public function alter_links_theme_upgrade( $links ) {
308
+ if ( isset( $links['preview'] ) ) {
309
+ $links['preview'] = str_replace( '<span aria-hidden="true">Customize</span>', '', $links['preview'] );
310
+ }
311
+
312
+ return $links;
313
+ }
314
+
315
+ /**
316
+ * Loads product object.
317
+ *
318
+ * @param Product $product Product object.
319
+ *
320
+ * @return bool Should we load the module?
321
+ */
322
+ public function can_load( $product ) {
323
+ if ( $this->is_from_partner( $product ) ) {
324
+ return false;
325
+ }
326
+ if ( $product->is_theme() && ! current_user_can( 'switch_themes' ) ) {
327
+ return false;
328
+ }
329
+
330
+ if ( $product->is_plugin() && ! current_user_can( 'install_plugins' ) ) {
331
+ return false;
332
+ }
333
+
334
+ return true;
335
+ }
336
+
337
+ /**
338
+ * Sort the rollbacks array in descending order.
339
+ *
340
+ * @param mixed $a First version to compare.
341
+ * @param mixed $b Second version to compare.
342
+ *
343
+ * @return bool Which version is greater?
344
+ */
345
+ public function sort_rollback_array( $a, $b ) {
346
+ return version_compare( $b['version'], $a['version'] );
347
+ }
348
+
349
+ /**
350
+ * Load module logic.
351
+ *
352
+ * @param Product $product Product object.
353
+ *
354
+ * @return $this Module object.
355
+ */
356
+ public function load( $product ) {
357
+ $this->product = $product;
358
+ $this->show_link();
359
+ $this->add_hooks();
360
+
361
+ return $this;
362
+ }
363
+
364
+ /**
365
+ * If product can be rolled back, show the link to rollback.
366
+ */
367
+ private function show_link() {
368
+ add_filter(
369
+ 'plugin_action_links_' . plugin_basename( $this->product->get_basefile() ),
370
+ array(
371
+ $this,
372
+ 'add_rollback_link',
373
+ )
374
+ );
375
+ }
376
+
377
+ /**
378
+ * Set the rollback hook. Strangely, this does not work if placed in the ThemeIsle_SDK_Rollback class, so it is being called from there instead.
379
+ */
380
+ public function add_hooks() {
381
+ add_action( 'admin_post_' . $this->product->get_key() . '_rollback', array( $this, 'start_rollback' ) );
382
+ add_action( 'admin_footer', array( $this, 'add_footer' ) );
383
+ }
384
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Translate.php ADDED
@@ -0,0 +1,918 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The translate model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Modules
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Translate module for ThemeIsle SDK.
24
+ */
25
+ class Translate extends Abstract_Module {
26
+ /**
27
+ * List of available locales.
28
+ *
29
+ * @var array Array of available locals.
30
+ */
31
+ private static $locales = array(
32
+ 'af' => array(
33
+ 'slug' => 'af',
34
+ 'name' => 'Afrikaans',
35
+ ),
36
+ 'ak' => array(
37
+ 'slug' => 'ak',
38
+ 'name' => 'Akan',
39
+ ),
40
+ 'am' => array(
41
+ 'slug' => 'am',
42
+ 'name' => 'Amharic',
43
+ ),
44
+ 'ar' => array(
45
+ 'slug' => 'ar',
46
+ 'name' => 'Arabic',
47
+ ),
48
+ 'arq' => array(
49
+ 'slug' => 'arq',
50
+ 'name' => 'Algerian Arabic',
51
+ ),
52
+ 'ary' => array(
53
+ 'slug' => 'ary',
54
+ 'name' => 'Moroccan Arabic',
55
+ ),
56
+ 'as' => array(
57
+ 'slug' => 'as',
58
+ 'name' => 'Assamese',
59
+ ),
60
+ 'ast' => array(
61
+ 'slug' => 'ast',
62
+ 'name' => 'Asturian',
63
+ ),
64
+ 'az' => array(
65
+ 'slug' => 'az',
66
+ 'name' => 'Azerbaijani',
67
+ ),
68
+ 'azb' => array(
69
+ 'slug' => 'azb',
70
+ 'name' => 'South Azerbaijani',
71
+ ),
72
+ 'az_TR' => array(
73
+ 'slug' => 'az-tr',
74
+ 'name' => 'Azerbaijani (Turkey)',
75
+ ),
76
+ 'ba' => array(
77
+ 'slug' => 'ba',
78
+ 'name' => 'Bashkir',
79
+ ),
80
+ 'bal' => array(
81
+ 'slug' => 'bal',
82
+ 'name' => 'Catalan (Balear)',
83
+ ),
84
+ 'bcc' => array(
85
+ 'slug' => 'bcc',
86
+ 'name' => 'Balochi Southern',
87
+ ),
88
+ 'bel' => array(
89
+ 'slug' => 'bel',
90
+ 'name' => 'Belarusian',
91
+ ),
92
+ 'bg_BG' => array(
93
+ 'slug' => 'bg',
94
+ 'name' => 'Bulgarian',
95
+ ),
96
+ 'bn_BD' => array(
97
+ 'slug' => 'bn',
98
+ 'name' => 'Bengali',
99
+ ),
100
+ 'bo' => array(
101
+ 'slug' => 'bo',
102
+ 'name' => 'Tibetan',
103
+ ),
104
+ 'bre' => array(
105
+ 'slug' => 'br',
106
+ 'name' => 'Breton',
107
+ ),
108
+ 'bs_BA' => array(
109
+ 'slug' => 'bs',
110
+ 'name' => 'Bosnian',
111
+ ),
112
+ 'ca' => array(
113
+ 'slug' => 'ca',
114
+ 'name' => 'Catalan',
115
+ ),
116
+ 'ceb' => array(
117
+ 'slug' => 'ceb',
118
+ 'name' => 'Cebuano',
119
+ ),
120
+ 'ckb' => array(
121
+ 'slug' => 'ckb',
122
+ 'name' => 'Kurdish (Sorani)',
123
+ ),
124
+ 'co' => array(
125
+ 'slug' => 'co',
126
+ 'name' => 'Corsican',
127
+ ),
128
+ 'cs_CZ' => array(
129
+ 'slug' => 'cs',
130
+ 'name' => 'Czech',
131
+ ),
132
+ 'cy' => array(
133
+ 'slug' => 'cy',
134
+ 'name' => 'Welsh',
135
+ ),
136
+ 'da_DK' => array(
137
+ 'slug' => 'da',
138
+ 'name' => 'Danish',
139
+ ),
140
+ 'de_DE' => array(
141
+ 'slug' => 'de',
142
+ 'name' => 'German',
143
+ ),
144
+ 'de_CH' => array(
145
+ 'slug' => 'de-ch',
146
+ 'name' => 'German (Switzerland)',
147
+ ),
148
+ 'dv' => array(
149
+ 'slug' => 'dv',
150
+ 'name' => 'Dhivehi',
151
+ ),
152
+ 'dzo' => array(
153
+ 'slug' => 'dzo',
154
+ 'name' => 'Dzongkha',
155
+ ),
156
+ 'el' => array(
157
+ 'slug' => 'el',
158
+ 'name' => 'Greek',
159
+ ),
160
+ 'art_xemoji' => array(
161
+ 'slug' => 'art-xemoji',
162
+ 'name' => 'Emoji',
163
+ ),
164
+ 'en_US' => array(
165
+ 'slug' => 'en',
166
+ 'name' => 'English',
167
+ ),
168
+ 'en_AU' => array(
169
+ 'slug' => 'en-au',
170
+ 'name' => 'English (Australia)',
171
+ ),
172
+ 'en_CA' => array(
173
+ 'slug' => 'en-ca',
174
+ 'name' => 'English (Canada)',
175
+ ),
176
+ 'en_GB' => array(
177
+ 'slug' => 'en-gb',
178
+ 'name' => 'English (UK)',
179
+ ),
180
+ 'en_NZ' => array(
181
+ 'slug' => 'en-nz',
182
+ 'name' => 'English (New Zealand)',
183
+ ),
184
+ 'en_ZA' => array(
185
+ 'slug' => 'en-za',
186
+ 'name' => 'English (South Africa)',
187
+ ),
188
+ 'eo' => array(
189
+ 'slug' => 'eo',
190
+ 'name' => 'Esperanto',
191
+ ),
192
+ 'es_ES' => array(
193
+ 'slug' => 'es',
194
+ 'name' => 'Spanish (Spain)',
195
+ ),
196
+ 'es_AR' => array(
197
+ 'slug' => 'es-ar',
198
+ 'name' => 'Spanish (Argentina)',
199
+ ),
200
+ 'es_CL' => array(
201
+ 'slug' => 'es-cl',
202
+ 'name' => 'Spanish (Chile)',
203
+ ),
204
+ 'es_CO' => array(
205
+ 'slug' => 'es-co',
206
+ 'name' => 'Spanish (Colombia)',
207
+ ),
208
+ 'es_CR' => array(
209
+ 'slug' => 'es-cr',
210
+ 'name' => 'Spanish (Costa Rica)',
211
+ ),
212
+ 'es_GT' => array(
213
+ 'slug' => 'es-gt',
214
+ 'name' => 'Spanish (Guatemala)',
215
+ ),
216
+ 'es_MX' => array(
217
+ 'slug' => 'es-mx',
218
+ 'name' => 'Spanish (Mexico)',
219
+ ),
220
+ 'es_PE' => array(
221
+ 'slug' => 'es-pe',
222
+ 'name' => 'Spanish (Peru)',
223
+ ),
224
+ 'es_PR' => array(
225
+ 'slug' => 'es-pr',
226
+ 'name' => 'Spanish (Puerto Rico)',
227
+ ),
228
+ 'es_VE' => array(
229
+ 'slug' => 'es-ve',
230
+ 'name' => 'Spanish (Venezuela)',
231
+ ),
232
+ 'et' => array(
233
+ 'slug' => 'et',
234
+ 'name' => 'Estonian',
235
+ ),
236
+ 'eu' => array(
237
+ 'slug' => 'eu',
238
+ 'name' => 'Basque',
239
+ ),
240
+ 'fa_IR' => array(
241
+ 'slug' => 'fa',
242
+ 'name' => 'Persian',
243
+ ),
244
+ 'fa_AF' => array(
245
+ 'slug' => 'fa-af',
246
+ 'name' => 'Persian (Afghanistan)',
247
+ ),
248
+ 'fuc' => array(
249
+ 'slug' => 'fuc',
250
+ 'name' => 'Fulah',
251
+ ),
252
+ 'fi' => array(
253
+ 'slug' => 'fi',
254
+ 'name' => 'Finnish',
255
+ ),
256
+ 'fo' => array(
257
+ 'slug' => 'fo',
258
+ 'name' => 'Faroese',
259
+ ),
260
+ 'fr_FR' => array(
261
+ 'slug' => 'fr',
262
+ 'name' => 'French (France)',
263
+ ),
264
+ 'fr_BE' => array(
265
+ 'slug' => 'fr-be',
266
+ 'name' => 'French (Belgium)',
267
+ ),
268
+ 'fr_CA' => array(
269
+ 'slug' => 'fr-ca',
270
+ 'name' => 'French (Canada)',
271
+ ),
272
+ 'frp' => array(
273
+ 'slug' => 'frp',
274
+ 'name' => 'Arpitan',
275
+ ),
276
+ 'fur' => array(
277
+ 'slug' => 'fur',
278
+ 'name' => 'Friulian',
279
+ ),
280
+ 'fy' => array(
281
+ 'slug' => 'fy',
282
+ 'name' => 'Frisian',
283
+ ),
284
+ 'ga' => array(
285
+ 'slug' => 'ga',
286
+ 'name' => 'Irish',
287
+ ),
288
+ 'gd' => array(
289
+ 'slug' => 'gd',
290
+ 'name' => 'Scottish Gaelic',
291
+ ),
292
+ 'gl_ES' => array(
293
+ 'slug' => 'gl',
294
+ 'name' => 'Galician',
295
+ ),
296
+ 'gn' => array(
297
+ 'slug' => 'gn',
298
+ 'name' => 'Guarani',
299
+ ),
300
+ 'gsw' => array(
301
+ 'slug' => 'gsw',
302
+ 'name' => 'Swiss German',
303
+ ),
304
+ 'gu' => array(
305
+ 'slug' => 'gu',
306
+ 'name' => 'Gujarati',
307
+ ),
308
+ 'hat' => array(
309
+ 'slug' => 'hat',
310
+ 'name' => 'Haitian Creole',
311
+ ),
312
+ 'hau' => array(
313
+ 'slug' => 'hau',
314
+ 'name' => 'Hausa',
315
+ ),
316
+ 'haw_US' => array(
317
+ 'slug' => 'haw',
318
+ 'name' => 'Hawaiian',
319
+ ),
320
+ 'haz' => array(
321
+ 'slug' => 'haz',
322
+ 'name' => 'Hazaragi',
323
+ ),
324
+ 'he_IL' => array(
325
+ 'slug' => 'he',
326
+ 'name' => 'Hebrew',
327
+ ),
328
+ 'hi_IN' => array(
329
+ 'slug' => 'hi',
330
+ 'name' => 'Hindi',
331
+ ),
332
+ 'hr' => array(
333
+ 'slug' => 'hr',
334
+ 'name' => 'Croatian',
335
+ ),
336
+ 'hu_HU' => array(
337
+ 'slug' => 'hu',
338
+ 'name' => 'Hungarian',
339
+ ),
340
+ 'hy' => array(
341
+ 'slug' => 'hy',
342
+ 'name' => 'Armenian',
343
+ ),
344
+ 'id_ID' => array(
345
+ 'slug' => 'id',
346
+ 'name' => 'Indonesian',
347
+ ),
348
+ 'ido' => array(
349
+ 'slug' => 'ido',
350
+ 'name' => 'Ido',
351
+ ),
352
+ 'is_IS' => array(
353
+ 'slug' => 'is',
354
+ 'name' => 'Icelandic',
355
+ ),
356
+ 'it_IT' => array(
357
+ 'slug' => 'it',
358
+ 'name' => 'Italian',
359
+ ),
360
+ 'ja' => array(
361
+ 'slug' => 'ja',
362
+ 'name' => 'Japanese',
363
+ ),
364
+ 'jv_ID' => array(
365
+ 'slug' => 'jv',
366
+ 'name' => 'Javanese',
367
+ ),
368
+ 'ka_GE' => array(
369
+ 'slug' => 'ka',
370
+ 'name' => 'Georgian',
371
+ ),
372
+ 'kab' => array(
373
+ 'slug' => 'kab',
374
+ 'name' => 'Kabyle',
375
+ ),
376
+ 'kal' => array(
377
+ 'slug' => 'kal',
378
+ 'name' => 'Greenlandic',
379
+ ),
380
+ 'kin' => array(
381
+ 'slug' => 'kin',
382
+ 'name' => 'Kinyarwanda',
383
+ ),
384
+ 'kk' => array(
385
+ 'slug' => 'kk',
386
+ 'name' => 'Kazakh',
387
+ ),
388
+ 'km' => array(
389
+ 'slug' => 'km',
390
+ 'name' => 'Khmer',
391
+ ),
392
+ 'kn' => array(
393
+ 'slug' => 'kn',
394
+ 'name' => 'Kannada',
395
+ ),
396
+ 'ko_KR' => array(
397
+ 'slug' => 'ko',
398
+ 'name' => 'Korean',
399
+ ),
400
+ 'kir' => array(
401
+ 'slug' => 'kir',
402
+ 'name' => 'Kyrgyz',
403
+ ),
404
+ 'lb_LU' => array(
405
+ 'slug' => 'lb',
406
+ 'name' => 'Luxembourgish',
407
+ ),
408
+ 'li' => array(
409
+ 'slug' => 'li',
410
+ 'name' => 'Limburgish',
411
+ ),
412
+ 'lin' => array(
413
+ 'slug' => 'lin',
414
+ 'name' => 'Lingala',
415
+ ),
416
+ 'lo' => array(
417
+ 'slug' => 'lo',
418
+ 'name' => 'Lao',
419
+ ),
420
+ 'lt_LT' => array(
421
+ 'slug' => 'lt',
422
+ 'name' => 'Lithuanian',
423
+ ),
424
+ 'lv' => array(
425
+ 'slug' => 'lv',
426
+ 'name' => 'Latvian',
427
+ ),
428
+ 'me_ME' => array(
429
+ 'slug' => 'me',
430
+ 'name' => 'Montenegrin',
431
+ ),
432
+ 'mg_MG' => array(
433
+ 'slug' => 'mg',
434
+ 'name' => 'Malagasy',
435
+ ),
436
+ 'mk_MK' => array(
437
+ 'slug' => 'mk',
438
+ 'name' => 'Macedonian',
439
+ ),
440
+ 'ml_IN' => array(
441
+ 'slug' => 'ml',
442
+ 'name' => 'Malayalam',
443
+ ),
444
+ 'mlt' => array(
445
+ 'slug' => 'mlt',
446
+ 'name' => 'Maltese',
447
+ ),
448
+ 'mn' => array(
449
+ 'slug' => 'mn',
450
+ 'name' => 'Mongolian',
451
+ ),
452
+ 'mr' => array(
453
+ 'slug' => 'mr',
454
+ 'name' => 'Marathi',
455
+ ),
456
+ 'mri' => array(
457
+ 'slug' => 'mri',
458
+ 'name' => 'Maori',
459
+ ),
460
+ 'ms_MY' => array(
461
+ 'slug' => 'ms',
462
+ 'name' => 'Malay',
463
+ ),
464
+ 'my_MM' => array(
465
+ 'slug' => 'mya',
466
+ 'name' => 'Myanmar (Burmese)',
467
+ ),
468
+ 'ne_NP' => array(
469
+ 'slug' => 'ne',
470
+ 'name' => 'Nepali',
471
+ ),
472
+ 'nb_NO' => array(
473
+ 'slug' => 'nb',
474
+ 'name' => 'Norwegian (Bokmal)',
475
+ ),
476
+ 'nl_NL' => array(
477
+ 'slug' => 'nl',
478
+ 'name' => 'Dutch',
479
+ ),
480
+ 'nl_BE' => array(
481
+ 'slug' => 'nl-be',
482
+ 'name' => 'Dutch (Belgium)',
483
+ ),
484
+ 'nn_NO' => array(
485
+ 'slug' => 'nn',
486
+ 'name' => 'Norwegian (Nynorsk)',
487
+ ),
488
+ 'oci' => array(
489
+ 'slug' => 'oci',
490
+ 'name' => 'Occitan',
491
+ ),
492
+ 'ory' => array(
493
+ 'slug' => 'ory',
494
+ 'name' => 'Oriya',
495
+ ),
496
+ 'os' => array(
497
+ 'slug' => 'os',
498
+ 'name' => 'Ossetic',
499
+ ),
500
+ 'pa_IN' => array(
501
+ 'slug' => 'pa',
502
+ 'name' => 'Punjabi',
503
+ ),
504
+ 'pl_PL' => array(
505
+ 'slug' => 'pl',
506
+ 'name' => 'Polish',
507
+ ),
508
+ 'pt_BR' => array(
509
+ 'slug' => 'pt-br',
510
+ 'name' => 'Portuguese (Brazil)',
511
+ ),
512
+ 'pt_PT' => array(
513
+ 'slug' => 'pt',
514
+ 'name' => 'Portuguese (Portugal)',
515
+ ),
516
+ 'ps' => array(
517
+ 'slug' => 'ps',
518
+ 'name' => 'Pashto',
519
+ ),
520
+ 'rhg' => array(
521
+ 'slug' => 'rhg',
522
+ 'name' => 'Rohingya',
523
+ ),
524
+ 'ro_RO' => array(
525
+ 'slug' => 'ro',
526
+ 'name' => 'Romanian',
527
+ ),
528
+ 'roh' => array(
529
+ 'slug' => 'roh',
530
+ 'name' => 'Romansh',
531
+ ),
532
+ 'ru_RU' => array(
533
+ 'slug' => 'ru',
534
+ 'name' => 'Russian',
535
+ ),
536
+ 'rue' => array(
537
+ 'slug' => 'rue',
538
+ 'name' => 'Rusyn',
539
+ ),
540
+ 'rup_MK' => array(
541
+ 'slug' => 'rup',
542
+ 'name' => 'Aromanian',
543
+ ),
544
+ 'sah' => array(
545
+ 'slug' => 'sah',
546
+ 'name' => 'Sakha',
547
+ ),
548
+ 'sa_IN' => array(
549
+ 'slug' => 'sa-in',
550
+ 'name' => 'Sanskrit',
551
+ ),
552
+ 'scn' => array(
553
+ 'slug' => 'scn',
554
+ 'name' => 'Sicilian',
555
+ ),
556
+ 'si_LK' => array(
557
+ 'slug' => 'si',
558
+ 'name' => 'Sinhala',
559
+ ),
560
+ 'sk_SK' => array(
561
+ 'slug' => 'sk',
562
+ 'name' => 'Slovak',
563
+ ),
564
+ 'sl_SI' => array(
565
+ 'slug' => 'sl',
566
+ 'name' => 'Slovenian',
567
+ ),
568
+ 'sna' => array(
569
+ 'slug' => 'sna',
570
+ 'name' => 'Shona',
571
+ ),
572
+ 'snd' => array(
573
+ 'slug' => 'snd',
574
+ 'name' => 'Sindhi',
575
+ ),
576
+ 'so_SO' => array(
577
+ 'slug' => 'so',
578
+ 'name' => 'Somali',
579
+ ),
580
+ 'sq' => array(
581
+ 'slug' => 'sq',
582
+ 'name' => 'Albanian',
583
+ ),
584
+ 'sq_XK' => array(
585
+ 'slug' => 'sq-xk',
586
+ 'name' => 'Shqip (Kosovo)',
587
+ ),
588
+ 'sr_RS' => array(
589
+ 'slug' => 'sr',
590
+ 'name' => 'Serbian',
591
+ ),
592
+ 'srd' => array(
593
+ 'slug' => 'srd',
594
+ 'name' => 'Sardinian',
595
+ ),
596
+ 'su_ID' => array(
597
+ 'slug' => 'su',
598
+ 'name' => 'Sundanese',
599
+ ),
600
+ 'sv_SE' => array(
601
+ 'slug' => 'sv',
602
+ 'name' => 'Swedish',
603
+ ),
604
+ 'sw' => array(
605
+ 'slug' => 'sw',
606
+ 'name' => 'Swahili',
607
+ ),
608
+ 'syr' => array(
609
+ 'slug' => 'syr',
610
+ 'name' => 'Syriac',
611
+ ),
612
+ 'szl' => array(
613
+ 'slug' => 'szl',
614
+ 'name' => 'Silesian',
615
+ ),
616
+ 'ta_IN' => array(
617
+ 'slug' => 'ta',
618
+ 'name' => 'Tamil',
619
+ ),
620
+ 'ta_LK' => array(
621
+ 'slug' => 'ta-lk',
622
+ 'name' => 'Tamil (Sri Lanka)',
623
+ ),
624
+ 'tah' => array(
625
+ 'slug' => 'tah',
626
+ 'name' => 'Tahitian',
627
+ ),
628
+ 'te' => array(
629
+ 'slug' => 'te',
630
+ 'name' => 'Telugu',
631
+ ),
632
+ 'tg' => array(
633
+ 'slug' => 'tg',
634
+ 'name' => 'Tajik',
635
+ ),
636
+ 'th' => array(
637
+ 'slug' => 'th',
638
+ 'name' => 'Thai',
639
+ ),
640
+ 'tir' => array(
641
+ 'slug' => 'tir',
642
+ 'name' => 'Tigrinya',
643
+ ),
644
+ 'tl' => array(
645
+ 'slug' => 'tl',
646
+ 'name' => 'Tagalog',
647
+ ),
648
+ 'tr_TR' => array(
649
+ 'slug' => 'tr',
650
+ 'name' => 'Turkish',
651
+ ),
652
+ 'tt_RU' => array(
653
+ 'slug' => 'tt',
654
+ 'name' => 'Tatar',
655
+ ),
656
+ 'tuk' => array(
657
+ 'slug' => 'tuk',
658
+ 'name' => 'Turkmen',
659
+ ),
660
+ 'twd' => array(
661
+ 'slug' => 'twd',
662
+ 'name' => 'Tweants',
663
+ ),
664
+ 'tzm' => array(
665
+ 'slug' => 'tzm',
666
+ 'name' => 'Tamazight (Central Atlas)',
667
+ ),
668
+ 'ug_CN' => array(
669
+ 'slug' => 'ug',
670
+ 'name' => 'Uighur',
671
+ ),
672
+ 'uk' => array(
673
+ 'slug' => 'uk',
674
+ 'name' => 'Ukrainian',
675
+ ),
676
+ 'ur' => array(
677
+ 'slug' => 'ur',
678
+ 'name' => 'Urdu',
679
+ ),
680
+ 'uz_UZ' => array(
681
+ 'slug' => 'uz',
682
+ 'name' => 'Uzbek',
683
+ ),
684
+ 'vi' => array(
685
+ 'slug' => 'vi',
686
+ 'name' => 'Vietnamese',
687
+ ),
688
+ 'wa' => array(
689
+ 'slug' => 'wa',
690
+ 'name' => 'Walloon',
691
+ ),
692
+ 'xho' => array(
693
+ 'slug' => 'xho',
694
+ 'name' => 'Xhosa',
695
+ ),
696
+ 'xmf' => array(
697
+ 'slug' => 'xmf',
698
+ 'name' => 'Mingrelian',
699
+ ),
700
+ 'yor' => array(
701
+ 'slug' => 'yor',
702
+ 'name' => 'Yoruba',
703
+ ),
704
+ 'zh_CN' => array(
705
+ 'slug' => 'zh-cn',
706
+ 'name' => 'Chinese (China)',
707
+ ),
708
+ 'zh_HK' => array(
709
+ 'slug' => 'zh-hk',
710
+ 'name' => 'Chinese (Hong Kong)',
711
+ ),
712
+ 'zh_TW' => array(
713
+ 'slug' => 'zh-tw',
714
+ 'name' => 'Chinese (Taiwan)',
715
+ ),
716
+ 'de_DE_formal' => array(
717
+ 'slug' => 'de/formal',
718
+ 'name' => 'German (Formal)',
719
+ ),
720
+ 'nl_NL_formal' => array(
721
+ 'slug' => 'nl/formal',
722
+ 'name' => 'Dutch (Formal)',
723
+ ),
724
+ 'de_CH_informal' => array(
725
+ 'slug' => 'de-ch/informal',
726
+ 'name' => 'Chinese (Taiwan)',
727
+ ),
728
+ 'pt_PT_ao90' => array(
729
+ 'slug' => 'pt/ao90',
730
+ 'name' => 'Portuguese (Portugal, AO90)',
731
+ ),
732
+ );
733
+
734
+ /**
735
+ * Check if we should load module for this.
736
+ *
737
+ * @param Product $product Product to check.
738
+ *
739
+ * @return bool Should load ?
740
+ */
741
+ public function can_load( $product ) {
742
+ if ( $this->is_from_partner( $product ) ) {
743
+ return false;
744
+ }
745
+ if ( ! $product->is_wordpress_available() ) {
746
+ return false;
747
+ }
748
+
749
+ $lang = $this->get_user_locale();
750
+
751
+ if ( 'en_US' === $lang ) {
752
+ return false;
753
+ }
754
+
755
+ $languages = $this->get_translations( $product );
756
+
757
+ if ( ! is_array( $languages ) ) {
758
+ return false;
759
+ }
760
+
761
+ if ( ! isset( $languages['translations'] ) ) {
762
+ return false;
763
+ }
764
+
765
+ $languages = $languages['translations'];
766
+
767
+ $available = wp_list_pluck( $languages, 'language' );
768
+
769
+ if ( in_array( $lang, $available ) ) {
770
+ return false;
771
+ }
772
+
773
+ if ( ! isset( self::$locales[ $lang ] ) ) {
774
+ return false;
775
+ }
776
+
777
+ return apply_filters( $product->get_slug() . '_sdk_enable_translate', true );
778
+ }
779
+
780
+ /**
781
+ * Get the user's locale.
782
+ */
783
+ private function get_user_locale() {
784
+ global $wp_version;
785
+ if ( version_compare( $wp_version, '4.7.0', '>=' ) ) {
786
+ return get_user_locale();
787
+ }
788
+ $user = wp_get_current_user();
789
+ if ( $user ) {
790
+ $locale = $user->locale;
791
+ }
792
+
793
+ return $locale ? $locale : get_locale();
794
+ }
795
+
796
+ /**
797
+ * Fetch translations from api.
798
+ *
799
+ * @param Product $product Product to check.
800
+ *
801
+ * @return mixed Translation array.
802
+ */
803
+ private function get_translations( $product ) {
804
+ $cache_key = $product->get_key() . '_all_languages';
805
+ $translations = get_transient( $cache_key );
806
+
807
+ if ( false === $translations ) {
808
+ require_once ABSPATH . 'wp-admin/includes/translation-install.php';
809
+ $translations = translations_api(
810
+ $product->get_type() . 's',
811
+ array(
812
+ 'slug' => $product->get_slug(),
813
+ 'version' => $product->get_version(),
814
+ )
815
+ );
816
+ set_transient( $cache_key, $translations, WEEK_IN_SECONDS );
817
+ }
818
+
819
+ return $translations;
820
+
821
+ }
822
+
823
+ /**
824
+ * Add notification to queue.
825
+ *
826
+ * @param array $all_notifications Previous notification.
827
+ *
828
+ * @return array All notifications.
829
+ */
830
+ public function add_notification( $all_notifications ) {
831
+
832
+ $lang = $this->get_user_locale();
833
+ $link = $this->get_locale_paths( $lang );
834
+ $language_meta = self::$locales[ $lang ];
835
+
836
+ $heading = apply_filters( $this->product->get_key() . '_feedback_translate_heading', 'Improve {product}' );
837
+ $heading = str_replace(
838
+ array( '{product}' ),
839
+ $this->product->get_friendly_name(),
840
+ $heading
841
+ );
842
+ $message = apply_filters(
843
+ $this->product->get_key() . '_feedback_translation',
844
+ 'Translating <b>{product}</b> into as many languages as possible is a huge project. We still need help with a lot of them, so if you are good at translating into <b>{language}</b>, it would be greatly appreciated.
845
+ The process is easy, and you can join by following the link below!'
846
+ );
847
+
848
+ $message = str_replace(
849
+ [ '{product}', '{language}' ],
850
+ [
851
+ $this->product->get_friendly_name(),
852
+ $language_meta['name'],
853
+ ],
854
+ $message
855
+ );
856
+
857
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_translate_button_do', 'Ok, I will gladly help.' );
858
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_translate_button_cancel', 'No, thanks.' );
859
+
860
+ $all_notifications[] = [
861
+ 'id' => $this->product->get_key() . '_translate_flag',
862
+ 'heading' => $heading,
863
+ 'message' => $message,
864
+ 'ctas' => [
865
+ 'confirm' => [
866
+ 'link' => $link,
867
+ 'text' => $button_submit,
868
+ ],
869
+ 'cancel' => [
870
+ 'link' => '#',
871
+ 'text' => $button_cancel,
872
+ ],
873
+ ],
874
+ ];
875
+
876
+ return $all_notifications;
877
+ }
878
+
879
+ /**
880
+ * Return the locale path.
881
+ *
882
+ * @param string $locale Locale code.
883
+ *
884
+ * @return string Locale path.
885
+ */
886
+ private function get_locale_paths( $locale ) {
887
+ if ( empty( $locale ) ) {
888
+ return '';
889
+ }
890
+
891
+ $slug = isset( self::$locales[ $locale ] ) ? self::$locales[ $locale ]['slug'] : '';
892
+ if ( empty( $slug ) ) {
893
+ return '';
894
+ }
895
+ if ( strpos( $slug, '/' ) === false ) {
896
+ $slug .= '/default';
897
+ }
898
+ $url = 'https://translate.wordpress.org/projects/wp-' . $this->product->get_type() . 's/' . $this->product->get_slug() . '/' . ( $this->product->get_type() === 'plugin' ? 'dev/' : '' ) . $slug . '?filters%5Bstatus%5D=untranslated&sort%5Bby%5D=random';
899
+
900
+ return $url;
901
+ }
902
+
903
+ /**
904
+ * Load module logic.
905
+ *
906
+ * @param Product $product Product to load.
907
+ *
908
+ * @return Translate Module instance.
909
+ */
910
+ public function load( $product ) {
911
+
912
+ $this->product = $product;
913
+
914
+ add_filter( 'themeisle_sdk_registered_notifications', [ $this, 'add_notification' ] );
915
+
916
+ return $this;
917
+ }
918
+ }
vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php ADDED
@@ -0,0 +1,858 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The deactivate feedback model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Feedback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK\Modules;
13
+
14
+ use ThemeisleSDK\Common\Abstract_Module;
15
+ use ThemeisleSDK\Product;
16
+
17
+ // Exit if accessed directly.
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Uninstall feedback module for ThemeIsle SDK.
24
+ */
25
+ class Uninstall_Feedback extends Abstract_Module {
26
+ /**
27
+ * How many seconds before the deactivation window is triggered for themes?
28
+ *
29
+ * @var int Number of days.
30
+ */
31
+ const AUTO_TRIGGER_DEACTIVATE_WINDOW_SECONDS = 3;
32
+ /**
33
+ * How many days before the deactivation window pops up again for the theme?
34
+ *
35
+ * @var int Number of days.
36
+ */
37
+ const PAUSE_DEACTIVATE_WINDOW_DAYS = 100;
38
+ /**
39
+ * Where to send the data.
40
+ *
41
+ * @var string Endpoint url.
42
+ */
43
+ const FEEDBACK_ENDPOINT = 'https://api.themeisle.com/tracking/uninstall';
44
+
45
+ /**
46
+ * Default options for plugins.
47
+ *
48
+ * @var array $options_plugin The main options list for plugins.
49
+ */
50
+ private $options_plugin = array(
51
+ 'I found a better plugin' => array(
52
+ 'id' => 3,
53
+ 'type' => 'text',
54
+ 'placeholder' => 'What\'s the plugin\'s name?',
55
+ ),
56
+ 'I could not get the plugin to work' => array(
57
+ 'type' => 'textarea',
58
+ 'placeholder' => 'What problem are you experiencing?',
59
+ 'id' => 4,
60
+ ),
61
+ 'I no longer need the plugin' => array(
62
+ 'id' => 5,
63
+ 'type' => 'textarea',
64
+ 'placeholder' => 'If you could improve one thing about our product, what would it be?',
65
+ ),
66
+ 'It\'s a temporary deactivation. I\'m just debugging an issue.' => array(
67
+ 'type' => 'textarea',
68
+ 'placeholder' => 'What problem are you experiencing?',
69
+ 'id' => 6,
70
+ ),
71
+ );
72
+ /**
73
+ * Default options for theme.
74
+ *
75
+ * @var array $options_theme The main options list for themes.
76
+ */
77
+ private $options_theme = array(
78
+ 'I don\'t know how to make it look like demo' => array(
79
+ 'id' => 7,
80
+ ),
81
+ 'It lacks options' => array(
82
+ 'placeholder' => 'What option is missing?',
83
+ 'type' => 'text',
84
+ 'id' => 8,
85
+ ),
86
+ 'Is not working with a plugin that I need' => array(
87
+ 'id' => 9,
88
+ 'type' => 'text',
89
+ 'placeholder' => 'What is the name of the plugin',
90
+ ),
91
+ 'I want to try a new design, I don\'t like {theme} style' => array(
92
+ 'id' => 10,
93
+ ),
94
+ );
95
+ /**
96
+ * Default other option.
97
+ *
98
+ * @var array $other The other option
99
+ */
100
+ private $other = array(
101
+ 'Other' => array(
102
+ 'id' => 999,
103
+ 'type' => 'textarea',
104
+ 'placeholder' => 'What can we do better?',
105
+ ),
106
+ );
107
+ /**
108
+ * Default heading for plugin.
109
+ *
110
+ * @var string $heading_plugin The heading of the modal
111
+ */
112
+ private $heading_plugin = 'What\'s wrong?';
113
+ /**
114
+ * Default heading for theme.
115
+ *
116
+ * @var string $heading_theme The heading of the modal
117
+ */
118
+ private $heading_theme = 'What does not work for you in {theme}?';
119
+ /**
120
+ * Default submit button action text.
121
+ *
122
+ * @var string $button_submit The text of the deactivate button
123
+ */
124
+ private $button_submit = 'Submit &amp; Deactivate';
125
+ /**
126
+ * Default cancel button.
127
+ *
128
+ * @var string $button_cancel The text of the cancel button
129
+ */
130
+ private $button_cancel = 'Skip &amp; Deactivate';
131
+
132
+ /**
133
+ * Loads the additional resources
134
+ */
135
+ public function load_resources() {
136
+ $screen = get_current_screen();
137
+
138
+ if ( ! $screen || ! in_array( $screen->id, array( 'theme-install', 'plugins' ) ) ) {
139
+ return;
140
+ }
141
+
142
+ $this->add_feedback_popup_style();
143
+
144
+ if ( $this->product->get_type() === 'theme' ) {
145
+ $this->add_theme_feedback_drawer_js();
146
+ $this->render_theme_feedback_popup();
147
+
148
+ return;
149
+ }
150
+ $this->add_plugin_feedback_popup_js();
151
+ $this->render_plugin_feedback_popup();
152
+ }
153
+
154
+ /**
155
+ * Render theme feedback drawer.
156
+ */
157
+ private function render_theme_feedback_popup() {
158
+ $heading = str_replace( '{theme}', $this->product->get_name(), $this->heading_theme );
159
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', 'Submit' );
160
+ $options = $this->options_theme;
161
+ $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $options ) );
162
+ $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', 'What info do we collect?' ) . '</a>';
163
+
164
+ $options += $this->other;
165
+
166
+ ?>
167
+ <div class="ti-theme-uninstall-feedback-drawer ti-feedback">
168
+ <div class="popup--header">
169
+ <h5><?php echo wp_kses( $heading, array( 'span' => true ) ); ?> </h5>
170
+ <button class="toggle"><span>&times;</span></button>
171
+ </div><!--/.popup--header-->
172
+ <div class="popup--body">
173
+ <?php $this->render_options_list( $options ); ?>
174
+ </div><!--/.popup--body-->
175
+ <div class="popup--footer">
176
+ <div class="actions">
177
+ <?php
178
+ echo wp_kses_post( $info_disclosure_link );
179
+ echo wp_kses_post( $this->get_disclosure_labels() );
180
+ echo '<div class="buttons">';
181
+ echo get_submit_button( //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Function has an internal sanitization.
182
+ $button_submit,
183
+ 'secondary',
184
+ $this->product->get_key() . 'ti-deactivate-yes',
185
+ false,
186
+ array(
187
+ 'data-after-text' => $button_submit,
188
+ 'disabled' => true,
189
+ )
190
+ );
191
+ echo '</div>';
192
+ ?>
193
+ </div><!--/.actions-->
194
+ </div><!--/.popup--footer-->
195
+ </div>
196
+ <?php
197
+ }
198
+
199
+ /**
200
+ * Add feedback styles.
201
+ */
202
+ private function add_feedback_popup_style() {
203
+ ?>
204
+ <style>
205
+ .ti-feedback {
206
+ background: #fff;
207
+ max-width: 400px;
208
+ z-index: 10000;
209
+ box-shadow: 0 0 15px -5px rgba(0, 0, 0, .5);
210
+ transition: all .3s ease-out;
211
+ }
212
+
213
+
214
+ .ti-feedback .popup--header {
215
+ position: relative;
216
+ background-color: #23A1CE;
217
+ }
218
+
219
+ .ti-feedback .popup--header h5 {
220
+ margin: 0;
221
+ font-size: 16px;
222
+ padding: 15px;
223
+ color: #fff;
224
+ font-weight: 600;
225
+ text-align: center;
226
+ letter-spacing: .3px;
227
+ }
228
+
229
+ .ti-feedback .popup--body {
230
+ padding: 15px;
231
+ }
232
+
233
+ .ti-feedback .popup--form {
234
+ margin: 0;
235
+ font-size: 13px;
236
+ }
237
+
238
+ .ti-feedback .popup--form input[type="radio"] {
239
+ <?php echo is_rtl() ? 'margin: 0 0 0 10px;' : 'margin: 0 10px 0 0;'; ?>
240
+ }
241
+
242
+ .ti-feedback .popup--form input[type="radio"]:checked ~ textarea {
243
+ display: block;
244
+ }
245
+
246
+ .ti-feedback .popup--form textarea {
247
+ width: 100%;
248
+ margin: 10px 0 0;
249
+ display: none;
250
+ max-height: 150px;
251
+ }
252
+
253
+ .ti-feedback li {
254
+ display: flex;
255
+ align-items: center;
256
+ margin-bottom: 15px;
257
+ flex-wrap: wrap;
258
+ }
259
+
260
+ .ti-feedback li label {
261
+ max-width: 90%;
262
+ }
263
+
264
+ .ti-feedback li:last-child {
265
+ margin-bottom: 0;
266
+ }
267
+
268
+ .ti-feedback .popup--footer {
269
+ padding: 0 15px 15px;
270
+ }
271
+
272
+ .ti-feedback .actions {
273
+ display: flex;
274
+ flex-wrap: wrap;
275
+ }
276
+
277
+ .info-disclosure-link {
278
+ width: 100%;
279
+ margin-bottom: 15px;
280
+ }
281
+
282
+ .ti-feedback .info-disclosure-content {
283
+ max-height: 0;
284
+ overflow: hidden;
285
+ width: 100%;
286
+ transition: .3s ease;
287
+ }
288
+
289
+ .ti-feedback .info-disclosure-content.active {
290
+ max-height: 300px;
291
+ }
292
+
293
+ .ti-feedback .info-disclosure-content p {
294
+ margin: 0;
295
+ }
296
+
297
+ .ti-feedback .info-disclosure-content ul {
298
+ margin: 10px 0;
299
+ border-radius: 3px;
300
+ }
301
+
302
+ .ti-feedback .info-disclosure-content ul li {
303
+ display: flex;
304
+ align-items: center;
305
+ justify-content: space-between;
306
+ margin-bottom: 0;
307
+ padding: 5px 0;
308
+ border-bottom: 1px solid #ccc;
309
+ }
310
+
311
+ .ti-feedback .buttons {
312
+ display: flex;
313
+ width: 100%;
314
+ }
315
+
316
+ .ti-feedback .buttons input:last-child {
317
+ <?php echo is_rtl() ? 'margin-right: auto;' : 'margin-left: auto;'; ?>
318
+ }
319
+
320
+ .ti-theme-uninstall-feedback-drawer {
321
+ border-top-left-radius: 5px;
322
+ position: fixed;
323
+ top: 100%;
324
+ right: 15px;
325
+ }
326
+
327
+ .ti-theme-uninstall-feedback-drawer.active {
328
+ transform: translateY(-100%);
329
+ }
330
+
331
+ .ti-theme-uninstall-feedback-drawer .popup--header {
332
+ border-top-left-radius: 5px;
333
+ }
334
+
335
+ .ti-theme-uninstall-feedback-drawer .popup--header .toggle {
336
+ position: absolute;
337
+ padding: 3px 0;
338
+ width: 30px;
339
+ top: -26px;
340
+ right: 0;
341
+ cursor: pointer;
342
+ border-top-left-radius: 5px;
343
+ border-top-right-radius: 5px;
344
+ font-size: 20px;
345
+ background-color: #23A1CE;
346
+ color: #fff;
347
+ border: none;
348
+ line-height: 20px;
349
+ }
350
+
351
+ .ti-theme-uninstall-feedback-drawer .toggle span {
352
+ margin: 0;
353
+ display: inline-block;
354
+ }
355
+
356
+ .ti-theme-uninstall-feedback-drawer:not(.active) .toggle span {
357
+ transform: rotate(45deg);
358
+ }
359
+
360
+ .ti-theme-uninstall-feedback-drawer .popup--header .toggle:hover {
361
+ background-color: #1880a5;
362
+ }
363
+
364
+
365
+ .ti-plugin-uninstall-feedback-popup .popup--header:before {
366
+ content: "";
367
+ display: block;
368
+ position: absolute;
369
+ top: 50%;
370
+ transform: translateY(-50%);
371
+ <?php
372
+ echo is_rtl() ?
373
+ 'right: -10px;
374
+ border-top: 20px solid transparent;
375
+ border-left: 20px solid #23A1CE;
376
+ border-bottom: 20px solid transparent;' :
377
+ 'left: -10px;
378
+ border-top: 20px solid transparent;
379
+ border-right: 20px solid #23A1CE;
380
+ border-bottom: 20px solid transparent;';
381
+ ?>
382
+ }
383
+
384
+ .ti-plugin-uninstall-feedback-popup {
385
+ display: none;
386
+ position: absolute;
387
+ white-space: normal;
388
+ width: 400px;
389
+ <?php echo is_rtl() ? 'right: calc( 100% + 15px );' : 'left: calc( 100% + 15px );'; ?>
390
+ top: -15px;
391
+ }
392
+
393
+ .ti-plugin-uninstall-feedback-popup.sending-feedback .popup--body i {
394
+ animation: rotation 2s infinite linear;
395
+ display: block;
396
+ float: none;
397
+ align-items: center;
398
+ width: 100%;
399
+ margin: 0 auto;
400
+ height: 100%;
401
+ background: transparent;
402
+ padding: 0;
403
+ }
404
+
405
+ .ti-plugin-uninstall-feedback-popup.sending-feedback .popup--body i:before {
406
+ padding: 0;
407
+ background: transparent;
408
+ box-shadow: none;
409
+ color: #b4b9be
410
+ }
411
+
412
+
413
+ .ti-plugin-uninstall-feedback-popup.active {
414
+ display: block;
415
+ }
416
+
417
+ tr[data-plugin^="<?php echo esc_attr( $this->product->get_slug() ); ?>"] .deactivate {
418
+ position: relative;
419
+ }
420
+
421
+ body.ti-feedback-open .ti-feedback-overlay {
422
+ content: "";
423
+ display: block;
424
+ background-color: rgba(0, 0, 0, 0.5);
425
+ top: 0;
426
+ bottom: 0;
427
+ right: 0;
428
+ left: 0;
429
+ z-index: 10000;
430
+ position: fixed;
431
+ }
432
+
433
+ @media (max-width: 768px) {
434
+ .ti-plugin-uninstall-feedback-popup {
435
+ position: fixed;
436
+ max-width: 100%;
437
+ margin: 0 auto;
438
+ left: 50%;
439
+ top: 50px;
440
+ transform: translateX(-50%);
441
+ }
442
+
443
+ .ti-plugin-uninstall-feedback-popup .popup--header:before {
444
+ display: none;
445
+ }
446
+ }
447
+ </style>
448
+ <?php
449
+ }
450
+
451
+ /**
452
+ * Theme feedback drawer JS.
453
+ */
454
+ private function add_theme_feedback_drawer_js() {
455
+ $key = $this->product->get_key();
456
+ ?>
457
+ <script type="text/javascript" id="ti-deactivate-js">
458
+ (function ($) {
459
+ $(document).ready(function () {
460
+ setTimeout(function () {
461
+ $('.ti-theme-uninstall-feedback-drawer').addClass('active');
462
+ }, <?php echo absint( self::AUTO_TRIGGER_DEACTIVATE_WINDOW_SECONDS * 1000 ); ?> );
463
+
464
+ $('.ti-theme-uninstall-feedback-drawer .toggle').on('click', function (e) {
465
+ e.preventDefault();
466
+ $('.ti-theme-uninstall-feedback-drawer').toggleClass('active');
467
+ });
468
+
469
+ $('.info-disclosure-link').on('click', function (e) {
470
+ e.preventDefault();
471
+ $('.info-disclosure-content').toggleClass('active');
472
+ });
473
+
474
+ $('.ti-theme-uninstall-feedback-drawer input[type="radio"]').on('change', function () {
475
+ var radio = $(this);
476
+ if (radio.parent().find('textarea').length > 0 &&
477
+ radio.parent().find('textarea').val().length === 0) {
478
+ $('#<?php echo esc_attr( $key ); ?>ti-deactivate-yes').attr('disabled', 'disabled');
479
+ radio.parent().find('textarea').on('keyup', function (e) {
480
+ if ($(this).val().length === 0) {
481
+ $('#<?php echo esc_attr( $key ); ?>ti-deactivate-yes').attr('disabled', 'disabled');
482
+ } else {
483
+ $('#<?php echo esc_attr( $key ); ?>ti-deactivate-yes').removeAttr('disabled');
484
+ }
485
+ });
486
+ } else {
487
+ $('#<?php echo esc_attr( $key ); ?>ti-deactivate-yes').removeAttr('disabled');
488
+ }
489
+ });
490
+
491
+ $('#<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) {
492
+ e.preventDefault();
493
+ e.stopPropagation();
494
+
495
+ var selectedOption = $(
496
+ '.ti-theme-uninstall-feedback-drawer input[name="ti-deactivate-option"]:checked');
497
+ $.post(ajaxurl, {
498
+ 'action': '<?php echo esc_attr( $key ) . '_uninstall_feedback'; ?>',
499
+ 'nonce': '<?php echo esc_attr( wp_create_nonce( (string) __CLASS__ ) ); ?>',
500
+ 'id': selectedOption.parent().attr('ti-option-id'),
501
+ 'msg': selectedOption.parent().find('textarea').val(),
502
+ 'type': 'theme',
503
+ 'key': '<?php echo esc_attr( $key ); ?>'
504
+ });
505
+ $('.ti-theme-uninstall-feedback-drawer').fadeOut();
506
+ });
507
+ });
508
+ })(jQuery);
509
+
510
+ </script>
511
+ <?php
512
+ do_action( $this->product->get_key() . '_uninstall_feedback_after_js' );
513
+ }
514
+
515
+ /**
516
+ * Render the options list.
517
+ *
518
+ * @param array $options the options for the feedback form.
519
+ */
520
+ private function render_options_list( $options ) {
521
+ $key = $this->product->get_key();
522
+ $inputs_row_map = [
523
+ 'text' => 1,
524
+ 'textarea' => 2,
525
+ ];
526
+ ?>
527
+ <ul class="popup--form">
528
+ <?php foreach ( $options as $title => $attributes ) { ?>
529
+ <li ti-option-id="<?php echo esc_attr( $attributes['id'] ); ?>">
530
+ <input type="radio" name="ti-deactivate-option" id="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
531
+ <label for="<?php echo esc_attr( $key . $attributes['id'] ); ?>">
532
+ <?php echo esc_attr( str_replace( '{theme}', $this->product->get_name(), $title ) ); ?>
533
+ </label>
534
+ <?php
535
+ if ( array_key_exists( 'type', $attributes ) ) {
536
+ $placeholder = array_key_exists( 'placeholder', $attributes ) ? $attributes['placeholder'] : '';
537
+ echo '<textarea width="100%" rows="' . esc_attr( $inputs_row_map[ $attributes['type'] ] ) . '" name="comments" placeholder="' . esc_attr( $placeholder ) . '"></textarea>';
538
+ }
539
+ ?>
540
+ </li>
541
+ <?php } ?>
542
+ </ul>
543
+ <?php
544
+ }
545
+
546
+ /**
547
+ * Render plugin feedback popup.
548
+ */
549
+ private function render_plugin_feedback_popup() {
550
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', $this->button_cancel );
551
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', $this->button_submit );
552
+ $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $this->options_plugin ) );
553
+ $info_disclosure_link = '<a href="#" class="info-disclosure-link">' . apply_filters( $this->product->get_slug() . '_themeisle_sdk_info_collect_cta', 'What info do we collect?' ) . '</a>';
554
+
555
+ $options += $this->other;
556
+ ?>
557
+ <div class="ti-plugin-uninstall-feedback-popup ti-feedback" id="<?php echo esc_attr( $this->product->get_slug() . '_uninstall_feedback_popup' ); ?>">
558
+ <div class="popup--header">
559
+ <h5><?php echo wp_kses( $this->heading_plugin, array( 'span' => true ) ); ?> </h5>
560
+ </div><!--/.popup--header-->
561
+ <div class="popup--body">
562
+ <?php $this->render_options_list( $options ); ?>
563
+ </div><!--/.popup--body-->
564
+ <div class="popup--footer">
565
+ <div class="actions">
566
+ <?php
567
+ echo wp_kses_post( $info_disclosure_link );
568
+ echo wp_kses_post( $this->get_disclosure_labels() );
569
+ echo '<div class="buttons">';
570
+ echo get_submit_button( //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Function internals are escaped.
571
+ $button_cancel,
572
+ 'secondary',
573
+ $this->product->get_key() . 'ti-deactivate-no',
574
+ false
575
+ );
576
+ echo get_submit_button( //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Function internals are escaped.
577
+ $button_submit,
578
+ 'primary',
579
+ $this->product->get_key() . 'ti-deactivate-yes',
580
+ false,
581
+ array(
582
+ 'data-after-text' => $button_submit,
583
+ 'disabled' => true,
584
+ )
585
+ );
586
+ echo '</div>';
587
+ ?>
588
+ </div><!--/.actions-->
589
+ </div><!--/.popup--footer-->
590
+ </div>
591
+
592
+ <?php
593
+ }
594
+
595
+ /**
596
+ * Add plugin feedback popup JS
597
+ */
598
+ private function add_plugin_feedback_popup_js() {
599
+ $popup_id = '#' . $this->product->get_slug() . '_uninstall_feedback_popup';
600
+ $key = $this->product->get_key();
601
+ ?>
602
+ <script type="text/javascript" id="ti-deactivate-js">
603
+ (function ($) {
604
+ $(document).ready(function () {
605
+ var targetElement = 'tr[data-plugin^="<?php echo esc_attr( $this->product->get_slug() ); ?>/"] span.deactivate a';
606
+ var redirectUrl = $(targetElement).attr('href');
607
+ if ($('.ti-feedback-overlay').length === 0) {
608
+ $('body').prepend('<div class="ti-feedback-overlay"></div>');
609
+ }
610
+ $('<?php echo esc_attr( $popup_id ); ?> ').appendTo($(targetElement).parent());
611
+
612
+ $(targetElement).on('click', function (e) {
613
+ e.preventDefault();
614
+ $('<?php echo esc_attr( $popup_id ); ?> ').addClass('active');
615
+ $('body').addClass('ti-feedback-open');
616
+ $('.ti-feedback-overlay').on('click', function () {
617
+ $('<?php echo esc_attr( $popup_id ); ?> ').removeClass('active');
618
+ $('body').removeClass('ti-feedback-open');
619
+ });
620
+ });
621
+
622
+ $('<?php echo esc_attr( $popup_id ); ?> .info-disclosure-link').on('click', function (e) {
623
+ e.preventDefault();
624
+ $(this).parent().find('.info-disclosure-content').toggleClass('active');
625
+ });
626
+
627
+ $('<?php echo esc_attr( $popup_id ); ?> input[type="radio"]').on('change', function () {
628
+ var radio = $(this);
629
+ if (radio.parent().find('textarea').length > 0 &&
630
+ radio.parent().find('textarea').val().length === 0) {
631
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').attr('disabled', 'disabled');
632
+ radio.parent().find('textarea').on('keyup', function (e) {
633
+ if ($(this).val().length === 0) {
634
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').attr('disabled', 'disabled');
635
+ } else {
636
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').removeAttr('disabled');
637
+ }
638
+ });
639
+ } else {
640
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').removeAttr('disabled');
641
+ }
642
+ });
643
+
644
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-no').on('click', function (e) {
645
+ e.preventDefault();
646
+ e.stopPropagation();
647
+ $(targetElement).unbind('click');
648
+ $('body').removeClass('ti-feedback-open');
649
+ $('<?php echo esc_attr( $popup_id ); ?>').remove();
650
+ if (redirectUrl !== '') {
651
+ location.href = redirectUrl;
652
+ }
653
+ });
654
+
655
+ $('<?php echo esc_attr( $popup_id ); ?> #<?php echo esc_attr( $key ); ?>ti-deactivate-yes').on('click', function (e) {
656
+ e.preventDefault();
657
+ e.stopPropagation();
658
+ $(targetElement).unbind('click');
659
+ var selectedOption = $(
660
+ '<?php echo esc_attr( $popup_id ); ?> input[name="ti-deactivate-option"]:checked');
661
+ var data = {
662
+ 'action': '<?php echo esc_attr( $key ) . '_uninstall_feedback'; ?>',
663
+ 'nonce': '<?php echo esc_attr( wp_create_nonce( (string) __CLASS__ ) ); ?>',
664
+ 'id': selectedOption.parent().attr('ti-option-id'),
665
+ 'msg': selectedOption.parent().find('textarea').val(),
666
+ 'type': 'plugin',
667
+ 'key': '<?php echo esc_attr( $key ); ?>'
668
+ };
669
+ $.ajax({
670
+ type: 'POST',
671
+ url: ajaxurl,
672
+ data: data,
673
+ complete() {
674
+ $('body').removeClass('ti-feedback-open');
675
+ $('<?php echo esc_attr( $popup_id ); ?>').remove();
676
+ if (redirectUrl !== '') {
677
+ location.href = redirectUrl;
678
+ }
679
+ },
680
+ beforeSend() {
681
+ $('<?php echo esc_attr( $popup_id ); ?>').addClass('sending-feedback');
682
+ $('<?php echo esc_attr( $popup_id ); ?> .popup--footer').remove();
683
+ $('<?php echo esc_attr( $popup_id ); ?> .popup--body').html('<i class="dashicons dashicons-update-alt"></i>');
684
+ }
685
+ });
686
+ });
687
+ });
688
+ })(jQuery);
689
+
690
+ </script>
691
+ <?php
692
+ do_action( $this->product->get_key() . '_uninstall_feedback_after_js' );
693
+ }
694
+
695
+ /**
696
+ * Get the disclosure labels markup.
697
+ *
698
+ * @return string
699
+ */
700
+ private function get_disclosure_labels() {
701
+ $disclosure_new_labels = apply_filters( $this->product->get_slug() . '_themeisle_sdk_disclosure_content_labels', [], $this->product );
702
+ $disclosure_labels = array_merge(
703
+ [
704
+ 'title' => 'Below is a detailed view of all data that ThemeIsle will receive if you fill in this survey. No domain name, email address or IP addresses are transmited after you submit the survey.',
705
+ 'items' => [
706
+ sprintf( '%s %s version %s %s %s %s', '<strong>', ucwords( $this->product->get_type() ), '</strong>', '<code>', $this->product->get_version(), '</code>' ),
707
+ sprintf( '%sCurrent website:%s %s %s %s', '<strong>', '</strong>', '<code>', get_site_url(), '</code>' ),
708
+ sprintf( '%s Uninstall reason %s %s Selected reason from the above survey %s ', '<strong>', '</strong>', '<i>', '</i>' ),
709
+ ],
710
+ ],
711
+ $disclosure_new_labels
712
+ );
713
+
714
+ $info_disclosure_content = '<div class="info-disclosure-content"><p>' . wp_kses_post( $disclosure_labels['title'] ) . '</p><ul>';
715
+ foreach ( $disclosure_labels['items'] as $disclosure_item ) {
716
+ $info_disclosure_content .= sprintf( '<li>%s</li>', wp_kses_post( $disclosure_item ) );
717
+ }
718
+ $info_disclosure_content .= '</ul></div>';
719
+
720
+ return $info_disclosure_content;
721
+ }
722
+
723
+ /**
724
+ * Randomizes the options array.
725
+ *
726
+ * @param array $options The options array.
727
+ */
728
+ public function randomize_options( $options ) {
729
+ $new = array();
730
+ $keys = array_keys( $options );
731
+ shuffle( $keys );
732
+
733
+ foreach ( $keys as $key ) {
734
+ $new[ $key ] = $options[ $key ];
735
+ }
736
+
737
+ return $new;
738
+ }
739
+
740
+ /**
741
+ * Called when the deactivate button is clicked.
742
+ */
743
+ public function post_deactivate() {
744
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
745
+
746
+ $this->post_deactivate_or_cancel();
747
+
748
+ if ( empty( $_POST['id'] ) ) {
749
+
750
+ wp_send_json( [] );
751
+
752
+ return;
753
+ }
754
+ $this->call_api(
755
+ array(
756
+ 'type' => 'deactivate',
757
+ 'id' => sanitize_key( $_POST['id'] ),
758
+ 'comment' => isset( $_POST['msg'] ) ? sanitize_textarea_field( $_POST['msg'] ) : '',
759
+ )
760
+ );
761
+ wp_send_json( [] );
762
+
763
+ }
764
+
765
+ /**
766
+ * Called when the deactivate/cancel button is clicked.
767
+ */
768
+ private function post_deactivate_or_cancel() {
769
+ if ( ! isset( $_POST['type'] ) || ! isset( $_POST['key'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing, Nonce already present in caller function.
770
+ return;
771
+ }
772
+ if ( 'theme' !== $_POST['type'] ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing, Nonce already present in caller function.
773
+ return;
774
+ }
775
+
776
+ set_transient( 'ti_sdk_pause_' . sanitize_text_field( $_POST['key'] ), true, self::PAUSE_DEACTIVATE_WINDOW_DAYS * DAY_IN_SECONDS );//phpcs:ignore WordPress.Security.NonceVerification.Missing, Nonce already present in caller function.
777
+
778
+ }
779
+
780
+ /**
781
+ * Calls the API
782
+ *
783
+ * @param array $attributes The attributes of the post body.
784
+ *
785
+ * @return bool Is the request succesfull?
786
+ */
787
+ protected function call_api( $attributes ) {
788
+ $slug = $this->product->get_slug();
789
+ $version = $this->product->get_version();
790
+ $attributes['slug'] = $slug;
791
+ $attributes['version'] = $version;
792
+ $attributes['url'] = get_site_url();
793
+
794
+ $response = wp_remote_post(
795
+ self::FEEDBACK_ENDPOINT,
796
+ array(
797
+ 'body' => $attributes,
798
+ )
799
+ );
800
+
801
+ return is_wp_error( $response );
802
+ }
803
+
804
+ /**
805
+ * Should we load this object?.
806
+ *
807
+ * @param Product $product Product object.
808
+ *
809
+ * @return bool Should we load the module?
810
+ */
811
+ public function can_load( $product ) {
812
+ if ( $this->is_from_partner( $product ) ) {
813
+ return false;
814
+ }
815
+ if ( $product->is_theme() && ( false !== get_transient( 'ti_sdk_pause_' . $product->get_key(), false ) ) ) {
816
+ return false;
817
+ }
818
+
819
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
820
+ return true;
821
+ }
822
+ global $pagenow;
823
+
824
+ if ( ! isset( $pagenow ) || empty( $pagenow ) ) {
825
+ return false;
826
+ }
827
+
828
+ if ( $product->is_plugin() && 'plugins.php' !== $pagenow ) {
829
+ return false;
830
+
831
+ }
832
+ if ( $product->is_theme() && 'theme-install.php' !== $pagenow ) {
833
+ return false;
834
+ }
835
+
836
+ return true;
837
+ }
838
+
839
+ /**
840
+ * Loads module hooks.
841
+ *
842
+ * @param Product $product Product details.
843
+ *
844
+ * @return Uninstall_Feedback Current module instance.
845
+ */
846
+ public function load( $product ) {
847
+
848
+ if ( apply_filters( $product->get_key() . '_hide_uninstall_feedback', false ) ) {
849
+ return;
850
+ }
851
+
852
+ $this->product = $product;
853
+ add_action( 'admin_head', array( $this, 'load_resources' ) );
854
+ add_action( 'wp_ajax_' . $this->product->get_key() . '_uninstall_feedback', array( $this, 'post_deactivate' ) );
855
+
856
+ return $this;
857
+ }
858
+ }
vendor/codeinwp/themeisle-sdk/src/Product.php ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The product model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Product
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+
12
+ namespace ThemeisleSDK;
13
+
14
+ // Exit if accessed directly.
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit;
17
+ }
18
+
19
+ /**
20
+ * Product model for ThemeIsle SDK.
21
+ */
22
+ class Product {
23
+ /**
24
+ * Define plugin type string.
25
+ */
26
+ const PLUGIN_TYPE = 'plugin';
27
+ /**
28
+ * Define theme type string.
29
+ */
30
+ const THEME_TYPE = 'theme';
31
+ /**
32
+ * If the product has a pro version, contains the pro slug.
33
+ *
34
+ * @var string $pro_slug Pro slug, if available.
35
+ */
36
+ public $pro_slug;
37
+ /**
38
+ * Current product slug.
39
+ *
40
+ * @var string $slug THe product slug.
41
+ */
42
+ private $slug;
43
+ /**
44
+ * Product basefile, with the proper metadata.
45
+ *
46
+ * @var string $basefile The file with headers.
47
+ */
48
+ private $basefile;
49
+ /**
50
+ * Type of the product.
51
+ *
52
+ * @var string $type The product type ( plugin | theme ).
53
+ */
54
+ private $type;
55
+ /**
56
+ * The file name.
57
+ *
58
+ * @var string $file The file name.
59
+ */
60
+ private $file;
61
+ /**
62
+ * Product name, fetched from the file headers.
63
+ *
64
+ * @var string $name The product name.
65
+ */
66
+ private $name;
67
+ /**
68
+ * Product normalized key.
69
+ *
70
+ * @var string $key The product ready key.
71
+ */
72
+ private $key;
73
+ /**
74
+ * Product store url.
75
+ *
76
+ * @var string $store_url The store url.
77
+ */
78
+ private $store_url;
79
+ /**
80
+ * Product install timestamp.
81
+ *
82
+ * @var int $install The date of install.
83
+ */
84
+ private $install;
85
+ /**
86
+ * Product store/author name.
87
+ *
88
+ * @var string $store_name The store name.
89
+ */
90
+ private $store_name;
91
+ /**
92
+ * Does the product requires license.
93
+ *
94
+ * @var bool $requires_license Either user needs to activate it with license.
95
+ */
96
+ private $requires_license;
97
+ /**
98
+ * Is the product available on wordpress.org
99
+ *
100
+ * @var bool $wordpress_available Either is available on WordPress or not.
101
+ */
102
+ private $wordpress_available;
103
+ /**
104
+ * Current version of the product.
105
+ *
106
+ * @var string $version The product version.
107
+ */
108
+ private $version;
109
+ /**
110
+ * Root api endpoint.
111
+ */
112
+ const API_URL = 'https://api.themeisle.com/';
113
+ /**
114
+ * ThemeIsle_SDK_Product constructor.
115
+ *
116
+ * @param string $basefile Product basefile.
117
+ */
118
+ public function __construct( $basefile ) {
119
+ if ( ! empty( $basefile ) ) {
120
+ if ( is_file( $basefile ) ) {
121
+ $this->basefile = $basefile;
122
+ $this->setup_from_path();
123
+ $this->setup_from_fileheaders();
124
+ }
125
+ }
126
+ $install = get_option( $this->get_key() . '_install', 0 );
127
+ if ( 0 === $install ) {
128
+ $install = time();
129
+ update_option( $this->get_key() . '_install', time() );
130
+ }
131
+ $this->install = $install;
132
+
133
+ }
134
+
135
+ /**
136
+ * Setup props from path.
137
+ */
138
+ public function setup_from_path() {
139
+ $this->file = basename( $this->basefile );
140
+ $dir = dirname( $this->basefile );
141
+ $this->slug = basename( $dir );
142
+ $exts = explode( '.', $this->basefile );
143
+ $ext = $exts[ count( $exts ) - 1 ];
144
+ if ( 'css' === $ext ) {
145
+ $this->type = 'theme';
146
+ }
147
+ if ( 'php' === $ext ) {
148
+ $this->type = 'plugin';
149
+ }
150
+ $this->key = self::key_ready_name( $this->slug );
151
+ }
152
+
153
+ /**
154
+ * Normalize string.
155
+ *
156
+ * @param string $string the String to be normalized for cron handler.
157
+ *
158
+ * @return string $name The normalized string.
159
+ */
160
+ public static function key_ready_name( $string ) {
161
+ return str_replace( '-', '_', strtolower( trim( $string ) ) );
162
+ }
163
+
164
+ /**
165
+ * Setup props from fileheaders.
166
+ */
167
+ public function setup_from_fileheaders() {
168
+ $file_headers = array(
169
+ 'Requires License' => 'Requires License',
170
+ 'WordPress Available' => 'WordPress Available',
171
+ 'Pro Slug' => 'Pro Slug',
172
+ 'Version' => 'Version',
173
+ );
174
+ if ( 'plugin' === $this->type ) {
175
+ $file_headers['Name'] = 'Plugin Name';
176
+ $file_headers['AuthorName'] = 'Author';
177
+ $file_headers['AuthorURI'] = 'Author URI';
178
+ }
179
+ if ( 'theme' === $this->type ) {
180
+ $file_headers['Name'] = 'Theme Name';
181
+ $file_headers['AuthorName'] = 'Author';
182
+ $file_headers['AuthorURI'] = 'Author URI';
183
+ }
184
+ $file_headers = get_file_data( $this->basefile, $file_headers );
185
+
186
+ $this->name = $file_headers['Name'];
187
+ $this->store_name = $file_headers['AuthorName'];
188
+ $this->author_url = $file_headers['AuthorURI'];
189
+ $this->store_url = $file_headers['AuthorURI'];
190
+
191
+ $this->requires_license = ( 'yes' === $file_headers['Requires License'] ) ? true : false;
192
+ $this->wordpress_available = ( 'yes' === $file_headers['WordPress Available'] ) ? true : false;
193
+ $this->pro_slug = ! empty( $file_headers['Pro Slug'] ) ? $file_headers['Pro Slug'] : '';
194
+ $this->version = $file_headers['Version'];
195
+
196
+ }
197
+
198
+ /**
199
+ * Return the product key.
200
+ *
201
+ * @return string The product key.
202
+ */
203
+ public function get_key() {
204
+ return $this->key;
205
+ }
206
+
207
+ /**
208
+ * Check if the product is either theme or plugin.
209
+ *
210
+ * @return string Product type.
211
+ */
212
+ public function get_type() {
213
+ return $this->type;
214
+ }
215
+
216
+ /**
217
+ * Return if the product is used as a plugin.
218
+ *
219
+ * @return bool Is plugin?
220
+ */
221
+ public function is_plugin() {
222
+ return self::PLUGIN_TYPE === $this->type;
223
+ }
224
+
225
+ /**
226
+ * Return if the product is used as a theme.
227
+ *
228
+ * @return bool Is theme ?
229
+ */
230
+ public function is_theme() {
231
+ return self::THEME_TYPE === $this->type;
232
+ }
233
+
234
+ /**
235
+ * Returns the product slug.
236
+ *
237
+ * @return string The product slug.
238
+ */
239
+ public function get_slug() {
240
+ return $this->slug;
241
+ }
242
+
243
+ /**
244
+ * The magic var_dump info method.
245
+ *
246
+ * @return array Debug info.
247
+ */
248
+ public function __debugInfo() {
249
+ return array(
250
+ 'name' => $this->name,
251
+ 'slug' => $this->slug,
252
+ 'version' => $this->version,
253
+ 'basefile' => $this->basefile,
254
+ 'key' => $this->key,
255
+ 'type' => $this->type,
256
+ 'store_name' => $this->store_name,
257
+ 'store_url' => $this->store_url,
258
+ 'wordpress_available' => $this->wordpress_available,
259
+ 'requires_license' => $this->requires_license,
260
+ );
261
+
262
+ }
263
+
264
+ /**
265
+ * Getter for product version.
266
+ *
267
+ * @return string The product version.
268
+ */
269
+ public function get_version() {
270
+ return $this->version;
271
+ }
272
+
273
+ /**
274
+ * Returns current product license, if available.
275
+ *
276
+ * @return string Return license key, if available.
277
+ */
278
+ public function get_license() {
279
+
280
+ if ( ! $this->requires_license() && ! $this->is_wordpress_available() ) {
281
+ return 'free';
282
+ }
283
+ $license_data = get_option( $this->get_key() . '_license_data', '' );
284
+
285
+ if ( empty( $license_data ) ) {
286
+ return get_option( $this->get_key() . '_license', '' );
287
+ }
288
+ if ( ! isset( $license_data->key ) ) {
289
+ return get_option( $this->get_key() . '_license', '' );
290
+ }
291
+
292
+ return $license_data->key;
293
+ }
294
+
295
+ /**
296
+ * Either the product requires license or not.
297
+ *
298
+ * @return bool Either requires license or not.
299
+ */
300
+ public function requires_license() {
301
+ return $this->requires_license;
302
+ }
303
+
304
+ /**
305
+ * If product is available on wordpress.org or not.
306
+ *
307
+ * @return bool Either is wp available or not.
308
+ */
309
+ public function is_wordpress_available() {
310
+ return $this->wordpress_available;
311
+ }
312
+
313
+ /**
314
+ * Return friendly name.
315
+ *
316
+ * @return string Friendly name.
317
+ */
318
+ public function get_friendly_name() {
319
+ $name = apply_filters( $this->get_key() . '_friendly_name', trim( str_replace( 'Lite', '', $this->get_name() ) ) );
320
+ $name = rtrim( $name, '- ()' );
321
+
322
+ return $name;
323
+ }
324
+
325
+ /**
326
+ * Getter for product name.
327
+ *
328
+ * @return string The product name.
329
+ */
330
+ public function get_name() {
331
+ return $this->name;
332
+ }
333
+
334
+ /**
335
+ * Returns the Store name.
336
+ *
337
+ * @return string Store name.
338
+ */
339
+ public function get_store_name() {
340
+ return $this->store_name;
341
+ }
342
+
343
+ /**
344
+ * Returns the store url.
345
+ *
346
+ * @return string The store url.
347
+ */
348
+ public function get_store_url() {
349
+
350
+ if ( strpos( $this->store_url, '/themeisle.com' ) !== false ) {
351
+ return 'https://store.themeisle.com/';
352
+ }
353
+
354
+ return $this->store_url;
355
+ }
356
+
357
+ /**
358
+ * Returns product basefile, which holds the metaheaders.
359
+ *
360
+ * @return string The product basefile.
361
+ */
362
+ public function get_basefile() {
363
+ return $this->basefile;
364
+ }
365
+
366
+ /**
367
+ * Get changelog url.
368
+ *
369
+ * @return string Changelog url.
370
+ */
371
+ public function get_changelog() {
372
+ return add_query_arg(
373
+ [
374
+ 'name' => rawurlencode( $this->get_name() ),
375
+ 'edd_action' => 'view_changelog',
376
+ ],
377
+ $this->get_store_url()
378
+ );
379
+ }
380
+
381
+ /**
382
+ * Returns product filename.
383
+ *
384
+ * @return string The product filename.
385
+ */
386
+ public function get_file() {
387
+ return $this->file;
388
+ }
389
+
390
+ /**
391
+ * Returns the pro slug, if available.
392
+ *
393
+ * @return string The pro slug.
394
+ */
395
+ public function get_pro_slug() {
396
+ return $this->pro_slug;
397
+ }
398
+
399
+ /**
400
+ * Return the install timestamp.
401
+ *
402
+ * @return int The install timestamp.
403
+ */
404
+ public function get_install_time() {
405
+ return $this->install;
406
+ }
407
+
408
+ /**
409
+ * Returns the URL of the product base file.
410
+ *
411
+ * @param string $path The path to the file.
412
+ *
413
+ * @return string The URL of the product base file.
414
+ */
415
+ public function get_base_url( $path = '/' ) {
416
+ if ( $this->type ) {
417
+ return plugins_url( $path, $this->basefile );
418
+ }
419
+ }
420
+
421
+ }
vendor/codeinwp/themeisle-sdk/start.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File responsible for sdk files loading.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @copyright Copyright (c) 2017, Marius Cristea
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ * @since 1.1.0
9
+ */
10
+
11
+ namespace ThemeisleSDK;
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+ $products = apply_filters( 'themeisle_sdk_products', array() );
17
+ $themeisle_library_path = dirname( __FILE__ );
18
+ $files_to_load = [
19
+ $themeisle_library_path . '/src/Loader.php',
20
+ $themeisle_library_path . '/src/Product.php',
21
+
22
+ $themeisle_library_path . '/src/Common/Abstract_module.php',
23
+ $themeisle_library_path . '/src/Common/Module_factory.php',
24
+
25
+ $themeisle_library_path . '/src/Modules/Dashboard_widget.php',
26
+ $themeisle_library_path . '/src/Modules/Rollback.php',
27
+ $themeisle_library_path . '/src/Modules/Uninstall_feedback.php',
28
+ $themeisle_library_path . '/src/Modules/Licenser.php',
29
+ $themeisle_library_path . '/src/Modules/Endpoint.php',
30
+ $themeisle_library_path . '/src/Modules/Notification.php',
31
+ $themeisle_library_path . '/src/Modules/Logger.php',
32
+ $themeisle_library_path . '/src/Modules/Translate.php',
33
+ $themeisle_library_path . '/src/Modules/Review.php',
34
+ $themeisle_library_path . '/src/Modules/Recommendation.php',
35
+ ];
36
+
37
+ $files_to_load = array_merge( $files_to_load, apply_filters( 'themeisle_sdk_required_files', [] ) );
38
+
39
+ foreach ( $files_to_load as $file ) {
40
+ if ( is_file( $file ) ) {
41
+ require_once $file;
42
+ }
43
+ }
44
+
45
+ Loader::init();
46
+
47
+ foreach ( $products as $product ) {
48
+ Loader::add_product( $product );
49
+ }
vendor/composer/InstalledVersions.php CHANGED
@@ -20,13 +20,15 @@ use Composer\Semver\VersionParser;
20
 
21
 
22
 
 
 
23
  class InstalledVersions
24
  {
25
  private static $installed = array (
26
  'root' =>
27
  array (
28
- 'pretty_version' => '1.1.10',
29
- 'version' => '1.1.10.0',
30
  'aliases' =>
31
  array (
32
  ),
@@ -37,13 +39,22 @@ private static $installed = array (
37
  array (
38
  'codeinwp/templates-patterns-collection' =>
39
  array (
40
- 'pretty_version' => '1.1.10',
41
- 'version' => '1.1.10.0',
42
  'aliases' =>
43
  array (
44
  ),
45
  'reference' => NULL,
46
  ),
 
 
 
 
 
 
 
 
 
47
  ),
48
  );
49
  private static $canGetVendors;
@@ -62,7 +73,6 @@ foreach (self::getInstalled() as $installed) {
62
  $packages[] = array_keys($installed['versions']);
63
  }
64
 
65
-
66
  if (1 === \count($packages)) {
67
  return $packages[0];
68
  }
@@ -258,6 +268,7 @@ self::$installedByVendor = array();
258
 
259
 
260
 
 
261
  private static function getInstalled()
262
  {
263
  if (null === self::$canGetVendors) {
20
 
21
 
22
 
23
+
24
+
25
  class InstalledVersions
26
  {
27
  private static $installed = array (
28
  'root' =>
29
  array (
30
+ 'pretty_version' => '1.1.11',
31
+ 'version' => '1.1.11.0',
32
  'aliases' =>
33
  array (
34
  ),
39
  array (
40
  'codeinwp/templates-patterns-collection' =>
41
  array (
42
+ 'pretty_version' => '1.1.11',
43
+ 'version' => '1.1.11.0',
44
  'aliases' =>
45
  array (
46
  ),
47
  'reference' => NULL,
48
  ),
49
+ 'codeinwp/themeisle-sdk' =>
50
+ array (
51
+ 'pretty_version' => '3.2.20',
52
+ 'version' => '3.2.20.0',
53
+ 'aliases' =>
54
+ array (
55
+ ),
56
+ 'reference' => 'aeef3f159c1b35451d87672b6984ccde36c0d21d',
57
+ ),
58
  ),
59
  );
60
  private static $canGetVendors;
73
  $packages[] = array_keys($installed['versions']);
74
  }
75
 
 
76
  if (1 === \count($packages)) {
77
  return $packages[0];
78
  }
268
 
269
 
270
 
271
+
272
  private static function getInstalled()
273
  {
274
  if (null === self::$canGetVendors) {
vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_files.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ '50f1a0479b2a5847c529d784c54cebe2' => $vendorDir . '/codeinwp/themeisle-sdk/load.php',
10
+ );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -50,6 +50,24 @@ class ComposerAutoloaderInitf50c81772e3cd2fc7ad6a1825c9b2614
50
 
51
  $loader->register(true);
52
 
 
 
 
 
 
 
 
 
 
53
  return $loader;
54
  }
55
  }
 
 
 
 
 
 
 
 
 
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit012ecd39ee10d42e943a09dc55e81c26
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit012ecd39ee10d42e943a09dc55e81c26', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit012ecd39ee10d42e943a09dc55e81c26', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
50
 
51
  $loader->register(true);
52
 
53
+ if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26::$files;
55
+ } else {
56
+ $includeFiles = require __DIR__ . '/autoload_files.php';
57
+ }
58
+ foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire012ecd39ee10d42e943a09dc55e81c26($fileIdentifier, $file);
60
+ }
61
+
62
  return $loader;
63
  }
64
  }
65
+
66
+ function composerRequire012ecd39ee10d42e943a09dc55e81c26($fileIdentifier, $file)
67
+ {
68
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
+ require $file;
70
+
71
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
72
+ }
73
+ }
vendor/composer/autoload_static.php CHANGED
@@ -4,8 +4,12 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614
8
  {
 
 
 
 
9
  public static $prefixLengthsPsr4 = array (
10
  'T' =>
11
  array (
@@ -52,9 +56,9 @@ class ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614
52
  public static function getInitializer(ClassLoader $loader)
53
  {
54
  return \Closure::bind(function () use ($loader) {
55
- $loader->prefixLengthsPsr4 = ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614::$prefixLengthsPsr4;
56
- $loader->prefixDirsPsr4 = ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614::$prefixDirsPsr4;
57
- $loader->classMap = ComposerStaticInitf50c81772e3cd2fc7ad6a1825c9b2614::$classMap;
58
 
59
  }, null, ClassLoader::class);
60
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26
8
  {
9
+ public static $files = array (
10
+ '50f1a0479b2a5847c529d784c54cebe2' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
11
+ );
12
+
13
  public static $prefixLengthsPsr4 = array (
14
  'T' =>
15
  array (
56
  public static function getInitializer(ClassLoader $loader)
57
  {
58
  return \Closure::bind(function () use ($loader) {
59
+ $loader->prefixLengthsPsr4 = ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26::$prefixLengthsPsr4;
60
+ $loader->prefixDirsPsr4 = ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26::$prefixDirsPsr4;
61
+ $loader->classMap = ComposerStaticInit012ecd39ee10d42e943a09dc55e81c26::$classMap;
62
 
63
  }, null, ClassLoader::class);
64
  }
vendor/composer/installed.json CHANGED
@@ -1,5 +1,49 @@
1
  {
2
- "packages": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  "dev": false,
4
  "dev-package-names": []
5
  }
1
  {
2
+ "packages": [
3
+ {
4
+ "name": "codeinwp/themeisle-sdk",
5
+ "version": "3.2.20",
6
+ "version_normalized": "3.2.20.0",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/Codeinwp/themeisle-sdk.git",
10
+ "reference": "aeef3f159c1b35451d87672b6984ccde36c0d21d"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/aeef3f159c1b35451d87672b6984ccde36c0d21d",
15
+ "reference": "aeef3f159c1b35451d87672b6984ccde36c0d21d",
16
+ "shasum": ""
17
+ },
18
+ "require-dev": {
19
+ "codeinwp/phpcs-ruleset": "dev-main"
20
+ },
21
+ "time": "2021-03-30T09:16:29+00:00",
22
+ "type": "library",
23
+ "installation-source": "dist",
24
+ "notification-url": "https://packagist.org/downloads/",
25
+ "license": [
26
+ "GPL-2.0+"
27
+ ],
28
+ "authors": [
29
+ {
30
+ "name": "ThemeIsle team",
31
+ "email": "friends@themeisle.com",
32
+ "homepage": "https://themeisle.com"
33
+ }
34
+ ],
35
+ "description": "ThemeIsle SDK",
36
+ "homepage": "https://github.com/Codeinwp/themeisle-sdk",
37
+ "keywords": [
38
+ "wordpress"
39
+ ],
40
+ "support": {
41
+ "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
42
+ "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.2.20"
43
+ },
44
+ "install-path": "../codeinwp/themeisle-sdk"
45
+ }
46
+ ],
47
  "dev": false,
48
  "dev-package-names": []
49
  }
vendor/composer/installed.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php return array (
2
  'root' =>
3
  array (
4
- 'pretty_version' => '1.1.10',
5
- 'version' => '1.1.10.0',
6
  'aliases' =>
7
  array (
8
  ),
@@ -13,12 +13,21 @@
13
  array (
14
  'codeinwp/templates-patterns-collection' =>
15
  array (
16
- 'pretty_version' => '1.1.10',
17
- 'version' => '1.1.10.0',
18
  'aliases' =>
19
  array (
20
  ),
21
  'reference' => NULL,
22
  ),
 
 
 
 
 
 
 
 
 
23
  ),
24
  );
1
  <?php return array (
2
  'root' =>
3
  array (
4
+ 'pretty_version' => '1.1.11',
5
+ 'version' => '1.1.11.0',
6
  'aliases' =>
7
  array (
8
  ),
13
  array (
14
  'codeinwp/templates-patterns-collection' =>
15
  array (
16
+ 'pretty_version' => '1.1.11',
17
+ 'version' => '1.1.11.0',
18
  'aliases' =>
19
  array (
20
  ),
21
  'reference' => NULL,
22
  ),
23
+ 'codeinwp/themeisle-sdk' =>
24
+ array (
25
+ 'pretty_version' => '3.2.20',
26
+ 'version' => '3.2.20.0',
27
+ 'aliases' =>
28
+ array (
29
+ ),
30
+ 'reference' => 'aeef3f159c1b35451d87672b6984ccde36c0d21d',
31
+ ),
32
  ),
33
  );