WordPress Charts and Graphs Lite - Version 2.0.0

Version Description

  • Improved design and layout to support multiple datasources.
  • Added new integrations in the Pro version.
  • Added opt-in for tracking.
Download this release

Release Info

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

Code changes from version 1.7.6 to 2.0.0

CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
 
 
 
 
2
- Improved UI of the builder.
3
- Added compatibility with the new options in the pro version.
4
- Added new travis stack.
5
- Added optin for tracking.
6
 
7
 
8
 
9
- Fixed issue when using the same shortcode multiple times on the same page.
1
 
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
 
10
 
11
 
 
classes/Visualizer/Module/Admin.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -47,69 +46,46 @@ class Visualizer_Module_Admin extends Visualizer_Module {
47
  * @since 1.0.0
48
  *
49
  * @access public
 
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
54
-
55
  $this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
56
  $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
57
  $this->_addAction( 'admin_footer', 'renderTempaltes' );
58
- $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts' );
59
  $this->_addAction( 'admin_menu', 'registerAdminMenu' );
60
-
61
  $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
62
  $this->_addFilter( 'plugin_action_links', 'getPluginActionLinks', 10, 2 );
63
  $this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
 
 
64
  }
65
 
66
  /**
67
- * Returns associated array of chart types and localized names.
68
- *
69
- * @since 1.0.0
70
- *
71
- * @static
72
- * @access private
73
- * @return array The associated array of chart types with localized names.
74
  */
75
- public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darray = false ) {
76
- $types = array(
77
- 'pie' => array( 'name' => esc_html__( 'Pie', 'visualizer' ), 'enabled' => true ),
78
- 'line' => array( 'name' => esc_html__( 'Line', 'visualizer' ), 'enabled' => true ),
79
- 'area' => array( 'name' => esc_html__( 'Area', 'visualizer' ), 'enabled' => true ),
80
- 'geo' => array( 'name' => esc_html__( 'Geo', 'visualizer' ), 'enabled' => true ),
81
- 'bar' => array( 'name' => esc_html__( 'Bar', 'visualizer' ), 'enabled' => true ),
82
- 'column' => array( 'name' => esc_html__( 'Column', 'visualizer' ), 'enabled' => true ),
83
- 'gauge' => array( 'name' => esc_html__( 'Gauge', 'visualizer' ), 'enabled' => true ),
84
- 'scatter' => array( 'name' => esc_html__( 'Scatter', 'visualizer' ), 'enabled' => true ),
85
- 'candlestick' => array( 'name' => esc_html__( 'Candlestick', 'visualizer' ), 'enabled' => true ),
86
- // pro types
87
- 'table' => array( 'name' => esc_html__( 'Table', 'visualizer' ), 'enabled' => false ),
88
- 'timeline' => array( 'name' => esc_html__( 'Timeline', 'visualizer' ), 'enabled' => false ),
89
- 'combo' => array( 'name' => esc_html__( 'Combo', 'visualizer' ), 'enabled' => false ),
90
- );
91
-
92
- $types = apply_filters( 'visualizer_pro_chart_types', $types );
93
-
94
- if ( $enabledOnly ) {
95
- $filtered = array();
96
- foreach ( $types as $type => $array ) {
97
- if ( ! $array['enabled'] ) { continue;
98
- }
99
- $filtered[ $type ] = $array;
100
- }
101
- $types = $filtered;
102
  }
 
 
103
 
104
- if ( $get2Darray ) {
105
- $doubleD = array();
106
- foreach ( $types as $type => $array ) {
107
- $doubleD[ $type ] = $array['name'];
108
- }
109
- $types = $doubleD;
110
- }
111
 
112
- return $types;
113
  }
114
 
115
  /**
@@ -123,18 +99,16 @@ class Visualizer_Module_Admin extends Visualizer_Module {
123
  */
124
  public function enqueueMediaScripts() {
125
  global $typenow;
126
-
127
  if ( post_type_supports( $typenow, 'editor' ) ) {
128
  wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION );
129
-
130
- wp_enqueue_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array( 'media-editor' ), null, true );
131
- wp_enqueue_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
132
- wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', array( 'visualizer-google-jsapi-old' ), Visualizer_Plugin::VERSION, true );
133
- wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true );
134
  wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true );
135
- wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true );
136
- wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION, true );
137
- wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION, true );
138
  }
139
  }
140
 
@@ -144,33 +118,126 @@ class Visualizer_Module_Admin extends Visualizer_Module {
144
  * @since 1.0.0
145
  *
146
  * @access public
 
147
  * @param array $strings The array of media view strings.
 
148
  * @return array The extended array of media view strings.
149
  */
150
  public function setupMediaViewStrings( $strings ) {
151
  $strings['visualizer'] = array(
152
- 'actions' => array(
153
  'get_charts' => Visualizer_Plugin::ACTION_GET_CHARTS,
154
  'delete_chart' => Visualizer_Plugin::ACTION_DELETE_CHART,
155
  ),
156
  'controller' => array(
157
  'title' => esc_html__( 'Visualizations', 'visualizer' ),
158
  ),
159
- 'routers' => array(
160
  'library' => esc_html__( 'From Library', 'visualizer' ),
161
  'create' => esc_html__( 'Create New', 'visualizer' ),
162
  ),
163
- 'library' => array(
164
- 'filters' => self::_getChartTypesLocalized( true, true ),
165
- 'types' => array_keys( self::_getChartTypesLocalized( true, true ) ),
166
  ),
167
- 'nonce' => wp_create_nonce(),
168
- 'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
169
  );
170
 
171
  return $strings;
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  /**
175
  * Renders templates to use in media popup.
176
  *
@@ -181,11 +248,9 @@ class Visualizer_Module_Admin extends Visualizer_Module {
181
  */
182
  public function renderTempaltes() {
183
  global $pagenow;
184
-
185
  if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) {
186
  return;
187
  }
188
-
189
  $render = new Visualizer_Render_Templates();
190
  $render->render();
191
  }
@@ -199,19 +264,24 @@ class Visualizer_Module_Admin extends Visualizer_Module {
199
  * @uses wp_enqueue_media() To enqueue media stuff.
200
  *
201
  * @access public
 
202
  * @param string $suffix The current page suffix.
203
  */
204
  public function enqueueLibraryScripts( $suffix ) {
205
  if ( $suffix == $this->_libraryPage ) {
206
  wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION );
207
-
208
  $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' );
209
-
210
  wp_enqueue_media();
211
- wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( 'jquery', 'media-views' ), Visualizer_Plugin::VERSION, true );
 
 
 
212
  wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
213
  wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
214
- wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi-old', 'visualizer-library' ), Visualizer_Plugin::VERSION, true );
 
 
 
215
  }
216
  }
217
 
@@ -221,11 +291,14 @@ class Visualizer_Module_Admin extends Visualizer_Module {
221
  * @since 1.0.0
222
  *
223
  * @access public
 
224
  * @param array $tabs The array of media upload tabs.
 
225
  * @return array Extended array of media upload tabs.
226
  */
227
  public function setupVisualizerTab( $tabs ) {
228
  $tabs['visualizer'] = 'Visualizer';
 
229
  return $tabs;
230
  }
231
 
@@ -237,8 +310,8 @@ class Visualizer_Module_Admin extends Visualizer_Module {
237
  * @access public
238
  */
239
  public function registerAdminMenu() {
240
- $title = esc_html__( 'Visualizer Library', 'visualizer' );
241
- $callback = array( $this, 'renderLibraryPage' );
242
  $this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
243
  }
244
 
@@ -257,14 +330,12 @@ class Visualizer_Module_Admin extends Visualizer_Module {
257
  'default' => 1,
258
  ),
259
  ) );
260
-
261
  // the initial query arguments to fetch charts
262
  $query_args = array(
263
  'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
264
  'posts_per_page' => 6,
265
  'paged' => $page,
266
  );
267
-
268
  // add chart type filter to the query arguments
269
  $filter = filter_input( INPUT_GET, 'type' );
270
  if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
@@ -278,34 +349,30 @@ class Visualizer_Module_Admin extends Visualizer_Module {
278
  } else {
279
  $filter = 'all';
280
  }
281
-
282
  // Added by Ash/Upwork
283
- $filterByMeta = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
284
  if ( $filterByMeta ) {
285
- $query = array(
286
- 'key' => Visualizer_Plugin::CF_SETTINGS,
287
- 'value' => $filterByMeta,
288
- 'compare' => 'LIKE',
289
  );
290
- $meta = isset( $query_args['meta_query'] ) ? $query_args['meta_query'] : array();
291
- $meta[] = $query;
292
- $query_args['meta_query'] = $meta;
293
  }
294
  // Added by Ash/Upwork
295
  // fetch charts
296
  $charts = array();
297
- $query = new WP_Query( $query_args );
298
  while ( $query->have_posts() ) {
299
  $chart = $query->next_post();
300
-
301
  // fetch and update settings
302
  $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
303
  unset( $settings['height'], $settings['width'] );
304
-
305
- $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
306
  $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
307
- $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
308
-
309
  // add chart to the array
310
  $charts[ 'visualizer-' . $chart->ID ] = array(
311
  'id' => $chart->ID,
@@ -315,24 +382,32 @@ class Visualizer_Module_Admin extends Visualizer_Module {
315
  'data' => $data,
316
  );
317
  }
318
-
319
  // enqueue charts array
320
  $ajaxurl = admin_url( 'admin-ajax.php' );
321
  wp_localize_script( 'visualizer-library', 'visualizer', array(
322
  'charts' => $charts,
323
  'urls' => array(
324
  'base' => add_query_arg( 'vpage', false ),
325
- 'create' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, 'library' => 'yes' ), $ajaxurl ),
326
- 'edit' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, 'library' => 'yes' ), $ajaxurl ),
 
 
 
 
 
 
 
 
 
 
 
327
  ),
328
  ) );
329
-
330
  // render library page
331
- $render = new Visualizer_Render_Library();
332
-
333
- $render->charts = $charts;
334
- $render->type = $filter;
335
- $render->types = self::_getChartTypesLocalized();
336
  $render->pagination = paginate_links( array(
337
  'base' => add_query_arg( 'vpage', '%#%' ),
338
  'format' => '',
@@ -340,7 +415,6 @@ class Visualizer_Module_Admin extends Visualizer_Module {
340
  'total' => $query->max_num_pages,
341
  'type' => 'array',
342
  ) );
343
-
344
  $render->render();
345
  }
346
 
@@ -350,8 +424,10 @@ class Visualizer_Module_Admin extends Visualizer_Module {
350
  * @since 1.0.0
351
  *
352
  * @access public
 
353
  * @param array $links The array of original action links.
354
  * @param string $file The plugin basename.
 
355
  * @return array Updated array of action links.
356
  */
357
  public function getPluginActionLinks( $links, $file ) {
@@ -375,8 +451,10 @@ class Visualizer_Module_Admin extends Visualizer_Module {
375
  * @since 1.0.0
376
  *
377
  * @access public
 
378
  * @param array $plugin_meta The array of a plugin meta links.
379
  * @param string $plugin_file The plugin's basename.
 
380
  * @return array Updated array of plugin meta links.
381
  */
382
  public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
46
  * @since 1.0.0
47
  *
48
  * @access public
49
+ *
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
 
54
  $this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
55
  $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
56
  $this->_addAction( 'admin_footer', 'renderTempaltes' );
57
+ $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 9 );
58
  $this->_addAction( 'admin_menu', 'registerAdminMenu' );
 
59
  $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
60
  $this->_addFilter( 'plugin_action_links', 'getPluginActionLinks', 10, 2 );
61
  $this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
62
+ $this->_addFilter( 'visualizer_logger_flag', 'get_logger_flag', 10, 1 );
63
+ $this->_addAjaxAction( Visualizer_Plugin::ACTION_TRACK, 'visualizer_enable_track' );
64
  }
65
 
66
  /**
67
+ * Enable track ajax action.
 
 
 
 
 
 
68
  */
69
+ public function visualizer_enable_track() {
70
+ check_admin_referer( Visualizer_Plugin::ACTION_TRACK, 'nonce' );
71
+ $status = $_GET['status'];
72
+ if ( $status == 'yes' ) {
73
+ update_option( 'visualizer_logger_flag', 'yes' );
74
+ } else {
75
+ update_option( 'visualizer_logger_flag', 'no' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
+ wp_send_json_success( array( 'status' => $status ) );
78
+ }
79
 
80
+ /**
81
+ * Either the tracking is active or not.
82
+ *
83
+ * @return bool The flag status.
84
+ */
85
+ public function get_logger_flag() {
86
+ $flag = get_option( 'visualizer_logger_flag', 'no' );
87
 
88
+ return ( $flag === 'yes' );
89
  }
90
 
91
  /**
99
  */
100
  public function enqueueMediaScripts() {
101
  global $typenow;
 
102
  if ( post_type_supports( $typenow, 'editor' ) ) {
103
  wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION );
104
+ wp_enqueue_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array( 'media-editor' ), null, true );
105
+ wp_enqueue_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
106
+ wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', array( 'visualizer-google-jsapi-old' ), Visualizer_Plugin::VERSION, true );
107
+ wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true );
 
108
  wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true );
109
+ wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true );
110
+ wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION, true );
111
+ wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION, true );
112
  }
113
  }
114
 
118
  * @since 1.0.0
119
  *
120
  * @access public
121
+ *
122
  * @param array $strings The array of media view strings.
123
+ *
124
  * @return array The extended array of media view strings.
125
  */
126
  public function setupMediaViewStrings( $strings ) {
127
  $strings['visualizer'] = array(
128
+ 'actions' => array(
129
  'get_charts' => Visualizer_Plugin::ACTION_GET_CHARTS,
130
  'delete_chart' => Visualizer_Plugin::ACTION_DELETE_CHART,
131
  ),
132
  'controller' => array(
133
  'title' => esc_html__( 'Visualizations', 'visualizer' ),
134
  ),
135
+ 'routers' => array(
136
  'library' => esc_html__( 'From Library', 'visualizer' ),
137
  'create' => esc_html__( 'Create New', 'visualizer' ),
138
  ),
139
+ 'library' => array(
140
+ 'filters' => self::_getChartTypesLocalized( true, true ),
141
+ 'types' => array_keys( self::_getChartTypesLocalized( true, true ) ),
142
  ),
143
+ 'nonce' => wp_create_nonce(),
144
+ 'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
145
  );
146
 
147
  return $strings;
148
  }
149
 
150
+ /**
151
+ * Returns associated array of chart types and localized names.
152
+ *
153
+ * @since 1.0.0
154
+ *
155
+ * @static
156
+ * @access private
157
+ * @return array The associated array of chart types with localized names.
158
+ */
159
+ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darray = false ) {
160
+ $types = array(
161
+ 'pie' => array(
162
+ 'name' => esc_html__( 'Pie', 'visualizer' ),
163
+ 'enabled' => true,
164
+ ),
165
+ 'line' => array(
166
+ 'name' => esc_html__( 'Line', 'visualizer' ),
167
+ 'enabled' => true,
168
+ ),
169
+ 'area' => array(
170
+ 'name' => esc_html__( 'Area', 'visualizer' ),
171
+ 'enabled' => true,
172
+ ),
173
+ 'geo' => array(
174
+ 'name' => esc_html__( 'Geo', 'visualizer' ),
175
+ 'enabled' => true,
176
+ ),
177
+ 'bar' => array(
178
+ 'name' => esc_html__( 'Bar', 'visualizer' ),
179
+ 'enabled' => true,
180
+ ),
181
+ 'column' => array(
182
+ 'name' => esc_html__( 'Column', 'visualizer' ),
183
+ 'enabled' => true,
184
+ ),
185
+ 'gauge' => array(
186
+ 'name' => esc_html__( 'Gauge', 'visualizer' ),
187
+ 'enabled' => true,
188
+ ),
189
+ 'scatter' => array(
190
+ 'name' => esc_html__( 'Scatter', 'visualizer' ),
191
+ 'enabled' => true,
192
+ ),
193
+ 'candlestick' => array(
194
+ 'name' => esc_html__( 'Candlestick', 'visualizer' ),
195
+ 'enabled' => true,
196
+ ),
197
+ // pro types
198
+ 'table' => array(
199
+ 'name' => esc_html__( 'Table', 'visualizer' ),
200
+ 'enabled' => false,
201
+ ),
202
+ 'timeline' => array(
203
+ 'name' => esc_html__( 'Timeline', 'visualizer' ),
204
+ 'enabled' => false,
205
+ ),
206
+ 'combo' => array(
207
+ 'name' => esc_html__( 'Combo', 'visualizer' ),
208
+ 'enabled' => false,
209
+ ),
210
+ );
211
+ $types = apply_filters( 'visualizer_pro_chart_types', $types );
212
+ if ( $enabledOnly ) {
213
+ $filtered = array();
214
+ foreach ( $types as $type => $array ) {
215
+ if ( ! is_array( $array ) ) {
216
+ // support for old pro
217
+ $array = array( 'enabled' => true, 'name' => $array );
218
+ }
219
+ if ( ! $array['enabled'] ) {
220
+ continue;
221
+ }
222
+ $filtered[ $type ] = $array;
223
+ }
224
+ $types = $filtered;
225
+ }
226
+ if ( $get2Darray ) {
227
+ $doubleD = array();
228
+ foreach ( $types as $type => $array ) {
229
+ if ( ! is_array( $array ) ) {
230
+ // support for old pro
231
+ $array = array( 'enabled' => true, 'name' => $array );
232
+ }
233
+ $doubleD[ $type ] = $array['name'];
234
+ }
235
+ $types = $doubleD;
236
+ }
237
+
238
+ return $types;
239
+ }
240
+
241
  /**
242
  * Renders templates to use in media popup.
243
  *
248
  */
249
  public function renderTempaltes() {
250
  global $pagenow;
 
251
  if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) {
252
  return;
253
  }
 
254
  $render = new Visualizer_Render_Templates();
255
  $render->render();
256
  }
264
  * @uses wp_enqueue_media() To enqueue media stuff.
265
  *
266
  * @access public
267
+ *
268
  * @param string $suffix The current page suffix.
269
  */
270
  public function enqueueLibraryScripts( $suffix ) {
271
  if ( $suffix == $this->_libraryPage ) {
272
  wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION );
 
273
  $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' );
 
274
  wp_enqueue_media();
275
+ wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array(
276
+ 'jquery',
277
+ 'media-views',
278
+ ), Visualizer_Plugin::VERSION, true );
279
  wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
280
  wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
281
+ wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array(
282
+ 'google-jsapi-old',
283
+ 'visualizer-library',
284
+ ), Visualizer_Plugin::VERSION, true );
285
  }
286
  }
287
 
291
  * @since 1.0.0
292
  *
293
  * @access public
294
+ *
295
  * @param array $tabs The array of media upload tabs.
296
+ *
297
  * @return array Extended array of media upload tabs.
298
  */
299
  public function setupVisualizerTab( $tabs ) {
300
  $tabs['visualizer'] = 'Visualizer';
301
+
302
  return $tabs;
303
  }
304
 
310
  * @access public
311
  */
312
  public function registerAdminMenu() {
313
+ $title = esc_html__( 'Visualizer Library', 'visualizer' );
314
+ $callback = array( $this, 'renderLibraryPage' );
315
  $this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
316
  }
317
 
330
  'default' => 1,
331
  ),
332
  ) );
 
333
  // the initial query arguments to fetch charts
334
  $query_args = array(
335
  'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
336
  'posts_per_page' => 6,
337
  'paged' => $page,
338
  );
 
339
  // add chart type filter to the query arguments
340
  $filter = filter_input( INPUT_GET, 'type' );
341
  if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
349
  } else {
350
  $filter = 'all';
351
  }
 
352
  // Added by Ash/Upwork
353
+ $filterByMeta = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
354
  if ( $filterByMeta ) {
355
+ $query = array(
356
+ 'key' => Visualizer_Plugin::CF_SETTINGS,
357
+ 'value' => $filterByMeta,
358
+ 'compare' => 'LIKE',
359
  );
360
+ $meta = isset( $query_args['meta_query'] ) ? $query_args['meta_query'] : array();
361
+ $meta[] = $query;
362
+ $query_args['meta_query'] = $meta;
363
  }
364
  // Added by Ash/Upwork
365
  // fetch charts
366
  $charts = array();
367
+ $query = new WP_Query( $query_args );
368
  while ( $query->have_posts() ) {
369
  $chart = $query->next_post();
 
370
  // fetch and update settings
371
  $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
372
  unset( $settings['height'], $settings['width'] );
373
+ $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
 
374
  $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
375
+ $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
 
376
  // add chart to the array
377
  $charts[ 'visualizer-' . $chart->ID ] = array(
378
  'id' => $chart->ID,
382
  'data' => $data,
383
  );
384
  }
 
385
  // enqueue charts array
386
  $ajaxurl = admin_url( 'admin-ajax.php' );
387
  wp_localize_script( 'visualizer-library', 'visualizer', array(
388
  'charts' => $charts,
389
  'urls' => array(
390
  'base' => add_query_arg( 'vpage', false ),
391
+ 'create' => add_query_arg( array(
392
+ 'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
393
+ 'library' => 'yes',
394
+ ), $ajaxurl ),
395
+ 'edit' => add_query_arg( array(
396
+ 'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
397
+ 'library' => 'yes',
398
+ ), $ajaxurl ),
399
+ 'logger' => add_query_arg( array(
400
+ 'action' => Visualizer_Plugin::ACTION_TRACK,
401
+ 'library' => 'yes',
402
+ 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_TRACK ),
403
+ ), $ajaxurl ),
404
  ),
405
  ) );
 
406
  // render library page
407
+ $render = new Visualizer_Render_Library();
408
+ $render->charts = $charts;
409
+ $render->type = $filter;
410
+ $render->types = self::_getChartTypesLocalized();
 
411
  $render->pagination = paginate_links( array(
412
  'base' => add_query_arg( 'vpage', '%#%' ),
413
  'format' => '',
415
  'total' => $query->max_num_pages,
416
  'type' => 'array',
417
  ) );
 
418
  $render->render();
419
  }
420
 
424
  * @since 1.0.0
425
  *
426
  * @access public
427
+ *
428
  * @param array $links The array of original action links.
429
  * @param string $file The plugin basename.
430
+ *
431
  * @return array Updated array of action links.
432
  */
433
  public function getPluginActionLinks( $links, $file ) {
451
  * @since 1.0.0
452
  *
453
  * @access public
454
+ *
455
  * @param array $plugin_meta The array of a plugin meta links.
456
  * @param string $plugin_file The plugin's basename.
457
+ *
458
  * @return array Updated array of plugin meta links.
459
  */
460
  public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
classes/Visualizer/Module/Chart.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -47,70 +46,22 @@ class Visualizer_Module_Chart extends Visualizer_Module {
47
  * @since 1.0.0
48
  *
49
  * @access public
 
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
54
-
55
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_GET_CHARTS, 'getCharts' );
56
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_DELETE_CHART, 'deleteChart' );
57
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_CREATE_CHART, 'renderChartPages' );
58
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' );
59
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_UPLOAD_DATA, 'uploadData' );
60
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' );
61
-
62
  // Added by Ash/Upwork
63
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_EXPORT_DATA, 'exportData' );
64
- if ( defined( 'Visualizer_Pro' ) ) {
65
- global $Visualizer_Pro;
66
- list($action, $name, $class) = $Visualizer_Pro->_getAjaxAction( $this );
67
- $this->_addAjaxAction( $action, $name, $class );
68
- }
69
  // Added by Ash/Upwork
70
  }
71
 
72
- /**
73
- * Sends json response.
74
- *
75
- * @since 1.0.0
76
- *
77
- * @access private
78
- * @param array $results The response array.
79
- */
80
- public function _sendResponse( $results ) {
81
- header( 'Content-type: application/json' );
82
- nocache_headers();
83
-
84
- echo json_encode( $results );
85
- exit;
86
- }
87
-
88
- /**
89
- * Returns chart data required for rendering.
90
- *
91
- * @since 1.0.0
92
- *
93
- * @access private
94
- * @param WP_Post $chart The chart object.
95
- * @return array The array of chart data.
96
- */
97
- private function _getChartArray( WP_Post $chart = null ) {
98
- if ( is_null( $chart ) ) {
99
- $chart = $this->_chart;
100
- }
101
-
102
- $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
103
- $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
104
- $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
105
-
106
- return array(
107
- 'type' => $type,
108
- 'series' => $series,
109
- 'settings' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ),
110
- 'data' => $data,
111
- );
112
- }
113
-
114
  /**
115
  * Fetches charts from database.
116
  *
@@ -129,8 +80,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
129
  ),
130
  ) ),
131
  );
132
-
133
- $filter = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
134
  if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
135
  $query_args['meta_query'] = array(
136
  array(
@@ -140,26 +90,64 @@ class Visualizer_Module_Chart extends Visualizer_Module {
140
  ),
141
  );
142
  }
143
-
144
- $query = new WP_Query( $query_args );
145
-
146
  $charts = array();
147
  while ( $query->have_posts() ) {
148
- $chart = $query->next_post();
149
-
150
- $chart_data = $this->_getChartArray( $chart );
151
  $chart_data['id'] = $chart->ID;
152
-
153
- $charts[] = $chart_data;
154
  }
155
-
156
- $this->_sendResponse( array(
157
  'success' => true,
158
  'data' => $charts,
159
  'total' => $query->max_num_pages,
160
  ) );
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Deletes a chart from database.
165
  *
@@ -169,28 +157,30 @@ class Visualizer_Module_Chart extends Visualizer_Module {
169
  * @access public
170
  */
171
  public function deleteChart() {
172
- $is_post = $_SERVER['REQUEST_METHOD'] == 'POST';
173
  $input_method = $is_post ? INPUT_POST : INPUT_GET;
174
-
175
- $chart_id = $success = false;
176
- $nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) );
177
- $capable = current_user_can( 'delete_posts' );
178
  if ( $nonce && $capable ) {
179
- $chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
 
 
 
 
180
  if ( $chart_id ) {
181
- $chart = get_post( $chart_id );
182
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
183
  }
184
  }
185
-
186
  if ( $success ) {
187
  wp_delete_post( $chart_id, true );
188
  }
189
-
190
  if ( $is_post ) {
191
- $this->_sendResponse( array( 'success' => $success ) );
 
 
192
  }
193
-
194
  wp_redirect( wp_get_referer() );
195
  exit;
196
  }
@@ -204,16 +194,13 @@ class Visualizer_Module_Chart extends Visualizer_Module {
204
  * @access public
205
  */
206
  public function renderChartPages() {
207
- define( 'IFRAME_REQUEST', 1 );
208
-
209
  // check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
210
- $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT );
211
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
212
  $default_type = 'line';
213
-
214
- $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
215
  $source->fetch();
216
-
217
  $chart_id = wp_insert_post( array(
218
  'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
219
  'post_title' => 'Visualization',
@@ -221,37 +208,40 @@ class Visualizer_Module_Chart extends Visualizer_Module {
221
  'post_status' => 'auto-draft',
222
  'post_content' => $source->getData(),
223
  ) );
224
-
225
  if ( $chart_id && ! is_wp_error( $chart_id ) ) {
226
  add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type );
227
  add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
228
  add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
229
  add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
230
- add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array( 'focusTarget' => 'datum' ) );
 
 
231
  }
232
-
233
  wp_redirect( add_query_arg( 'chart', (int) $chart_id ) );
234
- exit;
235
  }
236
-
237
  // enqueue and register scripts and styles
238
  wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array(), Visualizer_Plugin::VERSION );
239
-
240
  wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true );
241
  wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
242
  wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
243
- wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi-old', 'google-jsapi-new', 'visualizer-frame' ), Visualizer_Plugin::VERSION, true );
244
- wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array( 'wp-color-picker', 'visualizer-render' ), Visualizer_Plugin::VERSION, true );
245
-
 
 
 
 
 
 
246
  // added by Ash/Upwork
247
- if ( defined( 'Visualizer_Pro' ) ) {
248
  global $Visualizer_Pro;
249
  $Visualizer_Pro->_addScriptsAndStyles();
250
  }
251
-
252
  // dispatch pages
253
- $this->_chart = $chart;
254
- switch ( filter_input( INPUT_GET, 'tab' ) ) {
255
  case 'settings':
256
  // changed by Ash/Upwork
257
  $this->_handleDataAndSettingsPage();
@@ -261,150 +251,56 @@ class Visualizer_Module_Chart extends Visualizer_Module {
261
  $this->_handleTypesPage();
262
  break;
263
  }
264
-
265
- exit;
266
- }
267
-
268
- /**
269
- * Handles chart type selection page.
270
- *
271
- * @since 1.0.0
272
- *
273
- * @access private
274
- */
275
- private function _handleTypesPage() {
276
- // process post request
277
- if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
278
- $type = filter_input( INPUT_POST, 'type' );
279
- if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
280
- // save new chart type
281
- update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, $type );
282
-
283
- // if the chart has default data, update it with appropriate default data for new type
284
- if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) {
285
- $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' );
286
- $source->fetch();
287
-
288
- $this->_chart->post_content = $source->getData();
289
- wp_update_post( $this->_chart->to_array() );
290
-
291
- update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
292
- }
293
-
294
- // redirect to next tab
295
- // changed by Ash/Upwork
296
- wp_redirect( add_query_arg( 'tab', 'settings' ) );
297
- return;
298
- }
299
- }
300
-
301
- $render = new Visualizer_Render_Page_Types();
302
- $render->type = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
303
- $render->types = Visualizer_Module_Admin::_getChartTypesLocalized();
304
- $render->chart = $this->_chart;
305
-
306
- wp_enqueue_style( 'visualizer-frame' );
307
- wp_enqueue_script( 'visualizer-frame' );
308
-
309
- wp_iframe( array( $render, 'render' ) );
310
- }
311
-
312
- /**
313
- * Handles chart data page.
314
- *
315
- * @since 1.0.0
316
- *
317
- * @access private
318
- */
319
- private function _handleDataPage() {
320
- $data = $this->_getChartArray();
321
-
322
- $render = new Visualizer_Render_Page_Data();
323
- $render->chart = $this->_chart;
324
- $render->type = $data['type'];
325
-
326
- unset( $data['settings']['width'], $data['settings']['height'] );
327
-
328
- wp_enqueue_style( 'visualizer-frame' );
329
- wp_enqueue_script( 'visualizer-render' );
330
- wp_localize_script( 'visualizer-render', 'visualizer', array(
331
- 'l10n' => array(
332
- 'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ),
333
- 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
334
- ),
335
- 'charts' => array(
336
- 'canvas' => $data,
337
- ),
338
- ) );
339
-
340
- // Added by Ash/Upwork
341
- if ( defined( 'Visualizer_Pro' ) ) {
342
- global $Visualizer_Pro;
343
- $Visualizer_Pro->_enqueueScriptsAndStyles( $data );
344
- }
345
- // Added by Ash/Upwork
346
- $this->_addAction( 'admin_head', 'renderFlattrScript' );
347
-
348
- wp_iframe( array( $render, 'render' ) );
349
  }
350
 
351
  /**
352
  * Handle data and settings page
353
  */
354
  private function _handleDataAndSettingsPage() {
355
- if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
356
  if ( $this->_chart->post_status == 'auto-draft' ) {
357
  $this->_chart->post_status = 'publish';
358
  wp_update_post( $this->_chart->to_array() );
359
  }
360
-
361
  update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST );
362
-
363
- $render = new Visualizer_Render_Page_Send();
364
  $render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );
365
-
366
  wp_iframe( array( $render, 'render' ) );
 
367
  return;
368
  }
369
-
370
- $data = $this->_getChartArray();
371
-
372
- $sidebar = '';
373
  $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst( $data['type'] );
374
  if ( class_exists( $sidebar_class, true ) ) {
375
- $sidebar = new $sidebar_class( $data['settings'] );
376
  $sidebar->__series = $data['series'];
377
- $sidebar->__data = $data['data'];
378
  } else {
379
- $sidebar = apply_filters( 'visualizer_pro_chart_type_sidebar', '', $data );
380
  if ( $sidebar != '' ) {
381
  $sidebar->__series = $data['series'];
382
- $sidebar->__data = $data['data'];
383
  }
384
  }
385
-
386
  unset( $data['settings']['width'], $data['settings']['height'] );
387
-
388
  wp_enqueue_style( 'visualizer-frame' );
389
  wp_enqueue_style( 'wp-color-picker' );
390
  wp_enqueue_style( 'visualizer-frame' );
391
-
392
  wp_enqueue_script( 'visualizer-preview' );
393
  wp_enqueue_script( 'visualizer-render' );
394
  wp_localize_script( 'visualizer-render', 'visualizer', array(
395
  'l10n' => array(
396
- 'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ),
397
- 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
398
  ),
399
  'charts' => array(
400
  'canvas' => $data,
401
  ),
402
  ) );
403
-
404
- $render = new Visualizer_Render_Page_Data();
405
- $render->chart = $this->_chart;
406
- $render->type = $data['type'];
407
-
408
  $render->sidebar = $sidebar;
409
  if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) {
410
  $render->button = filter_input( INPUT_GET, 'action' ) == Visualizer_Plugin::ACTION_EDIT_CHART
@@ -413,17 +309,52 @@ class Visualizer_Module_Chart extends Visualizer_Module {
413
  } else {
414
  $render->button = esc_attr__( 'Insert Chart', 'visualizer' );
415
  }
416
-
417
- if ( defined( 'Visualizer_Pro' ) ) {
418
  global $Visualizer_Pro;
419
  $Visualizer_Pro->_enqueueScriptsAndStyles( $data );
420
  }
421
-
422
  $this->_addAction( 'admin_head', 'renderFlattrScript' );
 
 
423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  wp_iframe( array( $render, 'render' ) );
425
  }
426
- // changed by Ash/Upwork
427
  /**
428
  * Renders flattr script in the iframe <head>
429
  *
@@ -435,7 +366,7 @@ class Visualizer_Module_Chart extends Visualizer_Module {
435
  public function renderFlattrScript() {
436
  echo '';
437
  }
438
-
439
  /**
440
  * Parses uploaded CSV file and saves new data for the chart.
441
  *
@@ -445,52 +376,51 @@ class Visualizer_Module_Chart extends Visualizer_Module {
445
  */
446
  public function uploadData() {
447
  // validate nonce
448
- if ( ! wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ) ) ) {
 
449
  status_header( 403 );
450
  exit;
451
  }
452
-
453
  // check chart, if chart exists
454
- $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT );
455
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
456
  status_header( 400 );
457
  exit;
458
  }
459
-
 
 
460
  $source = null;
461
  $render = new Visualizer_Render_Page_Update();
462
- if ( filter_input( INPUT_POST, 'remote_data', FILTER_VALIDATE_URL ) ) {
463
  $source = new Visualizer_Source_Csv_Remote( $_POST['remote_data'] );
 
 
 
464
  } elseif ( isset( $_FILES['local_data'] ) && $_FILES['local_data']['error'] == 0 ) {
465
  $source = new Visualizer_Source_Csv( $_FILES['local_data']['tmp_name'] );
466
-
467
  // Added by Ash/Upwork
468
- } elseif ( defined( 'Visualizer_Pro' ) && isset( $_POST['chart_data'] ) && strlen( $_POST['chart_data'] ) > 0 ) {
469
- global $Visualizer_Pro;
470
- $source = $Visualizer_Pro->_handleChartData( $_POST['chart_data'] );
471
  // Added by Ash/Upwork
472
  } else {
473
  $render->message = esc_html__( 'CSV file with chart data was not uploaded. Please, try again.', 'visualizer' );
474
  }
475
-
476
  if ( $source ) {
477
  if ( $source->fetch() ) {
478
  $chart->post_content = $source->getData();
479
  wp_update_post( $chart->to_array() );
480
-
481
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
482
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
483
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
484
-
485
- $render->data = json_encode( $source->getRawData() );
486
  $render->series = json_encode( $source->getSeries() );
487
  } else {
488
  $render->message = esc_html__( 'CSV file is broken or invalid. Please, try again.', 'visualizer' );
489
  }
490
  }
491
-
492
  $render->render();
493
- exit;
494
  }
495
 
496
  /**
@@ -502,16 +432,19 @@ class Visualizer_Module_Chart extends Visualizer_Module {
502
  */
503
  public function cloneChart() {
504
  $chart_id = $success = false;
505
- $nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
506
- $capable = current_user_can( 'edit_posts' );
507
  if ( $nonce && $capable ) {
508
- $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
 
 
 
 
509
  if ( $chart_id ) {
510
- $chart = get_post( $chart_id );
511
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
512
  }
513
  }
514
-
515
  $redirect = wp_get_referer();
516
  if ( $success ) {
517
  $new_chart_id = wp_insert_post( array(
@@ -521,21 +454,18 @@ class Visualizer_Module_Chart extends Visualizer_Module {
521
  'post_status' => $chart->post_status,
522
  'post_content' => $chart->post_content,
523
  ) );
524
-
525
  if ( $new_chart_id && ! is_wp_error( $new_chart_id ) ) {
526
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_CHART_TYPE, get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ) );
527
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) );
528
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) );
529
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SERIES, get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ) );
530
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SETTINGS, get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ) );
531
-
532
  $redirect = add_query_arg( array(
533
  'page' => 'visualizer',
534
  'type' => filter_input( INPUT_GET, 'type' ),
535
  ), admin_url( 'upload.php' ) );
536
  }
537
  }
538
-
539
  wp_redirect( $redirect );
540
  exit;
541
  }
@@ -549,47 +479,48 @@ class Visualizer_Module_Chart extends Visualizer_Module {
549
  */
550
  public function exportData() {
551
  check_ajax_referer( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION, 'security' );
552
-
553
  $chart_id = $success = false;
554
- $capable = current_user_can( 'edit_posts' );
555
  if ( $capable ) {
556
- $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
 
 
 
 
557
  if ( $chart_id ) {
558
- $chart = get_post( $chart_id );
559
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
560
  }
561
  }
562
-
563
  if ( $success ) {
564
- $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
565
- $filename = $settings['title'];
566
  if ( empty( $filename ) ) {
567
- $filename = 'export.csv';
568
  } else {
569
- $filename .= '.csv';
570
  }
571
- $rows = array();
572
- $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
573
- $data = unserialize( $chart->post_content );
574
  if ( ! empty( $series ) ) {
575
- $row = array();
576
  foreach ( $series as $array ) {
577
- $row[] = $array['label'];
578
  }
579
- $rows[] = $row;
580
-
581
  $row = array();
582
  foreach ( $series as $array ) {
583
- $row[] = $array['type'];
584
  }
585
- $rows[] = $row;
586
  }
587
-
588
  if ( ! empty( $data ) ) {
589
  foreach ( $data as $array ) {
590
  // ignore strings
591
- if ( ! is_array( $array ) ) { continue; }
592
-
 
593
  // if this is an array of arrays...
594
  if ( is_array( $array[0] ) ) {
595
  foreach ( $array as $arr ) {
@@ -601,26 +532,57 @@ class Visualizer_Module_Chart extends Visualizer_Module {
601
  }
602
  }
603
  }
604
-
605
- $fp = tmpfile();
606
  foreach ( $rows as $row ) {
607
  fputcsv( $fp, $row );
608
  }
609
  rewind( $fp );
610
-
611
- $csv = '';
612
- while ( ($array = fgetcsv( $fp )) !== false ) {
613
- if ( strlen( $csv ) > 0 ) { $csv .= PHP_EOL; }
614
- $csv .= implode( ',', $array );
 
615
  }
616
  fclose( $fp );
617
-
618
- echo wp_send_json_success(array(
619
- 'csv' => $csv,
620
- 'name' => $filename,
621
- ));
622
  }// End if().
 
 
623
 
624
- exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  }
626
  }
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
46
  * @since 1.0.0
47
  *
48
  * @access public
49
+ *
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
 
54
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_GET_CHARTS, 'getCharts' );
55
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_DELETE_CHART, 'deleteChart' );
56
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_CREATE_CHART, 'renderChartPages' );
57
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_EDIT_CHART, 'renderChartPages' );
58
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_UPLOAD_DATA, 'uploadData' );
59
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_CLONE_CHART, 'cloneChart' );
 
60
  // Added by Ash/Upwork
61
  $this->_addAjaxAction( Visualizer_Plugin::ACTION_EXPORT_DATA, 'exportData' );
 
 
 
 
 
62
  // Added by Ash/Upwork
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Fetches charts from database.
67
  *
80
  ),
81
  ) ),
82
  );
83
+ $filter = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
 
84
  if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
85
  $query_args['meta_query'] = array(
86
  array(
90
  ),
91
  );
92
  }
93
+ $query = new WP_Query( $query_args );
 
 
94
  $charts = array();
95
  while ( $query->have_posts() ) {
96
+ $chart = $query->next_post();
97
+ $chart_data = $this->_getChartArray( $chart );
 
98
  $chart_data['id'] = $chart->ID;
99
+ $charts[] = $chart_data;
 
100
  }
101
+ self::_sendResponse( array(
 
102
  'success' => true,
103
  'data' => $charts,
104
  'total' => $query->max_num_pages,
105
  ) );
106
  }
107
 
108
+ /**
109
+ * Returns chart data required for rendering.
110
+ *
111
+ * @since 1.0.0
112
+ *
113
+ * @access private
114
+ *
115
+ * @param WP_Post $chart The chart object.
116
+ *
117
+ * @return array The array of chart data.
118
+ */
119
+ private function _getChartArray( WP_Post $chart = null ) {
120
+ if ( is_null( $chart ) ) {
121
+ $chart = $this->_chart;
122
+ }
123
+ $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
124
+ $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
125
+ $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
126
+
127
+ return array(
128
+ 'type' => $type,
129
+ 'series' => $series,
130
+ 'settings' => get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true ),
131
+ 'data' => $data,
132
+ );
133
+ }
134
+
135
+ /**
136
+ * Sends json response.
137
+ *
138
+ * @since 1.0.0
139
+ *
140
+ * @access private
141
+ *
142
+ * @param array $results The response array.
143
+ */
144
+ public static function _sendResponse( $results ) {
145
+ header( 'Content-type: application/json' );
146
+ nocache_headers();
147
+ echo json_encode( $results );
148
+ defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
149
+ }
150
+
151
  /**
152
  * Deletes a chart from database.
153
  *
157
  * @access public
158
  */
159
  public function deleteChart() {
160
+ $is_post = $_SERVER['REQUEST_METHOD'] == 'POST';
161
  $input_method = $is_post ? INPUT_POST : INPUT_GET;
162
+ $chart_id = $success = false;
163
+ $nonce = wp_verify_nonce( filter_input( $input_method, 'nonce' ) );
164
+ $capable = current_user_can( 'delete_posts' );
 
165
  if ( $nonce && $capable ) {
166
+ $chart_id = filter_input( $input_method, 'chart', FILTER_VALIDATE_INT, array(
167
+ 'options' => array(
168
+ 'min_range' => 1,
169
+ ),
170
+ ) );
171
  if ( $chart_id ) {
172
+ $chart = get_post( $chart_id );
173
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
174
  }
175
  }
 
176
  if ( $success ) {
177
  wp_delete_post( $chart_id, true );
178
  }
 
179
  if ( $is_post ) {
180
+ self::_sendResponse( array(
181
+ 'success' => $success,
182
+ ) );
183
  }
 
184
  wp_redirect( wp_get_referer() );
185
  exit;
186
  }
194
  * @access public
195
  */
196
  public function renderChartPages() {
197
+ defined( 'IFRAME_REQUEST' ) || define( 'IFRAME_REQUEST', 1 );
 
198
  // check chart, if chart not exists, will create new one and redirects to the same page with proper chart id
199
+ $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
200
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
201
  $default_type = 'line';
202
+ $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
 
203
  $source->fetch();
 
204
  $chart_id = wp_insert_post( array(
205
  'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
206
  'post_title' => 'Visualization',
208
  'post_status' => 'auto-draft',
209
  'post_content' => $source->getData(),
210
  ) );
 
211
  if ( $chart_id && ! is_wp_error( $chart_id ) ) {
212
  add_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, $default_type );
213
  add_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, 1 );
214
  add_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
215
  add_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
216
+ add_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, array(
217
+ 'focusTarget' => 'datum',
218
+ ) );
219
  }
 
220
  wp_redirect( add_query_arg( 'chart', (int) $chart_id ) );
221
+ defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
222
  }
 
223
  // enqueue and register scripts and styles
224
  wp_register_style( 'visualizer-frame', VISUALIZER_ABSURL . 'css/frame.css', array(), Visualizer_Plugin::VERSION );
 
225
  wp_register_script( 'visualizer-frame', VISUALIZER_ABSURL . 'js/frame.js', array( 'jquery' ), Visualizer_Plugin::VERSION, true );
226
  wp_register_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
227
  wp_register_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
228
+ wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array(
229
+ 'google-jsapi-old',
230
+ 'google-jsapi-new',
231
+ 'visualizer-frame',
232
+ ), Visualizer_Plugin::VERSION, true );
233
+ wp_register_script( 'visualizer-preview', VISUALIZER_ABSURL . 'js/preview.js', array(
234
+ 'wp-color-picker',
235
+ 'visualizer-render',
236
+ ), Visualizer_Plugin::VERSION, true );
237
  // added by Ash/Upwork
238
+ if ( VISUALIZER_PRO ) {
239
  global $Visualizer_Pro;
240
  $Visualizer_Pro->_addScriptsAndStyles();
241
  }
 
242
  // dispatch pages
243
+ $this->_chart = get_post( $chart_id );
244
+ switch ( isset( $_GET['tab'] ) ? $_GET['tab'] : '' ) {
245
  case 'settings':
246
  // changed by Ash/Upwork
247
  $this->_handleDataAndSettingsPage();
251
  $this->_handleTypesPage();
252
  break;
253
  }
254
+ defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  }
256
 
257
  /**
258
  * Handle data and settings page
259
  */
260
  private function _handleDataAndSettingsPage() {
261
+ if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'] ) ) {
262
  if ( $this->_chart->post_status == 'auto-draft' ) {
263
  $this->_chart->post_status = 'publish';
264
  wp_update_post( $this->_chart->to_array() );
265
  }
 
266
  update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST );
267
+ $render = new Visualizer_Render_Page_Send();
 
268
  $render->text = sprintf( '[visualizer id="%d"]', $this->_chart->ID );
 
269
  wp_iframe( array( $render, 'render' ) );
270
+
271
  return;
272
  }
273
+ $data = $this->_getChartArray();
274
+ $sidebar = '';
 
 
275
  $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst( $data['type'] );
276
  if ( class_exists( $sidebar_class, true ) ) {
277
+ $sidebar = new $sidebar_class( $data['settings'] );
278
  $sidebar->__series = $data['series'];
279
+ $sidebar->__data = $data['data'];
280
  } else {
281
+ $sidebar = apply_filters( 'visualizer_pro_chart_type_sidebar', '', $data );
282
  if ( $sidebar != '' ) {
283
  $sidebar->__series = $data['series'];
284
+ $sidebar->__data = $data['data'];
285
  }
286
  }
 
287
  unset( $data['settings']['width'], $data['settings']['height'] );
 
288
  wp_enqueue_style( 'visualizer-frame' );
289
  wp_enqueue_style( 'wp-color-picker' );
290
  wp_enqueue_style( 'visualizer-frame' );
 
291
  wp_enqueue_script( 'visualizer-preview' );
292
  wp_enqueue_script( 'visualizer-render' );
293
  wp_localize_script( 'visualizer-render', 'visualizer', array(
294
  'l10n' => array(
295
+ 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
 
296
  ),
297
  'charts' => array(
298
  'canvas' => $data,
299
  ),
300
  ) );
301
+ $render = new Visualizer_Render_Page_Data();
302
+ $render->chart = $this->_chart;
303
+ $render->type = $data['type'];
 
 
304
  $render->sidebar = $sidebar;
305
  if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) {
306
  $render->button = filter_input( INPUT_GET, 'action' ) == Visualizer_Plugin::ACTION_EDIT_CHART
309
  } else {
310
  $render->button = esc_attr__( 'Insert Chart', 'visualizer' );
311
  }
312
+ if ( VISUALIZER_PRO ) {
 
313
  global $Visualizer_Pro;
314
  $Visualizer_Pro->_enqueueScriptsAndStyles( $data );
315
  }
 
316
  $this->_addAction( 'admin_head', 'renderFlattrScript' );
317
+ wp_iframe( array( $render, 'render' ) );
318
+ }
319
 
320
+ /**
321
+ * Handles chart type selection page.
322
+ *
323
+ * @since 1.0.0
324
+ *
325
+ * @access private
326
+ */
327
+ private function _handleTypesPage() {
328
+ // process post request
329
+ if ( $_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
330
+ $type = filter_input( INPUT_POST, 'type' );
331
+ if ( in_array( $type, Visualizer_Plugin::getChartTypes() ) ) {
332
+ // save new chart type
333
+ update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, $type );
334
+ // if the chart has default data, update it with appropriate default data for new type
335
+ if ( filter_var( get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, true ), FILTER_VALIDATE_BOOLEAN ) ) {
336
+ $source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $type . '.csv' );
337
+ $source->fetch();
338
+ $this->_chart->post_content = $source->getData();
339
+ wp_update_post( $this->_chart->to_array() );
340
+ update_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
341
+ }
342
+ // redirect to next tab
343
+ // changed by Ash/Upwork
344
+ wp_redirect( add_query_arg( 'tab', 'settings' ) );
345
+
346
+ return;
347
+ }
348
+ }
349
+ $render = new Visualizer_Render_Page_Types();
350
+ $render->type = get_post_meta( $this->_chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
351
+ $render->types = Visualizer_Module_Admin::_getChartTypesLocalized();
352
+ $render->chart = $this->_chart;
353
+ wp_enqueue_style( 'visualizer-frame' );
354
+ wp_enqueue_script( 'visualizer-frame' );
355
  wp_iframe( array( $render, 'render' ) );
356
  }
357
+
358
  /**
359
  * Renders flattr script in the iframe <head>
360
  *
366
  public function renderFlattrScript() {
367
  echo '';
368
  }
369
+ // changed by Ash/Upwork
370
  /**
371
  * Parses uploaded CSV file and saves new data for the chart.
372
  *
376
  */
377
  public function uploadData() {
378
  // validate nonce
379
+ // do not use filter_input as it does not work for phpunit test cases, use filter_var instead
380
+ if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'] ) ) {
381
  status_header( 403 );
382
  exit;
383
  }
 
384
  // check chart, if chart exists
385
+ $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT ) : '';
386
  if ( ! $chart_id || ! ( $chart = get_post( $chart_id ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) {
387
  status_header( 400 );
388
  exit;
389
  }
390
+ if ( ! isset( $_POST['vz-import-time'] ) ) {
391
+ apply_filters( 'visualizer_pro_remove_schedule', $chart_id );
392
+ }
393
  $source = null;
394
  $render = new Visualizer_Render_Page_Update();
395
+ if ( isset( $_POST['remote_data'] ) && filter_var( $_POST['remote_data'], FILTER_VALIDATE_URL ) ) {
396
  $source = new Visualizer_Source_Csv_Remote( $_POST['remote_data'] );
397
+ if ( isset( $_POST['vz-import-time'] ) ) {
398
+ apply_filters( 'visualizer_pro_chart_schedule', $chart_id, $_POST['remote_data'], $_POST['vz-import-time'] );
399
+ }
400
  } elseif ( isset( $_FILES['local_data'] ) && $_FILES['local_data']['error'] == 0 ) {
401
  $source = new Visualizer_Source_Csv( $_FILES['local_data']['tmp_name'] );
 
402
  // Added by Ash/Upwork
403
+ } elseif ( isset( $_POST['chart_data'] ) && strlen( $_POST['chart_data'] ) > 0 ) {
404
+ $source = apply_filters( 'visualizer_pro_handle_chart_data', $_POST['chart_data'], '' );
 
405
  // Added by Ash/Upwork
406
  } else {
407
  $render->message = esc_html__( 'CSV file with chart data was not uploaded. Please, try again.', 'visualizer' );
408
  }
 
409
  if ( $source ) {
410
  if ( $source->fetch() ) {
411
  $chart->post_content = $source->getData();
412
  wp_update_post( $chart->to_array() );
 
413
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
414
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
415
  update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
416
+ $render->data = json_encode( $source->getRawData() );
 
417
  $render->series = json_encode( $source->getSeries() );
418
  } else {
419
  $render->message = esc_html__( 'CSV file is broken or invalid. Please, try again.', 'visualizer' );
420
  }
421
  }
 
422
  $render->render();
423
+ defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
424
  }
425
 
426
  /**
432
  */
433
  public function cloneChart() {
434
  $chart_id = $success = false;
435
+ $nonce = wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), Visualizer_Plugin::ACTION_CLONE_CHART );
436
+ $capable = current_user_can( 'edit_posts' );
437
  if ( $nonce && $capable ) {
438
+ $chart_id = filter_input( INPUT_GET, 'chart', FILTER_VALIDATE_INT, array(
439
+ 'options' => array(
440
+ 'min_range' => 1,
441
+ ),
442
+ ) );
443
  if ( $chart_id ) {
444
+ $chart = get_post( $chart_id );
445
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
446
  }
447
  }
 
448
  $redirect = wp_get_referer();
449
  if ( $success ) {
450
  $new_chart_id = wp_insert_post( array(
454
  'post_status' => $chart->post_status,
455
  'post_content' => $chart->post_content,
456
  ) );
 
457
  if ( $new_chart_id && ! is_wp_error( $new_chart_id ) ) {
458
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_CHART_TYPE, get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ) );
459
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, get_post_meta( $chart_id, Visualizer_Plugin::CF_DEFAULT_DATA, true ) );
460
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SOURCE, get_post_meta( $chart_id, Visualizer_Plugin::CF_SOURCE, true ) );
461
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SERIES, get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true ) );
462
  add_post_meta( $new_chart_id, Visualizer_Plugin::CF_SETTINGS, get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true ) );
 
463
  $redirect = add_query_arg( array(
464
  'page' => 'visualizer',
465
  'type' => filter_input( INPUT_GET, 'type' ),
466
  ), admin_url( 'upload.php' ) );
467
  }
468
  }
 
469
  wp_redirect( $redirect );
470
  exit;
471
  }
479
  */
480
  public function exportData() {
481
  check_ajax_referer( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION, 'security' );
 
482
  $chart_id = $success = false;
483
+ $capable = current_user_can( 'edit_posts' );
484
  if ( $capable ) {
485
+ $chart_id = isset( $_GET['chart'] ) ? filter_var( $_GET['chart'], FILTER_VALIDATE_INT, array(
486
+ 'options' => array(
487
+ 'min_range' => 1,
488
+ ),
489
+ ) ) : '';
490
  if ( $chart_id ) {
491
+ $chart = get_post( $chart_id );
492
  $success = $chart && $chart->post_type == Visualizer_Plugin::CPT_VISUALIZER;
493
  }
494
  }
 
495
  if ( $success ) {
496
+ $settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
497
+ $filename = isset( $settings['title'] ) ? $settings['title'] : '';
498
  if ( empty( $filename ) ) {
499
+ $filename = 'export.csv';
500
  } else {
501
+ $filename .= '.csv';
502
  }
503
+ $rows = array();
504
+ $series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
505
+ $data = unserialize( $chart->post_content );
506
  if ( ! empty( $series ) ) {
507
+ $row = array();
508
  foreach ( $series as $array ) {
509
+ $row[] = $array['label'];
510
  }
511
+ $rows[] = $row;
 
512
  $row = array();
513
  foreach ( $series as $array ) {
514
+ $row[] = $array['type'];
515
  }
516
+ $rows[] = $row;
517
  }
 
518
  if ( ! empty( $data ) ) {
519
  foreach ( $data as $array ) {
520
  // ignore strings
521
+ if ( ! is_array( $array ) ) {
522
+ continue;
523
+ }
524
  // if this is an array of arrays...
525
  if ( is_array( $array[0] ) ) {
526
  foreach ( $array as $arr ) {
532
  }
533
  }
534
  }
535
+ $fp = tmpfile();
 
536
  foreach ( $rows as $row ) {
537
  fputcsv( $fp, $row );
538
  }
539
  rewind( $fp );
540
+ $csv = '';
541
+ while ( ( $array = fgetcsv( $fp ) ) !== false ) {
542
+ if ( strlen( $csv ) > 0 ) {
543
+ $csv .= PHP_EOL;
544
+ }
545
+ $csv .= implode( ',', $array );
546
  }
547
  fclose( $fp );
548
+ echo wp_send_json_success( array(
549
+ 'csv' => $csv,
550
+ 'name' => $filename,
551
+ ) );
 
552
  }// End if().
553
+ defined( 'WP_TESTS_DOMAIN' ) ? wp_die() : exit();
554
+ }
555
 
556
+ /**
557
+ * Handles chart data page.
558
+ *
559
+ * @since 1.0.0
560
+ *
561
+ * @access private
562
+ */
563
+ private function _handleDataPage() {
564
+ $data = $this->_getChartArray();
565
+ $render = new Visualizer_Render_Page_Data();
566
+ $render->chart = $this->_chart;
567
+ $render->type = $data['type'];
568
+ unset( $data['settings']['width'], $data['settings']['height'] );
569
+ wp_enqueue_style( 'visualizer-frame' );
570
+ wp_enqueue_script( 'visualizer-render' );
571
+ wp_localize_script( 'visualizer-render', 'visualizer', array(
572
+ 'l10n' => array(
573
+ 'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
574
+ ),
575
+ 'charts' => array(
576
+ 'canvas' => $data,
577
+ ),
578
+ ) );
579
+ // Added by Ash/Upwork
580
+ if ( VISUALIZER_PRO ) {
581
+ global $Visualizer_Pro;
582
+ $Visualizer_Pro->_enqueueScriptsAndStyles( $data );
583
+ }
584
+ // Added by Ash/Upwork
585
+ $this->_addAction( 'admin_head', 'renderFlattrScript' );
586
+ wp_iframe( array( $render, 'render' ) );
587
  }
588
  }
classes/Visualizer/Module/Frontend.php CHANGED
@@ -151,7 +151,9 @@ class Visualizer_Module_Frontend extends Visualizer_Module {
151
 
152
  // enqueue visualizer render and update render localizations
153
  wp_enqueue_script( 'visualizer-render' );
154
- wp_localize_script( 'visualizer-render', 'visualizer', array( 'charts' => $this->_charts ) );
 
 
155
 
156
  // return placeholder div
157
  return '<div id="' . $id . '"' . $class . '></div>';
151
 
152
  // enqueue visualizer render and update render localizations
153
  wp_enqueue_script( 'visualizer-render' );
154
+ wp_localize_script( 'visualizer-render', 'visualizer', array(
155
+ 'charts' => $this->_charts,
156
+ ) );
157
 
158
  // return placeholder div
159
  return '<div id="' . $id . '"' . $class . '></div>';
classes/Visualizer/Module/Sources.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -47,13 +46,35 @@ class Visualizer_Module_Sources extends Visualizer_Module {
47
  * @since 1.1.0
48
  *
49
  * @access public
 
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
54
-
55
  $this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_SERIES, 'filterChartSeries', 1, 2 );
56
  $this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA, 'filterChartData', 1, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
@@ -62,7 +83,9 @@ class Visualizer_Module_Sources extends Visualizer_Module {
62
  * @since 1.1.0
63
  *
64
  * @access private
 
65
  * @param int $chart_id The chart id.
 
66
  * @return Visualizer_Source The source object if source exists, otherwise FALSE.
67
  */
68
  private function _getSource( $chart_id ) {
@@ -71,7 +94,6 @@ class Visualizer_Module_Sources extends Visualizer_Module {
71
  if ( ! class_exists( $class, true ) ) {
72
  return false;
73
  }
74
-
75
  $this->_sources[ $chart_id ] = new $class();
76
  }
77
 
@@ -79,41 +101,57 @@ class Visualizer_Module_Sources extends Visualizer_Module {
79
  }
80
 
81
  /**
82
- * Filters chart sereis.
83
  *
84
  * @since 1.1.0
85
  *
86
  * @access public
87
- * @param array $series The array of chart series.
 
88
  * @param int $chart_id The chart id.
89
- * @return array The array of filtered series.
 
90
  */
91
- public function filterChartSeries( $series, $chart_id ) {
92
  $source = $this->_getSource( $chart_id );
93
  if ( ! $source ) {
94
- return $series;
95
  }
96
 
97
- return $source->repopulateSeries( $series, $chart_id );
98
  }
99
 
100
  /**
101
- * Filters chart data.
102
  *
103
- * @since 1.1.0
 
104
  *
105
- * @access public
106
- * @param array $data The array of chart data.
107
- * @param int $chart_id The chart id.
108
- * @return array The array of filtered data.
109
  */
110
- public function filterChartData( $data, $chart_id ) {
111
- $source = $this->_getSource( $chart_id );
112
- if ( ! $source ) {
113
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
 
116
- return $source->repopulateData( $data, $chart_id );
117
  }
118
 
119
  }
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
46
  * @since 1.1.0
47
  *
48
  * @access public
49
+ *
50
  * @param Visualizer_Plugin $plugin The instance of the plugin.
51
  */
52
  public function __construct( Visualizer_Plugin $plugin ) {
53
  parent::__construct( $plugin );
 
54
  $this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_SERIES, 'filterChartSeries', 1, 2 );
55
  $this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA, 'filterChartData', 1, 2 );
56
+ $this->_addFilter( 'visualizer_pro_upsell', 'addProUpsell', 10, 2 );
57
+ }
58
+
59
+ /**
60
+ * Filters chart sereis.
61
+ *
62
+ * @since 1.1.0
63
+ *
64
+ * @access public
65
+ *
66
+ * @param array $series The array of chart series.
67
+ * @param int $chart_id The chart id.
68
+ *
69
+ * @return array The array of filtered series.
70
+ */
71
+ public function filterChartSeries( $series, $chart_id ) {
72
+ $source = $this->_getSource( $chart_id );
73
+ if ( ! $source ) {
74
+ return $series;
75
+ }
76
+
77
+ return $source->repopulateSeries( $series, $chart_id );
78
  }
79
 
80
  /**
83
  * @since 1.1.0
84
  *
85
  * @access private
86
+ *
87
  * @param int $chart_id The chart id.
88
+ *
89
  * @return Visualizer_Source The source object if source exists, otherwise FALSE.
90
  */
91
  private function _getSource( $chart_id ) {
94
  if ( ! class_exists( $class, true ) ) {
95
  return false;
96
  }
 
97
  $this->_sources[ $chart_id ] = new $class();
98
  }
99
 
101
  }
102
 
103
  /**
104
+ * Filters chart data.
105
  *
106
  * @since 1.1.0
107
  *
108
  * @access public
109
+ *
110
+ * @param array $data The array of chart data.
111
  * @param int $chart_id The chart id.
112
+ *
113
+ * @return array The array of filtered data.
114
  */
115
+ public function filterChartData( $data, $chart_id ) {
116
  $source = $this->_getSource( $chart_id );
117
  if ( ! $source ) {
118
+ return $data;
119
  }
120
 
121
+ return $source->repopulateData( $data, $chart_id );
122
  }
123
 
124
  /**
125
+ * Add the pro upsell html.
126
  *
127
+ * @param string $old The previous html string.
128
+ * @param string $feature What feature is this filter running for.
129
  *
130
+ * @return string The new html code.
 
 
 
131
  */
132
+ public function addProUpsell( $old, $feature = null ) {
133
+ $return = '';
134
+ $feature = strval( $feature );
135
+ if ( empty( $feature ) || ( $feature == 'schedule-chart' && ! apply_filters( 'visualizer_is_business', false ) ) ) {
136
+ $plan = 'PRO';
137
+ if ( $feature === 'schedule-chart' ) {
138
+ $plan = 'BUSINESS';
139
+ }
140
+ $return = '<div class="only-pro-content">';
141
+ $return .= ' <div class="only-pro-container">';
142
+ $return .= ' <div class="only-pro-inner">';
143
+ $return .= ' <p>' . sprintf( __( 'Enable this feature in %s version!', 'visualizer' ), $plan ) . '</p>';
144
+ $return .= ' <a target="_blank" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" title="' . __( 'Buy now', 'visualizer' ) . '">' . __( 'Buy now', 'visualizer' ) . '</a>';
145
+ $return .= ' </div>';
146
+ $return .= ' </div>';
147
+ $return .= '</div>';
148
+ }
149
+ if ( empty( $feature ) && defined( 'VISUALIZER_PRO_VERSION' ) ) {
150
+ remove_filter( 'visualizer_pro_upsell', 'addProUpsell', 10, 1 );
151
+ $return = '';
152
  }
153
 
154
+ return $return;
155
  }
156
 
157
  }
classes/Visualizer/Plugin.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -28,38 +27,41 @@
28
  */
29
  class Visualizer_Plugin {
30
 
31
- const NAME = 'visualizer';
32
- const VERSION = '1.7.6';
33
 
34
  // custom post types
35
  const CPT_VISUALIZER = 'visualizer';
36
 
37
  // custom meta fields
38
- const CF_CHART_TYPE = 'visualizer-chart-type';
39
- const CF_SOURCE = 'visualizer-source';
40
- const CF_SERIES = 'visualizer-series';
41
  const CF_DEFAULT_DATA = 'visualizer-default-data';
42
- const CF_SETTINGS = 'visualizer-settings';
43
 
44
  // custom actions
45
- const ACTION_GET_CHARTS = 'visualizer-get-charts';
 
46
  const ACTION_CREATE_CHART = 'visualizer-create-chart';
47
- const ACTION_EDIT_CHART = 'visualizer-edit-chart';
48
- const ACTION_CLONE_CHART = 'visualizer-clone-chart';
49
  const ACTION_DELETE_CHART = 'visualizer-delete-chart';
50
- const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
51
  // Added by Ash/Upwork
52
- const ACTION_EXPORT_DATA = 'visualizer-export-data';
53
 
54
  // custom filters
55
  const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
56
- const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
57
- const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
58
- const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';
59
 
 
 
60
  // Added by Ash/Upwork
61
- const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/';
62
- const PRO_TEASER_TITLE = 'Check PRO version ';
63
  // Added by Ash/Upwork
64
  /**
65
  * Singletone instance of the plugin.
@@ -88,16 +90,8 @@ class Visualizer_Plugin {
88
  *
89
  * @access private
90
  */
91
- private function __construct() {}
92
-
93
- /**
94
- * Private clone method.
95
- *
96
- * @since 1.0.0
97
- *
98
- * @access private
99
- */
100
- private function __clone() {}
101
 
102
  /**
103
  * Returns singletone instance of the plugin.
@@ -116,13 +110,30 @@ class Visualizer_Plugin {
116
  return self::$_instance;
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Returns a module if it was registered before. Otherwise NULL.
121
  *
122
  * @since 1.0.0
123
  *
124
  * @access public
 
125
  * @param string $name The name of the module to return.
 
126
  * @return Visualizer_Module|null Returns a module if it was registered or NULL.
127
  */
128
  public function getModule( $name ) {
@@ -135,7 +146,9 @@ class Visualizer_Plugin {
135
  * @since 1.0.0
136
  *
137
  * @access public
 
138
  * @param string $name The name of a module to check.
 
139
  * @return boolean TRUE if the module has been registered. Otherwise FALSE.
140
  */
141
  public function hasModule( $name ) {
@@ -148,6 +161,7 @@ class Visualizer_Plugin {
148
  * @since 1.0.0
149
  *
150
  * @access public
 
151
  * @param string $class The name of the module to use in the plugin.
152
  */
153
  public function setModule( $class ) {
@@ -155,17 +169,13 @@ class Visualizer_Plugin {
155
  }
156
 
157
  /**
158
- * Returns chart types.
159
  *
160
  * @since 1.0.0
161
  *
162
- * @static
163
- * @access public
164
- * @return array
165
  */
166
- public static function getChartTypes() {
167
- $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() );
168
- return $array;
169
  }
170
 
171
  }
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
27
  */
28
  class Visualizer_Plugin {
29
 
30
+ const NAME = 'visualizer';
31
+ const VERSION = '2.0.0';
32
 
33
  // custom post types
34
  const CPT_VISUALIZER = 'visualizer';
35
 
36
  // custom meta fields
37
+ const CF_CHART_TYPE = 'visualizer-chart-type';
38
+ const CF_SOURCE = 'visualizer-source';
39
+ const CF_SERIES = 'visualizer-series';
40
  const CF_DEFAULT_DATA = 'visualizer-default-data';
41
+ const CF_SETTINGS = 'visualizer-settings';
42
 
43
  // custom actions
44
+ const ACTION_GET_CHARTS = 'visualizer-get-charts';
45
+ const ACTION_TRACK = 'visualizer-track';
46
  const ACTION_CREATE_CHART = 'visualizer-create-chart';
47
+ const ACTION_EDIT_CHART = 'visualizer-edit-chart';
48
+ const ACTION_CLONE_CHART = 'visualizer-clone-chart';
49
  const ACTION_DELETE_CHART = 'visualizer-delete-chart';
50
+ const ACTION_UPLOAD_DATA = 'visualizer-upload-data';
51
  // Added by Ash/Upwork
52
+ const ACTION_EXPORT_DATA = 'visualizer-export-data';
53
 
54
  // custom filters
55
  const FILTER_CHART_WRAPPER_CLASS = 'visualizer-chart-wrapper-class';
56
+ const FILTER_GET_CHART_SERIES = 'visualizer-get-chart-series';
57
+ const FILTER_GET_CHART_DATA = 'visualizer-get-chart-data';
58
+ const FILTER_GET_CHART_SETTINGS = 'visualizer-get-chart-settings';
59
 
60
+ const CF_CHART_URL = 'visualizer-chart-url';
61
+ const CF_CHART_SCHEDULE = 'visualizer-chart-schedule';
62
  // Added by Ash/Upwork
63
+ const PRO_TEASER_URL = 'http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/';
64
+ const PRO_TEASER_TITLE = 'Check PRO version ';
65
  // Added by Ash/Upwork
66
  /**
67
  * Singletone instance of the plugin.
90
  *
91
  * @access private
92
  */
93
+ private function __construct() {
94
+ }
 
 
 
 
 
 
 
 
95
 
96
  /**
97
  * Returns singletone instance of the plugin.
110
  return self::$_instance;
111
  }
112
 
113
+ /**
114
+ * Returns chart types.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @static
119
+ * @access public
120
+ * @return array
121
+ */
122
+ public static function getChartTypes() {
123
+ $array = array_keys( Visualizer_Module_Admin::_getChartTypesLocalized() );
124
+
125
+ return $array;
126
+ }
127
+
128
  /**
129
  * Returns a module if it was registered before. Otherwise NULL.
130
  *
131
  * @since 1.0.0
132
  *
133
  * @access public
134
+ *
135
  * @param string $name The name of the module to return.
136
+ *
137
  * @return Visualizer_Module|null Returns a module if it was registered or NULL.
138
  */
139
  public function getModule( $name ) {
146
  * @since 1.0.0
147
  *
148
  * @access public
149
+ *
150
  * @param string $name The name of a module to check.
151
+ *
152
  * @return boolean TRUE if the module has been registered. Otherwise FALSE.
153
  */
154
  public function hasModule( $name ) {
161
  * @since 1.0.0
162
  *
163
  * @access public
164
+ *
165
  * @param string $class The name of the module to use in the plugin.
166
  */
167
  public function setModule( $class ) {
169
  }
170
 
171
  /**
172
+ * Private clone method.
173
  *
174
  * @since 1.0.0
175
  *
176
+ * @access private
 
 
177
  */
178
+ private function __clone() {
 
 
179
  }
180
 
181
  }
classes/Visualizer/Render/Library.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -30,51 +29,39 @@
30
  class Visualizer_Render_Library extends Visualizer_Render {
31
 
32
  /**
33
- * Renders chart's box block.
34
  *
35
  * @since 1.0.0
36
  *
37
- * @access private
38
- * @param string $placeholder_id The placeholder's id for the chart.
39
- * @param int $chart_id The id of the chart.
40
  */
41
- private function _renderChartBox( $placeholder_id, $chart_id ) {
42
- $ajax_url = admin_url( 'admin-ajax.php' );
43
-
44
- $delete_url = add_query_arg( array(
45
- 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
46
- 'nonce' => wp_create_nonce(),
47
- 'chart' => $chart_id,
48
- ), $ajax_url );
49
-
50
- $clone_url = add_query_arg( array(
51
- 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
52
- 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
53
- 'chart' => $chart_id,
54
- 'type' => $this->type,
55
- ), $ajax_url );
56
-
57
- $export_link = add_query_arg( array(
58
- 'action' => Visualizer_Plugin::ACTION_EXPORT_DATA,
59
- 'chart' => $chart_id,
60
- 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION ),
61
- ), admin_url( 'admin-ajax.php' ) );
62
-
63
- echo '<div class="visualizer-chart">';
64
- echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
65
- echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
66
- echo '</div>';
67
- echo '<div class="visualizer-chart-footer visualizer-clearfix">';
68
- echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>';
69
- echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>';
70
- echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>';
71
- echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>';
72
 
73
- echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">';
74
- echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
75
- echo '</span>';
 
 
 
 
 
 
 
 
 
 
76
  echo '</div>';
77
- echo '</div>';
78
  }
79
 
80
  /**
@@ -86,27 +73,29 @@ class Visualizer_Render_Library extends Visualizer_Render {
86
  */
87
  private function _renderLibrary() {
88
  // Added by Ash/Upwork
89
- $filterBy = null;
90
- if ( isset( $_GET['filter'] ) && strlen( $_GET['filter'] ) > 0 ) {
91
- $filterBy = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
92
  }
93
- echo '<div id="visualizer-search"><form action="" method="get">
94
- <input type="text" name="filter" value="' . $filterBy . '">
95
- <input type="hidden" name="page" value="visualizer">
96
- <input type="submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
97
- </form></div>';
98
  // Added by Ash/Upwork
99
  echo '<div id="visualizer-types" class="visualizer-clearfix">';
100
- echo '<ul>';
101
  foreach ( $this->types as $type => $array ) {
102
- $label = $array['name'];
103
- $link = '<a class="page-numbers" href="' . esc_url( add_query_arg( array( 'type' => $type, 'vpage' => false ) ) ) . '">';
 
 
 
 
 
 
 
104
  if ( ! $array['enabled'] ) {
105
- $link = "<a class='pro-upsell page-numbers' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
106
  }
107
- echo '<li class="visualizer-list-item">';
108
  if ( $type == $this->type ) {
109
- echo '<a class="page-numbers current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
110
  echo $label;
111
  echo '</a>';
112
  } else {
@@ -114,79 +103,119 @@ class Visualizer_Render_Library extends Visualizer_Render {
114
  echo $label;
115
  echo '</a>';
116
  }
117
- echo '</li>';
118
  }
119
- echo '</ul>';
 
 
 
 
 
120
  echo '</div>';
121
-
122
  if ( ! empty( $this->charts ) ) {
123
  echo '<div id="visualizer-library" class="visualizer-clearfix">';
124
- foreach ( $this->charts as $placeholder_id => $chart ) {
125
  $this->_renderChartBox( $placeholder_id, $chart['id'] );
126
  }
127
  echo '</div>';
128
-
129
  if ( is_array( $this->pagination ) ) {
130
- echo '<ul class="visualizer-library-pagination">';
131
  foreach ( $this->pagination as $page ) {
132
- echo '<li class="visualizer-list-item">', $page, '</li>';
133
  }
134
  echo '</ul>';
135
  }
136
  } else {
137
  echo '<div id="visualizer-library" class="visualizer-clearfix">';
138
- echo '<div class="visualizer-chart">';
139
- echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
140
- echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
141
- echo '</div>';
142
- echo '<div class="visualizer-chart-footer visualizer-clearfix">';
143
- echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
144
- echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
145
- echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
146
- echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>';
147
-
148
- echo '<span class="visualizer-chart-shortcode">';
149
- echo '&nbsp;[visualizer]&nbsp;';
150
- echo '</span>';
151
- echo '</div>';
152
- echo '</div>';
153
  echo '</div>';
154
  }
 
 
155
  }
156
 
157
  /**
158
- * Renders library page.
159
  *
160
  * @since 1.0.0
161
  *
162
- * @access protected
 
 
 
163
  */
164
- protected function _toHTML() {
165
- echo '<div class="wrap">';
166
- echo '<div id="visualizer-icon" class="icon32"><br></div>';
167
- echo '<h2>';
168
- esc_html_e( 'Visualizer Library', 'visualizer' );
169
- echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', 'visualizer' ), '</a>';
170
- echo '</h2>';
171
-
172
- $this->_renderMessages();
173
- $this->_renderLibrary();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  echo '</div>';
175
  }
176
 
177
  /**
178
- * Renders notification messages if need be.
179
- *
180
- * @since 1.4.2
181
- *
182
- * @access private
183
  */
184
- private function _renderMessages() {
185
- if ( ! filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
186
- echo '<div class="updated error">';
187
- echo '<p>';
188
- printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', 'visualizer' ), '<b>allow_url_fopen</b>' );
189
- echo '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  echo '</div>';
191
  }
192
  }
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
29
  class Visualizer_Render_Library extends Visualizer_Render {
30
 
31
  /**
32
+ * Renders library page.
33
  *
34
  * @since 1.0.0
35
  *
36
+ * @access protected
 
 
37
  */
38
+ protected function _toHTML() {
39
+ echo '<div class="wrap">';
40
+ echo '<div id="visualizer-icon" class="icon32"><br></div>';
41
+ echo '<h2>';
42
+ esc_html_e( 'Visualizer Library', 'visualizer' );
43
+ echo ' <a href="javascript:;" class="add-new-h2">', esc_html__( 'Add New', 'visualizer' ), '</a>';
44
+ echo '</h2>';
45
+ $this->_renderMessages();
46
+ $this->_renderLibrary();
47
+ echo '</div>';
48
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ /**
51
+ * Renders notification messages if need be.
52
+ *
53
+ * @since 1.4.2
54
+ *
55
+ * @access private
56
+ */
57
+ private function _renderMessages() {
58
+ if ( ! filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) {
59
+ echo '<div class="updated error">';
60
+ echo '<p>';
61
+ printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', 'visualizer' ), '<b>allow_url_fopen</b>' );
62
+ echo '</p>';
63
  echo '</div>';
64
+ }
65
  }
66
 
67
  /**
73
  */
74
  private function _renderLibrary() {
75
  // Added by Ash/Upwork
76
+ $filterBy = null;
77
+ if ( isset( $_GET['s'] ) && strlen( $_GET['s'] ) > 0 ) {
78
+ $filterBy = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
79
  }
 
 
 
 
 
80
  // Added by Ash/Upwork
81
  echo '<div id="visualizer-types" class="visualizer-clearfix">';
82
+ echo '<ul class="subsubsub">';
83
  foreach ( $this->types as $type => $array ) {
84
+ if ( ! is_array( $array ) ) {
85
+ // support for old pro
86
+ $array = array( 'enabled' => true, 'name' => $array );
87
+ }
88
+ $label = $array['name'];
89
+ $link = '<a class=" " href="' . esc_url( add_query_arg( array(
90
+ 'type' => $type,
91
+ 'vpage' => false,
92
+ ) ) ) . '">';
93
  if ( ! $array['enabled'] ) {
94
+ $link = "<a class=' visualizer-pro-only' href='" . Visualizer_Plugin::PRO_TEASER_URL . "' target='_blank'>";
95
  }
96
+ echo '<li class="visualizer-list-item all">';
97
  if ( $type == $this->type ) {
98
+ echo '<a class=" current" href="', esc_url( add_query_arg( 'vpage', false ) ), '">';
99
  echo $label;
100
  echo '</a>';
101
  } else {
103
  echo $label;
104
  echo '</a>';
105
  }
106
+ echo ' | </li>';
107
  }
108
+ echo '</ul>';
109
+ echo '<form action="" method="get"><p id="visualizer-search" class="search-box">
110
+ <input type="search" name="s" value="' . $filterBy . '">
111
+ <input type="hidden" name="page" value="visualizer">
112
+ <input type="submit" id="search-submit" class="button button-secondary" value="' . esc_attr__( 'Search', 'visualizer' ) . '">
113
+ </p> </form>';
114
  echo '</div>';
115
+ echo '<div id="visualizer-content-wrapper">';
116
  if ( ! empty( $this->charts ) ) {
117
  echo '<div id="visualizer-library" class="visualizer-clearfix">';
118
+ foreach ( $this->charts as $placeholder_id => $chart ) {
119
  $this->_renderChartBox( $placeholder_id, $chart['id'] );
120
  }
121
  echo '</div>';
 
122
  if ( is_array( $this->pagination ) ) {
123
+ echo '<ul class=" subsubsub">';
124
  foreach ( $this->pagination as $page ) {
125
+ echo '<li class="all">', $page, '</li>';
126
  }
127
  echo '</ul>';
128
  }
129
  } else {
130
  echo '<div id="visualizer-library" class="visualizer-clearfix">';
131
+ echo '<div class="visualizer-chart">';
132
+ echo '<div class="visualizer-chart-canvas visualizer-nochart-canvas">';
133
+ echo '<div class="visualizer-notfound">', esc_html__( 'No charts found', 'visualizer' ), '</div>';
134
+ echo '</div>';
135
+ echo '<div class="visualizer-chart-footer visualizer-clearfix">';
136
+ echo '<span class="visualizer-chart-action visualizer-nochart-delete"></span>';
137
+ echo '<span class="visualizer-chart-action visualizer-nochart-clone"></span>';
138
+ echo '<span class="visualizer-chart-action visualizer-nochart-edit"></span>';
139
+ echo '<span class="visualizer-chart-action visualizer-nochart-export"></span>';
140
+ echo '<span class="visualizer-chart-shortcode">';
141
+ echo '&nbsp;[visualizer]&nbsp;';
142
+ echo '</span>';
143
+ echo '</div>';
144
+ echo '</div>';
 
145
  echo '</div>';
146
  }
147
+ $this->_renderSidebar();
148
+ echo '</div>';
149
  }
150
 
151
  /**
152
+ * Renders chart's box block.
153
  *
154
  * @since 1.0.0
155
  *
156
+ * @access private
157
+ *
158
+ * @param string $placeholder_id The placeholder's id for the chart.
159
+ * @param int $chart_id The id of the chart.
160
  */
161
+ private function _renderChartBox( $placeholder_id, $chart_id ) {
162
+ $ajax_url = admin_url( 'admin-ajax.php' );
163
+ $delete_url = add_query_arg( array(
164
+ 'action' => Visualizer_Plugin::ACTION_DELETE_CHART,
165
+ 'nonce' => wp_create_nonce(),
166
+ 'chart' => $chart_id,
167
+ ), $ajax_url );
168
+ $clone_url = add_query_arg( array(
169
+ 'action' => Visualizer_Plugin::ACTION_CLONE_CHART,
170
+ 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ),
171
+ 'chart' => $chart_id,
172
+ 'type' => $this->type,
173
+ ), $ajax_url );
174
+ $export_link = add_query_arg( array(
175
+ 'action' => Visualizer_Plugin::ACTION_EXPORT_DATA,
176
+ 'chart' => $chart_id,
177
+ 'security' => wp_create_nonce( Visualizer_Plugin::ACTION_EXPORT_DATA . Visualizer_Plugin::VERSION ),
178
+ ), admin_url( 'admin-ajax.php' ) );
179
+ echo '<div class="visualizer-chart">';
180
+ echo '<div id="', $placeholder_id, '" class="visualizer-chart-canvas">';
181
+ echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
182
+ echo '</div>';
183
+ echo '<div class="visualizer-chart-footer visualizer-clearfix">';
184
+ echo '<a class="visualizer-chart-action visualizer-chart-delete" href="', $delete_url, '" title="', esc_attr__( 'Delete', 'visualizer' ), '" onclick="return showNotice.warn();"></a>';
185
+ echo '<a class="visualizer-chart-action visualizer-chart-clone" href="', $clone_url, '" title="', esc_attr__( 'Clone', 'visualizer' ), '"></a>';
186
+ echo '<a class="visualizer-chart-action visualizer-chart-edit" href="javascript:;" title="', esc_attr__( 'Edit', 'visualizer' ), '" data-chart="', $chart_id, '"></a>';
187
+ echo '<a class="visualizer-chart-action visualizer-chart-export" href="javascript:;" title="', esc_attr__( 'Export', 'visualizer' ), '" data-chart="', $export_link, '"></a>';
188
+ echo '<span class="visualizer-chart-shortcode" title="', esc_attr__( 'Click to select', 'visualizer' ), '">';
189
+ echo '&nbsp;[visualizer id=&quot;', $chart_id, '&quot;]&nbsp;';
190
+ echo '</span>';
191
+ echo '</div>';
192
  echo '</div>';
193
  }
194
 
195
  /**
196
+ * Render sidebar.
 
 
 
 
197
  */
198
+ private function _renderSidebar() {
199
+ if ( ! VISUALIZER_PRO ) {
200
+ $checked = apply_filters( 'visualizer_logger_flag', false );
201
+ $checked = ( $checked === false ) ? '' : 'checked';
202
+ echo '<div id="visualizer-sidebar">';
203
+ echo '<div class="visualizer-sidebar-box">';
204
+ echo '<h3>' . __( 'Gain more editing power', 'visualizer' ) . '</h3><ul>';
205
+ echo '<li>' . __( 'Spreadsheet like editor', 'visualizer' ) . '</li>';
206
+ echo '<li>' . __( 'Import from other charts', 'visualizer' ) . '</li>';
207
+ echo '<li>' . __( 'Auto-sync with online files', 'visualizer' ) . '</li>';
208
+ echo '<li>' . __( '3 more chart types', 'visualizer' ) . '</li></ul>';
209
+ echo '<a href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank" class="button button-primary">' . __( 'View more features', 'visualizer' ) . '</a>';
210
+ echo '</div>';
211
+ echo '<div class="visualizer-sidebar-box visualizer-tracking">';
212
+ echo '<label class="visualizer-switch">';
213
+ echo '<input type="checkbox" ' . $checked . ' >';
214
+ echo '<div class="visualizer-slider visualizer-round"></div>';
215
+ echo '</label>';
216
+ echo '<span>' . __( 'Enable Tracking', 'visualizer' ) . '<sup>*</sup></span>';
217
+ echo '<p><small><sup>*</sup>' . __( 'Allow Visualizer to anonymously track how this plugin is used and help us make the plugin better. No sensitive data is tracked.', 'visualizer' ) . '</small></p>';
218
+ echo '</div>';
219
  echo '</div>';
220
  }
221
  }
classes/Visualizer/Render/Page.php CHANGED
@@ -64,17 +64,8 @@ class Visualizer_Render_Page extends Visualizer_Render {
64
  */
65
  protected function _renderSidebar() {
66
  echo '<div id="sidebar">';
67
- echo '<ul class="group-wrapper">';
68
  $this->_renderSidebarContent();
69
- echo '</ul>';
70
 
71
- echo '<div id="rate-the-plugin">';
72
- echo '<div><b>', esc_html__( 'Like the plugin? Show us your love!', 'visualizer' ), '</b></div>';
73
- echo '<div id="rate-stars">&nbsp;</div>';
74
- echo '<a id="rate-link" href="http://wordpress.org/support/view/plugin-reviews/visualizer" target="_blank">';
75
- esc_html_e( 'Rate it on WordPress.org', 'visualizer' );
76
- echo '</a>';
77
- echo '</div>';
78
  echo '</div>';
79
  }
80
 
64
  */
65
  protected function _renderSidebar() {
66
  echo '<div id="sidebar">';
 
67
  $this->_renderSidebarContent();
 
68
 
 
 
 
 
 
 
 
69
  echo '</div>';
70
  }
71
 
classes/Visualizer/Render/Page/Data.php CHANGED
@@ -39,13 +39,13 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
39
  */
40
  protected function _renderContent() {
41
  // Added by Ash/Upwork
42
- if ( defined( 'Visualizer_Pro' ) ) {
43
  global $Visualizer_Pro;
44
  $Visualizer_Pro->_addEditor();
45
  }
46
  // Added by Ash/Upwork
47
  echo '<div id="canvas">';
48
- echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
49
  echo '</div>';
50
  }
51
 
@@ -63,63 +63,176 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
63
  'chart' => $this->chart->ID,
64
  ), admin_url( 'admin-ajax.php' ) );
65
 
66
- echo '<input type="button" name="back_button" class="return-settings-btn preview-btn hidden-setting" value="&laquo; Back">';
67
- echo '<div class="initial-screen">';
68
- echo '<iframe id="thehole" name="thehole"></iframe>';
69
- echo '<p class="group-description">';
70
- esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' );
71
- echo '</p>';
72
-
73
- echo '<p class="group-description">';
74
- esc_html_e( 'If you are unsure about how to format your data CSV then please take a look at this sample:', 'visualizer' );
75
- echo ' <a href="', VISUALIZER_ABSURL, 'samples/', $this->type, '.csv" target="_blank">', $this->type, '.csv</a> ';
76
- printf( esc_html__( 'or read how you can add Google spreadsheet in following %1$sarticle%1$s.', 'visualizer' ), '<a href="https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank">', '</a>' );
77
- echo '</p>';
78
-
79
- echo '<div>';
80
- echo '<form id="csv-form" action="', $upload_link, '" method="post" target="thehole" enctype="multipart/form-data">';
81
- echo '<input type="hidden" id="remote-data" name="remote_data">';
82
- echo '<div class="form-inline">';
83
- echo '<div class="button button-primary file-wrapper computer-btn">';
84
- echo '<input type="file" id="csv-file" class="file" name="local_data">';
85
- esc_attr_e( 'From Computer', 'visualizer' );
86
- echo '</div>';
87
-
88
- echo '<a id="remote-file" class="button from-web from-web-btn" href="javascript:;">', esc_html__( 'From Web', 'visualizer' ), '</a>';
89
- // Added by Ash/Upwork
90
- if ( defined( 'Visualizer_Pro' ) ) {
91
- global $Visualizer_Pro;
92
- $Visualizer_Pro->_addFormElements();
93
- } else {
94
- // Added by Ash/Upwork
95
- echo '<div class="just-on-pro"> </div>';
96
- }
97
- echo '</div>';
98
- echo '</form>';
99
 
100
- // added by Ash/Upwork
101
- if ( defined( 'Visualizer_Pro' ) ) {
102
- global $Visualizer_Pro;
103
- $Visualizer_Pro->_addEditorElements();
104
- } else {
105
- ?>
106
- <a href="<?php echo Visualizer_Plugin::PRO_TEASER_URL;?>" title="<?php echo Visualizer_Plugin::PRO_TEASER_TITLE;?>" class="check-pro-btn" target="_new">
107
- <input type="button" class="button preview preview-btn" id="existing-chart-free" value="<?php esc_attr_e( 'Check PRO Version ', 'visualizer' );?>">
108
- </a>
109
- <?php
110
- }
111
 
112
- echo'<input type="button" name="advanced_button" class="advanced-settings-btn preview-btn" value="' . __( 'Advanced', 'visualizer' ) . ' &raquo;">';
113
- // Added by Ash/Upwork
114
- echo '</div>';
115
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- // changed by Ash/Upwork
118
- echo '<div class= "second-screen hidden-setting">';
119
- echo '<form id="settings-form" action="', add_query_arg( 'nonce', wp_create_nonce() ), '" method="post">';
120
- echo $this->sidebar;
121
- echo '</form>';
122
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  // changed by Ash/Upwork
124
  }
125
 
@@ -134,7 +247,7 @@ class Visualizer_Render_Page_Data extends Visualizer_Render_Page {
134
  // changed by Ash/Upwork
135
  echo '<div class="toolbar-div">';
136
  echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
137
- esc_html_e( 'Back', 'visualizer' );
138
  echo '</a>';
139
  echo '</div>';
140
  echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
39
  */
40
  protected function _renderContent() {
41
  // Added by Ash/Upwork
42
+ if ( VISUALIZER_PRO ) {
43
  global $Visualizer_Pro;
44
  $Visualizer_Pro->_addEditor();
45
  }
46
  // Added by Ash/Upwork
47
  echo '<div id="canvas">';
48
+ echo '<img src="', VISUALIZER_ABSURL, 'images/ajax-loader.gif" class="loader">';
49
  echo '</div>';
50
  }
51
 
63
  'chart' => $this->chart->ID,
64
  ), admin_url( 'admin-ajax.php' ) );
65
 
66
+ ?>
67
+ <iframe id="thehole" name="thehole"></iframe>
68
+ <ul class="group-wrapper full-height">
69
+ <li class="group group-category open" id="vz-chart-source">
70
+ <div class="group-header">
71
+ <h2 class="group-title main-group"><?php _e( 'Chart Data', 'visualizer' ); ?></h2>
72
+ </div>
73
+ <ul class="group-content">
74
+ <ul class="group-wrapper">
75
+ <li class="group">
76
+ <h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Import data from file', 'visualizer' ); ?></h2>
77
+ <div class="group-content">
78
+ <p class="group-description"><?php esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?></p>
79
+ <p class="group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">' , $this->type , '.csv</a>' ); ?></p>
80
+ <form id="vz-csv-file-form" action="<?php echo $upload_link ?>" method="post"
81
+ target="thehole" enctype="multipart/form-data">
82
+ <input type="hidden" id="remote-data" name="remote_data">
83
+ <div class="">
84
+ <input type="file" id="csv-file" name="local_data">
85
+ </div>
86
+ <input type="button" class="button button-primary" id="vz-import-file"
87
+ value="<?php _e( 'Import', 'visualizer' ); ?>">
88
+ </form>
89
+ </div>
90
+ </li>
91
+ <li class="group visualizer-import-url">
92
+ <h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Import data from URL', 'visualizer' ); ?></h2>
93
+ <ul class="group-content">
94
+ <li class="subsection">
95
+ <span class="section-title"><?php _e( 'One time import', 'visualizer' ); ?></span>
 
 
 
96
 
97
+ <div class="section-items">
98
+ <p class="group-description"><?php _e( 'You can use this to import data from a remote CSV file. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' ); ?> </p>
99
+ <p class="group-description"><?php echo sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s %2$s%3$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">' , $this->type , '.csv</a>' ); ?></p>
100
+ <p class="group-description"> <?php _e( 'You can also import data from Google Spreadsheet, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
101
+ <form id="vz-one-time-import" action="<?php echo $upload_link ?>" method="post"
102
+ target="thehole" enctype="multipart/form-data">
103
+ <div class="remote-file-section">
104
+ <input type="url" id="remote-data" name="remote_data"
105
+ placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
106
+ class="visualizer-input">
 
107
 
108
+ </div>
109
+ <input type="button" id="view-remote-file" class="button button-primary"
110
+ value="<?php _e( 'Import', 'visualizer' ); ?>">
111
+ </form>
112
+ </div>
113
+ </li>
114
+ <li class="subsection <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature', 'schedule-chart' ); ?>">
115
+ <span class="section-title visualizer-import-url-schedule"><?php _e( 'Schedule Import', 'visualizer' ); ?><span
116
+ class="dashicons dashicons-lock"></span></span>
117
+ <div class="section-items">
118
+ <p class="group-description"><?php _e( 'You can choose here to synchronize your chart data with a remote CSV file.', 'visualizer' ); ?> </p>
119
+ <p class="group-description"> <?php _e( 'You can also synchronize with your Google Spreadsheet file, for more info check <a href="https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank" >this</a> tutorial', 'visualizer' ); ?></p>
120
+ <p class="group-description"> <?php _e( 'We will update the chart data based on your time interval preference by overwritting the current data with the one from the URL.', 'visualizer' ); ?></p>
121
+ <form id="vz-schedule-import" action="<?php echo $upload_link ?>" method="post"
122
+ target="thehole" enctype="multipart/form-data">
123
+ <div class="remote-file-section">
124
+ <input type="url" id="vz-schedule-url" name="remote_data" value="<?php echo get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_URL, true );?>"
125
+ placeholder="<?php esc_html_e( 'Please enter the URL of CSV file', 'visualizer' ); ?>"
126
+ class="visualizer-input visualizer-remote-url">
127
+ <p class="group-description"><?php _e( 'How often do you want to check the url', 'visualizer' ); ?></p>
128
+ <select name="vz-import-time" id="vz-import-time" class="visualizer-select">
129
+ <?php
130
+ $hours = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_SCHEDULE, true );
131
+ $schedules = array(
132
+ '1' => __( 'Each hour', 'visualizer' ),
133
+ '12' => __( 'Each 12 hours', 'visualizer' ),
134
+ '24' => __( 'Each day', 'visualizer' ),
135
+ '36' => __( 'Each 3 days', 'visualizer' ),
136
+ );
137
+ foreach ( $schedules as $num => $name ) {
138
+ $extra = $num == $hours ? 'selected' : '';
139
+ ?>
140
+ <option value="<?php echo $num;?>" <?php echo $extra;?>><?php echo $name;?></option>
141
+ <?php
142
+ }
143
+ ?>
144
+ </select>
145
+ </div>
146
+ <input type="button" id="vz-save-schedule" class="button button-primary"
147
+ value="<?php _e( 'Save schedule', 'visualizer' ); ?>">
148
 
149
+
150
+ <?php echo apply_filters( 'visualizer_pro_upsell', '', 'schedule-chart' ); ?>
151
+ </form>
152
+ </div>
153
+ </li>
154
+ </ul>
155
+ </li>
156
+ <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?> ">
157
+ <h2 class="group-title sub-group"
158
+ data-current="chart"><?php _e( 'Import from other chart', 'visualizer' ); ?><span
159
+ class="dashicons dashicons-lock"></span></h2>
160
+ <div class="group-content edit-data-content">
161
+ <div>
162
+ <p class="group-description"><?php _e( 'You can import here data from your previously created charts', 'visualizer' ); ?></p>
163
+ <form>
164
+ <select name="vz-import-from-chart" id="chart-id" class="visualizer-select">
165
+ <?php
166
+ $fetch_link = add_query_arg( array(
167
+ 'action' => ( VISUALIZER_PRO ) ? Visualizer_Pro::ACTION_FETCH_DATA : '',
168
+ 'nonce' => wp_create_nonce(),
169
+ ), admin_url( 'admin-ajax.php' ) );
170
+
171
+ $query_args_charts = array(
172
+ 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
173
+ 'posts_per_page' => 300,
174
+ 'no_found_rows' => true,
175
+ );
176
+ $charts = array();
177
+ $query = new WP_Query( $query_args_charts );
178
+ while ( $query->have_posts() ) {
179
+ $chart = $query->next_post();
180
+ $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
181
+ ?>
182
+ <option value="<?php echo $chart->ID; ?>"><?php echo empty( $settings['title'] ) ? '#' . $chart->ID : $settings['title']; ?></option>
183
+ <?php
184
+ }
185
+ ?>
186
+
187
+ </select>
188
+ </form>
189
+ <input type="button" id="existing-chart" class="button button-primary"
190
+ value="<?php _e( 'Import Chart', 'visualizer' ); ?>" data-viz-link="<?php echo $fetch_link;?>">
191
+ <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
192
+ </div>
193
+ </div>
194
+ </li>
195
+ <li class="group <?php echo apply_filters( 'visualizer_pro_upsell_class','only-pro-feature' ); ?>">
196
+ <h2 class="group-title sub-group visualizer-editor-tab"
197
+ data-current="chart"><?php _e( 'Edit current data', 'visualizer' ); ?><span
198
+ class="dashicons dashicons-lock"></span></h2>
199
+ <form id="editor-form" action="<?php echo $upload_link?>" method="post" target="thehole">
200
+ <input type="hidden" id="chart-data" name="chart_data">
201
+ </form>
202
+
203
+ <div class="group-content edit-data-content">
204
+ <div>
205
+ <p class="group-description"><?php _e( 'You can manually edit the chart data using the spreadsheet like editor.', 'visualizer' ); ?></p>
206
+ <input type="button" id="editor-chart-button" class="button button-primary "
207
+ value="<?php _e( 'View Editor', 'visualizer' ); ?>" data-current="chart" data-t-editor="<?php _e( 'Show Chart', 'visualizer' );?>" data-t-chart="<?php _e( 'View Editor', 'visualizer' );?>">
208
+
209
+ <?php echo apply_filters( 'visualizer_pro_upsell', '' ); ?>
210
+ </div>
211
+ </div>
212
+ </li>
213
+ </ul>
214
+ </li>
215
+ </ul>
216
+ <li class="group group-category bottom-fixed " id="vz-chart-settings">
217
+ <h2><?php _e( 'Advanced Settings', 'visualizer' ); ?></h2>
218
+ <div class="group-header">
219
+ <button class="customize-section-back" tabindex="0"></button>
220
+ <h3 class="group-title main-group"><?php _e( 'Chart Settings', 'visualizer' ); ?></h3>
221
+ </div>
222
+ <ul class="group-content">
223
+ <form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() ); ?>"
224
+ method="post">
225
+ <?php echo $this->sidebar; ?>
226
+ </form>
227
+ </ul>
228
+ </li>
229
+ <li class=" group bottom-fixed" id="vz-chart-review">
230
+ <a href="https://wordpress.org/support/plugin/visualizer/reviews/?filter=5#new-post"
231
+ target="_blank"><?php _e( 'Rate our plugin', 'visualizer' ); ?></a>
232
+ </li>
233
+ <li class="group bottom-fixed" id="vz-chart-copyright">Visualizer &copy; 2014</li>
234
+ </ul>
235
+ <?php
236
  // changed by Ash/Upwork
237
  }
238
 
247
  // changed by Ash/Upwork
248
  echo '<div class="toolbar-div">';
249
  echo '<a class="button button-large" href="', add_query_arg( 'tab', 'types' ), '">';
250
+ esc_html_e( 'Back', 'visualizer' );
251
  echo '</a>';
252
  echo '</div>';
253
  echo '<input type="submit" id="settings-button" class="button button-primary button-large push-right" value="', $this->button, '">';
classes/Visualizer/Render/Page/Types.php CHANGED
@@ -90,7 +90,7 @@ class Visualizer_Render_Page_Types extends Visualizer_Render_Page {
90
  * @access protected
91
  */
92
  protected function _renderToolbar() {
93
- if ( defined( 'Visualizer_Pro' ) ) {
94
  global $Visualizer_Pro;
95
  }
96
  echo '<input type="submit" class="button button-primary button-large push-right" value="', esc_attr__( 'Next', 'visualizer' ), '">';
90
  * @access protected
91
  */
92
  protected function _renderToolbar() {
93
+ if ( VISUALIZER_PRO ) {
94
  global $Visualizer_Pro;
95
  }
96
  echo '<input type="submit" class="button button-primary button-large push-right" value="', esc_attr__( 'Next', 'visualizer' ), '">';
classes/Visualizer/Render/Page/Update.php CHANGED
@@ -52,11 +52,10 @@ class Visualizer_Render_Page_Update extends Visualizer_Render_Page {
52
  echo '}';
53
 
54
  // added by Ash/Upwork
55
- if ( defined( 'Visualizer_Pro' ) ) {
56
  global $Visualizer_Pro;
57
  $Visualizer_Pro->_addUpdateHook( $this->series, $this->data );
58
  }
59
- // Added by Ash/Upwork
60
  } else {
61
  echo 'alert("', $this->message, '");';
62
  }
52
  echo '}';
53
 
54
  // added by Ash/Upwork
55
+ if ( VISUALIZER_PRO ) {
56
  global $Visualizer_Pro;
57
  $Visualizer_Pro->_addUpdateHook( $this->series, $this->data );
58
  }
 
59
  } else {
60
  echo 'alert("', $this->message, '");';
61
  }
classes/Visualizer/Render/Sidebar.php CHANGED
@@ -476,9 +476,12 @@ abstract class Visualizer_Render_Sidebar extends Visualizer_Render {
476
  * @param boolean $open Determines whether the section items block has to be expanded or collapsed.
477
  */
478
  protected static function _renderSectionStart( $title = false, $open = true ) {
479
- echo '<li>';
480
  if ( ! empty( $title ) ) {
 
481
  echo '<span class="section-title">', $title, '</span>';
 
 
482
  }
483
  echo '<div class="section-items', $open ? ' open' : '', '">';
484
  }
476
  * @param boolean $open Determines whether the section items block has to be expanded or collapsed.
477
  */
478
  protected static function _renderSectionStart( $title = false, $open = true ) {
479
+
480
  if ( ! empty( $title ) ) {
481
+ echo '<li class="subsection">';
482
  echo '<span class="section-title">', $title, '</span>';
483
+ } else {
484
+ echo '<li class=" ">';
485
  }
486
  echo '<div class="section-items', $open ? ' open' : '', '">';
487
  }
classes/Visualizer/Source.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  // +----------------------------------------------------------------------+
4
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5
  // +----------------------------------------------------------------------+
@@ -30,6 +29,15 @@
30
  */
31
  abstract class Visualizer_Source {
32
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * The array of data.
35
  *
@@ -39,7 +47,6 @@ abstract class Visualizer_Source {
39
  * @var array
40
  */
41
  protected $_data = array();
42
-
43
  /**
44
  * The array of series.
45
  *
@@ -50,6 +57,41 @@ abstract class Visualizer_Source {
50
  */
51
  protected $_series = array();
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
  * Returns source name.
55
  *
@@ -107,13 +149,47 @@ abstract class Visualizer_Source {
107
  return $this->_data;
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * Normalizes values according to series' type.
112
  *
113
  * @since 1.0.0
114
  *
115
  * @access protected
 
116
  * @param array $data The row of data.
 
117
  * @return array Normalized row of data.
118
  */
119
  protected function _normalizeData( $data ) {
@@ -124,14 +200,12 @@ abstract class Visualizer_Source {
124
  if ( ! isset( $data[ $i ] ) ) {
125
  $data[ $i ] = null;
126
  }
127
-
128
  if ( is_null( $data[ $i ] ) ) {
129
  continue;
130
  }
131
-
132
  switch ( $series['type'] ) {
133
  case 'number':
134
- $data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : (is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null);
135
  break;
136
  case 'boolean':
137
  $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null;
@@ -149,56 +223,8 @@ abstract class Visualizer_Source {
149
  break;
150
  }
151
  }
152
- // error_log(print_r($data,true));
153
- return $data;
154
- }
155
 
156
- /**
157
- * Validates series tyeps.
158
- *
159
- * @since 1.0.1
160
- *
161
- * @static
162
- * @access protected
163
- * @param array $types The icoming series types.
164
- * @return boolean TRUE if sereis types are valid, otherwise FALSE.
165
- */
166
- protected static function _validateTypes( $types ) {
167
- $allowed_types = array( 'string', 'number', 'boolean', 'date', 'datetime', 'timeofday' );
168
- foreach ( $types as $type ) {
169
- if ( ! in_array( $type, $allowed_types ) ) {
170
- return false;
171
- }
172
- }
173
-
174
- return true;
175
- }
176
-
177
- /**
178
- * Re populates series if the source is dynamic.
179
- *
180
- * @since 1.1.0
181
- *
182
- * @access public
183
- * @param array $series The actual array of series.
184
- * @param int $chart_id The chart id.
185
- * @return array The re populated array of series or old one.
186
- */
187
- public function repopulateSeries( $series, $chart_id ) {
188
- return $series;
189
- }
190
-
191
- /**
192
- * Re populates data if the source is dynamic.
193
- *
194
- * @since 1.1.0
195
- *
196
- * @access public
197
- * @param array $data The actual array of data.
198
- * @param int $chart_id The chart id.
199
- * @return array The re populated array of data or old one.
200
- */
201
- public function repopulateData( $data, $chart_id ) {
202
  return $data;
203
  }
204
 
1
  <?php
 
2
  // +----------------------------------------------------------------------+
3
  // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4
  // +----------------------------------------------------------------------+
29
  */
30
  abstract class Visualizer_Source {
31
 
32
+ /**
33
+ * The array of allowed types.
34
+ *
35
+ * @since 1.0.0
36
+ *
37
+ * @access protected
38
+ * @var array
39
+ */
40
+ protected static $allowed_types = array( 'string', 'number', 'boolean', 'date', 'datetime', 'timeofday' );
41
  /**
42
  * The array of data.
43
  *
47
  * @var array
48
  */
49
  protected $_data = array();
 
50
  /**
51
  * The array of series.
52
  *
57
  */
58
  protected $_series = array();
59
 
60
+ /**
61
+ * Return allowed types
62
+ *
63
+ * @since 1.0.1
64
+ *
65
+ * @static
66
+ * @access public
67
+ * @return array the allowed types
68
+ */
69
+ public static function getAllowedTypes() {
70
+ return self::$allowed_types;
71
+ }
72
+
73
+ /**
74
+ * Validates series tyeps.
75
+ *
76
+ * @since 1.0.1
77
+ *
78
+ * @static
79
+ * @access protected
80
+ *
81
+ * @param array $types The icoming series types.
82
+ *
83
+ * @return boolean TRUE if sereis types are valid, otherwise FALSE.
84
+ */
85
+ protected static function _validateTypes( $types ) {
86
+ foreach ( $types as $type ) {
87
+ if ( ! in_array( $type, self::$allowed_types ) ) {
88
+ return false;
89
+ }
90
+ }
91
+
92
+ return true;
93
+ }
94
+
95
  /**
96
  * Returns source name.
97
  *
149
  return $this->_data;
150
  }
151
 
152
+ /**
153
+ * Re populates series if the source is dynamic.
154
+ *
155
+ * @since 1.1.0
156
+ *
157
+ * @access public
158
+ *
159
+ * @param array $series The actual array of series.
160
+ * @param int $chart_id The chart id.
161
+ *
162
+ * @return array The re populated array of series or old one.
163
+ */
164
+ public function repopulateSeries( $series, $chart_id ) {
165
+ return $series;
166
+ }
167
+
168
+ /**
169
+ * Re populates data if the source is dynamic.
170
+ *
171
+ * @since 1.1.0
172
+ *
173
+ * @access public
174
+ *
175
+ * @param array $data The actual array of data.
176
+ * @param int $chart_id The chart id.
177
+ *
178
+ * @return array The re populated array of data or old one.
179
+ */
180
+ public function repopulateData( $data, $chart_id ) {
181
+ return $data;
182
+ }
183
+
184
  /**
185
  * Normalizes values according to series' type.
186
  *
187
  * @since 1.0.0
188
  *
189
  * @access protected
190
+ *
191
  * @param array $data The row of data.
192
+ *
193
  * @return array Normalized row of data.
194
  */
195
  protected function _normalizeData( $data ) {
200
  if ( ! isset( $data[ $i ] ) ) {
201
  $data[ $i ] = null;
202
  }
 
203
  if ( is_null( $data[ $i ] ) ) {
204
  continue;
205
  }
 
206
  switch ( $series['type'] ) {
207
  case 'number':
208
+ $data[ $i ] = ( is_numeric( $data[ $i ] ) ) ? floatval( $data[ $i ] ) : ( is_numeric( str_replace( ',', '', $data[ $i ] ) ) ? floatval( str_replace( ',', '', $data[ $i ] ) ) : null );
209
  break;
210
  case 'boolean':
211
  $data[ $i ] = ! empty( $data[ $i ] ) ? filter_validate( $data[ $i ], FILTER_VALIDATE_BOOLEAN ) : null;
223
  break;
224
  }
225
  }
 
 
 
226
 
227
+ // error_log(print_r($data,true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  return $data;
229
  }
230
 
composer.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "codeinwp/visualizer",
3
+ "description": "Visualizer for WordPress.",
4
+ "keywords": [
5
+ "wordpress",
6
+ "charts",
7
+ "visualization"
8
+ ],
9
+ "repositories": [
10
+ {
11
+ "type": "vcs",
12
+ "url": "https://github.com/Codeinwp/themeisle-sdk"
13
+ }
14
+ ],
15
+ "homepage": "https://themeisle.com/plugins/visualizer/",
16
+ "license": "GPL-2.0+",
17
+ "authors": [
18
+ {
19
+ "name": "ThemeIsle Team",
20
+ "email": "friends@themeisle.com.com",
21
+ "homepage": "https://themeisle.com"
22
+ }
23
+ ],
24
+ "type": "wordpress-plugin",
25
+ "support": {
26
+ "issues": "https://github.com/Codeinwp/visualizer/issues",
27
+ "source": "https://github.com/Codeinwp/visualizer"
28
+ },
29
+ "require": {
30
+ "codeinwp/themeisle-sdk": "master",
31
+ "xrstf/composer-php52": "^1.0.20"
32
+ },
33
+ "minimum-stability": "dev",
34
+ "prefer-stable": true,
35
+ "scripts": {
36
+ "post-install-cmd": [
37
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
38
+ ],
39
+ "post-update-cmd": [
40
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
41
+ ],
42
+ "post-autoload-dump": [
43
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
44
+ ]
45
+ }
46
+ }
css/frame.css CHANGED
@@ -43,13 +43,6 @@
43
  -webkit-overflow-scrolling: touch;
44
  }
45
 
46
- .group-wrapper {
47
- margin: 0;
48
- padding: 0;
49
- border-top: 1px solid #dfdfdf;
50
- list-style: none;
51
- }
52
-
53
  .group {
54
  margin: 0;
55
  font-size: 12px;
@@ -57,104 +50,150 @@
57
  list-style: none;
58
  }
59
 
60
- .group.open {
61
- border-bottom: 1px solid #dfdfdf;
 
 
 
 
 
62
  }
63
 
64
- .group-title {
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  position: relative;
66
  margin: 0;
67
- padding: 10px 20px;
68
- border-top: 1px solid white;
69
- border-bottom: 1px solid #dfdfdf;
70
- background: whiteSmoke;
71
- background-image: -webkit-gradient(linear, left bottom, left top, from(#eee), to(whiteSmoke));
72
- background-image: -webkit-linear-gradient(bottom, #eee, whiteSmoke);
73
- background-image: -webkit-gradient( linear, left top, left bottom, from(#eee), to(whiteSmoke));
74
- background-image: -webkit-linear-gradient( top, #eee, whiteSmoke);
75
- background-image: linear-gradient( to bottom, #eee, whiteSmoke);
76
- text-shadow: 0 1px 0 white;
77
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
78
- font-family: "Open Sans",sans-serif;
79
- font-size: 15px;
80
- font-weight: normal;
81
- font-weight: 700;
82
  cursor: pointer;
83
- -webkit-user-select: none;
84
- -moz-user-select: none;
85
- -ms-user-select: none;
86
- user-select: none;
87
- }
88
-
89
- .group-title:hover,
90
- .group.open .group-title {
91
- color: white;
92
- background: gray;
93
- background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(gray));
94
- background-image: -webkit-linear-gradient(bottom, #6d6d6d, gray);
95
- background-image: -webkit-gradient( linear, left top, left bottom, from(#6d6d6d), to(gray));
96
- background-image: -webkit-linear-gradient( top, #6d6d6d, gray);
97
- background-image: linear-gradient( to bottom, #6d6d6d, gray);
98
- text-shadow: 0 -1px 0 #333;
99
- font-family: "Open Sans", sans-serif;
100
- font-weight: 700;
101
  }
102
 
103
- .group-title::after {
 
 
 
 
 
 
 
104
  position: absolute;
105
  z-index: 1;
106
- top: 15px;
107
- right: 20px;
108
- width: 0;
109
- height: 0;
110
- border-width: 6px 6px 0;
111
- border-style: solid;
112
- border-color: #ccc transparent;
113
- content: "";
114
  }
115
 
116
- .group-title:hover::after,
117
- .group.open .group-title::after {
118
- border-color: #eee transparent;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
- .group:hover .group-title {
122
- border-top-color: gray;
 
 
 
123
  }
124
 
125
- .group.open .group-title {
126
- border-top-color: #6d6d6d;
 
127
  }
128
 
129
- .group.open .group-title::after {
130
- border-width: 0 6px 6px;
 
131
  }
132
 
133
  .group-content {
134
  display: none;
135
- overflow: hidden;
136
  margin: 0;
137
- padding: 10px 0 20px 0;
138
  background-color: #fdfdfd;
139
  }
140
 
141
  div.group-content {
142
- padding: 10px 20px 20px;
143
  }
144
 
145
- .group.open .group-content {
146
  display: block;
147
  }
148
 
149
  .group-description {
150
  margin: 0;
151
- padding: 5px 20px 10px;
152
  color: #555;
153
  font-size: 12px;
 
154
  }
155
 
156
  div.group-content .group-description {
157
- padding: 0;
158
  font-family: "Montserrat",sans-serif;
159
  font-weight: 300;
160
  }
@@ -180,6 +219,13 @@ div.group-content .group-description {
180
  cursor: pointer;
181
  }
182
 
 
 
 
 
 
 
 
183
  .section-title::after {
184
  position: absolute;
185
  z-index: 1;
@@ -199,7 +245,7 @@ div.group-content .group-description {
199
 
200
  .section-items {
201
  display: none;
202
- padding: 5px 20px 10px 20px;
203
  }
204
 
205
  .section-items.open {
@@ -555,15 +601,6 @@ div.group-content .group-description {
555
  transition: all 0.3s ease;
556
  }
557
 
558
- .just-on-pro {
559
- width: 250px;
560
- height: 100px;
561
- margin-bottom: 10px;
562
- opacity: 0.8;
563
- background: #f5f5f5 url("../images/available_pro.png") no-repeat scroll 0 1px !important;
564
- cursor: not-allowed;
565
- }
566
-
567
  .from-web {
568
  margin-top: 0;
569
  margin-bottom: 15px !important;
@@ -645,7 +682,8 @@ input#existing-chart {
645
 
646
  select#chart-id {
647
  float: right;
648
- width: 95px;
 
649
  }
650
 
651
  button#editor-chart-button {
@@ -748,16 +786,6 @@ button#editor-chart-button {
748
  /* ====== RESPONSIVE ====== */
749
 
750
  @media (max-width: 1366px) {
751
- .group-title {
752
- padding: 4px 20px;
753
- font-size: 14px;
754
- font-weight: 400;
755
- }
756
-
757
- .group-title::after {
758
- top: 10px;
759
- }
760
-
761
  #rate-stars {
762
  margin: 3px 0 10px 40%;
763
  }
@@ -779,3 +807,192 @@ button#editor-chart-button {
779
  vertical-align: middle;
780
  }
781
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  -webkit-overflow-scrolling: touch;
44
  }
45
 
 
 
 
 
 
 
 
46
  .group {
47
  margin: 0;
48
  font-size: 12px;
50
  list-style: none;
51
  }
52
 
53
+ .group .group-header .group-title {
54
+ margin: 10px 0;
55
+ padding: 15px 20px;
56
+ border-top: 1px solid #ddd;
57
+ border-bottom: 1px solid #ddd;
58
+ color: #555d66;
59
+ background: #fff;
60
  }
61
 
62
+ .group-wrapper ul .group-title {
63
+ border-top: 1px solid #ddd;
64
+ }
65
+
66
+ .group-wrapper ul li {
67
+ border-top: 1px solid #ddd;
68
+ }
69
+
70
+ .group-wrapper ul ul li.subsection {
71
+ margin: 5px;
72
+ border: 1px solid #ddd;
73
+ }
74
+
75
+ .group-wrapper .group .group .group-title {
76
  position: relative;
77
  margin: 0;
78
+ padding: 10px 10px 11px 14px;
79
+ border-top: none;
80
+ border-bottom: none;
81
+ border-left: 4px solid #fff;
82
+ color: #555d66;
83
+ background-color: #fff;
84
+ font-size: 14px;
85
+ font-weight: 600;
86
+ line-height: 21px;
 
 
 
 
 
 
87
  cursor: pointer;
88
+ -webkit-transition: 0.15s color ease-in-out,0.15s background-color ease-in-out,0.15s border-color ease-in-out;
89
+ transition: 0.15s color ease-in-out,0.15s background-color ease-in-out,0.15s border-color ease-in-out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
+ .group-wrapper .group .group:hover .group-title,
93
+ .group-wrapper .group .group.open .group-title {
94
+ border-left-color: #0073aa;
95
+ color: #0073aa;
96
+ background: #f3f3f5;
97
+ }
98
+
99
+ .group-wrapper .group .group .group-title:after {
100
  position: absolute;
101
  z-index: 1;
102
+ top: 11px;
103
+ right: 10px;
104
+ color: #a0a5aa;
105
+ font: 400 20px/1 dashicons;
106
+ content: "\f345";
 
 
 
107
  }
108
 
109
+ .group-wrapper .group .group.open .group-title:after {
110
+ content: "\f347";
111
+ }
112
+
113
+ .group-wrapper .group .customize-section-back {
114
+ display: block;
115
+ float: left;
116
+ width: 42px;
117
+ height: 49px;
118
+ margin: 0 15px 0 0;
119
+ padding: 0;
120
+ border: none;
121
+ border-top: 1px solid #ddd;
122
+ border-right: 1px solid #ddd;
123
+ border-left: 4px solid #fff;
124
+ background: #fff;
125
+ -webkit-box-shadow: none;
126
+ box-shadow: none;
127
+ cursor: pointer;
128
+ -webkit-transition: color 0.15s ease-in-out,border-color 0.15s ease-in-out,background 0.15s ease-in-out;
129
+ transition: color 0.15s ease-in-out,border-color 0.15s ease-in-out,background 0.15s ease-in-out;
130
+ }
131
+
132
+ .group-wrapper .group .customize-section-back:hover {
133
+ border-left-color: #0073aa;
134
+ outline: 0;
135
+ color: #0073aa;
136
+ background: #f3f3f5;
137
+ }
138
+
139
+ .group-wrapper .group .customize-section-back:before {
140
+ position: relative;
141
+ top: -11px;
142
+ left: -2px;
143
+ font: 400 20px/72px dashicons;
144
+ content: "\f341";
145
+ }
146
+
147
+ .group-wrapper.full-height {
148
+ float: left;
149
+ position: relative;
150
+ width: 100%;
151
+ height: 100%;
152
+ margin: 0;
153
  }
154
 
155
+ .group.bottom-fixed {
156
+ display: block;
157
+ position: absolute;
158
+ bottom: 0;
159
+ width: 100%;
160
  }
161
 
162
+ .group ul li h2,
163
+ .group ul li h3 {
164
+ padding: 7px 15px 7px 35px;
165
  }
166
 
167
+ .group h2 .dashicons {
168
+ margin-right: 5px;
169
+ vertical-align: -5px;
170
  }
171
 
172
  .group-content {
173
  display: none;
 
174
  margin: 0;
175
+ padding: 0;
176
  background-color: #fdfdfd;
177
  }
178
 
179
  div.group-content {
180
+ padding: 15px;
181
  }
182
 
183
+ .group.open > .group-content {
184
  display: block;
185
  }
186
 
187
  .group-description {
188
  margin: 0;
189
+ padding: 5px;
190
  color: #555;
191
  font-size: 12px;
192
+ text-align: left;
193
  }
194
 
195
  div.group-content .group-description {
196
+ padding: 5px;
197
  font-family: "Montserrat",sans-serif;
198
  font-weight: 300;
199
  }
219
  cursor: pointer;
220
  }
221
 
222
+ .group-wrapper ul ul li .section-title {
223
+ margin-bottom: 0;
224
+ border: none;
225
+ -webkit-box-shadow: none;
226
+ box-shadow: none;
227
+ }
228
+
229
  .section-title::after {
230
  position: absolute;
231
  z-index: 1;
245
 
246
  .section-items {
247
  display: none;
248
+ padding: 15px;
249
  }
250
 
251
  .section-items.open {
601
  transition: all 0.3s ease;
602
  }
603
 
 
 
 
 
 
 
 
 
 
604
  .from-web {
605
  margin-top: 0;
606
  margin-bottom: 15px !important;
682
 
683
  select#chart-id {
684
  float: right;
685
+ width: 146px;
686
+ margin-right: 14px;
687
  }
688
 
689
  button#editor-chart-button {
786
  /* ====== RESPONSIVE ====== */
787
 
788
  @media (max-width: 1366px) {
 
 
 
 
 
 
 
 
 
 
789
  #rate-stars {
790
  margin: 3px 0 10px 40%;
791
  }
807
  vertical-align: middle;
808
  }
809
  }
810
+
811
+ #vz-chart-settings h2:hover,
812
+ #vz-chart-review a:hover {
813
+ text-decoration: underline;
814
+ }
815
+
816
+ #vz-chart-review a {
817
+ color: #00a0d2;
818
+ text-decoration: none;
819
+ }
820
+
821
+ #vz-chart-settings h2,
822
+ #vz-chart-review h2 {
823
+ padding: 0;
824
+ border: none;
825
+ font-size: 12px;
826
+ font-weight: 400;
827
+ }
828
+
829
+ #vz-chart-review {
830
+ right: 0;
831
+ bottom: 40px;
832
+ -webkit-box-sizing: border-box;
833
+ box-sizing: border-box;
834
+ width: 50%;
835
+ padding-right: 20px;
836
+ text-align: right;
837
+ }
838
+
839
+ #vz-chart-settings.bottom-fixed h2 {
840
+ padding-left: 20px;
841
+ }
842
+
843
+ #vz-chart-settings {
844
+ bottom: 40px;
845
+ left: 0;
846
+ -webkit-box-sizing: border-box;
847
+ box-sizing: border-box;
848
+ width: 50%;
849
+ text-align: left;
850
+ }
851
+
852
+ #vz-chart-review,
853
+ #vz-chart-settings h2 {
854
+ display: inline;
855
+ color: #00a0d2;
856
+ background: none;
857
+ font-family: "Open Sans",sans-serif;
858
+ cursor: pointer;
859
+ }
860
+
861
+ #vz-chart-settings {
862
+ display: inline;
863
+ background: none;
864
+ cursor: pointer;
865
+ }
866
+
867
+ #vz-chart-source > ul,
868
+ #vz-chart-settings > ul {
869
+ position: relative;
870
+ z-index: 10;
871
+ border-bottom: 1px solid #ddd;
872
+ }
873
+
874
+ #vz-chart-copyright {
875
+ bottom: 10px;
876
+ text-align: center;
877
+ }
878
+
879
+ #sidebar {
880
+ border-left: 1px solid #ddd;
881
+ background: #f3f3f3;
882
+ }
883
+
884
+ #vz-chart-settings.open h2 {
885
+ position: absolute;
886
+ bottom: 28px;
887
+ left: 20px;
888
+ }
889
+
890
+ #vz-chart-settings.open .group-header {
891
+ display: block;
892
+ }
893
+
894
+ #vz-chart-settings .group-header {
895
+ display: none;
896
+ }
897
+
898
+ #vz-csv-file-form,
899
+ #vz-one-time-import,
900
+ #vz-schedule-import,
901
+ .edit-data-content {
902
+ text-align: center;
903
+ }
904
+
905
+ #csv-file {
906
+ margin: 15px 0;
907
+ padding: 0;
908
+ }
909
+
910
+ .visualizer-input,
911
+ .visualizer-select {
912
+ width: 100%;
913
+ margin: 0 0 15px;
914
+ }
915
+
916
+ .group .dashicons-lock {
917
+ display: none;
918
+ }
919
+
920
+ .only-pro-feature .dashicons-lock {
921
+ display: inline;
922
+ }
923
+
924
+ .section-title .dashicons,
925
+ .group-title .dashicons {
926
+ width: 18px;
927
+ height: 18px;
928
+ margin-left: 3px;
929
+ font-size: 18px;
930
+ }
931
+
932
+ .only-pro-feature input,
933
+ .only-pro-feature button,
934
+ .only-pro-feature select {
935
+ cursor: not-allowed !important;
936
+ pointer-events: none;
937
+ }
938
+
939
+ .only-pro-feature > div {
940
+ position: relative;
941
+ }
942
+
943
+ .only-pro-content {
944
+ position: absolute;
945
+ top: 0;
946
+ bottom: 0;
947
+ left: 0;
948
+ width: 100%;
949
+ opacity: 0;
950
+ background: rgba(253,253,253,0.9);
951
+ -webkit-transition: 0.5s ease;
952
+ transition: 0.5s ease;
953
+ }
954
+
955
+ .only-pro-feature:hover .only-pro-content {
956
+ opacity: 1;
957
+ }
958
+
959
+ .only-pro-container {
960
+ display: table;
961
+ width: 100%;
962
+ height: 100%;
963
+ }
964
+
965
+ .only-pro-inner {
966
+ display: table-cell;
967
+ vertical-align: middle;
968
+ }
969
+
970
+ .only-pro-content p {
971
+ margin: 0 0 15px;
972
+ font-size: 14px;
973
+ font-weight: 700;
974
+ }
975
+
976
+ .only-pro-content a {
977
+ display: inline-block;
978
+ padding: 7px 12px;
979
+ color: #fff;
980
+ background: #ff595e;
981
+ font-weight: 600;
982
+ text-decoration: none;
983
+ text-transform: uppercase;
984
+ -webkit-transition: 0.1s ease;
985
+ transition: 0.1s ease;
986
+ }
987
+
988
+ .only-pro-content a:hover {
989
+ background: #ce484c;
990
+ }
991
+
992
+ #sidebar::-webkit-scrollbar {
993
+ width: 4px;
994
+ }
995
+
996
+ #sidebar::-webkit-scrollbar-thumb {
997
+ background: #999;
998
+ }
css/library.css CHANGED
@@ -21,10 +21,20 @@
21
  margin: 20px 0 10px;
22
  }
23
 
 
 
 
 
24
  #visualizer-library {
 
 
25
  margin: 20px 0;
26
  }
27
 
 
 
 
 
28
  .loader {
29
  position: absolute;
30
  top: 50%;
@@ -137,59 +147,139 @@
137
  margin-right: 20px;
138
  }
139
 
140
- .page-numbers {
141
- padding: 5px 10px;
142
- border-radius: 2px;
143
- color: white !important;
144
- background-color: #aaa;
145
- -webkit-box-shadow: 0 0 5px #ccc;
146
- box-shadow: 0 0 5px #ccc;
147
- font-weight: bold;
148
- text-decoration: none;
 
 
 
 
 
 
 
 
 
149
  }
150
 
151
- .page-numbers.current,
152
- a.page-numbers:hover {
153
- background-color: lightcoral;
154
- -webkit-box-shadow: 0 0 5px lightpink;
155
- box-shadow: 0 0 5px lightpink;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
- .visualizer-library-pagination {
 
159
  display: none;
160
  }
161
 
162
- #visualizer-search form {
163
- display: -webkit-box;
164
- display: -webkit-flex;
165
- display: -ms-flexbox;
166
- display: flex;
167
 
168
- -webkit-align-items: center;
169
- align-items: center;
170
- -webkit-box-align: center;
171
- -ms-flex-align: center;
 
 
 
 
 
 
172
  }
173
 
174
- #visualizer-search > form > input[type="text"]:nth-child(1) {
175
- height: 30px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
177
 
178
- #visualizer-search .button-secondary {
179
- margin-left: 20px;
180
- padding: 5px 10px;
181
- border-radius: 5px;
182
- color: white;
183
- background-color: lightcoral;
184
- -webkit-box-shadow: 0 0 5px lightpink;
185
- box-shadow: 0 0 5px lightpink;
 
 
 
 
 
 
 
 
186
  font-size: 14px;
187
  font-weight: bold;
188
- line-height: 17px;
189
- text-decoration: none;
190
  }
191
 
192
- #visualizer-search .button-secondary:hover {
193
- border-color: lightpink;
194
- background-color: lightpink;
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
21
  margin: 20px 0 10px;
22
  }
23
 
24
+ .visualizer-list-item .visualizer-pro-only {
25
+ text-decoration: line-through;
26
+ }
27
+
28
  #visualizer-library {
29
+ display: table-cell;
30
+ width: auto;
31
  margin: 20px 0;
32
  }
33
 
34
+ #visualizer-content-wrapper {
35
+ width: 100%;
36
+ }
37
+
38
  .loader {
39
  position: absolute;
40
  top: 50%;
147
  margin-right: 20px;
148
  }
149
 
150
+ #visualizer-search form {
151
+ text-align: right;
152
+ }
153
+
154
+ #visualizer-sidebar {
155
+ display: table-cell;
156
+ width: 250px;
157
+ }
158
+
159
+ .visualizer-sidebar-box ul li {
160
+ margin: 4px 0;
161
+ color: #23282d;
162
+ }
163
+
164
+ .visualizer-sidebar-box ul {
165
+ margin-left: 40px;
166
+ text-align: left;
167
+ list-style-type: disc;
168
  }
169
 
170
+ .visualizer-sidebar-box {
171
+ display: block;
172
+ width: 95%;
173
+ margin: 0;
174
+ margin-top: 20px;
175
+ margin-left: 2.5%;
176
+ padding-top: 10px;
177
+ padding-bottom: 15px;
178
+ border-top: 5px solid #0073aa;
179
+ color: #0073aa;
180
+ background: white;
181
+ text-align: center;
182
+ }
183
+
184
+ /* The switch - the box around the slider */
185
+ .visualizer-switch {
186
+ display: inline-block;
187
+ position: relative;
188
+ width: 30px;
189
+ height: 18px;
190
  }
191
 
192
+ /* Hide default HTML checkbox */
193
+ .visualizer-switch input {
194
  display: none;
195
  }
196
 
197
+ /* The slider */
198
+ .visualizer-tracking sup {
199
+ vertical-align: 3px;
200
+ }
 
201
 
202
+ .visualizer-slider {
203
+ position: absolute;
204
+ top: 0;
205
+ right: 0;
206
+ bottom: 0;
207
+ left: 0;
208
+ background-color: #ccc;
209
+ cursor: pointer;
210
+ -webkit-transition: 0.4s;
211
+ transition: 0.4s;
212
  }
213
 
214
+ .visualizer-slider:before {
215
+ position: absolute;
216
+ bottom: 1.5px;
217
+ left: 2px;
218
+ width: 15px;
219
+ height: 15px;
220
+ background-color: white;
221
+ content: "";
222
+ -webkit-transition: 0.4s;
223
+ transition: 0.4s;
224
+ }
225
+
226
+ input:checked + .visualizer-slider {
227
+ background-color: #0085ba;
228
+ }
229
+
230
+ input:focus + .visualizer-slider {
231
+ -webkit-box-shadow: 0 0 1px #0085ba;
232
+ box-shadow: 0 0 1px #0085ba;
233
+ }
234
+
235
+ input:checked + .visualizer-slider:before {
236
+ -webkit-transform: translateX(11px);
237
+ -ms-transform: translateX(11px);
238
+ transform: translateX(11px);
239
+ }
240
+
241
+ /* Rounded sliders */
242
+ .visualizer-slider.visualizer-round {
243
+ border-radius: 34px;
244
+ }
245
+
246
+ .visualizer-slider.visualizer-round:before {
247
+ border-radius: 50%;
248
  }
249
 
250
+ .visualizer-tracking p small sup {
251
+ margin-left: -3px;
252
+ }
253
+
254
+ .visualizer-tracking p {
255
+ padding-left: 14px;
256
+ color: #23282d;
257
+ font-size: 12px;
258
+ line-height: 12px;
259
+ text-align: left;
260
+ }
261
+
262
+ .visualizer-tracking span {
263
+ margin-left: 10px;
264
+ color: #23282d;
265
+ background: none;
266
  font-size: 14px;
267
  font-weight: bold;
 
 
268
  }
269
 
270
+ #visualizer-content-wrapper {
271
+ display: table;
272
+ }
273
+
274
+ #visualizer-sidebar h3 {
275
+ margin-top: 0;
276
+ }
277
+
278
+ #visualizer-sidebar .visualizer-sidebar-box p {
279
+ margin-bottom: 0;
280
+ }
281
+
282
+ #visualizer-sidebar .visualizer-sidebar-box {
283
+ padding-top: 20px;
284
+ padding-bottom: 20px;
285
  }
css/media.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 1.7.6
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
1
  /*
2
+ Version: 2.0.0
3
  */
4
  #visualizer-library-view {
5
  padding: 30px 10px 10px 30px;
index.php CHANGED
@@ -4,47 +4,29 @@
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: 1.7.6
8
  Author: Themeisle
9
  Author URI: http://themeisle.com
10
  License: GPL v2.0 or later
 
 
11
  License URI: http://www.opensource.org/licenses/gpl-license.php
12
  */
13
 
14
-
15
- // +----------------------------------------------------------------------+
16
- // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
17
- // +----------------------------------------------------------------------+
18
- // | This program is free software; you can redistribute it and/or modify |
19
- // | it under the terms of the GNU General Public License, version 2, as |
20
- // | published by the Free Software Foundation. |
21
- // | |
22
- // | This program is distributed in the hope that it will be useful, |
23
- // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
24
- // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25
- // | GNU General Public License for more details. |
26
- // | |
27
- // | You should have received a copy of the GNU General Public License |
28
- // | along with this program; if not, write to the Free Software |
29
- // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
30
- // | MA 02110-1301 USA |
31
- // +----------------------------------------------------------------------+
32
- // | Author: Eugene Manuilov <eugene@manuilov.org> |
33
- // +----------------------------------------------------------------------+
34
- // prevent direct access to the plugin folder
35
  if ( ! defined( 'ABSPATH' ) ) {
36
  header( 'HTTP/1.0 404 Not Found', true, 404 );
37
  exit;
38
  }
39
-
40
  // don't load the plugin, if it has been already loaded
41
  if ( class_exists( 'Visualizer_Plugin', false ) ) {
42
  return;
43
  }
44
-
45
  // Added by Ash/Upwork
46
  if ( class_exists( 'Visualizer_Pro', false ) ) {
47
- define( 'Visualizer_Pro', true );
 
 
48
  }
49
  // Added by Ash/Upwork
50
  /**
@@ -54,6 +36,7 @@ if ( class_exists( 'Visualizer_Pro', false ) ) {
54
  * @since 1.0.0
55
  *
56
  * @param string $class The class name to autoload.
 
57
  * @return boolean Returns TRUE if the class is located. Otherwise FALSE.
58
  */
59
  function visualizer_autoloader( $class ) {
@@ -63,6 +46,7 @@ function visualizer_autoloader( $class ) {
63
  $filename = dirname( __FILE__ ) . str_replace( '_', DIRECTORY_SEPARATOR, "_classes_{$class}.php" );
64
  if ( is_readable( $filename ) ) {
65
  require $filename;
 
66
  return true;
67
  }
68
  }
@@ -81,46 +65,33 @@ function visualizer_launch() {
81
  define( 'VISUALIZER_BASEFILE', __FILE__ );
82
  define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
83
  define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
84
-
85
  if ( ! defined( 'VISUALIZER_CSV_DELIMITER' ) ) {
86
  define( 'VISUALIZER_CSV_DELIMITER', ',' );
87
  }
88
-
89
  if ( ! defined( 'VISUALIZER_CSV_ENCLOSURE' ) ) {
90
  define( 'VISUALIZER_CSV_ENCLOSURE', '"' );
91
  }
92
-
93
- // don't load the plugin if cron job is running or doing autosave
94
- $doing_autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
95
- $doing_cron = defined( 'DOING_CRON' ) && DOING_CRON;
96
- $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
97
- if ( $doing_autosave || $doing_cron ) {
98
- return;
99
- }
100
-
101
  // instantiate the plugin
102
  $plugin = Visualizer_Plugin::instance();
103
-
104
  // set general modules
105
  $plugin->setModule( Visualizer_Module_Setup::NAME );
106
  $plugin->setModule( Visualizer_Module_Sources::NAME );
107
-
108
- if ( $doing_ajax ) {
109
- // set ajax modules
110
- $plugin->setModule( Visualizer_Module_Chart::NAME );
111
  } else {
112
- if ( is_admin() ) {
113
- // set admin modules
114
- $plugin->setModule( Visualizer_Module_Admin::NAME );
115
- } else {
116
- // set frontend modules
117
- $plugin->setModule( Visualizer_Module_Frontend::NAME );
118
- }
119
  }
120
  }
121
 
122
  // register autoloader function
123
  spl_autoload_register( 'visualizer_autoloader' );
124
-
125
  // launch the plugin
126
  visualizer_launch();
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.0.0
8
  Author: Themeisle
9
  Author URI: http://themeisle.com
10
  License: GPL v2.0 or later
11
+ WordPress Available: yes
12
+ Requires License: no
13
  License URI: http://www.opensource.org/licenses/gpl-license.php
14
  */
15
 
16
+ // Prevent direct access to the plugin folder.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if ( ! defined( 'ABSPATH' ) ) {
18
  header( 'HTTP/1.0 404 Not Found', true, 404 );
19
  exit;
20
  }
 
21
  // don't load the plugin, if it has been already loaded
22
  if ( class_exists( 'Visualizer_Plugin', false ) ) {
23
  return;
24
  }
 
25
  // Added by Ash/Upwork
26
  if ( class_exists( 'Visualizer_Pro', false ) ) {
27
+ define( 'VISUALIZER_PRO', true );
28
+ } else {
29
+ defined( 'VISUALIZER_PRO' ) || define( 'VISUALIZER_PRO', false );
30
  }
31
  // Added by Ash/Upwork
32
  /**
36
  * @since 1.0.0
37
  *
38
  * @param string $class The class name to autoload.
39
+ *
40
  * @return boolean Returns TRUE if the class is located. Otherwise FALSE.
41
  */
42
  function visualizer_autoloader( $class ) {
46
  $filename = dirname( __FILE__ ) . str_replace( '_', DIRECTORY_SEPARATOR, "_classes_{$class}.php" );
47
  if ( is_readable( $filename ) ) {
48
  require $filename;
49
+
50
  return true;
51
  }
52
  }
65
  define( 'VISUALIZER_BASEFILE', __FILE__ );
66
  define( 'VISUALIZER_ABSURL', plugins_url( '/', __FILE__ ) );
67
  define( 'VISUALIZER_ABSPATH', dirname( __FILE__ ) );
 
68
  if ( ! defined( 'VISUALIZER_CSV_DELIMITER' ) ) {
69
  define( 'VISUALIZER_CSV_DELIMITER', ',' );
70
  }
 
71
  if ( ! defined( 'VISUALIZER_CSV_ENCLOSURE' ) ) {
72
  define( 'VISUALIZER_CSV_ENCLOSURE', '"' );
73
  }
 
 
 
 
 
 
 
 
 
74
  // instantiate the plugin
75
  $plugin = Visualizer_Plugin::instance();
 
76
  // set general modules
77
  $plugin->setModule( Visualizer_Module_Setup::NAME );
78
  $plugin->setModule( Visualizer_Module_Sources::NAME );
79
+ $plugin->setModule( Visualizer_Module_Chart::NAME );
80
+ if ( is_admin() ) {
81
+ // set admin modules
82
+ $plugin->setModule( Visualizer_Module_Admin::NAME );
83
  } else {
84
+ // set frontend modules
85
+ $plugin->setModule( Visualizer_Module_Frontend::NAME );
86
+ }
87
+ $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload_52.php';
88
+ if ( is_readable( $vendor_file ) ) {
89
+ require_once $vendor_file;
90
+ ThemeIsle_SDK_Loader::init_product( VISUALIZER_BASEFILE );
91
  }
92
  }
93
 
94
  // register autoloader function
95
  spl_autoload_register( 'visualizer_autoloader' );
 
96
  // launch the plugin
97
  visualizer_launch();
js/frame.js CHANGED
@@ -2,70 +2,79 @@
2
  /* global visualizer */
3
  /* global alert */
4
 
5
- (function($) {
6
- $(document).ready(function() {
7
- $('.type-radio').change(function() {
8
- $('.type-label-selected').removeClass('type-label-selected');
9
- $(this).parent().addClass('type-label-selected');
10
- });
11
-
12
- $('.group-title').click(function() {
13
- var parent = $(this).parent();
14
-
15
- if (parent.hasClass('open')) {
16
- parent.removeClass('open');
17
- } else {
18
- $('.group.open').removeClass('open');
19
- parent.addClass('open');
20
- }
21
- });
22
-
23
- $('#remote-file').click(function() {
24
- var url = $.trim(prompt(visualizer.l10n.remotecsv_prompt));
25
-
26
- if (url !== '') {
27
- if (/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url)) {
28
- if (url.substr(url.length - 8) === '/pubhtml') {
29
- url = url.substring(0, url.length - 8) + '/export?format=csv';
30
- }
31
-
32
- $('#remote-data').val(url);
33
- $('#csv-file').val('');
34
- $('#canvas').lock();
35
- $('#csv-form').submit();
36
- } else {
37
- alert(visualizer.l10n.invalid_source);
38
- }
39
- }
40
- });
41
-
42
- $('#csv-file').change(function() {
43
- if ($.trim($(this).val()) !== '') {
44
- $('#remote-data').val('');
45
- $('#canvas').lock();
46
- $('#csv-form').submit();
47
- }
48
- });
49
-
50
- $('#thehole').load(function() {
51
- $('#canvas').unlock();
52
- });
53
-
54
- $('.section-title').click(function() {
55
- $(this).toggleClass('open').parent().find('.section-items').toggle();
56
- });
57
-
58
- $('.more-info').click(function() {
59
- $(this).parent().find('.section-description:first').toggle();
60
- return false;
61
- });
62
-
63
- });
 
 
 
 
 
 
 
 
 
64
  })(jQuery);
65
 
66
- (function($) {
67
- $.fn.lock = function() {
68
- $(this).each(function() {
69
  var $this = $(this);
70
  var position = $this.css('position');
71
 
@@ -73,7 +82,7 @@
73
  position = 'static';
74
  }
75
 
76
- switch(position) {
77
  case 'absolute':
78
  case 'relative':
79
  break;
@@ -94,7 +103,7 @@
94
 
95
  locker.append(loader);
96
  $this.append(locker);
97
- $(window).resize(function() {
98
  $this.find('.locker,.locker-loader').width($this.width()).height($this.height());
99
  });
100
  });
@@ -102,28 +111,12 @@
102
  return $(this);
103
  };
104
 
105
- $.fn.unlock = function() {
106
- $(this).each(function() {
107
  $(this).find('.locker').remove();
108
  $(this).css('position', $(this).data('position'));
109
  });
110
 
111
  return $(this);
112
  };
113
- })(jQuery);
114
-
115
- //Hide / show settings in sidebar
116
- (function($) {
117
- $(document).ready(function() {
118
-
119
- $('.advanced-settings-btn').click(function(){
120
- $('.second-screen, .return-settings-btn').removeClass("hidden-setting");
121
- $('.initial-screen').addClass("hidden-setting");
122
- });
123
-
124
- $('.return-settings-btn').click(function(){
125
- $('.second-screen, .return-settings-btn').addClass("hidden-setting");
126
- $('.initial-screen').removeClass("hidden-setting");
127
- });
128
- });
129
- })(jQuery);
2
  /* global visualizer */
3
  /* global alert */
4
 
5
+ (function ($) {
6
+ $(document).ready(function () {
7
+ $('.type-radio').change(function () {
8
+ $('.type-label-selected').removeClass('type-label-selected');
9
+ $(this).parent().addClass('type-label-selected');
10
+ });
11
+
12
+ $('#vz-chart-settings h2').click(function () {
13
+ $("#vz-chart-source").hide();
14
+ $(this).parent().removeClass('bottom-fixed').addClass('open');
15
+
16
+ return false;
17
+ });
18
+ $('#vz-chart-settings .customize-section-back').click(function () {
19
+ $("#vz-chart-source").show();
20
+ $(this).parent().parent().removeClass('open').addClass('bottom-fixed');
21
+
22
+ return false;
23
+ });
24
+ $('.group-title').click(function () {
25
+ var parent = $(this).parent();
26
+
27
+ if (parent.hasClass('open')) {
28
+ parent.removeClass('open');
29
+ } else {
30
+ parent.parent().find('.group.open').removeClass('open');
31
+ parent.addClass('open');
32
+ }
33
+ });
34
+ $('#view-remote-file').click(function () {
35
+ var url = $(this).parent().find('#remote-data').val();
36
+
37
+ if (url !== '') {
38
+ if (/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url)) {
39
+ if (url.substr(url.length - 8) === '/pubhtml') {
40
+ url = url.substring(0, url.length - 8) + '/export?format=csv';
41
+ }
42
+
43
+ $('#canvas').lock();
44
+ $(this).parent().submit();
45
+ } else {
46
+ alert(visualizer.l10n.invalid_source);
47
+ }
48
+ }
49
+ });
50
+
51
+ $('#vz-import-file').click(function (e) {
52
+ e.preventDefault();
53
+ if ($.trim($(this).parent().find("#csv-file").val()) !== '') {
54
+ $('#canvas').lock();
55
+ $(this).parent().submit();
56
+ }
57
+ });
58
+
59
+ $('#thehole').load(function () {
60
+ $('#canvas').unlock();
61
+ });
62
+
63
+ $('.section-title').click(function () {
64
+ $(this).toggleClass('open').parent().find('.section-items').toggle();
65
+ });
66
+
67
+ $('.more-info').click(function () {
68
+ $(this).parent().find('.section-description:first').toggle();
69
+ return false;
70
+ });
71
+
72
+ });
73
  })(jQuery);
74
 
75
+ (function ($) {
76
+ $.fn.lock = function () {
77
+ $(this).each(function () {
78
  var $this = $(this);
79
  var position = $this.css('position');
80
 
82
  position = 'static';
83
  }
84
 
85
+ switch (position) {
86
  case 'absolute':
87
  case 'relative':
88
  break;
103
 
104
  locker.append(loader);
105
  $this.append(locker);
106
+ $(window).resize(function () {
107
  $this.find('.locker,.locker-loader').width($this.width()).height($this.height());
108
  });
109
  });
111
  return $(this);
112
  };
113
 
114
+ $.fn.unlock = function () {
115
+ $(this).each(function () {
116
  $(this).find('.locker').remove();
117
  $(this).css('position', $(this).data('position'));
118
  });
119
 
120
  return $(this);
121
  };
122
+ })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/library.js CHANGED
@@ -1,117 +1,128 @@
1
  /* global visualizer */
2
- (function(wpmv) {
3
- var vm, vmv;
4
 
5
- vm = visualizer.media = {};
6
- vmv = vm.view = {};
7
 
8
- vmv.Chart = wpmv.MediaFrame.extend({
9
- initialize: function() {
10
- var self = this;
11
 
12
- _.defaults(self.options, {
13
- action: '',
14
- state: 'iframe:visualizer'
15
- });
16
 
17
- wpmv.MediaFrame.prototype.initialize.apply(self, arguments);
18
 
19
- wpmv.settings.tabUrl = self.options.action;
20
- self.createIframeStates();
21
- },
22
 
23
- open: function() {
24
- wpmv.MediaFrame.prototype.open.apply(this, arguments);
25
- this.$el.addClass('hide-menu');
26
- }
27
- });
28
  })(wp.media.view);
29
 
30
- (function($, vmv, vu) {
31
- var resizeTimeout;
32
-
33
- $.fn.adjust = function() {
34
- return $(this).each(function() {
35
- var width = $('#visualizer-library').width(),
36
- margin = width * 0.02;
37
-
38
- width *= 0.305;
39
- $(this).width(width - 14).height(width * 0.75).parent().css('margin-right', margin + 'px').css('margin-bottom', margin + 'px');
40
- });
41
- };
42
-
43
- $('.visualizer-chart-canvas').adjust();
44
-
45
- $(document).ready(function() {
46
- $('.visualizer-chart, .visualizer-library-pagination').fadeIn(500);
47
 
48
- $('.visualizer-chart-shortcode').click(function(e) {
49
- var range, selection;
 
 
50
 
51
- if (window.getSelection && document.createRange) {
52
- selection = window.getSelection();
53
- range = document.createRange();
54
- range.selectNodeContents(e.target);
55
- selection.removeAllRanges();
56
- selection.addRange(range);
57
- } else if (document.selection && document.body.createTextRange) {
58
- range = document.body.createTextRange();
59
- range.moveToElementText(e.target);
60
- range.select();
61
- }
62
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- $('.add-new-h2').click(function() {
65
- var wnd = window,
66
- view = new vmv.Chart({action: vu.create});
67
 
68
- wnd.send_to_editor = function() {
69
- wnd.location.href = vu.base;
70
- };
71
- view.open();
72
 
73
- return false;
74
- });
75
 
76
- $('.visualizer-chart-edit').click(function() {
77
- var wnd = window,
78
- view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
79
 
80
- wnd.send_to_editor = function() {
81
- wnd.location.reload();
82
- };
83
 
84
- view.open();
85
 
86
- return false;
87
- });
88
 
89
- $(".visualizer-chart-export").on("click", function() {
90
  $.ajax({
91
  url: $(this).attr("data-chart"),
92
  method: "get",
93
- success: function( data, textStatus, jqXHR ){
94
  var a = document.createElement("a");
95
  document.body.appendChild(a);
96
  a.style = "display: none";
97
  var blob = new Blob([data.data.csv], {type: "application/csv"}),
98
- url = window.URL.createObjectURL(blob);
99
  a.href = url;
100
  a.download = data.data.name;
101
  a.click();
102
- setTimeout(function(){
103
  window.URL.revokeObjectURL(url);
104
  }, 100);
105
  }
106
  });
107
  return false;
108
  });
 
109
 
110
- $(window).resize(function() {
111
- clearTimeout(resizeTimeout);
112
- resizeTimeout = setTimeout(function() {
113
- $('.visualizer-chart-canvas').adjust();
114
- }, 100);
115
- });
116
- });
 
 
 
 
 
 
 
 
 
 
117
  })(jQuery, visualizer.media.view, visualizer.urls);
1
  /* global visualizer */
2
+ (function (wpmv) {
3
+ var vm, vmv;
4
 
5
+ vm = visualizer.media = {};
6
+ vmv = vm.view = {};
7
 
8
+ vmv.Chart = wpmv.MediaFrame.extend({
9
+ initialize: function () {
10
+ var self = this;
11
 
12
+ _.defaults(self.options, {
13
+ action: '',
14
+ state: 'iframe:visualizer'
15
+ });
16
 
17
+ wpmv.MediaFrame.prototype.initialize.apply(self, arguments);
18
 
19
+ wpmv.settings.tabUrl = self.options.action;
20
+ self.createIframeStates();
21
+ },
22
 
23
+ open: function () {
24
+ wpmv.MediaFrame.prototype.open.apply(this, arguments);
25
+ this.$el.addClass('hide-menu');
26
+ }
27
+ });
28
  })(wp.media.view);
29
 
30
+ (function ($, vmv, vu) {
31
+ var resizeTimeout;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
+ $.fn.adjust = function () {
34
+ return $(this).each(function () {
35
+ var width = $('#visualizer-library').width(),
36
+ margin = width * 0.02;
37
 
38
+ width *= 0.305;
39
+ $(this).width(width - 14).height(width * 0.75).parent().css('margin-right', margin + 'px').css('margin-bottom', margin + 'px');
40
+ });
41
+ };
42
+
43
+ $('.visualizer-chart-canvas').adjust();
44
+
45
+ $(document).ready(function () {
46
+ $('.visualizer-chart, .visualizer-library-pagination').fadeIn(500);
47
+
48
+ $('.visualizer-chart-shortcode').click(function (e) {
49
+ var range, selection;
50
+
51
+ if (window.getSelection && document.createRange) {
52
+ selection = window.getSelection();
53
+ range = document.createRange();
54
+ range.selectNodeContents(e.target);
55
+ selection.removeAllRanges();
56
+ selection.addRange(range);
57
+ } else if (document.selection && document.body.createTextRange) {
58
+ range = document.body.createTextRange();
59
+ range.moveToElementText(e.target);
60
+ range.select();
61
+ }
62
+ });
63
 
64
+ $('.add-new-h2').click(function () {
65
+ var wnd = window,
66
+ view = new vmv.Chart({action: vu.create});
67
 
68
+ wnd.send_to_editor = function () {
69
+ wnd.location.href = vu.base;
70
+ };
71
+ view.open();
72
 
73
+ return false;
74
+ });
75
 
76
+ $('.visualizer-chart-edit').click(function () {
77
+ var wnd = window,
78
+ view = new vmv.Chart({action: vu.edit + '&chart=' + $(this).attr('data-chart')});
79
 
80
+ wnd.send_to_editor = function () {
81
+ wnd.location.reload();
82
+ };
83
 
84
+ view.open();
85
 
86
+ return false;
87
+ });
88
 
89
+ $(".visualizer-chart-export").on("click", function () {
90
  $.ajax({
91
  url: $(this).attr("data-chart"),
92
  method: "get",
93
+ success: function (data, textStatus, jqXHR) {
94
  var a = document.createElement("a");
95
  document.body.appendChild(a);
96
  a.style = "display: none";
97
  var blob = new Blob([data.data.csv], {type: "application/csv"}),
98
+ url = window.URL.createObjectURL(blob);
99
  a.href = url;
100
  a.download = data.data.name;
101
  a.click();
102
+ setTimeout(function () {
103
  window.URL.revokeObjectURL(url);
104
  }, 100);
105
  }
106
  });
107
  return false;
108
  });
109
+ $('.visualizer-switch input').on('change', function () {
110
 
111
+ var status = $(this).is(':checked');
112
+ status = (status) ? 'yes' : 'no';
113
+ $.ajax({
114
+ url: visualizer.urls.logger,
115
+ data: {status: status},
116
+ method: "get",
117
+ success: function (data, textStatus, jqXHR) {
118
+ }
119
+ });
120
+ });
121
+ $(window).resize(function () {
122
+ clearTimeout(resizeTimeout);
123
+ resizeTimeout = setTimeout(function () {
124
+ $('.visualizer-chart-canvas').adjust();
125
+ }, 100);
126
+ });
127
+ });
128
  })(jQuery, visualizer.media.view, visualizer.urls);
js/render.js CHANGED
@@ -166,7 +166,7 @@
166
  if (settings.series) {
167
  for (i = 0; i < settings.series.length; i++) {
168
  format = settings.series[i].format;
169
- if (!format || format === '') {
170
  continue;
171
  }
172
 
166
  if (settings.series) {
167
  for (i = 0; i < settings.series.length; i++) {
168
  format = settings.series[i].format;
169
+ if (!format || format === '' || !series[i + 1]) {
170
  continue;
171
  }
172
 
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 1.7.5\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n"
7
- "POT-Creation-Date: 2017-01-20 12:32:52+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,188 +24,332 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: classes/Visualizer/Module/Admin.php:77
 
 
 
 
 
 
 
 
 
 
 
 
28
  msgid "Pie"
29
  msgstr ""
30
 
31
- #: classes/Visualizer/Module/Admin.php:78
32
  msgid "Line"
33
  msgstr ""
34
 
35
- #: classes/Visualizer/Module/Admin.php:79
36
  msgid "Area"
37
  msgstr ""
38
 
39
- #: classes/Visualizer/Module/Admin.php:80
40
  msgid "Geo"
41
  msgstr ""
42
 
43
- #: classes/Visualizer/Module/Admin.php:81
44
  msgid "Bar"
45
  msgstr ""
46
 
47
- #: classes/Visualizer/Module/Admin.php:82
48
  msgid "Column"
49
  msgstr ""
50
 
51
- #: classes/Visualizer/Module/Admin.php:83
52
  msgid "Gauge"
53
  msgstr ""
54
 
55
- #: classes/Visualizer/Module/Admin.php:84
56
  msgid "Scatter"
57
  msgstr ""
58
 
59
- #: classes/Visualizer/Module/Admin.php:85
60
  msgid "Candlestick"
61
  msgstr ""
62
 
63
- #: classes/Visualizer/Module/Admin.php:87
64
  msgid "Table"
65
  msgstr ""
66
 
67
- #: classes/Visualizer/Module/Admin.php:88
68
  msgid "Timeline"
69
  msgstr ""
70
 
71
- #: classes/Visualizer/Module/Admin.php:89
72
  msgid "Combo"
73
  msgstr ""
74
 
75
- #: classes/Visualizer/Module/Admin.php:157
76
- msgid "Visualizations"
77
- msgstr ""
78
-
79
- #: classes/Visualizer/Module/Admin.php:160
80
- msgid "From Library"
81
- msgstr ""
82
-
83
- #: classes/Visualizer/Module/Admin.php:161
84
- msgid "Create New"
85
- msgstr ""
86
-
87
- #: classes/Visualizer/Module/Admin.php:240
88
- #: classes/Visualizer/Render/Library.php:168
89
  msgid "Visualizer Library"
90
  msgstr ""
91
 
92
- #: classes/Visualizer/Module/Admin.php:364
93
  msgid "Library"
94
  msgstr ""
95
 
96
- #: classes/Visualizer/Module/Admin.php:387
97
  msgid "Knowledge Base"
98
  msgstr ""
99
 
100
- #: classes/Visualizer/Module/Admin.php:392
101
  msgid "Pro Addon"
102
  msgstr ""
103
 
104
- #: classes/Visualizer/Module/Chart.php:332
105
- #: classes/Visualizer/Module/Chart.php:396
106
- msgid "Please, enter the URL of CSV file:"
107
- msgstr ""
108
-
109
- #: classes/Visualizer/Module/Chart.php:333
110
- #: classes/Visualizer/Module/Chart.php:397
111
  msgid "You have entered invalid URL. Please, insert proper URL."
112
  msgstr ""
113
 
114
- #: classes/Visualizer/Module/Chart.php:411
115
  msgid "Save Chart"
116
  msgstr ""
117
 
118
- #: classes/Visualizer/Module/Chart.php:412
119
  msgid "Create Chart"
120
  msgstr ""
121
 
122
- #: classes/Visualizer/Module/Chart.php:414
123
  msgid "Insert Chart"
124
  msgstr ""
125
 
126
- #: classes/Visualizer/Module/Chart.php:473
127
  msgid "CSV file with chart data was not uploaded. Please, try again."
128
  msgstr ""
129
 
130
- #: classes/Visualizer/Module/Chart.php:488
131
  msgid "CSV file is broken or invalid. Please, try again."
132
  msgstr ""
133
 
134
- #: classes/Visualizer/Render/Library.php:68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  #: classes/Visualizer/Render/Templates.php:68
136
  msgid "Delete"
137
  msgstr ""
138
 
139
- #: classes/Visualizer/Render/Library.php:69
140
  msgid "Clone"
141
  msgstr ""
142
 
143
- #: classes/Visualizer/Render/Library.php:70
144
  msgid "Edit"
145
  msgstr ""
146
 
147
- #: classes/Visualizer/Render/Library.php:71
148
  msgid "Export"
149
  msgstr ""
150
 
151
- #: classes/Visualizer/Render/Library.php:73
152
  #: classes/Visualizer/Render/Templates.php:71
153
  msgid "Click to select"
154
  msgstr ""
155
 
156
- #: classes/Visualizer/Render/Library.php:96
157
- msgid "Search"
158
  msgstr ""
159
 
160
- #: classes/Visualizer/Render/Library.php:140
161
- #: classes/Visualizer/Render/Templates.php:85
162
- msgid "No charts found"
163
  msgstr ""
164
 
165
- #: classes/Visualizer/Render/Library.php:169
166
- msgid "Add New"
167
  msgstr ""
168
 
169
- #: classes/Visualizer/Render/Library.php:188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  msgid ""
171
- "%s option is disabled in your php.ini config. Please, enable it by change "
172
- "its value to 1. This option increases the speed of remote CSV uploading."
173
  msgstr ""
174
 
175
- #: classes/Visualizer/Render/Page/Data.php:70
 
 
 
 
 
 
 
 
176
  msgid ""
177
  "Select and upload your data CSV file here. The first row of the CSV file "
178
  "should contain the column headings. The second one should contain series "
179
  "type (string, number, boolean, date, datetime, timeofday)."
180
  msgstr ""
181
 
182
- #: classes/Visualizer/Render/Page/Data.php:74
 
183
  msgid ""
184
  "If you are unsure about how to format your data CSV then please take a look "
185
- "at this sample:"
186
  msgstr ""
187
 
188
- #: classes/Visualizer/Render/Page/Data.php:76
189
- msgid "or read how you can add Google spreadsheet in following %1$sarticle%1$s."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  msgstr ""
191
 
192
- #: classes/Visualizer/Render/Page/Data.php:85
193
- msgid "From Computer"
194
  msgstr ""
195
 
196
- #: classes/Visualizer/Render/Page/Data.php:88
197
- msgid "From Web"
198
  msgstr ""
199
 
200
- #: classes/Visualizer/Render/Page/Data.php:107
201
- msgid "Check PRO Version "
202
  msgstr ""
203
 
204
- #: classes/Visualizer/Render/Page/Data.php:112
205
- msgid "Advanced"
206
  msgstr ""
207
 
208
- #: classes/Visualizer/Render/Page/Data.php:137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  #: classes/Visualizer/Render/Page/Settings.php:55
210
  msgid "Back"
211
  msgstr ""
@@ -218,14 +362,6 @@ msgstr ""
218
  msgid "Next"
219
  msgstr ""
220
 
221
- #: classes/Visualizer/Render/Page.php:72
222
- msgid "Like the plugin? Show us your love!"
223
- msgstr ""
224
-
225
- #: classes/Visualizer/Render/Page.php:75
226
- msgid "Rate it on WordPress.org"
227
- msgstr ""
228
-
229
  #: classes/Visualizer/Render/Sidebar/Columnar.php:42
230
  msgid "Bars Settings"
231
  msgstr ""
@@ -499,7 +635,7 @@ msgstr ""
499
 
500
  #: classes/Visualizer/Render/Sidebar/Graph.php:422
501
  #: classes/Visualizer/Render/Sidebar/Graph.php:451
502
- #: classes/Visualizer/Render/Sidebar.php:526
503
  msgid "Number Format"
504
  msgstr ""
505
 
@@ -1315,7 +1451,7 @@ msgstr ""
1315
  msgid "Hex Value"
1316
  msgstr ""
1317
 
1318
- #: classes/Visualizer/Render/Sidebar.php:529
1319
  msgid ""
1320
  "Enter custom format pattern to apply to this series value, similar to the "
1321
  "%1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, "
@@ -1323,11 +1459,11 @@ msgid ""
1323
  "percentage format then your values will be multiplied by 100."
1324
  msgstr ""
1325
 
1326
- #: classes/Visualizer/Render/Sidebar.php:537
1327
  msgid "Date Format"
1328
  msgstr ""
1329
 
1330
- #: classes/Visualizer/Render/Sidebar.php:540
1331
  msgid ""
1332
  "Enter custom format pattern to apply to this series value, similar to the "
1333
  "%1$sICU date and time format%2$s."
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.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n"
7
+ "POT-Creation-Date: 2017-04-12 10:19:50+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
+ #: classes/Visualizer/Module/Admin.php:133
28
+ msgid "Visualizations"
29
+ msgstr ""
30
+
31
+ #: classes/Visualizer/Module/Admin.php:136
32
+ msgid "From Library"
33
+ msgstr ""
34
+
35
+ #: classes/Visualizer/Module/Admin.php:137
36
+ msgid "Create New"
37
+ msgstr ""
38
+
39
+ #: classes/Visualizer/Module/Admin.php:162
40
  msgid "Pie"
41
  msgstr ""
42
 
43
+ #: classes/Visualizer/Module/Admin.php:166
44
  msgid "Line"
45
  msgstr ""
46
 
47
+ #: classes/Visualizer/Module/Admin.php:170
48
  msgid "Area"
49
  msgstr ""
50
 
51
+ #: classes/Visualizer/Module/Admin.php:174
52
  msgid "Geo"
53
  msgstr ""
54
 
55
+ #: classes/Visualizer/Module/Admin.php:178
56
  msgid "Bar"
57
  msgstr ""
58
 
59
+ #: classes/Visualizer/Module/Admin.php:182
60
  msgid "Column"
61
  msgstr ""
62
 
63
+ #: classes/Visualizer/Module/Admin.php:186
64
  msgid "Gauge"
65
  msgstr ""
66
 
67
+ #: classes/Visualizer/Module/Admin.php:190
68
  msgid "Scatter"
69
  msgstr ""
70
 
71
+ #: classes/Visualizer/Module/Admin.php:194
72
  msgid "Candlestick"
73
  msgstr ""
74
 
75
+ #: classes/Visualizer/Module/Admin.php:199
76
  msgid "Table"
77
  msgstr ""
78
 
79
+ #: classes/Visualizer/Module/Admin.php:203
80
  msgid "Timeline"
81
  msgstr ""
82
 
83
+ #: classes/Visualizer/Module/Admin.php:207
84
  msgid "Combo"
85
  msgstr ""
86
 
87
+ #: classes/Visualizer/Module/Admin.php:313
88
+ #: classes/Visualizer/Render/Library.php:42
 
 
 
 
 
 
 
 
 
 
 
 
89
  msgid "Visualizer Library"
90
  msgstr ""
91
 
92
+ #: classes/Visualizer/Module/Admin.php:440
93
  msgid "Library"
94
  msgstr ""
95
 
96
+ #: classes/Visualizer/Module/Admin.php:465
97
  msgid "Knowledge Base"
98
  msgstr ""
99
 
100
+ #: classes/Visualizer/Module/Admin.php:470
101
  msgid "Pro Addon"
102
  msgstr ""
103
 
104
+ #: classes/Visualizer/Module/Chart.php:295
105
+ #: classes/Visualizer/Module/Chart.php:573
 
 
 
 
 
106
  msgid "You have entered invalid URL. Please, insert proper URL."
107
  msgstr ""
108
 
109
+ #: classes/Visualizer/Module/Chart.php:307
110
  msgid "Save Chart"
111
  msgstr ""
112
 
113
+ #: classes/Visualizer/Module/Chart.php:308
114
  msgid "Create Chart"
115
  msgstr ""
116
 
117
+ #: classes/Visualizer/Module/Chart.php:310
118
  msgid "Insert Chart"
119
  msgstr ""
120
 
121
+ #: classes/Visualizer/Module/Chart.php:407
122
  msgid "CSV file with chart data was not uploaded. Please, try again."
123
  msgstr ""
124
 
125
+ #: classes/Visualizer/Module/Chart.php:419
126
  msgid "CSV file is broken or invalid. Please, try again."
127
  msgstr ""
128
 
129
+ #: classes/Visualizer/Module/Sources.php:142
130
+ msgid "Enable this feature in PRO version!"
131
+ msgstr ""
132
+
133
+ #: classes/Visualizer/Module/Sources.php:143
134
+ msgid "Buy now"
135
+ msgstr ""
136
+
137
+ #: classes/Visualizer/Render/Library.php:43
138
+ msgid "Add New"
139
+ msgstr ""
140
+
141
+ #: classes/Visualizer/Render/Library.php:61
142
+ msgid ""
143
+ "%s option is disabled in your php.ini config. Please, enable it by change "
144
+ "its value to 1. This option increases the speed of remote CSV uploading."
145
+ msgstr ""
146
+
147
+ #: classes/Visualizer/Render/Library.php:112
148
+ msgid "Search"
149
+ msgstr ""
150
+
151
+ #: classes/Visualizer/Render/Library.php:133
152
+ #: classes/Visualizer/Render/Templates.php:85
153
+ msgid "No charts found"
154
+ msgstr ""
155
+
156
+ #: classes/Visualizer/Render/Library.php:184
157
  #: classes/Visualizer/Render/Templates.php:68
158
  msgid "Delete"
159
  msgstr ""
160
 
161
+ #: classes/Visualizer/Render/Library.php:185
162
  msgid "Clone"
163
  msgstr ""
164
 
165
+ #: classes/Visualizer/Render/Library.php:186
166
  msgid "Edit"
167
  msgstr ""
168
 
169
+ #: classes/Visualizer/Render/Library.php:187
170
  msgid "Export"
171
  msgstr ""
172
 
173
+ #: classes/Visualizer/Render/Library.php:188
174
  #: classes/Visualizer/Render/Templates.php:71
175
  msgid "Click to select"
176
  msgstr ""
177
 
178
+ #: classes/Visualizer/Render/Library.php:204
179
+ msgid "Gain more editing power"
180
  msgstr ""
181
 
182
+ #: classes/Visualizer/Render/Library.php:205
183
+ msgid "Spreadsheet like editor"
 
184
  msgstr ""
185
 
186
+ #: classes/Visualizer/Render/Library.php:206
187
+ msgid "Import from other charts"
188
  msgstr ""
189
 
190
+ #: classes/Visualizer/Render/Library.php:207
191
+ msgid "Auto-sync with online files"
192
+ msgstr ""
193
+
194
+ #: classes/Visualizer/Render/Library.php:208
195
+ msgid "3 more chart types"
196
+ msgstr ""
197
+
198
+ #: classes/Visualizer/Render/Library.php:209
199
+ msgid "View more features"
200
+ msgstr ""
201
+
202
+ #: classes/Visualizer/Render/Library.php:217
203
+ msgid "Enable Tracking"
204
+ msgstr ""
205
+
206
+ #: classes/Visualizer/Render/Library.php:218
207
  msgid ""
208
+ "Allow Visualizer to anonymously track how this plugin is used and help us "
209
+ "make the plugin better. No sensitive data is tracked."
210
  msgstr ""
211
 
212
+ #: classes/Visualizer/Render/Page/Data.php:71
213
+ msgid "Chart Data"
214
+ msgstr ""
215
+
216
+ #: classes/Visualizer/Render/Page/Data.php:76
217
+ msgid "Import data from file"
218
+ msgstr ""
219
+
220
+ #: classes/Visualizer/Render/Page/Data.php:78
221
  msgid ""
222
  "Select and upload your data CSV file here. The first row of the CSV file "
223
  "should contain the column headings. The second one should contain series "
224
  "type (string, number, boolean, date, datetime, timeofday)."
225
  msgstr ""
226
 
227
+ #: classes/Visualizer/Render/Page/Data.php:79
228
+ #: classes/Visualizer/Render/Page/Data.php:99
229
  msgid ""
230
  "If you are unsure about how to format your data CSV then please take a look "
231
+ "at this sample: %1$s %2$s%3$s"
232
  msgstr ""
233
 
234
+ #: classes/Visualizer/Render/Page/Data.php:87
235
+ #: classes/Visualizer/Render/Page/Data.php:110
236
+ msgid "Import"
237
+ msgstr ""
238
+
239
+ #: classes/Visualizer/Render/Page/Data.php:92
240
+ msgid "Import data from URL"
241
+ msgstr ""
242
+
243
+ #: classes/Visualizer/Render/Page/Data.php:95
244
+ msgid "One time import"
245
+ msgstr ""
246
+
247
+ #: classes/Visualizer/Render/Page/Data.php:98
248
+ msgid ""
249
+ "You can use this to import data from a remote CSV file. The first row of "
250
+ "the CSV file should contain the column headings. The second one should "
251
+ "contain series type (string, number, boolean, date, datetime, timeofday)."
252
+ msgstr ""
253
+
254
+ #: classes/Visualizer/Render/Page/Data.php:100
255
+ msgid ""
256
+ "You can also import data from Google Spreadsheet, for more info check <a "
257
+ "href=\"https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-"
258
+ "from-Google-Spreadsheet%3F\" target=\"_blank\" >this</a> tutorial"
259
+ msgstr ""
260
+
261
+ #: classes/Visualizer/Render/Page/Data.php:105
262
+ #: classes/Visualizer/Render/Page/Data.php:125
263
+ msgid "Please enter the URL of CSV file"
264
+ msgstr ""
265
+
266
+ #: classes/Visualizer/Render/Page/Data.php:115
267
+ msgid "Schedule Import"
268
+ msgstr ""
269
+
270
+ #: classes/Visualizer/Render/Page/Data.php:118
271
+ msgid "You can choose here to synchronize your chart data with a remote CSV file."
272
+ msgstr ""
273
+
274
+ #: classes/Visualizer/Render/Page/Data.php:119
275
+ msgid ""
276
+ "You can also synchronize with your Google Spreadsheet file, for more info "
277
+ "check <a "
278
+ "href=\"https://github.com/Codeinwp/visualizer/wiki/How-can-I-populate-data-"
279
+ "from-Google-Spreadsheet%3F\" target=\"_blank\" >this</a> tutorial"
280
+ msgstr ""
281
+
282
+ #: classes/Visualizer/Render/Page/Data.php:120
283
+ msgid ""
284
+ "We will update the chart data based on your time interval preference by "
285
+ "overwritting the current data with the one from the URL."
286
+ msgstr ""
287
+
288
+ #: classes/Visualizer/Render/Page/Data.php:127
289
+ msgid "How often do you want to check the url"
290
+ msgstr ""
291
+
292
+ #: classes/Visualizer/Render/Page/Data.php:132
293
+ msgid "Each hour"
294
  msgstr ""
295
 
296
+ #: classes/Visualizer/Render/Page/Data.php:133
297
+ msgid "Each 12 hours"
298
  msgstr ""
299
 
300
+ #: classes/Visualizer/Render/Page/Data.php:134
301
+ msgid "Each day"
302
  msgstr ""
303
 
304
+ #: classes/Visualizer/Render/Page/Data.php:135
305
+ msgid "Each 3 days"
306
  msgstr ""
307
 
308
+ #: classes/Visualizer/Render/Page/Data.php:147
309
+ msgid "Save schedule"
310
  msgstr ""
311
 
312
+ #: classes/Visualizer/Render/Page/Data.php:158
313
+ msgid "Import from other chart"
314
+ msgstr ""
315
+
316
+ #: classes/Visualizer/Render/Page/Data.php:162
317
+ msgid "You can import here data from your previously created charts"
318
+ msgstr ""
319
+
320
+ #: classes/Visualizer/Render/Page/Data.php:190
321
+ msgid "Import Chart"
322
+ msgstr ""
323
+
324
+ #: classes/Visualizer/Render/Page/Data.php:197
325
+ msgid "Edit current data"
326
+ msgstr ""
327
+
328
+ #: classes/Visualizer/Render/Page/Data.php:205
329
+ msgid "You can manually edit the chart data using the spreadsheet like editor."
330
+ msgstr ""
331
+
332
+ #: classes/Visualizer/Render/Page/Data.php:207
333
+ msgid "View Editor"
334
+ msgstr ""
335
+
336
+ #: classes/Visualizer/Render/Page/Data.php:207
337
+ msgid "Show Chart"
338
+ msgstr ""
339
+
340
+ #: classes/Visualizer/Render/Page/Data.php:217
341
+ msgid "Advanced Settings"
342
+ msgstr ""
343
+
344
+ #: classes/Visualizer/Render/Page/Data.php:220
345
+ msgid "Chart Settings"
346
+ msgstr ""
347
+
348
+ #: classes/Visualizer/Render/Page/Data.php:231
349
+ msgid "Rate our plugin"
350
+ msgstr ""
351
+
352
+ #: classes/Visualizer/Render/Page/Data.php:250
353
  #: classes/Visualizer/Render/Page/Settings.php:55
354
  msgid "Back"
355
  msgstr ""
362
  msgid "Next"
363
  msgstr ""
364
 
 
 
 
 
 
 
 
 
365
  #: classes/Visualizer/Render/Sidebar/Columnar.php:42
366
  msgid "Bars Settings"
367
  msgstr ""
635
 
636
  #: classes/Visualizer/Render/Sidebar/Graph.php:422
637
  #: classes/Visualizer/Render/Sidebar/Graph.php:451
638
+ #: classes/Visualizer/Render/Sidebar.php:529
639
  msgid "Number Format"
640
  msgstr ""
641
 
1451
  msgid "Hex Value"
1452
  msgstr ""
1453
 
1454
+ #: classes/Visualizer/Render/Sidebar.php:532
1455
  msgid ""
1456
  "Enter custom format pattern to apply to this series value, similar to the "
1457
  "%1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, "
1459
  "percentage format then your values will be multiplied by 100."
1460
  msgstr ""
1461
 
1462
+ #: classes/Visualizer/Render/Sidebar.php:540
1463
  msgid "Date Format"
1464
  msgstr ""
1465
 
1466
+ #: classes/Visualizer/Render/Sidebar.php:543
1467
  msgid ""
1468
  "Enter custom format pattern to apply to this series value, similar to the "
1469
  "%1$sICU date and time format%2$s."
readme.txt CHANGED
@@ -2,32 +2,33 @@
2
  Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle
3
  Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api
4
  Requires at least: 3.5
5
- Tested up to: 4.7.1
6
  Stable tag: trunk
7
  License: GPL v2.0 or later
8
  License URI: http://www.opensource.org/licenses/gpl-license.php
9
 
10
- A simple and quite powerful WordPress chart plugin to create, manage and embed interactive charts into your WordPress posts and pages.
11
 
12
  == Description ==
13
 
14
- <a href="http://themeisle.com/plugins/visualizer-charts-and-graphs-lite/" rel="nofollow">WordPress Visualizer plugin</a> is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages.
15
 
16
- The plugin uses Google Visualization API to add charts, which support cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
17
 
18
  > **Time-saving features available in the Pro version:**
19
  >
20
  > * Import data from other charts
21
  > * Easy edit the data using a live editor
22
  > * 3 more chart types ( Combo, Timeline and Table chart )
 
23
  > * Priority email support from the developer of the plugin
24
  > * Support and updates for 1 year
25
  >
26
- > **[Learn more about Visualizer PRO](http://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/)**
27
 
28
 
29
  ### 9 Chart types + 3 more in the pro version ###
30
- This WordPress graph plugin provides a variety of charts that are optimized to address your WordPress data visualization needs. It is line chart, area chart, bar chart, column chart, pie chart, geo chart, gauge chart, candlestick chart and scatter chart. These charts are based on pure HTML5/SVG technology (adopting VML for old IE versions), so no extra plugins are required. Adding these charts to your page can be done in a few simple steps.
31
 
32
  ### Flexible and customizable ###
33
  Make the charts your own. Configure an extensive set of options to perfectly match the look and feel of your website. You can use Google Chart Tools with their default setting - all customization is optional and the basic setup is launch-ready. However, charts can be easily customizable in case your webpage adopts a style which is at odds with provided defaults. Every chart exposes a number of options that customize its look and feel.
@@ -39,15 +40,22 @@ Charts are rendered using HTML5/SVG technology to provide cross-browser compatib
39
 
40
  The plugins works perfectly with the all <a href="http://justfreethemes.com" rel="nofollow">free</a> or <a href="http://www.codeinwp.com/blog/best-wordpress-themes/" rel="nofollow">premium WordPress themes</a>
41
 
42
- ### Knowledge Base ###
43
 
44
- 1. [How can I create a chart?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-create-a-chart%3F)
45
- 1. [How can I edit a chart?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-edit-a-chart%3F)
46
- 1. [How can I clone a chart?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-clone-a-chart%3F)
47
- 1. [How can I delete a chart?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-delete-a-chart%3F)
48
- 1. [How can I highlight a single bar?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-highlight-a-single-bar%3F)
49
- 1. [How can I populate chart series and data dynamically?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-chart-series-and-data-dynamically%3F)
50
- 1. [How can I populate data from Google Spreadsheet?](https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F)
 
 
 
 
 
 
 
 
51
 
52
  == Installation ==
53
 
@@ -60,6 +68,46 @@ The plugins works perfectly with the all <a href="http://justfreethemes.com" rel
60
 
61
  Pay attention that to turn your shortcodes into graphs, your theme has to have `<?php wp_footer(); ?>` call at the bottom of **footer.php** file.
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  == Screenshots ==
64
 
65
  1. Chart type selection
@@ -70,29 +118,34 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
70
 
71
  == Changelog ==
72
 
73
- = 1.7.6=
 
 
 
 
 
74
  * Fixed issue when using the same shortcode multiple times on the same page.
75
 
76
- = 1.7.5=
77
  * Removed footer banner upsell
78
  * Fixed series settings issue
79
  * Fixed issue with comas being used in numbers
80
 
81
- = 1.7.2=
82
  * Improved charts responsive system
83
 
84
- = 1.7.1=
85
  * Fixed grid lines error links
86
 
87
- = 1.7.0=
88
  * Fixed responsive issues
89
  * Fixed issues with zero margin values
90
  * Fixed import issue
91
 
92
- = 1.6.6=
93
  * Fixed charts resizing on tabbed content
94
 
95
- = 1.6.5=
96
  * Fixed responsive issue
97
  * Fixed no axis text color for line and bar charts
98
 
@@ -208,4 +261,4 @@ Pay attention that to turn your shortcodes into graphs, your theme has to have `
208
  * The bug with CSV file uploading was fixed.
209
 
210
  = 1.0.0 =
211
- * The first version of the plugin was implemented.
2
  Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle
3
  Tags: chart, charts, charting, graph, graphs, graphing, visualisation, visualise data, visualization, visualize data, HTML5, canvas, pie chart, line chart, bar chart, column chart, gauge chart, area chart, scatter chart, candlestick chart, geo chart, google visualization api
4
  Requires at least: 3.5
5
+ Tested up to: 4.7.3
6
  Stable tag: trunk
7
  License: GPL v2.0 or later
8
  License URI: http://www.opensource.org/licenses/gpl-license.php
9
 
10
+ A simple and quite powerful WordPress chart plugin to create and embed interactive charts & tables into your site.
11
 
12
  == Description ==
13
 
14
+ <a href="http://themeisle.com/plugins/visualizer-charts-and-graphs-lite/" rel="nofollow">WordPress Visualizer plugin</a> is a simple, easy to use and quite powerful tool to create, manage and embed interactive charts & tables into your WordPress posts and pages.
15
 
16
+ The plugin uses Google Visualization API to add responsive & animated charts/diagrams, which support cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases. Is the best Excel to WordPress solution who let's you insert charts to your wp site using a simple chart builder.
17
 
18
  > **Time-saving features available in the Pro version:**
19
  >
20
  > * Import data from other charts
21
  > * Easy edit the data using a live editor
22
  > * 3 more chart types ( Combo, Timeline and Table chart )
23
+ > * Auto synchronize with your online file.
24
  > * Priority email support from the developer of the plugin
25
  > * Support and updates for 1 year
26
  >
27
+ > **[Learn more about Visualizer PRO](http://themeisle.com/plugins/visualizer-charts-and-graphs/)**
28
 
29
 
30
  ### 9 Chart types + 3 more in the pro version ###
31
+ This WordPress graph plugin provides a variety of charts that are optimized to address your WordPress data visualization needs. It is line chart,flow chart, area chart, bar chart, column chart, pie chart, geo chart, gauge chart, candlestick chart and scatter chart. These charts are based on pure HTML5/SVG technology (adopting VML for old IE versions), so no extra plugins are required. Adding these charts to your page can be done in a few simple steps. The premium version can act as a interactive WordPress Table plugin, with sorting capabilities.
32
 
33
  ### Flexible and customizable ###
34
  Make the charts your own. Configure an extensive set of options to perfectly match the look and feel of your website. You can use Google Chart Tools with their default setting - all customization is optional and the basic setup is launch-ready. However, charts can be easily customizable in case your webpage adopts a style which is at odds with provided defaults. Every chart exposes a number of options that customize its look and feel.
40
 
41
  The plugins works perfectly with the all <a href="http://justfreethemes.com" rel="nofollow">free</a> or <a href="http://www.codeinwp.com/blog/best-wordpress-themes/" rel="nofollow">premium WordPress themes</a>
42
 
 
43
 
44
+ = See how Visualizer can integrate with your website =
45
+
46
+ * [Create line chart ](https://demo.themeisle.com/visualizer/line-chart/)
47
+ * [Create pie chart ](https://demo.themeisle.com/visualizer/pie-chart/)
48
+ * [Create bar chart](https://demo.themeisle.com/visualizer/bar-chart/)
49
+ * [Create column chart](https://demo.themeisle.com/visualizer/column-chart/)
50
+ * [Create area chart](https://demo.themeisle.com/visualizer/area-chart/)
51
+ * [Create geo chart](https://demo.themeisle.com/visualizer/geo-chart/)
52
+ * [Create table chart](https://demo.themeisle.com/visualizer/table-chart/)
53
+ * [Create gauge chart](https://demo.themeisle.com/visualizer/gauge-chart//)
54
+ * [Create candlestick chart](https://demo.themeisle.com/visualizer/candlestick-chart/)
55
+ * [Create combo chart](https://demo.themeisle.com/visualizer/combo-chart/)
56
+ * [Create scatter chart](https://demo.themeisle.com/visualizer/scatter-chart/)
57
+ * [Create timeline chart](https://demo.themeisle.com/visualizer/timeline-chart/)
58
+
59
 
60
  == Installation ==
61
 
68
 
69
  Pay attention that to turn your shortcodes into graphs, your theme has to have `<?php wp_footer(); ?>` call at the bottom of **footer.php** file.
70
 
71
+ = How can I create a chart? =
72
+
73
+ http://docs.themeisle.com/article/597-create-chart
74
+
75
+ = How can I edit a chart? =
76
+
77
+ http://docs.themeisle.com/article/602-how-can-i-edit-a-chart
78
+
79
+ = How can I delete a chart? =
80
+
81
+ http://docs.themeisle.com/article/600-delete-chart
82
+
83
+ = How can I clone a chart? =
84
+
85
+ http://docs.themeisle.com/article/598-clone-chart
86
+
87
+ = How can I highlight a single bar? =
88
+
89
+ http://docs.themeisle.com/article/603-how-can-i-highlight-a-single-bar
90
+
91
+ = How can I populate chart series and data dynamically? =
92
+
93
+ http://docs.themeisle.com/article/605-how-can-i-populate-chart-series-and-data-dynamically
94
+
95
+ = How can I populate data from Google Spreadsheet? =
96
+
97
+ http://docs.themeisle.com/article/607-how-can-i-populate-data-from-google-spreadsheet
98
+
99
+ = How can i import content from another chart? =
100
+
101
+ http://docs.themeisle.com/article/609-how-can-i-import-content-from-another-chart
102
+
103
+ = How to export a chart? =
104
+
105
+ http://docs.themeisle.com/article/608-how-to-export-a-chart
106
+
107
+ = How can i edit the data manually? =
108
+
109
+ http://docs.themeisle.com/article/610-how-can-i-edit-the-data-manually
110
+
111
  == Screenshots ==
112
 
113
  1. Chart type selection
118
 
119
  == Changelog ==
120
 
121
+ = 2.0.0 =
122
+ * Improved design and layout to support multiple datasources.
123
+ * Added new integrations in the Pro version.
124
+ * Added opt-in for tracking.
125
+
126
+ = 1.7.6 =
127
  * Fixed issue when using the same shortcode multiple times on the same page.
128
 
129
+ = 1.7.5 =
130
  * Removed footer banner upsell
131
  * Fixed series settings issue
132
  * Fixed issue with comas being used in numbers
133
 
134
+ = 1.7.2 =
135
  * Improved charts responsive system
136
 
137
+ = 1.7.1 =
138
  * Fixed grid lines error links
139
 
140
+ = 1.7.0 =
141
  * Fixed responsive issues
142
  * Fixed issues with zero margin values
143
  * Fixed import issue
144
 
145
+ = 1.6.6 =
146
  * Fixed charts resizing on tabbed content
147
 
148
+ = 1.6.5 =
149
  * Fixed responsive issue
150
  * Fixed no axis text color for line and bar charts
151
 
261
  * The bug with CSV file uploading was fixed.
262
 
263
  = 1.0.0 =
264
+ * The first version of what wil be the best wp charts plugin.