PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.0.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.0.3
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 +64 -70 3.0.52.0.3 View file →
@@ -53,37 +53,40 @@
53 53 parent::__construct( $plugin );
54 54 $this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
55 55 $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
56 56 $this->_addAction( 'admin_footer', 'renderTempaltes' );
57 - $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 8 );
57 + $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 9 );
58 58 $this->_addAction( 'admin_menu', 'registerAdminMenu' );
59 59 $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
60 60 $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' );
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 64 }
65 65
66 66 /**
67 - * Whether to show the feedback review or not.
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.
68 82 *
69 - * @access public
83 + * @return bool The flag status.
70 84 */
71 - public function feedbackReviewTrigger( $dumb ) {
72 - $query = new WP_Query(
73 - array(
74 - 'posts_per_page' => 50,
75 - 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
76 - 'fields' => 'ids',
77 - 'update_post_meta_cache' => false,
78 - 'update_post_term_cache' => false,
79 - )
80 - );
85 + public function get_logger_flag() {
86 + $flag = get_option( 'visualizer_logger_flag', 'no' );
81 87
82 - if ( $query->have_posts() && $query->post_count > 0 ) {
83 - return true;
84 - }
85 - return false;
88 + return ( $flag === 'yes' );
86 89 }
87 90
88 91 /**
89 92 * Enqueues media scripts and styles.
@@ -268,22 +271,18 @@
268 271 if ( $suffix == $this->_libraryPage ) {
269 272 wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION );
270 273 $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' );
271 274 wp_enqueue_media();
272 - wp_enqueue_script(
273 - 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array(
274 - 'jquery',
275 - 'media-views',
276 - ), Visualizer_Plugin::VERSION, true
277 - );
275 + wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array(
276 + 'jquery',
277 + 'media-views',
278 + ), Visualizer_Plugin::VERSION, true );
278 279 wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true );
279 280 wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true );
280 - wp_enqueue_script(
281 - 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array(
282 - 'google-jsapi-old',
283 - 'visualizer-library',
284 - ), Visualizer_Plugin::VERSION, true
285 - );
281 + wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array(
282 + 'google-jsapi-old',
283 + 'visualizer-library',
284 + ), Visualizer_Plugin::VERSION, true );
286 285 }
287 286 }
288 287
289 288 /**
@@ -324,16 +323,14 @@
324 323 * @access public
325 324 */
326 325 public function renderLibraryPage() {
327 326 // get current page
328 - $page = filter_input(
329 - INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array(
330 - 'options' => array(
331 - 'min_range' => 1,
332 - 'default' => 1,
333 - ),
334 - )
335 - );
327 + $page = filter_input( INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array(
328 + 'options' => array(
329 + 'min_range' => 1,
330 + 'default' => 1,
331 + ),
332 + ) );
336 333 // the initial query arguments to fetch charts
337 334 $query_args = array(
338 335 'post_type' => Visualizer_Plugin::CPT_VISUALIZER,
339 336 'posts_per_page' => 6,
@@ -374,9 +371,9 @@
374 371 $settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
375 372 unset( $settings['height'], $settings['width'] );
376 373 $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
377 374 $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
378 - $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( html_entity_decode( $chart->post_content ) ), $chart->ID, $type );
375 + $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type );
379 376 // add chart to the array
380 377 $charts[ 'visualizer-' . $chart->ID ] = array(
381 378 'id' => $chart->ID,
382 379 'type' => $type,
@@ -386,42 +383,39 @@
386 383 );
387 384 }
388 385 // enqueue charts array
389 386 $ajaxurl = admin_url( 'admin-ajax.php' );
390 - wp_localize_script(
391 - 'visualizer-library', 'visualizer', array(
392 - 'charts' => $charts,
393 - 'urls' => array(
394 - 'base' => add_query_arg( 'vpage', false ),
395 - 'create' => add_query_arg(
396 - array(
397 - 'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
398 - 'library' => 'yes',
399 - ), $ajaxurl
400 - ),
401 - 'edit' => add_query_arg(
402 - array(
403 - 'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
404 - 'library' => 'yes',
405 - ), $ajaxurl
406 - ),
407 - ),
408 - )
409 - );
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 + ) );
410 406 // render library page
411 407 $render = new Visualizer_Render_Library();
412 408 $render->charts = $charts;
413 409 $render->type = $filter;
414 410 $render->types = self::_getChartTypesLocalized();
415 - $render->pagination = paginate_links(
416 - array(
417 - 'base' => add_query_arg( 'vpage', '%#%' ),
418 - 'format' => '',
419 - 'current' => $page,
420 - 'total' => $query->max_num_pages,
421 - 'type' => 'array',
422 - )
423 - );
411 + $render->pagination = paginate_links( array(
412 + 'base' => add_query_arg( 'vpage', '%#%' ),
413 + 'format' => '',
414 + 'current' => $page,
415 + 'total' => $query->max_num_pages,
416 + 'type' => 'array',
417 + ) );
424 418 $render->render();
425 419 }
426 420
427 421 /**