WordPress Charts and Graphs Lite - Version 2.1.1

Version Description

  • Fixed charts bliking on some themes.
Download this release

Release Info

Developer codeinwp
Plugin Icon WordPress Charts and Graphs Lite
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1.0 to 2.1.1

CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
 
 
 
 
 
 
 
 
 
2
  ### v2.1.0 - 2017-05-12
3
  **Changes:**
4
  - Fixed responsive issues on pagebuilders.
1
 
2
+ ### v2.1.1 - 2017-05-29
3
+ **Changes:**
4
+ - Capitalized the Pi in WordPress, to go along with the guidelines.
5
+
6
+ ### v2.1.1 - 2017-05-16
7
+ **Changes:**
8
+ - Fixed blinking chart issue.
9
+
10
  ### v2.1.0 - 2017-05-12
11
  **Changes:**
12
  - Fixed responsive issues on pagebuilders.
classes/Visualizer/Plugin.php CHANGED
@@ -28,7 +28,7 @@
28
  class Visualizer_Plugin {
29
 
30
  const NAME = 'visualizer';
31
- const VERSION = '2.1.0';
32
 
33
  // custom post types
34
  const CPT_VISUALIZER = 'visualizer';
28
  class Visualizer_Plugin {
29
 
30
  const NAME = 'visualizer';
31
+ const VERSION = '2.1.1';
32
 
33
  // custom post types
34
  const CPT_VISUALIZER = 'visualizer';
classes/Visualizer/Render/Page/Data.php CHANGED
@@ -198,11 +198,11 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
198
  </li>
199
 
200
  <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
201
- <h2 class="group-title sub-group"><?php _e( 'Import from Wordpress', 'visualizer' ); ?><span
202
  class="dashicons dashicons-lock"></span></h2>
203
  <div class="group-content edit-data-content">
204
  <div>
205
- <p class="group-description"><?php _e( 'You can import here data from Wordpress', 'visualizer' ); ?></p>
206
  <input type="button" id="filter-chart-button" class="button button-primary "
207
  value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart"
208
  data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
198
  </li>
199
 
200
  <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'schedule-chart' ); ?> ">
201
+ <h2 class="group-title sub-group"><?php _e( 'Import from WordPress', 'visualizer' ); ?><span
202
  class="dashicons dashicons-lock"></span></h2>
203
  <div class="group-content edit-data-content">
204
  <div>
205
+ <p class="group-description"><?php _e( 'You can import here data from WordPress', 'visualizer' ); ?></p>
206
  <input type="button" id="filter-chart-button" class="button button-primary "
207
  value="<?php _e( 'Create Filters', 'visualizer' ); ?>" data-current="chart"
208
  data-t-filter="<?php _e( 'Show Chart', 'visualizer' ); ?>"
css/media.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 2.1.0
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
1
  /*
2
+ Version: 2.1.1
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
index.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Visualizer: Charts and Graphs Lite
5
  Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
6
  Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
7
- Version: 2.1.0
8
  Author: Themeisle
9
  Author URI: http://themeisle.com
10
  License: GPL v2.0 or later
4
  Plugin Name: Visualizer: Charts and Graphs Lite
5
  Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
6
  Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
7
+ Version: 2.1.1
8
  Author: Themeisle
9
  Author URI: http://themeisle.com
10
  License: GPL v2.0 or later
js/render.js CHANGED
@@ -225,7 +225,7 @@
225
 
226
  function resizeHiddenContainers(everytime){
227
  $(".visualizer-front").parents().each(function(){
228
- if(!$(this).hasClass("visualizer-hidden-container")){
229
  $(this).addClass("visualizer-hidden-container");
230
  }
231
  });
225
 
226
  function resizeHiddenContainers(everytime){
227
  $(".visualizer-front").parents().each(function(){
228
+ if(!$(this).is(":visible") && !$(this).hasClass("visualizer-hidden-container")){
229
  $(this).addClass("visualizer-hidden-container");
230
  }
231
  });
languages/visualizer.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL v2.0 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Visualizer: Charts and Graphs Lite 2.0.5\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n"
7
- "POT-Creation-Date: 2017-05-12 11:50:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -100,7 +100,9 @@ msgstr ""
100
  #: classes/Visualizer/Module/Admin.php:458
101
  msgid "Pro Addon"
102
  msgstr ""
103
-
 
 
104
  msgid "You have entered invalid URL. Please, insert proper URL."
105
  msgstr ""
106
 
2
  # This file is distributed under the GPL v2.0 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Visualizer: Charts and Graphs Lite 2.1.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n"
7
+ "POT-Creation-Date: 2017-05-16 06:15:21+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
100
  #: classes/Visualizer/Module/Admin.php:458
101
  msgid "Pro Addon"
102
  msgstr ""
103
+
104
+ #: classes/Visualizer/Module/Chart.php:298
105
+ #: classes/Visualizer/Module/Chart.php:580
106
  msgid "You have entered invalid URL. Please, insert proper URL."
107
  msgstr ""
108
 
readme.txt CHANGED
@@ -119,6 +119,9 @@ http://docs.themeisle.com/article/610-how-can-i-edit-the-data-manually
119
 
120
  == Changelog ==
121
 
 
 
 
122
  = 2.1.0 =
123
  * Fixed geomap issue with apikey.
124
  * Fixed responsive issues on tabbed interface and page builders.
119
 
120
  == Changelog ==
121
 
122
+ = 2.1.1 =
123
+ * Fixed charts bliking on some themes.
124
+
125
  = 2.1.0 =
126
  * Fixed geomap issue with apikey.
127
  * Fixed responsive issues on tabbed interface and page builders.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitbcffff6ec0d732b793ac5b61a414557c::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit9f56ad3c43f28a8cd68767f9c89fbcdc::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit21b09bbb4b72b0f87cc03f5ff671df58::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit0e38fe72414a2baf5893448767dd9405::getLoader();
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-deactivate.php ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Deactivate' ) ) :
16
+ /**
17
+ * Deactivate feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Deactivate extends ThemeIsle_SDK_Feedback {
20
+
21
+ /**
22
+ * @var array $options The main options list
23
+ */
24
+ private $options = array(
25
+ 'I only needed the plugin for a short period' => array(
26
+ 'id' => 1,
27
+ ),
28
+ 'The plugin broke my site' => array(
29
+ 'id' => 2,
30
+ ),
31
+ 'I found a better plugin' => array(
32
+ 'id' => 3,
33
+ 'type' => 'text',
34
+ 'placeholder' => 'What\'s the plugin\'s name?',
35
+ ),
36
+ 'The plugin suddenly stopped working' => array(
37
+ 'id' => 4,
38
+ ),
39
+ 'I no longer need the plugin' => array(
40
+ 'id' => 5,
41
+ 'type' => 'textarea',
42
+ 'placeholder' => 'If you could improve one thing about our product, what would it be?',
43
+ ),
44
+ 'It\'s a temporary deactivation. I\'m just debugging an issue.' => array(
45
+ 'id' => 6,
46
+ ),
47
+ );
48
+
49
+ /**
50
+ * @var array $other The other option
51
+ */
52
+ private $other = array(
53
+ 'Other' => array(
54
+ 'id' => 999,
55
+ 'type' => 'textarea',
56
+ 'placeholder' => 'cmon cmon tell us',
57
+ ),
58
+ );
59
+
60
+ /**
61
+ * @var string $heading The heading of the modal
62
+ */
63
+ private $heading = 'If you have a moment, please let us know why you are deactivating:';
64
+
65
+ /**
66
+ * @var string $button_submit_before The text of the deactivate button before an option is chosen
67
+ */
68
+ private $button_submit_before = 'Skip &amp; Deactivate';
69
+
70
+ /**
71
+ * @var string $button_submit The text of the deactivate button
72
+ */
73
+ private $button_submit = 'Submit &amp; Deactivate';
74
+
75
+ /**
76
+ * @var string $button_cancel The text of the cancel button
77
+ */
78
+ private $button_cancel = 'Cancel';
79
+
80
+ /**
81
+ * ThemeIsle_SDK_Feedback_Deactivate constructor.
82
+ *
83
+ * @param ThemeIsle_SDK_Product $product_object The product object.
84
+ */
85
+ public function __construct( $product_object ) {
86
+ parent::__construct( $product_object );
87
+ }
88
+
89
+ /**
90
+ * Registers the hooks
91
+ */
92
+ public function setup_hooks_child() {
93
+ global $pagenow;
94
+ if ( 'plugins.php' === $pagenow ) {
95
+ add_action( 'admin_head', array( $this, 'load_resources' ) );
96
+ }
97
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'post_deactivate' ) );
98
+ }
99
+
100
+ /**
101
+ * Loads the additional resources
102
+ */
103
+ function load_resources() {
104
+ add_thickbox();
105
+
106
+ $id = $this->product->get_key() . '_deactivate';
107
+
108
+ $this->add_css( $this->product->get_key() );
109
+ $this->add_js( $this->product->get_key(), '#TB_inline?' . apply_filters( $this->product->get_key() . '_feedback_deactivate_attributes', 'width=600&height=550' ) . '&inlineId=' . $id );
110
+
111
+ echo '<div id="' . $id . '" style="display:none;" class="themeisle-deactivate-box">' . $this->get_html( $this->product->get_key() ) . '</div>';
112
+ }
113
+
114
+ /**
115
+ * Loads the css
116
+ *
117
+ * @param string $key The product key.
118
+ */
119
+ function add_css( $key ) {
120
+ ?>
121
+ <style type="text/css" id="<?php echo $key; ?>ti-deactivate-css">
122
+ input[name="ti-deactivate-option"] ~ div {
123
+ display: none;
124
+ }
125
+
126
+ input[name="ti-deactivate-option"]:checked ~ div {
127
+ display: block;
128
+ }
129
+
130
+ body.plugins-php .<?php echo $key; ?>-containe #TB_window.thickbox-loading:before {
131
+ background: none !important;
132
+ }
133
+
134
+ body.plugins-php .<?php echo $key; ?>-container #TB_title {
135
+ font-size: 21px;
136
+ padding: 20px 0;
137
+ background-color: #f3f3f3;
138
+ }
139
+
140
+ body.plugins-php .<?php echo $key; ?>-container div.actions {
141
+ padding: 20px 0;
142
+ background-color: #f3f3f3;
143
+ border-top: 1px solid #dddddd;
144
+ }
145
+
146
+ body.plugins-php .<?php echo $key; ?>-container input.button.button-primary {
147
+ margin-right: 20px;
148
+ }
149
+
150
+ body.plugins-php .<?php echo $key; ?>-container input.button {
151
+ margin-right: 20px;
152
+ }
153
+
154
+ body.plugins-php .<?php echo $key; ?>-container #TB_ajaxWindowTitle {
155
+ text-align: left;
156
+ margin-left: 15px;
157
+ }
158
+
159
+ body.plugins-php .<?php echo $key; ?>-container div.revive_network-container {
160
+ background-color: #ffffff;
161
+ }
162
+
163
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li {
164
+ font-size: 14px;
165
+ }
166
+
167
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li label {
168
+ margin-left: 10px;
169
+ line-height: 32px;
170
+ font-size: 16px;
171
+ }
172
+
173
+ body.plugins-php .<?php echo $key; ?>-container #TB_ajaxContent {
174
+ padding: 10px 20px;
175
+ }
176
+
177
+ body.plugins-php .<?php echo $key; ?>-container li div textarea {
178
+ padding: 10px 15px;
179
+ width: 100%;
180
+ }
181
+
182
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li div {
183
+ margin: 10px 30px;
184
+ }
185
+
186
+ .<?php echo $key; ?>-container #TB_title #TB_ajaxWindowTitle {
187
+ display: block;
188
+ }
189
+
190
+ body.plugins-php .<?php echo $key; ?>-container .actions {
191
+
192
+ width: 100%;
193
+ display: block;
194
+ position: absolute;
195
+ left: 0px;
196
+ bottom: 0px;
197
+ text-align: right;
198
+ }
199
+
200
+ body.plugins-php .<?php echo $key; ?>-container #TB_title {
201
+
202
+ height: 33px;
203
+ width: 100%;
204
+ text-align: center;
205
+ }
206
+
207
+ body.plugins-php .<?php echo $key; ?>-container {
208
+
209
+ margin: auto !important;
210
+ height: 550px !important;
211
+ top: 0 !important;
212
+ left: 0 !important;
213
+ bottom: 0 !important;
214
+ right: 0 !important;
215
+ }
216
+ </style>
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Loads the js
222
+ *
223
+ * @param string $key The product key.
224
+ * @param string $src The url that will hijack the deactivate button url.
225
+ */
226
+ function add_js( $key, $src ) {
227
+
228
+ $heading = apply_filters( $this->product->get_key() . '_feedback_deactivate_heading', $this->heading );
229
+ ?>
230
+ <script type="text/javascript" id="ti-deactivate-js">
231
+ (function ($) {
232
+ $(document).ready(function () {
233
+ var href = $('tr[data-slug="<?php echo $this->product->get_slug();?>"] span.deactivate a').attr('href');
234
+ $('#<?php echo $key;?>ti-deactivate-no').on('click', function (e) {
235
+ e.preventDefault();
236
+ e.stopPropagation();
237
+ $('body').unbind('thickbox:removed');
238
+ tb_remove();
239
+ });
240
+
241
+ $('#<?php echo $key;?> ul.ti-list label, #<?php echo $key;?> ul.ti-list input[name="ti-deactivate-option"]').on('click', function (e) {
242
+ $('#<?php echo $key;?>ti-deactivate-yes').val($('#<?php echo $key;?>ti-deactivate-yes').attr('data-after-text'));
243
+
244
+ var radio = $(this).prop('tagName') === 'LABEL' ? $(this).parent() : $(this);
245
+ if (radio.parent().find('textarea').length > 0 && radio.parent().find('textarea').val().length === 0) {
246
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('disabled', 'disabled');
247
+ radio.parent().find('textarea').on('keyup', function (ee) {
248
+ if ($(this).val().length === 0) {
249
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('disabled', 'disabled');
250
+ } else {
251
+ $('#<?php echo $key;?>ti-deactivate-yes').removeAttr('disabled');
252
+ }
253
+ });
254
+ } else {
255
+ $('#<?php echo $key;?>ti-deactivate-yes').removeAttr('disabled');
256
+ }
257
+ });
258
+
259
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('data-ti-action', href).on('click', function (e) {
260
+ e.preventDefault();
261
+ e.stopPropagation();
262
+ $.ajax({
263
+ url: ajaxurl,
264
+ method: 'post',
265
+ data: {
266
+ 'action': '<?php echo $key . __CLASS__;?>',
267
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
268
+ 'id': $('#<?php echo $key;?> input[name="ti-deactivate-option"]:checked').parent().attr('ti-option-id'),
269
+ 'msg': $('#<?php echo $key;?> input[name="ti-deactivate-option"]:checked').parent().find('textarea').val()
270
+ },
271
+ });
272
+ location.href = $(this).attr('data-ti-action');
273
+ });
274
+ $('tr[data-plugin^="<?php echo $this->product->get_slug();?>/"] span.deactivate a').attr('name', '<?php echo esc_html( $heading ); ?>').attr('href', '<?php echo $src;?>').addClass('thickbox');
275
+ var thicbox_timer;
276
+ $('tr[data-slug="<?php echo $this->product->get_slug();?>"] span.deactivate a').on('click', function () {
277
+ tiBindThickbox();
278
+ });
279
+
280
+ function tiBindThickbox() {
281
+ var thicbox_timer = setTimeout(function () {
282
+ if ($("#<?php echo esc_html( $key ); ?>").is(":visible")) {
283
+ $("body").trigger('thickbox:iframe:loaded');
284
+ $("#TB_window").addClass("<?php echo $key; ?>-container");
285
+ clearTimeout(thicbox_timer);
286
+ } else {
287
+ tiBindThickbox();
288
+ }
289
+ }, 100);
290
+ }
291
+ });
292
+ })(jQuery);
293
+ </script>
294
+ <?php
295
+ }
296
+
297
+ /**
298
+ * Generates the HTML
299
+ *
300
+ * @param string $key The product key.
301
+ */
302
+ function get_html( $key ) {
303
+ $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $this->options ) );
304
+ $button_submit_before = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit_before', $this->button_submit_before );
305
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', $this->button_submit );
306
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', $this->button_cancel );
307
+
308
+ $options += $this->other;
309
+
310
+ $list = '';
311
+ foreach ( $options as $title => $attributes ) {
312
+ $id = $attributes['id'];
313
+ $list .= '<li ti-option-id="' . $id . '"><input type="radio" name="ti-deactivate-option" id="' . $key . $id . '"><label for="' . $key . $id . '">' . __( $title ) . '</label>';
314
+ if ( array_key_exists( 'type', $attributes ) ) {
315
+ $list .= '<div>';
316
+ $placeholder = array_key_exists( 'placeholder', $attributes ) ? __( $attributes['placeholder'] ) : '';
317
+ switch ( $attributes['type'] ) {
318
+ case 'text':
319
+ $list .= '<textarea style="width: 100%" rows="1" name="comments" placeholder="' . $placeholder . '"></textarea>';
320
+ break;
321
+ case 'textarea':
322
+ $list .= '<textarea style="width: 100%" rows="2" name="comments" placeholder="' . $placeholder . '"></textarea>';
323
+ break;
324
+ }
325
+ $list .= '</div>';
326
+ }
327
+ $list .= '</li>';
328
+ }
329
+
330
+ return '<div id="' . $this->product->get_key() . '">'
331
+ . '<ul class="ti-list">' . $list . '</ul>'
332
+ . '<div class="actions">'
333
+ . get_submit_button( __( $button_submit_before ), 'secondary', $this->product->get_key() . 'ti-deactivate-yes', false, array(
334
+ 'data-after-text' => $button_submit,
335
+ ) )
336
+ . get_submit_button( __( $button_cancel ), 'primary', $this->product->get_key() . 'ti-deactivate-no', false )
337
+ . '</div></div>';
338
+ }
339
+
340
+ /**
341
+ * Called when the deactivate button is clicked
342
+ */
343
+ function post_deactivate() {
344
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
345
+
346
+ if ( ! empty( $_POST['id'] ) ) {
347
+ $this->call_api( array(
348
+ 'type' => 'deactivate',
349
+ 'id' => $_POST['id'],
350
+ 'comment' => isset( $_POST['msg'] ) ? $_POST['msg'] : '',
351
+ ) );
352
+ }
353
+ }
354
+ }
355
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-factory.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The feedback factory 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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Factory' ) ) :
16
+ /**
17
+ * Feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Factory {
20
+
21
+ /**
22
+ * @var array $instances collection of the instances that are registered with the factory
23
+ */
24
+ private $_instances = array();
25
+
26
+ /**
27
+ * ThemeIsle_SDK_Feedback_Factory constructor.
28
+ *
29
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
30
+ * @param array $feedback_types the feedback types.
31
+ */
32
+ public function __construct( $product_object, $feedback_types ) {
33
+ if ( $product_object instanceof ThemeIsle_SDK_Product && $feedback_types && is_array( $feedback_types ) ) {
34
+ foreach ( $feedback_types as $type ) {
35
+ $class = 'ThemeIsle_SDK_Feedback_' . ucwords( $type );
36
+ $instance = new $class( $product_object );
37
+ $this->_instances[ $type ] = $instance;
38
+ $instance->setup_hooks();
39
+ }
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Get the registered instances
45
+ */
46
+ public function get_instances() {
47
+ return $this->_instances;
48
+ }
49
+ }
50
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-review.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The review 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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Review' ) ) :
16
+ /**
17
+ * Deactivate feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Review extends ThemeIsle_SDK_Feedback {
20
+
21
+ /**
22
+ * @var string $heading The heading of the modal
23
+ */
24
+ private $heading = 'Hey, it’s great to see you have {product} 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/>~ Marius, developer of {product}';
25
+
26
+ /**
27
+ * @var string $button_cancel The text of the cancel button
28
+ */
29
+ private $button_cancel = 'No, thanks.';
30
+ /**
31
+ * @var string $button_already The text of the already did it button
32
+ */
33
+ private $button_do = 'Ok, I will gladly help.';
34
+
35
+ /**
36
+ * ThemeIsle_SDK_Feedback_Deactivate constructor.
37
+ *
38
+ * @param ThemeIsle_SDK_Product $product_object The product object.
39
+ */
40
+ public function __construct( $product_object ) {
41
+ parent::__construct( $product_object );
42
+ }
43
+
44
+ /**
45
+ * Registers the hooks
46
+ */
47
+ public function setup_hooks_child() {
48
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'dismiss' ) );
49
+ }
50
+
51
+ /**
52
+ * Shows the notification
53
+ */
54
+ function show_notification() {
55
+ if ( ! $this->product->is_wordpress_available() ) {
56
+ $this->disable();
57
+
58
+ return false;
59
+ }
60
+ $show = get_option( $this->product->get_key() . '_review_flag', 'yes' );
61
+ if ( 'no' === $show ) {
62
+ return false;
63
+ }
64
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
65
+
66
+ return true;
67
+ }
68
+
69
+ /**
70
+ * Shows the admin notice
71
+ */
72
+ function admin_notices() {
73
+ $id = $this->product->get_key() . '_review';
74
+
75
+ $this->add_css( $this->product->get_key() );
76
+ $this->add_js( $this->product->get_key() );
77
+
78
+ echo '<div class="notice notice-success is-dismissible" id="' . $id . '" ><div class="themeisle-review-box">' . $this->get_html( $this->product->get_key() ) . '</div></div>';
79
+ }
80
+
81
+ /**
82
+ * Loads the css
83
+ *
84
+ * @param string $key The product key.
85
+ */
86
+ function add_css( $key ) {
87
+ ?>
88
+ <style type="text/css" id="<?php echo $key; ?>ti-review-css">
89
+ #<?php echo $key; ?>-review-notification{
90
+ padding-bottom:5px;
91
+ }
92
+ #<?php echo $key; ?>-review-notification .review-dismiss{
93
+ margin-left:5px;
94
+ }
95
+ </style>
96
+ <?php
97
+ }
98
+
99
+ /**
100
+ * Loads the js
101
+ *
102
+ * @param string $key The product key.
103
+ */
104
+ function add_js( $key ) {
105
+ ?>
106
+ <script type="text/javascript" id="<?php echo $key; ?>ti-review-js">
107
+ (function ($) {
108
+ $(document).ready(function () {
109
+ $('#<?php echo $key?>_review').on('click', '.notice-dismiss, .review-dismiss', function (e) {
110
+
111
+ $.ajax({
112
+ url: ajaxurl,
113
+ method: "post",
114
+ data: {
115
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
116
+ 'action': '<?php echo $this->product->get_key() . __CLASS__;?>'
117
+ },
118
+ success: function () {
119
+ $('#<?php echo $key;?>_review').hide();
120
+ }
121
+ });
122
+ });
123
+ });
124
+ })(jQuery);
125
+ </script>
126
+ <?php
127
+ }
128
+
129
+ /**
130
+ * Generates the HTML
131
+ *
132
+ * @param string $key The product key.
133
+ */
134
+ function get_html( $key ) {
135
+ $link = 'https://wordpress.org/support/plugin/' . $this->product->get_slug() . '/reviews/#wporg-footer';
136
+ $heading = apply_filters( $this->product->get_key() . '_feedback_review_heading', $this->heading );
137
+ $heading = str_replace( array( '{product}' ),
138
+ str_replace( 'Lite', '', $this->product->get_name() ), $heading );
139
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', $this->button_cancel );
140
+ $button_do = apply_filters( $this->product->get_key() . '_feedback_review_button_do', $this->button_do );
141
+
142
+ return '<div id="' . $this->product->get_key() . '-review-notification" class="themeisle-sdk-review-box">'
143
+ . '<p>' . $heading . '</p>'
144
+ . '<div class="actions">'
145
+ . '<a href="' . $link . '" target="_blank" class="button button-primary review-dismiss"> ' . $button_do . '</a>'
146
+ . get_submit_button( $button_cancel, 'review-dismiss ' . $this->product->get_key() . '-ti-review', $this->product->get_key() . 'ti-review-no', false )
147
+ . '</div></div>';
148
+ }
149
+
150
+ /**
151
+ * Called when the either button is clicked
152
+ */
153
+ function dismiss() {
154
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
155
+
156
+ $this->disable();
157
+ }
158
+
159
+ /**
160
+ * Disables the notification
161
+ */
162
+ protected function disable() {
163
+ update_option( $this->product->get_key() . '_review_flag', 'no' );
164
+ }
165
+
166
+ /**
167
+ * Enables the notification
168
+ */
169
+ protected function enable() {
170
+ update_option( $this->product->get_key() . '_review_flag', 'yes' );
171
+ }
172
+ }
173
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The 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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback' ) ) :
16
+ /**
17
+ * Feedback model for ThemeIsle SDK.
18
+ */
19
+ abstract class ThemeIsle_SDK_Feedback {
20
+ /**
21
+ * @var ThemeIsle_SDK_Product $product Themeisle Product.
22
+ */
23
+ protected $product;
24
+
25
+ /**
26
+ * @var string $feedback_url Url where to send the feedback
27
+ */
28
+ private $feedback_url = 'http://feedback.themeisle.com/wordpress/wp-json/__pirate_feedback_/v1/feedback';
29
+
30
+ /**
31
+ * ThemeIsle_SDK_Feedback constructor.
32
+ *
33
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
34
+ */
35
+ public function __construct( $product_object ) {
36
+ if ( $product_object instanceof ThemeIsle_SDK_Product ) {
37
+ $this->product = $product_object;
38
+ }
39
+ $this->setup_hooks();
40
+ }
41
+
42
+ /**
43
+ * Registers the hooks and then delegates to the child
44
+ */
45
+ public function setup_hooks() {
46
+ $this->setup_hooks_child();
47
+ }
48
+
49
+ /**
50
+ * Calls the API
51
+ *
52
+ * @param string $attributes The attributes of the post body.
53
+ */
54
+ protected function call_api( $attributes ) {
55
+ $slug = $this->product->get_slug();
56
+ $version = $this->product->get_version();
57
+ $attributes['slug'] = $slug;
58
+ $attributes['version'] = $version;
59
+
60
+ $response = wp_remote_post( $this->feedback_url, array(
61
+ 'body' => $attributes,
62
+ ) );
63
+ }
64
+
65
+ /**
66
+ * Randomizes the options array
67
+ *
68
+ * @param array $options The options array.
69
+ */
70
+ function randomize_options( $options ) {
71
+ $new = array();
72
+ $keys = array_keys( $options );
73
+ shuffle( $keys );
74
+
75
+ foreach ( $keys as $key ) {
76
+ $new[ $key ] = $options[ $key ];
77
+ }
78
+
79
+ return $new;
80
+ }
81
+
82
+ /**
83
+ * Abstract function for delegating to the child
84
+ */
85
+ protected abstract function setup_hooks_child();
86
+
87
+ }
88
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php CHANGED
@@ -105,7 +105,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
105
  $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
106
  $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
107
 
108
- echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product->get_key() . '_license" name="' . $this->product->get_key() . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $valid_string ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $invalid_string ) ) . ' </a>&nbsp;&nbsp;&nbsp;<button name="' . $this->product->get_key() . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">' . $deactivate_string ) : ( ' class="button button-primary" value="yes" type="submit" >' . $activate_string ) ) . ' </button></p><p class="description">' . sprintf( $license_message, '<a href="' . $this->product->get_store_url() . '">' . $this->product->get_store_url() . '</a> ', $this->product->get_type() ) . '</p>';
109
 
110
  }
111
 
@@ -307,8 +307,8 @@ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
307
  $api_params = array(
308
  'edd_action' => 'check_license',
309
  'license' => $license,
310
- 'item_name' => urlencode( $this->product->get_name() ),
311
- 'url' => urlencode( home_url() ),
312
  );
313
  // Call the custom API.
314
  $response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ), array(
@@ -368,8 +368,8 @@ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
368
  $license = $_POST[ $this->product->get_key() . '_license' ];
369
  $api_params = array(
370
  'license' => $license,
371
- 'item_name' => urlencode( $this->product->get_name() ),
372
- 'url' => urlencode( home_url() ),
373
  );
374
  if ( $status != 'valid' ) {
375
  // data to send in our API request
@@ -509,7 +509,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
509
  'name' => $this->product->get_name(),
510
  'slug' => $this->product->get_slug(),
511
  'author' => $this->product->get_store_name(),
512
- 'url' => urlencode( home_url() ),
513
  );
514
  $response = wp_remote_post( $this->product->get_store_url(), array(
515
  'timeout' => 15,
@@ -594,10 +594,10 @@ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
594
  $api_params = array(
595
  'edd_action' => 'get_version',
596
  'license' => $this->license_key,
597
- 'name' => urlencode( $this->product->get_name() ),
598
- 'slug' => urlencode( $this->product->get_slug() ),
599
  'author' => $this->product->get_store_name(),
600
- 'url' => urlencode( home_url() ),
601
  );
602
  $request = wp_remote_post( $this->product->get_store_url(), array(
603
  'timeout' => 15,
105
  $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
106
  $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
107
 
108
+ echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product->get_key() . '_license" name="' . $this->product->get_key() . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $valid_string ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $invalid_string ) ) . ' </a>&nbsp;&nbsp;&nbsp;<button name="' . $this->product->get_key() . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">' . $deactivate_string ) : ( ' class="button button-primary" value="yes" type="submit" >' . $activate_string ) ) . ' </button></p><p class="description">' . sprintf( $license_message, '<a href="' . $this->product->get_store_url() . '">' . $this->product->get_store_name() . '</a> ', $this->product->get_type() ) . '</p>';
109
 
110
  }
111
 
307
  $api_params = array(
308
  'edd_action' => 'check_license',
309
  'license' => $license,
310
+ 'item_name' => rawurlencode( $this->product->get_name() ),
311
+ 'url' => rawurlencode( home_url() ),
312
  );
313
  // Call the custom API.
314
  $response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ), array(
368
  $license = $_POST[ $this->product->get_key() . '_license' ];
369
  $api_params = array(
370
  'license' => $license,
371
+ 'item_name' => rawurlencode( $this->product->get_name() ),
372
+ 'url' => rawurlencode( home_url() ),
373
  );
374
  if ( $status != 'valid' ) {
375
  // data to send in our API request
509
  'name' => $this->product->get_name(),
510
  'slug' => $this->product->get_slug(),
511
  'author' => $this->product->get_store_name(),
512
+ 'url' => rawurlencode( home_url() ),
513
  );
514
  $response = wp_remote_post( $this->product->get_store_url(), array(
515
  'timeout' => 15,
594
  $api_params = array(
595
  'edd_action' => 'get_version',
596
  'license' => $this->license_key,
597
+ 'name' => rawurlencode( $this->product->get_name() ),
598
+ 'slug' => rawurlencode( $this->product->get_slug() ),
599
  'author' => $this->product->get_store_name(),
600
+ 'url' => rawurlencode( home_url() ),
601
  );
602
  $request = wp_remote_post( $this->product->get_store_url(), array(
603
  'timeout' => 15,
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php CHANGED
@@ -44,16 +44,30 @@ if ( ! class_exists( 'ThemeIsle_SDK_Loader' ) ) :
44
  }
45
  $product_object = new ThemeIsle_SDK_Product( $basefile );
46
  self::$products[ $product_object->get_slug() ] = $product_object;
 
 
47
  // Based on the Wordpress Available file header we enable the logger or not.
48
  if ( ! $product_object->is_wordpress_available() ) {
49
  $licenser = new ThemeIsle_SDK_Licenser( $product_object );
50
  $licenser->enable();
51
  }
52
- // We enable the logger feature.
 
53
  if ( $product_object->is_logger_active() ) {
54
- $logger = new ThemeIsle_SDK_Logger( $product_object );
55
  $logger->enable();
 
 
 
 
 
 
 
 
 
56
  }
 
 
 
57
 
58
  return self::$instance;
59
  }
44
  }
45
  $product_object = new ThemeIsle_SDK_Product( $basefile );
46
  self::$products[ $product_object->get_slug() ] = $product_object;
47
+
48
+ $notifications = array();
49
  // Based on the Wordpress Available file header we enable the logger or not.
50
  if ( ! $product_object->is_wordpress_available() ) {
51
  $licenser = new ThemeIsle_SDK_Licenser( $product_object );
52
  $licenser->enable();
53
  }
54
+
55
+ $logger = new ThemeIsle_SDK_Logger( $product_object );
56
  if ( $product_object->is_logger_active() ) {
 
57
  $logger->enable();
58
+ } else {
59
+ $notifications[] = $logger;
60
+ }
61
+
62
+ $feedback = new ThemeIsle_SDK_Feedback_Factory( $product_object, $product_object->get_feedback_types() );
63
+
64
+ $instances = $feedback->get_instances();
65
+ if ( array_key_exists( 'review', $instances ) ) {
66
+ $notifications[] = $instances['review'];
67
  }
68
+ new ThemeIsle_SDK_Notification_Manager( $product_object, $notifications );
69
+
70
+ new ThemeIsle_SDK_Widgets_Factory( $product_object, $product_object->get_widget_types() );
71
 
72
  return self::$instance;
73
  }
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php CHANGED
@@ -22,7 +22,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
22
  /**
23
  * @var string $logging_url Url where to send the logs
24
  */
25
- private $logging_url = 'http://mirror.themeisle.com';
26
 
27
  /**
28
  * @var ThemeIsle_SDK_Product $product Themeisle Product.
@@ -34,6 +34,21 @@ if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
34
  */
35
  private $product_cron;
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * ThemeIsle_SDK_Logger constructor.
39
  *
@@ -44,6 +59,7 @@ if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
44
  $this->product = $product_object;
45
  $this->product_cron = $product_object->get_key() . '_log_activity';
46
  }
 
47
  }
48
 
49
 
@@ -70,11 +86,119 @@ if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
70
  ),
71
  'body' => array(
72
  'site' => get_site_url(),
73
- 'product' => $this->product->get_slug(),
74
  'version' => $this->product->get_version(),
 
75
  ),
76
  ) );
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
  endif;
22
  /**
23
  * @var string $logging_url Url where to send the logs
24
  */
25
+ private $logging_url = 'http://log.themeisle.com/wp-json/v1/logs/';
26
 
27
  /**
28
  * @var ThemeIsle_SDK_Product $product Themeisle Product.
34
  */
35
  private $product_cron;
36
 
37
+ /**
38
+ * @var string $heading The heading of the modal
39
+ */
40
+ private $heading = 'Do you enjoy {product}? Become a contributor by opting in to our anonymous plugin data tracking. We guarantee no sensitive data is collected.';
41
+
42
+ /**
43
+ * @var string $button_submit The text of the submit button
44
+ */
45
+ private $button_submit = 'Sure, I would love to help.';
46
+
47
+ /**
48
+ * @var string $button_cancel The text of the cancel button
49
+ */
50
+ private $button_cancel = 'No, thanks.';
51
+
52
  /**
53
  * ThemeIsle_SDK_Logger constructor.
54
  *
59
  $this->product = $product_object;
60
  $this->product_cron = $product_object->get_key() . '_log_activity';
61
  }
62
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'dismiss' ) );
63
  }
64
 
65
 
86
  ),
87
  'body' => array(
88
  'site' => get_site_url(),
89
+ 'slug' => $this->product->get_slug(),
90
  'version' => $this->product->get_version(),
91
+ 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ),
92
  ),
93
  ) );
94
  }
95
 
96
+ /**
97
+ * Dismiss the notification
98
+ */
99
+ function dismiss() {
100
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
101
+
102
+ $flag = intval( $_POST['enable'] ) === 1;
103
+ update_option( $this->product->logger_option, ( $flag ? 'yes' : 'no' ) );
104
+
105
+ if ( true === $flag ) {
106
+ $this->enable();
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Shows the notification
112
+ */
113
+ function show_notification() {
114
+ $show = $this->product->is_logger_active();
115
+ $checked = get_option( $this->product->logger_option, '' );
116
+ if ( ! $show && $checked == '' ) {
117
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
118
+
119
+ return true;
120
+ }
121
+
122
+ return false;
123
+ }
124
+
125
+ /**
126
+ * Shows the admin notice
127
+ */
128
+ function admin_notices() {
129
+ $id = $this->product->get_key() . '_logger';
130
+
131
+ $this->add_media( $this->product->get_key() );
132
+
133
+ echo '<div class="notice notice-success is-dismissible " id="' . $this->product->get_key() . '-logger-notification" ><div id="' . $id . '" class="themeisle-logger-box">' . $this->get_html( $this->product->get_key() ) . '</div></div>';
134
+ }
135
+
136
+ /**
137
+ * Generates the HTML
138
+ *
139
+ * @param string $key The product key.
140
+ */
141
+ function get_html( $key ) {
142
+ $heading = apply_filters( $this->product->get_key() . '_logger_heading', $this->heading );
143
+ $heading = str_replace( array( '{product}' ), array(
144
+ str_replace( 'Lite', '', $this->product->get_name() )
145
+ ),
146
+ $heading
147
+ );
148
+ $button_submit = apply_filters( $this->product->get_key() . '_logger_button_submit', $this->button_submit );
149
+ $button_cancel = apply_filters( $this->product->get_key() . '_logger_button_cancel', $this->button_cancel );
150
+
151
+ return '<div >'
152
+ . '<p>' . $heading . '</p>'
153
+ . '<div class="actions">'
154
+ . get_submit_button( __( $button_submit ), 'primary ' . $this->product->get_key() . '-ti-logger', $this->product->get_key() . 'ti-logger-yes', false, array(
155
+ 'data-ti-log-enable' => 1,
156
+ ) )
157
+ . get_submit_button( __( $button_cancel ), 'secondary ' . $this->product->get_key() . '-ti-logger', $this->product->get_key() . 'ti-logger-no', false, array(
158
+ 'data-ti-log-enable' => 0,
159
+ ) )
160
+ . '</div></div>';
161
+ }
162
+
163
+ /**
164
+ * Loads the js
165
+ *
166
+ * @param string $key The product key.
167
+ */
168
+ function add_media( $key ) {
169
+ ?>
170
+ <style type="text/css">
171
+ #<?php echo $key; ?>-logger-notification {
172
+ padding-bottom: 5px;
173
+ }
174
+
175
+ #<?php echo $key; ?>-logger-notification .button {
176
+ margin-left: 5px;
177
+ }
178
+ </style>
179
+ <script type="text/javascript" id="<?php echo $key; ?>ti-logger-js">
180
+ (function ($) {
181
+ $(document).ready(function () {
182
+ $('.<?php echo $key?>-ti-logger').on('click', function (e) {
183
+
184
+ $.ajax({
185
+ url: ajaxurl,
186
+ method: "post",
187
+ data: {
188
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
189
+ 'action': '<?php echo $this->product->get_key() . __CLASS__;?>',
190
+ 'enable': $(this).attr('data-ti-log-enable')
191
+ },
192
+ success: function () {
193
+ $('#<?php echo $key;?>-logger-notification').hide();
194
+ }
195
+ });
196
+ });
197
+ });
198
+ })(jQuery);
199
+ </script>
200
+ <?php
201
+ }
202
+
203
  }
204
  endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-notification-manager.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The notification manager class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Notification
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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Notification_Manager' ) ) :
16
+ /**
17
+ * Notification manager model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Notification_Manager {
20
+ /**
21
+ * Time between notifications.
22
+ */
23
+ const NOTIFICATION_INTERVAL_HOURS = 100;
24
+ /**
25
+ * @var array Notifications for the current product.
26
+ */
27
+ private $notifications = array();
28
+
29
+ /**
30
+ * ThemeIsle_SDK_Notification_Manager constructor.
31
+ *
32
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
33
+ * @param array $callbacks the objects that will be called when a notification is due.
34
+ */
35
+ public function __construct( $product_object, $callbacks ) {
36
+
37
+ // Load the notifications only if we have it installed after the required interval.
38
+ if ( ( time() - $product_object->get_install_time() ) > self::NOTIFICATION_INTERVAL_HOURS * HOUR_IN_SECONDS ) {
39
+ if ( $product_object instanceof ThemeIsle_SDK_Product && $callbacks && is_array( $callbacks ) ) {
40
+ foreach ( $callbacks as $instance ) {
41
+ $this->notifications[ $product_object->get_key() . get_class( $instance ) ] = $instance;
42
+ }
43
+ }
44
+ }
45
+
46
+ $this->setup_hooks();
47
+ }
48
+
49
+ /**
50
+ * Setup the internal hooks
51
+ */
52
+ private function setup_hooks() {
53
+ add_action( 'admin_head', array( $this, 'show_notification' ) );
54
+ }
55
+
56
+ /**
57
+ * Shows the notification
58
+ */
59
+ function show_notification() {
60
+
61
+ $hidden = get_option( 'themeisle_sdk_notification_hidden', array() );
62
+ $instances = $this->notifications;
63
+ if ( empty( $instances ) ) {
64
+ return;
65
+ }
66
+
67
+ // Get timestamp of last notification.
68
+ $old = 0;
69
+ if ( ! empty( $hidden ) ) {
70
+ $old = $hidden[ count( $hidden ) - 1 ]['time'];
71
+ }
72
+ // Check if the current one is expired.
73
+ if ( ( time() - $old ) > self::NOTIFICATION_INTERVAL_HOURS * HOUR_IN_SECONDS ) {
74
+ // Get hidden notifications key.
75
+ $hidden_ones = wp_list_pluck( $hidden, 'key' );
76
+ // Get the non-hidden notifications.
77
+ $available_notifications = array_diff( array_keys( $instances ), $hidden_ones );
78
+ if ( empty( $available_notifications ) ) {
79
+ return;
80
+ }
81
+ // Get the first notification available.
82
+ $new_one = reset( $available_notifications );
83
+
84
+ $instance = $instances[ $new_one ];
85
+ $hidden[] = array(
86
+ 'time' => time(),
87
+ 'key' => $new_one,
88
+ );
89
+ update_option( 'themeisle_sdk_notification_hidden', $hidden );
90
+ } else {
91
+ $key = $hidden[ count( $hidden ) - 1 ]['key'];
92
+ if ( ! isset( $this->notifications[ $key ] ) ) {
93
+ return;
94
+ } else {
95
+ $instance = $this->notifications[ $key ];
96
+ }
97
+ }
98
+ $instance->show_notification();
99
+ }
100
+ }
101
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php CHANGED
@@ -45,6 +45,10 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
45
  * @var string $store_url The store url.
46
  */
47
  private $store_url;
 
 
 
 
48
  /**
49
  * @var string $store_name The store name.
50
  */
@@ -61,6 +65,19 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
61
  * @var string $version The product version.
62
  */
63
  private $version;
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  /**
66
  * ThemeIsle_SDK_Product constructor.
@@ -75,6 +92,14 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
75
  $this->setup_from_fileheaders();
76
  }
77
  }
 
 
 
 
 
 
 
 
78
  }
79
 
80
  /**
@@ -95,7 +120,12 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
95
  $this->requires_license = ( $file_headers['Requires License'] == 'yes' ) ? true : false;
96
  $this->wordpress_available = ( $file_headers['WordPress Available'] == 'yes' ) ? true : false;
97
  $this->version = $file_headers['Version'];
98
-
 
 
 
 
 
99
  }
100
 
101
  /**
@@ -245,6 +275,24 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
245
  return $this->file;
246
  }
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  /**
249
  * We log the user website and product version.
250
  *
@@ -257,9 +305,27 @@ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
257
  } else {
258
  // If we have the product on wprog, by default this will be false
259
  // and we can change it in each product.
260
- return apply_filters( $this->get_key() . '_logger_flag', false );
261
  }
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  }
265
  endif;
45
  * @var string $store_url The store url.
46
  */
47
  private $store_url;
48
+ /**
49
+ * @var int $install The date of install.
50
+ */
51
+ private $install;
52
  /**
53
  * @var string $store_name The store name.
54
  */
65
  * @var string $version The product version.
66
  */
67
  private $version;
68
+ /**
69
+ * @var string $logger_option Logger option key.
70
+ */
71
+ public $logger_option;
72
+ /**
73
+ * @var string $feedback_types All the feedback types the product supports
74
+ */
75
+ private $feedback_types = array();
76
+
77
+ /**
78
+ * @var string $widget_types All the widget types the product supports
79
+ */
80
+ private $widget_types = array( 'dashboard_blog' );
81
 
82
  /**
83
  * ThemeIsle_SDK_Product constructor.
92
  $this->setup_from_fileheaders();
93
  }
94
  }
95
+ $install = get_option( $this->get_key() . '_install', 0 );
96
+ if ( $install === 0 ) {
97
+ $install = time();
98
+ update_option( $this->get_key() . '_install', time() );
99
+ }
100
+ $this->install = $install;
101
+
102
+ $this->logger_option = $this->get_key() . '_logger_flag';
103
  }
104
 
105
  /**
120
  $this->requires_license = ( $file_headers['Requires License'] == 'yes' ) ? true : false;
121
  $this->wordpress_available = ( $file_headers['WordPress Available'] == 'yes' ) ? true : false;
122
  $this->version = $file_headers['Version'];
123
+ if ( $this->require_uninstall_feedback() ) {
124
+ $this->feedback_types[] = 'deactivate';
125
+ }
126
+ if ( $this->is_wordpress_available() && $this->get_type() === 'plugin' ) {
127
+ $this->feedback_types[] = 'review';
128
+ }
129
  }
130
 
131
  /**
275
  return $this->file;
276
  }
277
 
278
+ /**
279
+ * Returns feedback types
280
+ *
281
+ * @return array The feedback types.
282
+ */
283
+ public function get_feedback_types() {
284
+ return apply_filters( $this->get_key() . '_feedback_types', $this->feedback_types );
285
+ }
286
+
287
+ /**
288
+ * Returns widget types
289
+ *
290
+ * @return array The widget types.
291
+ */
292
+ public function get_widget_types() {
293
+ return apply_filters( $this->get_key() . '_widget_types', $this->widget_types );
294
+ }
295
+
296
  /**
297
  * We log the user website and product version.
298
  *
305
  } else {
306
  // If we have the product on wprog, by default this will be false
307
  // and we can change it in each product.
308
+ return ( get_option( $this->get_key() . '_logger_flag', 'no' ) === 'yes' );
309
  }
310
  }
311
 
312
+ /**
313
+ * Return the install timestamp.
314
+ *
315
+ * @return int The install timestamp.
316
+ */
317
+ public function get_install_time() {
318
+ return $this->install;
319
+ }
320
+
321
+ /**
322
+ * We require feedback on uninstall.
323
+ *
324
+ * @return bool Either we should require feedback on uninstall or not.
325
+ */
326
+ public function require_uninstall_feedback() {
327
+ return $this->get_type() === 'plugin';
328
+ }
329
+
330
  }
331
  endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The blog dashboard model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widget_Dashboard_Blog' ) ) :
16
+ /**
17
+ * Blog dashboard widget model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Widget_Dashboard_Blog extends ThemeIsle_SDK_Widget {
20
+
21
+ /**
22
+ * @var array instance The instances.
23
+ */
24
+ protected $product;
25
+
26
+ /**
27
+ * ThemeIsle_SDK_Widget_Dashboard_Blog constructor.
28
+ *
29
+ * @param ThemeIsle_SDK_Product $product_object The product object.
30
+ */
31
+ public function __construct( $product_object ) {
32
+ $this->product = $product_object;
33
+ parent::__construct( $product_object );
34
+ }
35
+
36
+ /**
37
+ * Registers the hooks
38
+ */
39
+ public function setup_hooks_child() {
40
+ $this->setup_vars();
41
+ add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
42
+ add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
43
+ add_filter( 'themeisle_sdk_recommend_plugin_or_theme', array( &$this, 'recommend_plugin_or_theme' ) );
44
+ }
45
+
46
+ /**
47
+ * Setup class variables
48
+ */
49
+ function setup_vars() {
50
+ $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' );
51
+ $this->feeds = apply_filters( 'themeisle_sdk_dashboard_widget_feeds', array(
52
+ 'https://themeisle.com/blog/feed'
53
+ ) );
54
+ }
55
+
56
+ /**
57
+ * Add widget to the dashboard
58
+ *
59
+ * @return string|void
60
+ */
61
+ function add_widget() {
62
+ global $wp_meta_boxes;
63
+ if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) {
64
+ return;
65
+ }
66
+ // Load SimplePie Instance
67
+ $feed = fetch_feed( $this->feeds );
68
+ // TODO report error when is an error loading the feed
69
+ if ( is_wp_error( $feed ) ) {
70
+ return '';
71
+ }
72
+
73
+ $items = $feed->get_items( 0, 5 );
74
+ foreach ( (array) $items as $item ) {
75
+ $this->items[] = array(
76
+ 'title' => $item->get_title(),
77
+ 'date' => $item->get_date( 'U' ),
78
+ 'link' => $item->get_permalink(),
79
+ );
80
+ }
81
+ wp_add_dashboard_widget( 'themeisle', $this->dashboard_name, array(
82
+ &$this,
83
+ 'render_dashboard_widget',
84
+ ) );
85
+ }
86
+
87
+ /**
88
+ * Render widget content
89
+ */
90
+ function render_dashboard_widget() {
91
+ ?>
92
+ <style type="text/css">
93
+ #themeisle ul {
94
+ margin-bottom: 0px;
95
+ }
96
+
97
+ #themeisle ul li.ti-dw-recommend-item {
98
+
99
+ padding-left: 7px;
100
+ border-top: 1px solid #eee;
101
+
102
+ margin-bottom: 0px;
103
+ padding-top: 6px;
104
+ }
105
+
106
+ #themeisle h2.hndle {
107
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALfSURBVEhL7VW/ayJBFL7/5ZqziBzIcSCHxUE4hAiCgnAQsBASOAikEAIeCAaCiJAyIBICQURYwoJoEUmxa6MWioWxURu30mq77b57s86acX+oOQhp8sFjdmbfzrfve2/efMI74IP0VTB0gz/th/8iNbQxOt0eOmoN6WgAn78cwJeoYcLf78KrSPVneU3isEQZoz0D3pt03jhDrDTERJXxWM3A5yAOIPmgce/t2IvUGFzjkDa+7C5RTx0gWbxG0v8bBXUG3fLReigk4rh55gtbsAfpGDfhVTS+VA19bYbH7BkqU/56AzNU7nrYpbI7qfbEcxfBkSOHJGO27Vk0htqEYoXvARdS+tsEJyAJY1GRkOxnGTdq2zuaRZOkJ1Wi1+h7ODlJB/l1kYRKZVyKhMwoSmUw5M4uWMhIcl9f1l1qB2m/aMkZQIE2d5BeDTGiSD0VfC4jZPmSKiO+LMJGuoRE1bkiOIW00CAdW3NuxzLmxhD1hyHmug7dbBRD9KdLc4dR6Zfgn0ffXN2EjVSMLIcOrWxuwiyyPhYGI7X0m/agqPeIib5+yit/LWILKYuUlrTa5kbMwjko7J0AXc1RLZwifRF58Us1YXMzYSMV5WQ5ZWsG5VnYaG1BxM7zKBRzOAkHac460gxK9sUnVBqbu9rhKCS9lRaq1/poCeUq7tL6uPnjSLeoBRo9/KXjslqP4Na1gbiQssiULK9gP+VVqPnFQMblnwi+WmTfIji5amLES1mn/mz9yCFVuddZdiFlIJlTK+JtH2/AaPMogzipzrZ+4yQ1qCL1JSaNDL6bf81y1aOb5R6Vhow6G1tPNK9Borl0R2NLRiEaxNEF9Wa3yrHBSarTbeHot7ySqVmYR4AucDYuaJyzkfptZ0e/FeGa03m3jOQPizCAo0QG9W2ktL5HgGt45JRgaBh1x9R1WHY0KCTnLZOW5Kw0miuZq01ITGa6Z18Db9I3xAfpm+IdSIF/du91gSA2+I8AAAAASUVORK5CYII=');
108
+ background-repeat: no-repeat;
109
+ background-position: 90% 50%;
110
+ background-size: 29px;
111
+ }
112
+
113
+ .ti-dw-feed-item {
114
+ display: flex;
115
+ align-items: center;
116
+ }
117
+
118
+ .ti-dw-feed-item a {
119
+ float: left;
120
+ width: 89.9%;
121
+ }
122
+
123
+ .ti-dw-feed-item .ti-dw-day-container {
124
+ width: 100%;
125
+ letter-spacing: 3px;
126
+ display: block;
127
+ }
128
+
129
+ .ti-dw-feed-item .ti-dw-month-container {
130
+
131
+ width: 100%;
132
+ display: block;
133
+ font-weight: 600;
134
+ padding: 0px;
135
+ margin-top: -6px;
136
+ text-transform: uppercase;
137
+ font-size: 10px;
138
+ letter-spacing: 1px;
139
+ }
140
+
141
+ .ti-dw-feed-item .ti-dw-date-container {
142
+ float: left;
143
+ min-height: 30px;
144
+ margin-right: 0.1%;
145
+ width: 10%;
146
+ text-align: center;
147
+ }
148
+
149
+
150
+ .ti-dw-recommend-item span {
151
+ color: #72777c;
152
+ }
153
+
154
+ </style>
155
+ <ul>
156
+ <?php
157
+ foreach ( $this->items as $item ) {
158
+ ?>
159
+ <li class="ti-dw-feed-item"><span class="ti-dw-date-container"><span
160
+ class="ti-dw-day-container"><?php echo date( 'd', $item['date'] ); ?></span> <span
161
+ class="ti-dw-month-container"><?php echo substr( date( 'M', $item['date'] ), 0, 3 ); ?></span></span><a
162
+ href="<?php echo add_query_arg(
163
+ array(
164
+ 'utm_campaign' => 'feed',
165
+ 'utm_medium' => 'dashboard_widget',
166
+ ), $item['link'] ); ?>" target="_blank"><?php echo $item['title']; ?></a>
167
+ <div class="clear"></div>
168
+ </li>
169
+ <?php
170
+ }
171
+
172
+ $recommend = apply_filters( 'themeisle_sdk_recommend_plugin_or_theme', array() );
173
+ if ( is_array( $recommend ) && ! empty( $recommend ) ) {
174
+
175
+ $type = $recommend['type'];
176
+ if ( ( $type == 'theme' && current_user_can( 'install_themes' ) ) || ( $type == 'plugin' && current_user_can( 'install_plugins' ) ) ) {
177
+ add_thickbox();
178
+ $url = add_query_arg( array(
179
+ 'theme' => $recommend['slug'],
180
+ ), network_admin_url( 'theme-install.php' ) );
181
+
182
+ if ( 'plugin' === $type ) {
183
+
184
+ $url = add_query_arg( array(
185
+ 'tab' => 'plugin-information',
186
+ 'plugin' => $recommend['slug'],
187
+ ), network_admin_url( 'plugin-install.php' ) );
188
+ }
189
+ ?>
190
+ <li class="ti-dw-recommend-item ">
191
+ <span class="ti-dw-recommend"><?php echo apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ); ?>
192
+ : </span><?php echo trim( str_replace( array(
193
+ 'lite',
194
+ 'Lite',
195
+ ), '', $recommend['name'] ) ); ?>
196
+ (<a class="thickbox open-plugin-details-modal"
197
+ href="<?php echo $url . '&TB_iframe=true&width=600&height=500'; ?>"><?php _e( 'Install' ); ?></a>)
198
+ </li>
199
+
200
+ <?php
201
+ }
202
+ }
203
+ ?>
204
+ </ul>
205
+
206
+ <?php
207
+
208
+ }
209
+
210
+ /**
211
+ * Either the current product is installed or not.
212
+ *
213
+ * @param array $val The current recommended product.
214
+ *
215
+ * @return bool Either we should exclude the plugin or not.
216
+ */
217
+ public function remove_current_products( $val ) {
218
+ if ( $val['type'] === 'theme' ) {
219
+ $exist = wp_get_theme( $val['slug'] );
220
+
221
+ return ! $exist->exists();
222
+ } else {
223
+ $all_plugins = array_keys( get_plugins() );
224
+ foreach ( $all_plugins as $slug ) {
225
+ if ( strpos( $slug, $val['slug'] ) !== false ) {
226
+ return false;
227
+ }
228
+ }
229
+
230
+ return true;
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Fetch themes from wporg api.
236
+ *
237
+ * @param string $author The author name.
238
+ *
239
+ * @return array The list of themes.
240
+ */
241
+ function get_themes_from_wporg( $author ) {
242
+ $products = wp_remote_get(
243
+ 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[author]=' . $author . '&request[per_page]=30&request[fields][active_installs]=true'
244
+ );
245
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
246
+ if ( is_object( $products ) ) {
247
+ $products = isset( $products->themes ) ? $products->themes : array();
248
+ } else {
249
+ $products = array();
250
+ }
251
+
252
+ return $products;
253
+ }
254
+
255
+ /**
256
+ * Fetch plugin from wporg api.
257
+ *
258
+ * @param string $author The author slug.
259
+ *
260
+ * @return array The list of plugins for the selected author.
261
+ */
262
+ function get_plugins_from_wporg( $author ) {
263
+ $products = wp_remote_get(
264
+ 'https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[author]=' . $author . '&request[author]=codeinwp&request[per_page]=20&request[fields][active_installs]=true'
265
+ );
266
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
267
+ if ( is_object( $products ) ) {
268
+ $products = isset( $products->plugins ) ? $products->plugins : array();
269
+ } else {
270
+ $products = array();
271
+ }
272
+
273
+ return $products;
274
+ }
275
+
276
+ /**
277
+ * Fetch products from the recomended section.
278
+ *
279
+ * @return array|mixed The list of products to use in recomended section.
280
+ */
281
+ function get_product_from_api() {
282
+ if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) {
283
+ $products = array();
284
+ $themeisle_themes = $this->get_themes_from_wporg( 'themeisle' );
285
+ $codeinwp_themes = $this->get_themes_from_wporg( 'codeinwp' );
286
+
287
+ $themeisle_plugins = $this->get_plugins_from_wporg( 'themeisle' );
288
+ $codeinwp_plugins = $this->get_plugins_from_wporg( 'codeinwp' );
289
+
290
+ $all_themes = array_merge( $themeisle_themes, $codeinwp_themes );
291
+ foreach ( $all_themes as $theme ) {
292
+ if ( $theme->active_installs < 4999 ) {
293
+ continue;
294
+ }
295
+ $products[] = array(
296
+ 'name' => $theme->name,
297
+ 'type' => 'theme',
298
+ 'slug' => $theme->slug,
299
+ 'installs' => $theme->active_installs,
300
+ );
301
+ }
302
+ $all_plugins = array_merge( $themeisle_plugins, $codeinwp_plugins );
303
+ foreach ( $all_plugins as $plugin ) {
304
+ if ( $plugin->active_installs < 5999 ) {
305
+ continue;
306
+ }
307
+ $products[] = array(
308
+ 'name' => $plugin->name,
309
+ 'type' => 'plugin',
310
+ 'slug' => $plugin->slug,
311
+ 'installs' => $plugin->active_installs,
312
+ );
313
+ }
314
+ set_transient( 'themeisle_sdk_products', $products, 6 * HOUR_IN_SECONDS );
315
+ }
316
+
317
+ return $products;
318
+ }
319
+
320
+ /**
321
+ * Contact the API and fetch the recommended plugins/themes
322
+ */
323
+ function recommend_plugin_or_theme() {
324
+ $products = $this->get_product_from_api();
325
+ if ( ! is_array( $products ) ) {
326
+ $products = array();
327
+ }
328
+ $products = array_filter( $products, array( $this, 'remove_current_products' ) );
329
+ $products = array_merge( $products );
330
+ if ( count( $products ) > 1 ) {
331
+ shuffle( $products );
332
+ $products = array_slice( $products, 0, 1 );
333
+ }
334
+ $to_recommend = isset( $products[0] ) ? $products[0] : $products;
335
+
336
+ return $to_recommend;
337
+ }
338
+ }
339
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The widget model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widget' ) ) :
16
+ /**
17
+ * Widget model for ThemeIsle SDK.
18
+ */
19
+ abstract class ThemeIsle_SDK_Widget {
20
+ /**
21
+ * @var ThemeIsle_SDK_Product $product Themeisle Product.
22
+ */
23
+ protected $product;
24
+
25
+ /**
26
+ * ThemeIsle_SDK_Widget constructor.
27
+ *
28
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
29
+ */
30
+ public function __construct( $product_object ) {
31
+ if ( $product_object instanceof ThemeIsle_SDK_Product ) {
32
+ $this->product = $product_object;
33
+ }
34
+ $this->setup_hooks();
35
+ }
36
+
37
+ /**
38
+ * Registers the hooks and then delegates to the child
39
+ */
40
+ public function setup_hooks() {
41
+ $this->setup_hooks_child();
42
+ }
43
+
44
+ /**
45
+ * Abstract function for delegating to the child
46
+ */
47
+ protected abstract function setup_hooks_child();
48
+
49
+ }
50
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widgets-factory.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The widgets factory class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
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
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widgets_Factory' ) ) :
16
+ /**
17
+ * Widgets factory model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Widgets_Factory {
20
+
21
+ /**
22
+ * ThemeIsle_SDK_Widgets_Factory constructor.
23
+ *
24
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
25
+ * @param array $widgets the widgets.
26
+ */
27
+ public function __construct( $product_object, $widgets ) {
28
+ if ( $product_object instanceof ThemeIsle_SDK_Product && $widgets && is_array( $widgets ) ) {
29
+ foreach ( $widgets as $widget ) {
30
+ $class = 'ThemeIsle_SDK_Widget_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) );
31
+ $instance = new $class( $product_object );
32
+ $instance->setup_hooks();
33
+ }
34
+ }
35
+ }
36
+ }
37
+ endif;
vendor/codeinwp/themeisle-sdk/composer.json CHANGED
@@ -18,7 +18,15 @@
18
  "class-themeisle-sdk-loader.php",
19
  "class-themeisle-sdk-product.php",
20
  "class-themeisle-sdk-logger.php",
21
- "class-themeisle-sdk-licenser.php"
 
 
 
 
 
 
 
 
22
  ]
23
  },
24
  "support": {
18
  "class-themeisle-sdk-loader.php",
19
  "class-themeisle-sdk-product.php",
20
  "class-themeisle-sdk-logger.php",
21
+ "class-themeisle-sdk-licenser.php",
22
+ "class-themeisle-sdk-feedback-factory.php",
23
+ "class-themeisle-sdk-feedback.php",
24
+ "class-themeisle-sdk-feedback-deactivate.php",
25
+ "class-themeisle-sdk-feedback-review.php",
26
+ "class-themeisle-sdk-notification-manager.php",
27
+ "class-themeisle-sdk-widget.php",
28
+ "class-themeisle-sdk-widget-dashboard-blog.php",
29
+ "class-themeisle-sdk-widgets-factory.php"
30
  ]
31
  },
32
  "support": {
vendor/composer/autoload_classmap.php CHANGED
@@ -6,8 +6,16 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
 
 
9
  'ThemeIsle_SDK_Licenser' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php',
10
  'ThemeIsle_SDK_Loader' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php',
11
  'ThemeIsle_SDK_Logger' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php',
 
12
  'ThemeIsle_SDK_Product' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php',
 
 
 
13
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'ThemeIsle_SDK_Feedback' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback.php',
10
+ 'ThemeIsle_SDK_Feedback_Deactivate' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-deactivate.php',
11
+ 'ThemeIsle_SDK_Feedback_Factory' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-factory.php',
12
+ 'ThemeIsle_SDK_Feedback_Review' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-review.php',
13
  'ThemeIsle_SDK_Licenser' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php',
14
  'ThemeIsle_SDK_Loader' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php',
15
  'ThemeIsle_SDK_Logger' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php',
16
+ 'ThemeIsle_SDK_Notification_Manager' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-notification-manager.php',
17
  'ThemeIsle_SDK_Product' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php',
18
+ 'ThemeIsle_SDK_Widget' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-widget.php',
19
+ 'ThemeIsle_SDK_Widget_Dashboard_Blog' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php',
20
+ 'ThemeIsle_SDK_Widgets_Factory' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-widgets-factory.php',
21
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitbcffff6ec0d732b793ac5b61a414557c
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitbcffff6ec0d732b793ac5b61a414557c
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitbcffff6ec0d732b793ac5b61a414557c', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitbcffff6ec0d732b793ac5b61a414557c', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit9f56ad3c43f28a8cd68767f9c89fbcdc
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit9f56ad3c43f28a8cd68767f9c89fbcdc', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit9f56ad3c43f28a8cd68767f9c89fbcdc', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit21b09bbb4b72b0f87cc03f5ff671df58 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit21b09bbb4b72b0f87cc03f5ff671df58 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit21b09bbb4b72b0f87cc03f5ff671df58', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit21b09bbb4b72b0f87cc03f5ff671df58', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit0e38fe72414a2baf5893448767dd9405 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0e38fe72414a2baf5893448767dd9405', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0e38fe72414a2baf5893448767dd9405', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/installed.json CHANGED
@@ -39,23 +39,31 @@
39
  "source": {
40
  "type": "git",
41
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
42
- "reference": "beb20b65c6916d14e2222d40252a48faa440e72e"
43
  },
44
  "dist": {
45
  "type": "zip",
46
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/beb20b65c6916d14e2222d40252a48faa440e72e",
47
- "reference": "beb20b65c6916d14e2222d40252a48faa440e72e",
48
  "shasum": ""
49
  },
50
- "time": "2017-03-30 15:34:04",
51
  "type": "library",
52
- "installation-source": "source",
53
  "autoload": {
54
  "classmap": [
55
  "class-themeisle-sdk-loader.php",
56
  "class-themeisle-sdk-product.php",
57
  "class-themeisle-sdk-logger.php",
58
- "class-themeisle-sdk-licenser.php"
 
 
 
 
 
 
 
 
59
  ]
60
  },
61
  "license": [
39
  "source": {
40
  "type": "git",
41
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
42
+ "reference": "eac36fdb955f45979b73573576976b18f6ef2043"
43
  },
44
  "dist": {
45
  "type": "zip",
46
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/eac36fdb955f45979b73573576976b18f6ef2043",
47
+ "reference": "eac36fdb955f45979b73573576976b18f6ef2043",
48
  "shasum": ""
49
  },
50
+ "time": "2017-05-29 12:14:04",
51
  "type": "library",
52
+ "installation-source": "dist",
53
  "autoload": {
54
  "classmap": [
55
  "class-themeisle-sdk-loader.php",
56
  "class-themeisle-sdk-product.php",
57
  "class-themeisle-sdk-logger.php",
58
+ "class-themeisle-sdk-licenser.php",
59
+ "class-themeisle-sdk-feedback-factory.php",
60
+ "class-themeisle-sdk-feedback.php",
61
+ "class-themeisle-sdk-feedback-deactivate.php",
62
+ "class-themeisle-sdk-feedback-review.php",
63
+ "class-themeisle-sdk-notification-manager.php",
64
+ "class-themeisle-sdk-widget.php",
65
+ "class-themeisle-sdk-widget-dashboard-blog.php",
66
+ "class-themeisle-sdk-widgets-factory.php"
67
  ]
68
  },
69
  "license": [