PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 1.6.6
Visualizer – Tables & Charts Manager with Built-in AI Generator v1.6.6
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Module/Admin.php +112 -280 3.0.61.6.6 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 // +----------------------------------------------------------------------+
3 4 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
4 5 // +----------------------------------------------------------------------+
5 6 // | This program is free software; you can redistribute it and/or modify |
@@ -17,8 +18,9 @@
17 18 // | MA 02110-1301 USA |
18 19 // +----------------------------------------------------------------------+
19 20 // | Author: Eugene Manuilov <eugene@manuilov.org> |
20 21 // +----------------------------------------------------------------------+
22 +
21 23 /**
22 24 * The module for all admin stuff.
23 25 *
24 26 * @category Visualizer
@@ -45,101 +47,53 @@
45 47 *
46 48 * @since 1.0.0
47 49 *
48 50 * @access public
49 - *
50 51 * @param Visualizer_Plugin $plugin The instance of the plugin.
51 52 */
52 53 public function __construct( Visualizer_Plugin $plugin ) {
53 54 parent::__construct( $plugin );
55 +
54 56 $this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
55 57 $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
56 58 $this->_addAction( 'admin_footer', 'renderTempaltes' );
57 - $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 8 );
59 + $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts' );
58 60 $this->_addAction( 'admin_menu', 'registerAdminMenu' );
61 +
59 62 $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
60 63 $this->_addFilter( 'plugin_action_links', 'getPluginActionLinks', 10, 2 );
61 - $this->_addFilter( 'visualizer_logger_data', 'getLoggerData' );
62 - $this->_addFilter( 'visualizer_get_chart_counts', 'getChartCountsByTypeAndMeta' );
63 - $this->_addFilter( 'visualizer_feedback_review_trigger', 'feedbackReviewTrigger' );
64 -
65 - $this->_addAction( 'admin_init', 'init' );
64 + $this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
66 65 }
67 66
68 67 /**
69 - * Admin init.
68 + * Returns associated array of chart types and localized names.
70 69 *
71 - * @access public
72 - */
73 - public function init() {
74 - if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) && 'true' == get_user_option( 'rich_editing' ) ) {
75 - $this->_addFilter( 'mce_external_languages', 'add_tinymce_lang', 10, 1 );
76 - $this->_addFilter( 'mce_external_plugins', 'tinymce_plugin', 10, 1 );
77 - $this->_addFilter( 'mce_buttons', 'register_mce_button', 10, 1 );
78 - }
79 - }
80 -
81 - /**
82 - * Load plugin translation for - TinyMCE API
70 + * @since 1.0.0
83 71 *
84 - * @access public
85 - * @param array $arr The tinymce_lang array.
86 - * @return array
72 + * @static
73 + * @access private
74 + * @return array The associated array of chart types with localized names.
87 75 */
88 - public function add_tinymce_lang( $arr ) {
89 - $ui_lang = VISUALIZER_ABSPATH . '/classes/Visualizer/Module/Language.php';
90 - $ui_lang = apply_filters( 'visualizer_ui_lang_filter', $ui_lang );
91 - $arr[] = $ui_lang;
92 - return $arr;
93 - }
76 + public static function _getChartTypesLocalized() {
77 + $types = array(
78 + 'all' => esc_html__( 'All', Visualizer_Plugin::NAME ),
79 + 'pie' => esc_html__( 'Pie', Visualizer_Plugin::NAME ),
80 + 'line' => esc_html__( 'Line', Visualizer_Plugin::NAME ),
81 + 'area' => esc_html__( 'Area', Visualizer_Plugin::NAME ),
82 + 'geo' => esc_html__( 'Geo', Visualizer_Plugin::NAME ),
83 + 'bar' => esc_html__( 'Bar', Visualizer_Plugin::NAME ),
84 + 'column' => esc_html__( 'Column', Visualizer_Plugin::NAME ),
85 + 'gauge' => esc_html__( 'Gauge', Visualizer_Plugin::NAME ),
86 + 'scatter' => esc_html__( 'Scatter', Visualizer_Plugin::NAME ),
87 + 'candlestick' => esc_html__( 'Candlestick', Visualizer_Plugin::NAME ),
88 + );
94 89
95 - /**
96 - * Load custom js options - TinyMCE API
97 - *
98 - * @access public
99 - * @param array $plugin_array The tinymce plugin array.
100 - * @return array
101 - */
102 - public function tinymce_plugin( $plugin_array ) {
103 - $plugin_array['visualizer_mce_button'] = VISUALIZER_ABSURL . 'js/mce.js';
104 - return $plugin_array;
105 - }
90 + $types = apply_filters("visualizer_pro_chart_types", $types);
106 91
107 - /**
108 - * Register new button in the editor
109 - *
110 - * @access public
111 - * @param array $buttons The tinymce buttons array.
112 - * @return array
113 - */
114 - public function register_mce_button( $buttons ) {
115 - array_push( $buttons, 'visualizer_mce_button' );
116 - return $buttons;
92 + return $types;
117 93 }
118 94
119 95 /**
120 - * Whether to show the feedback review or not.
121 - *
122 - * @access public
123 - */
124 - public function feedbackReviewTrigger( $dumb ) {
125 - $query = new WP_Query(
126 - array(
127 - 'posts_per_page' => 50,
128 - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
129 - 'fields' => 'ids',
130 - 'update_post_meta_cache' => false,
131 - 'update_post_term_cache' => false,
132 - )
133 - );
134 -
135 - if ( $query->have_posts() && $query->post_count > 0 ) {
136 - return true;
137 - }
138 - return false;
139 - }
140 -
141 - /**
142 96 * Enqueues media scripts and styles.
143 97 *
144 98 * @since 1.0.0
145 99 * @uses wp_enqueue_style To enqueue style file.
@@ -148,18 +102,20 @@
148 102 * @access public
149 103 */
150 104 public function enqueueMediaScripts() {
151 105 global $typenow;
106 +
152 107 if ( post_type_supports( $typenow, 'editor' ) ) {
153 108 wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION );
154 - wp_enqueue_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array( 'media-editor' ), null, true );
155 - wp_enqueue_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
156 - wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', array( 'visualizer-google-jsapi-old' ), Visualizer_Plugin::VERSION, true );
157 - wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true );
109 +
110 + wp_enqueue_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array( 'media-editor' ), null, true );
111 + wp_enqueue_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true );
112 + wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', array( 'visualizer-google-jsapi-old' ), Visualizer_Plugin::VERSION, true );
113 + wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true );
158 114 wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true );
159 - wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true );
160 - wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION, true );
161 - wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION, true );
115 + wp_enqueue_script( 'visualizer-media-view', VISUALIZER_ABSURL . 'js/media/view.js', array( 'visualizer-media-controller' ), Visualizer_Plugin::VERSION, true );
116 + wp_enqueue_script( 'visualizer-media-toolbar', VISUALIZER_ABSURL . 'js/media/toolbar.js', array( 'visualizer-media-view' ), Visualizer_Plugin::VERSION, true );
117 + wp_enqueue_script( 'visualizer-media', VISUALIZER_ABSURL . 'js/media.js', array( 'visualizer-media-toolbar' ), Visualizer_Plugin::VERSION, true );
162 118 }
163 119 }
164 120
165 121 /**
@@ -167,33 +123,29 @@
167 123 *
168 124 * @since 1.0.0
169 125 *
170 126 * @access public
171 - *
172 127 * @param array $strings The array of media view strings.
173 - *
174 128 * @return array The extended array of media view strings.
175 129 */
176 130 public function setupMediaViewStrings( $strings ) {
177 - $chart_types = self::_getChartTypesLocalized( true, true, true );
178 131 $strings['visualizer'] = array(
179 - 'actions' => array(
132 + 'actions' => array(
180 133 'get_charts' => Visualizer_Plugin::ACTION_GET_CHARTS,
181 134 'delete_chart' => Visualizer_Plugin::ACTION_DELETE_CHART,
182 135 ),
183 136 'controller' => array(
184 - 'title' => esc_html__( 'Visualizations', 'visualizer' ),
137 + 'title' => esc_html__( 'Visualizations', Visualizer_Plugin::NAME ),
185 138 ),
186 - 'routers' => array(
187 - 'library' => esc_html__( 'From Library', 'visualizer' ),
188 - 'create' => esc_html__( 'Create New', 'visualizer' ),
139 + 'routers' => array(
140 + 'library' => esc_html__( 'From Library', Visualizer_Plugin::NAME ),
141 + 'create' => esc_html__( 'Create New', Visualizer_Plugin::NAME ),
189 142 ),
190 - 'library' => array(
191 - 'filters' => $chart_types,
192 - 'types' => array_keys( $chart_types ),
143 + 'library' => array(
144 + 'filters' => self::_getChartTypesLocalized(),
193 145 ),
194 - 'nonce' => wp_create_nonce(),
195 - 'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
146 + 'nonce' => wp_create_nonce(),
147 + 'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
196 148 );
197 149
198 150 return $strings;
199 151 }
@@ -198,109 +150,8 @@
198 150 return $strings;
199 151 }
200 152
201 153 /**
202 - * Returns associated array of chart types and localized names.
203 - *
204 - * @since 1.0.0
205 - *
206 - * @static
207 - * @access private
208 - * @return array The associated array of chart types with localized names.
209 - */
210 - public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darray = false, $add_select = false ) {
211 - $additional = array();
212 - if ( $add_select ) {
213 - $additional['select'] = array(
214 - 'name' => esc_html__( 'All', 'visualizer' ),
215 - 'enabled' => true,
216 - );
217 - }
218 -
219 - $types = array_merge(
220 - $additional, array(
221 - 'pie' => array(
222 - 'name' => esc_html__( 'Pie', 'visualizer' ),
223 - 'enabled' => true,
224 - ),
225 - 'line' => array(
226 - 'name' => esc_html__( 'Line', 'visualizer' ),
227 - 'enabled' => true,
228 - ),
229 - 'area' => array(
230 - 'name' => esc_html__( 'Area', 'visualizer' ),
231 - 'enabled' => true,
232 - ),
233 - 'geo' => array(
234 - 'name' => esc_html__( 'Geo', 'visualizer' ),
235 - 'enabled' => true,
236 - ),
237 - 'bar' => array(
238 - 'name' => esc_html__( 'Bar', 'visualizer' ),
239 - 'enabled' => true,
240 - ),
241 - 'column' => array(
242 - 'name' => esc_html__( 'Column', 'visualizer' ),
243 - 'enabled' => true,
244 - ),
245 - 'gauge' => array(
246 - 'name' => esc_html__( 'Gauge', 'visualizer' ),
247 - 'enabled' => true,
248 - ),
249 - 'scatter' => array(
250 - 'name' => esc_html__( 'Scatter', 'visualizer' ),
251 - 'enabled' => true,
252 - ),
253 - 'candlestick' => array(
254 - 'name' => esc_html__( 'Candlestick', 'visualizer' ),
255 - 'enabled' => true,
256 - ),
257 - // pro types
258 - 'table' => array(
259 - 'name' => esc_html__( 'Table', 'visualizer' ),
260 - 'enabled' => false,
261 - ),
262 - 'timeline' => array(
263 - 'name' => esc_html__( 'Timeline', 'visualizer' ),
264 - 'enabled' => false,
265 - ),
266 - 'combo' => array(
267 - 'name' => esc_html__( 'Combo', 'visualizer' ),
268 - 'enabled' => false,
269 - ),
270 - )
271 - );
272 - $types = apply_filters( 'visualizer_pro_chart_types', $types );
273 - if ( $enabledOnly ) {
274 - $filtered = array();
275 - foreach ( $types as $type => $array ) {
276 - if ( ! is_array( $array ) ) {
277 - // support for old pro
278 - $array = array( 'enabled' => true, 'name' => $array );
279 - }
280 - if ( ! $array['enabled'] ) {
281 - continue;
282 - }
283 - $filtered[ $type ] = $array;
284 - }
285 - $types = $filtered;
286 - }
287 - if ( $get2Darray ) {
288 - $doubleD = array();
289 - foreach ( $types as $type => $array ) {
290 - if ( ! is_array( $array ) ) {
291 - // support for old pro
292 - $array = array( 'enabled' => true, 'name' => $array );
293 - }
294 - $doubleD[ $type ] = $array['name'];
295 - }
296 - $types = $doubleD;
297 - }
298 -
299 - return $types;
300 - }
301 -
302 - /**
303 154 * Renders templates to use in media popup.
304 155 *
305 156 * @since 1.0.0
306 157 * @global string $pagenow The name of the current page.
@@ -308,11 +159,13 @@
308 159 * @access public
309 160 */
310 161 public function renderTempaltes() {
311 162 global $pagenow;
163 +
312 164 if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) {
313 165 return;
314 166 }
167 +
315 168 $render = new Visualizer_Render_Templates();
316 169 $render->render();
317 170 }
318 171
@@ -324,30 +177,21 @@
324 177 * @uses wp_enqueue_script() To enqueue javascript file.
325 178 * @uses wp_enqueue_media() To enqueue media stuff.
326 179 *
327 180 * @access public
328 - *
329 181 * @param string $suffix The current page suffix.
330 182 */
331 183 public function enqueueLibraryScripts( $suffix ) {
332 184 if ( $suffix == $this->_libraryPage ) {
333 185 wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION );
186 +
334 187 $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' );
188 +
335 189 wp_enqueue_media();
336 - wp_enqueue_script(
337 - 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array(
338 - 'jquery',
339 - 'media-views',
340 - ), Visualizer_Plugin::VERSION, true
341 - );
190 + wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( 'jquery', 'media-views' ), Visualizer_Plugin::VERSION, true );
342 191 wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
343 - wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
344 - wp_enqueue_script(
345 - 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array(
346 - 'google-jsapi-old',
347 - 'visualizer-library',
348 - ), Visualizer_Plugin::VERSION, true
349 - );
192 + wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array('google-jsapi-new'), null, true );
193 + wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'google-jsapi-old', 'visualizer-library' ), Visualizer_Plugin::VERSION, true );
350 194 }
351 195 }
352 196
353 197 /**
@@ -355,16 +199,13 @@
355 199 *
356 200 * @since 1.0.0
357 201 *
358 202 * @access public
359 - *
360 203 * @param array $tabs The array of media upload tabs.
361 - *
362 204 * @return array Extended array of media upload tabs.
363 205 */
364 206 public function setupVisualizerTab( $tabs ) {
365 207 $tabs['visualizer'] = 'Visualizer';
366 -
367 208 return $tabs;
368 209 }
369 210
370 211 /**
@@ -374,10 +215,10 @@
374 215 *
375 216 * @access public
376 217 */
377 218 public function registerAdminMenu() {
378 - $title = esc_html__( 'Visualizer Library', 'visualizer' );
379 - $callback = array( $this, 'renderLibraryPage' );
219 + $title = esc_html__( 'Visualizer Library', Visualizer_Plugin::NAME );
220 + $callback = array( $this, 'renderLibraryPage' );
380 221 $this->_libraryPage = add_submenu_page( 'upload.php', $title, $title, 'edit_posts', Visualizer_Plugin::NAME, $callback );
381 222 }
382 223
383 224 /**
@@ -388,16 +229,15 @@
388 229 * @access public
389 230 */
390 231 public function renderLibraryPage() {
391 232 // get current page
392 - $page = filter_input(
393 - INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array(
394 - 'options' => array(
395 - 'min_range' => 1,
396 - 'default' => 1,
397 - ),
233 + $page = filter_input( INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array(
234 + 'options' => array(
235 + 'min_range' => 1,
236 + 'default' => 1,
398 237 )
399 - );
238 + ) );
239 +
400 240 // the initial query arguments to fetch charts
401 241 $query_args = array(
402 242 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
403 243 'posts_per_page' => 6,
@@ -402,8 +242,9 @@
402 242 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
403 243 'posts_per_page' => 6,
404 244 'paged' => $page,
405 245 );
246 +
406 247 // add chart type filter to the query arguments
407 248 $filter = filter_input( INPUT_GET, 'type' );
408 249 if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) {
409 250 $query_args['meta_query'] = array(
@@ -415,34 +256,39 @@
415 256 );
416 257 } else {
417 258 $filter = 'all';
418 259 }
419 - // Added by Ash/Upwork
420 - $filterByMeta = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
421 - if ( $filterByMeta ) {
422 - $query = array(
423 - 'key' => Visualizer_Plugin::CF_SETTINGS,
424 - 'value' => $filterByMeta,
425 - 'compare' => 'LIKE',
426 - );
427 - $meta = isset( $query_args['meta_query'] ) ? $query_args['meta_query'] : array();
428 - $meta[] = $query;
429 - $query_args['meta_query'] = $meta;
430 - }
431 - // Added by Ash/Upwork
260 +
261 + // Added by Ash/Upwork
262 + $filterByMeta = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
263 + if($filterByMeta){
264 + $query = array(
265 + 'key' => Visualizer_Plugin::CF_SETTINGS,
266 + 'value' => $filterByMeta,
267 + 'compare' => 'LIKE',
268 + );
269 + $meta = isset($query_args['meta_query']) ? $query_args['meta_query'] : array();
270 + $meta[] = $query;
271 + $query_args['meta_query'] = $meta;
272 + }
273 + // Added by Ash/Upwork
274 +
432 275 // fetch charts
433 276 $charts = array();
434 - $query = new WP_Query( $query_args );
435 - while ( $query->have_posts() ) {
277 + $query = new WP_Query( $query_args );
278 + while( $query->have_posts() ) {
436 279 $chart = $query->next_post();
280 +
437 281 // fetch and update settings
438 282 $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
439 283 unset( $settings['height'], $settings['width'] );
440 - $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
284 +
285 + $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
441 286 $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
442 - $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $chart->ID, $type );
287 + $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
288 +
443 289 // add chart to the array
444 - $charts[ 'visualizer-' . $chart->ID ] = array(
290 + $charts['visualizer-' . $chart->ID] = array(
445 291 'id' => $chart->ID,
446 292 'type' => $type,
447 293 'series' => $series,
448 294 'settings' => $settings,
@@ -448,44 +294,34 @@
448 294 'settings' => $settings,
449 295 'data' => $data,
450 296 );
451 297 }
298 +
452 299 // enqueue charts array
453 300 $ajaxurl = admin_url( 'admin-ajax.php' );
454 - wp_localize_script(
455 - 'visualizer-library', 'visualizer', array(
456 - 'charts' => $charts,
457 - 'urls' => array(
458 - 'base' => add_query_arg( 'vpage', false ),
459 - 'create' => add_query_arg(
460 - array(
461 - 'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
462 - 'library' => 'yes',
463 - ), $ajaxurl
464 - ),
465 - 'edit' => add_query_arg(
466 - array(
467 - 'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
468 - 'library' => 'yes',
469 - ), $ajaxurl
470 - ),
471 - ),
472 - )
473 - );
301 + wp_localize_script( 'visualizer-library', 'visualizer', array(
302 + 'charts' => $charts,
303 + 'urls' => array(
304 + 'base' => add_query_arg( 'vpage', false ),
305 + 'create' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, 'library' => 'yes' ), $ajaxurl ),
306 + 'edit' => add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, 'library' => 'yes' ), $ajaxurl ),
307 + ),
308 + ) );
309 +
474 310 // render library page
475 - $render = new Visualizer_Render_Library();
476 - $render->charts = $charts;
477 - $render->type = $filter;
478 - $render->types = self::_getChartTypesLocalized();
479 - $render->pagination = paginate_links(
480 - array(
481 - 'base' => add_query_arg( 'vpage', '%#%' ),
482 - 'format' => '',
483 - 'current' => $page,
484 - 'total' => $query->max_num_pages,
485 - 'type' => 'array',
486 - )
487 - );
311 + $render = new Visualizer_Render_Library();
312 +
313 + $render->charts = $charts;
314 + $render->type = $filter;
315 + $render->types = self::_getChartTypesLocalized();
316 + $render->pagination = paginate_links( array(
317 + 'base' => add_query_arg( 'vpage', '%#%' ),
318 + 'format' => '',
319 + 'current' => $page,
320 + 'total' => $query->max_num_pages,
321 + 'type' => 'array',
322 + ) );
323 +
488 324 $render->render();
489 325 }
490 326
491 327 /**
@@ -493,12 +329,10 @@
493 329 *
494 330 * @since 1.0.0
495 331 *
496 332 * @access public
497 - *
498 - * @param array $links The array of original action links.
333 + * @param array $links The array of original action links.
499 334 * @param string $file The plugin basename.
500 - *
501 335 * @return array Updated array of action links.
502 336 */
503 337 public function getPluginActionLinks( $links, $file ) {
504 338 if ( $file == plugin_basename( VISUALIZER_BASEFILE ) ) {
@@ -506,9 +340,9 @@
506 340 $links,
507 341 sprintf(
508 342 '<a href="%s">%s</a>',
509 343 admin_url( 'upload.php?page=' . Visualizer_Plugin::NAME ),
510 - esc_html__( 'Library', 'visualizer' )
344 + esc_html__( 'Library', Visualizer_Plugin::NAME )
511 345 )
512 346 );
513 347 }
514 348
@@ -520,12 +354,10 @@
520 354 *
521 355 * @since 1.0.0
522 356 *
523 357 * @access public
524 - *
525 - * @param array $plugin_meta The array of a plugin meta links.
358 + * @param array $plugin_meta The array of a plugin meta links.
526 359 * @param string $plugin_file The plugin's basename.
527 - *
528 360 * @return array Updated array of plugin meta links.
529 361 */
530 362 public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
531 363 if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
@@ -531,14 +363,14 @@
531 363 if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) {
532 364 // knowledge base link
533 365 $plugin_meta[] = sprintf(
534 366 '<a href="https://github.com/codeinwp/visualizer/wiki" target="_blank">%s</a>',
535 - esc_html__( 'Knowledge Base', 'visualizer' )
367 + esc_html__( 'Knowledge Base', Visualizer_Plugin::NAME )
536 368 );
537 369 // flattr link
538 370 $plugin_meta[] = sprintf(
539 371 '<a style="color:red" href="https://themeisle.com/plugins/visualizer-charts-and-graphs-pro-addon/" target="_blank">%s</a>',
540 - esc_html__( 'Pro Addon', 'visualizer' )
372 + esc_html__( 'Pro Addon', Visualizer_Plugin::NAME )
541 373 );
542 374 }
543 375
544 376 return $plugin_meta;
@@ -543,5 +375,5 @@
543 375
544 376 return $plugin_meta;
545 377 }
546 378
547 -}
379 +}