| @@ -245,18 +245,22 @@ | ||
| 245 | 245 | if ( $suffix == $this->_libraryPage ) { |
| 246 | 246 | wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION ); |
| 247 | 247 | $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' ); |
| 248 | 248 | wp_enqueue_media(); |
| 249 | - wp_enqueue_script( 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( | |
| 250 | - 'jquery', | |
| 251 | - 'media-views', | |
| 252 | - ), Visualizer_Plugin::VERSION, true ); | |
| 249 | + wp_enqueue_script( | |
| 250 | + 'visualizer-library', VISUALIZER_ABSURL . 'js/library.js', array( | |
| 251 | + 'jquery', | |
| 252 | + 'media-views', | |
| 253 | + ), Visualizer_Plugin::VERSION, true | |
| 254 | + ); | |
| 253 | 255 | wp_enqueue_script( 'google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 254 | 256 | wp_enqueue_script( 'google-jsapi-old', '//www.google.com/jsapi', array( 'google-jsapi-new' ), null, true ); |
| 255 | - wp_enqueue_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 256 | - 'google-jsapi-old', | |
| 257 | - 'visualizer-library', | |
| 258 | - ), Visualizer_Plugin::VERSION, true ); | |
| 257 | + wp_enqueue_script( | |
| 258 | + 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( | |
| 259 | + 'google-jsapi-old', | |
| 260 | + 'visualizer-library', | |
| 261 | + ), Visualizer_Plugin::VERSION, true | |
| 262 | + ); | |
| 259 | 263 | } |
| 260 | 264 | } |
| 261 | 265 | |
| 262 | 266 | /** |
| @@ -297,14 +301,16 @@ | ||
| 297 | 301 | * @access public |
| 298 | 302 | */ |
| 299 | 303 | public function renderLibraryPage() { |
| 300 | 304 | // get current page |
| 301 | - $page = filter_input( INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array( | |
| 302 | - 'options' => array( | |
| 303 | - 'min_range' => 1, | |
| 304 | - 'default' => 1, | |
| 305 | - ), | |
| 306 | - ) ); | |
| 305 | + $page = filter_input( | |
| 306 | + INPUT_GET, 'vpage', FILTER_VALIDATE_INT, array( | |
| 307 | + 'options' => array( | |
| 308 | + 'min_range' => 1, | |
| 309 | + 'default' => 1, | |
| 310 | + ), | |
| 311 | + ) | |
| 312 | + ); | |
| 307 | 313 | // the initial query arguments to fetch charts |
| 308 | 314 | $query_args = array( |
| 309 | 315 | 'post_type' => Visualizer_Plugin::CPT_VISUALIZER, |
| 310 | 316 | 'posts_per_page' => 6, |
| @@ -357,34 +363,42 @@ | ||
| 357 | 363 | ); |
| 358 | 364 | } |
| 359 | 365 | // enqueue charts array |
| 360 | 366 | $ajaxurl = admin_url( 'admin-ajax.php' ); |
| 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 | - ) ); | |
| 367 | + wp_localize_script( | |
| 368 | + 'visualizer-library', 'visualizer', array( | |
| 369 | + 'charts' => $charts, | |
| 370 | + 'urls' => array( | |
| 371 | + 'base' => add_query_arg( 'vpage', false ), | |
| 372 | + 'create' => add_query_arg( | |
| 373 | + array( | |
| 374 | + 'action' => Visualizer_Plugin::ACTION_CREATE_CHART, | |
| 375 | + 'library' => 'yes', | |
| 376 | + ), $ajaxurl | |
| 377 | + ), | |
| 378 | + 'edit' => add_query_arg( | |
| 379 | + array( | |
| 380 | + 'action' => Visualizer_Plugin::ACTION_EDIT_CHART, | |
| 381 | + 'library' => 'yes', | |
| 382 | + ), $ajaxurl | |
| 383 | + ), | |
| 384 | + ), | |
| 385 | + ) | |
| 386 | + ); | |
| 375 | 387 | // render library page |
| 376 | 388 | $render = new Visualizer_Render_Library(); |
| 377 | 389 | $render->charts = $charts; |
| 378 | 390 | $render->type = $filter; |
| 379 | 391 | $render->types = self::_getChartTypesLocalized(); |
| 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 | - ) ); | |
| 392 | + $render->pagination = paginate_links( | |
| 393 | + array( | |
| 394 | + 'base' => add_query_arg( 'vpage', '%#%' ), | |
| 395 | + 'format' => '', | |
| 396 | + 'current' => $page, | |
| 397 | + 'total' => $query->max_num_pages, | |
| 398 | + 'type' => 'array', | |
| 399 | + ) | |
| 400 | + ); | |
| 387 | 401 | $render->render(); |
| 388 | 402 | } |
| 389 | 403 | |
| 390 | 404 | /** |