| @@ -57,35 +57,12 @@ | ||
| 57 | 57 | $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 8 ); |
| 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 ); | |
| 64 | 62 | } |
| 65 | 63 | |
| 66 | - /** | |
| 67 | - * Whether to show the feedback review or not. | |
| 68 | - * | |
| 69 | - * @access public | |
| 70 | - */ | |
| 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 | - ); | |
| 81 | 64 | |
| 82 | - if ( $query->have_posts() && $query->post_count > 0 ) { | |
| 83 | - return true; | |
| 84 | - } | |
| 85 | - return false; | |
| 86 | - } | |
| 87 | - | |
| 88 | 65 | /** |
| 89 | 66 | * Enqueues media scripts and styles. |
| 90 | 67 | * |
| 91 | 68 | * @since 1.0.0 |
| @@ -268,22 +245,18 @@ | ||
| 268 | 245 | if ( $suffix == $this->_libraryPage ) { |
| 269 | 246 | wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION ); |
| 270 | 247 | $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' ); |
| 271 | 248 | 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 | - ); | |
| 249 | + wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( | |
| 250 | + 'jquery', | |
| 251 | + 'media-views', | |
| 252 | + ), Visualizer_Plugin::VERSION, true ); | |
| 278 | 253 | wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 279 | 254 | 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 | - ); | |
| 255 | + wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 256 | + 'google-jsapi-old', | |
| 257 | + 'visualizer-library', | |
| 258 | + ), Visualizer_Plugin::VERSION, true ); | |
| 286 | 259 | } |
| 287 | 260 | } |
| 288 | 261 | |
| 289 | 262 | /** |
| @@ -324,16 +297,14 @@ | ||
| 324 | 297 | * @access public |
| 325 | 298 | */ |
| 326 | 299 | public function renderLibraryPage() { |
| 327 | 300 | // 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 | - ); | |
| 301 | + $page = filter_input( INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array( | |
| 302 | + 'options' => array( | |
| 303 | + 'min_range' => 1, | |
| 304 | + 'default' => 1, | |
| 305 | + ), | |
| 306 | + ) ); | |
| 336 | 307 | // the initial query arguments to fetch charts |
| 337 | 308 | $query_args = array( |
| 338 | 309 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 339 | 310 | 'posts_per_page' => 6, |
| @@ -386,42 +357,34 @@ | ||
| 386 | 357 | ); |
| 387 | 358 | } |
| 388 | 359 | // enqueue charts array |
| 389 | 360 | $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 | - ); | |
| 361 | + wp_localize_script( 'visualizer-library', 'visualizer', array( | |
| 362 | + 'charts' => $charts, | |
| 363 | + 'urls' => array( | |
| 364 | + 'base' => add_query_arg( 'vpage', false ), | |
| 365 | + 'create' => add_query_arg( array( | |
| 366 | + 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, | |
| 367 | + 'library' => 'yes', | |
| 368 | + ), $ajaxurl ), | |
| 369 | + 'edit' => add_query_arg( array( | |
| 370 | + 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, | |
| 371 | + 'library' => 'yes', | |
| 372 | + ), $ajaxurl ), | |
| 373 | + ), | |
| 374 | + ) ); | |
| 410 | 375 | // render library page |
| 411 | 376 | $render = new Visualizer_Render_Library(); |
| 412 | 377 | $render->charts = $charts; |
| 413 | 378 | $render->type = $filter; |
| 414 | 379 | $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 | - ); | |
| 380 | + $render->pagination = paginate_links( array( | |
| 381 | + 'base' => add_query_arg( 'vpage', '%#%' ), | |
| 382 | + 'format' => '', | |
| 383 | + 'current' => $page, | |
| 384 | + 'total' => $query->max_num_pages, | |
| 385 | + 'type' => 'array', | |
| 386 | + ) ); | |
| 424 | 387 | $render->render(); |
| 425 | 388 | } |
| 426 | 389 | |
| 427 | 390 | /** |