| @@ -132,8 +132,9 @@ | ||
| 132 | 132 | * |
| 133 | 133 | * @access public |
| 134 | 134 | */ |
| 135 | 135 | public function init() { |
| 136 | + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison | |
| 136 | 137 | if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) && 'true' == get_user_option( 'rich_editing' ) ) { |
| 137 | 138 | $this->_addFilter( 'mce_external_languages', 'add_tinymce_lang', 10, 1 ); |
| 138 | 139 | $this->_addFilter( 'mce_external_plugins', 'tinymce_plugin', 10, 1 ); |
| 139 | 140 | $this->_addFilter( 'mce_buttons', 'register_mce_button', 10, 1 ); |
| @@ -214,10 +215,12 @@ | ||
| 214 | 215 | if ( post_type_supports( $typenow, 'editor' ) ) { |
| 215 | 216 | wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION ); |
| 216 | 217 | |
| 217 | 218 | // Load all the assets for the different libraries we support. |
| 218 | - $deps = Visualizer_Render_Sidebar_Google::enqueue_assets( array( 'media-editor' ) ); | |
| 219 | - $deps += Visualizer_Render_Sidebar_Type_DataTable::enqueue_assets( array( 'media-editor' ) ); | |
| 219 | + $deps = array( | |
| 220 | + Visualizer_Render_Sidebar_Google::enqueue_assets( array( 'media-editor' ) ), | |
| 221 | + Visualizer_Render_Sidebar_Type_DataTable::enqueue_assets( array( 'media-editor' ) ), | |
| 222 | + ); | |
| 220 | 223 | |
| 221 | 224 | wp_enqueue_script( 'visualizer-media-model', VISUALIZER_ABSURL . 'js/media/model.js', $deps, Visualizer_Plugin::VERSION, true ); |
| 222 | 225 | wp_enqueue_script( 'visualizer-media-collection', VISUALIZER_ABSURL . 'js/media/collection.js', array( 'visualizer-media-model' ), Visualizer_Plugin::VERSION, true ); |
| 223 | 226 | wp_enqueue_script( 'visualizer-media-controller', VISUALIZER_ABSURL . 'js/media/controller.js', array( 'visualizer-media-collection' ), Visualizer_Plugin::VERSION, true ); |
| @@ -462,9 +465,9 @@ | ||
| 462 | 465 | * @access public |
| 463 | 466 | */ |
| 464 | 467 | public function renderTemplates() { |
| 465 | 468 | global $pagenow; |
| 466 | - if ( 'post.php' != $pagenow && 'post-new.php' != $pagenow ) { | |
| 469 | + if ( 'post.php' !== $pagenow && 'post-new.php' !== $pagenow ) { | |
| 467 | 470 | return; |
| 468 | 471 | } |
| 469 | 472 | $render = new Visualizer_Render_Templates(); |
| 470 | 473 | $render->render(); |
| @@ -482,9 +485,9 @@ | ||
| 482 | 485 | * |
| 483 | 486 | * @param string $suffix The current page suffix. |
| 484 | 487 | */ |
| 485 | 488 | public function enqueueLibraryScripts( $suffix ) { |
| 486 | - if ( $suffix == $this->_libraryPage ) { | |
| 489 | + if ( $suffix === $this->_libraryPage ) { | |
| 487 | 490 | wp_enqueue_style( 'visualizer-library', VISUALIZER_ABSURL . 'css/library.css', array(), Visualizer_Plugin::VERSION ); |
| 488 | 491 | $this->_addFilter( 'media_upload_tabs', 'setupVisualizerTab' ); |
| 489 | 492 | wp_enqueue_media(); |
| 490 | 493 | wp_enqueue_script( |
| @@ -576,9 +579,9 @@ | ||
| 576 | 579 | 'paged' => $page, |
| 577 | 580 | ); |
| 578 | 581 | // add chart type filter to the query arguments |
| 579 | 582 | $filter = filter_input( INPUT_GET, 'type' ); |
| 580 | - if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) { | |
| 583 | + if ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes(), true ) ) { | |
| 581 | 584 | $query_args['meta_query'] = array( |
| 582 | 585 | array( |
| 583 | 586 | 'key' => Visualizer_Plugin::CF_CHART_TYPE, |
| 584 | 587 | 'value' => $filter, |
| @@ -628,9 +631,9 @@ | ||
| 628 | 631 | ) |
| 629 | 632 | ); |
| 630 | 633 | // add chart type filter to the query arguments |
| 631 | 634 | $filter = filter_input( INPUT_GET, 'type' ); |
| 632 | - if ( ! ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes() ) ) ) { | |
| 635 | + if ( ! ( $filter && in_array( $filter, Visualizer_Plugin::getChartTypes(), true ) ) ) { | |
| 633 | 636 | $filter = 'all'; |
| 634 | 637 | } |
| 635 | 638 | |
| 636 | 639 | $css = ''; |
| @@ -702,8 +705,9 @@ | ||
| 702 | 705 | $ajaxurl |
| 703 | 706 | ), |
| 704 | 707 | ), |
| 705 | 708 | 'page_type' => 'library', |
| 709 | + 'is_front' => false, | |
| 706 | 710 | ) |
| 707 | 711 | ); |
| 708 | 712 | // render library page |
| 709 | 713 | $render = new Visualizer_Render_Library(); |
| @@ -735,9 +739,9 @@ | ||
| 735 | 739 | * |
| 736 | 740 | * @return array Updated array of action links. |
| 737 | 741 | */ |
| 738 | 742 | public function getPluginActionLinks( $links, $file ) { |
| 739 | - if ( $file == plugin_basename( VISUALIZER_BASEFILE ) ) { | |
| 743 | + if ( $file === plugin_basename( VISUALIZER_BASEFILE ) ) { | |
| 740 | 744 | array_unshift( |
| 741 | 745 | $links, |
| 742 | 746 | sprintf( |
| 743 | 747 | '<a href="%s">%s</a>', |
| @@ -762,9 +766,9 @@ | ||
| 762 | 766 | * |
| 763 | 767 | * @return array Updated array of plugin meta links. |
| 764 | 768 | */ |
| 765 | 769 | public function getPluginMetaLinks( $plugin_meta, $plugin_file ) { |
| 766 | - if ( $plugin_file == plugin_basename( VISUALIZER_BASEFILE ) ) { | |
| 770 | + if ( $plugin_file === plugin_basename( VISUALIZER_BASEFILE ) ) { | |
| 767 | 771 | // knowledge base link |
| 768 | 772 | $plugin_meta[] = sprintf( |
| 769 | 773 | '<a href="https://github.com/codeinwp/visualizer/wiki" target="_blank">%s</a>', |
| 770 | 774 | esc_html__( 'Knowledge Base', 'visualizer' ) |