PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.4
4.0.8 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 All 149 releases
← All changes | classes/Visualizer/Module/Admin.php +21 -144 3.10.33.7.4 View file →
@@ -53,9 +53,9 @@
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', 'renderTemplates' );
57 - $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 0 );
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 61 $this->_addFilter( 'plugin_row_meta', 'getPluginMetaLinks', 10, 2 );
@@ -73,10 +73,8 @@
73 73 $this->_addAction( 'visualizer_chart_schedules_spl', 'addSplChartSchedules', null, 10, 3 );
74 74
75 75 $this->_addAction( 'admin_init', 'init' );
76 76
77 - $this->_addAction( 'visualizer_chart_languages', 'addMultilingualSupport' );
78 -
79 77 if ( defined( 'TI_CYPRESS_TESTING' ) ) {
80 78 $this->load_cypress_hooks();
81 79 }
82 80
@@ -366,9 +364,9 @@
366 364 'filters' => $chart_types,
367 365 'types' => array_keys( $chart_types ),
368 366 ),
369 367 'nonce' => wp_create_nonce(),
370 - 'buildurl' => esc_url( add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ) ),
368 + 'buildurl' => add_query_arg( 'action', Visualizer_Plugin::ACTION_CREATE_CHART, admin_url( 'admin-ajax.php' ) ),
371 369 );
372 370
373 371 return $strings;
374 372 }
@@ -687,49 +685,14 @@
687 685 'edit_posts',
688 686 'viz-support',
689 687 array( $this, 'renderSupportPage' )
690 688 );
691 -
692 689 remove_submenu_page( Visualizer_Plugin::NAME, Visualizer_Plugin::NAME );
693 690
694 691 add_action( "load-{$this->_libraryPage}", array( $this, 'addScreenOptions' ) );
695 - add_action( 'admin_footer', array( $this, 'handleGetProSubMenu' ) );
696 692 }
697 693
698 694 /**
699 - * Handle get pro plugin submenu.
700 - */
701 - public function handleGetProSubMenu() {
702 - if ( ! Visualizer_Module::is_pro() ) {
703 - ?>
704 - <style type="text/css">
705 - #toplevel_page_visualizer ul.wp-submenu li:last-child {
706 - background: #FF7E65;
707 - font-size: 14px;
708 - font-weight: 600;
709 - color: #fff;
710 - }
711 - #toplevel_page_visualizer ul.wp-submenu li:last-child > a {
712 - color: #fff !important;
713 - }
714 - #toplevel_page_visualizer ul.wp-submenu li:last-child > a:hover {
715 - box-shadow: inherit;
716 - }
717 - </style>
718 - <?php
719 - if ( get_option( 'visualizer_fresh_install', false ) ) {
720 - ?>
721 - <style type="text/css">
722 - #toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li {
723 - display: none;
724 - }
725 - </style>
726 - <?php
727 - }
728 - }
729 - }
730 -
731 - /**
732 695 * Adds the screen options for pagination.
733 696 */
734 697 function addScreenOptions() {
735 698 $screen = get_current_screen();
@@ -760,24 +723,8 @@
760 723 * Adds the display filters to be used in the meta_query while displaying the charts.
761 724 */
762 725 private function getDisplayFilters( &$query_args ) {
763 726 $query = array();
764 - global $sitepress;
765 - if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) {
766 - $current_lang = icl_get_current_language();
767 - if ( in_array( $current_lang, array( 'all', icl_get_default_language() ), true ) ) {
768 - $query[] = array(
769 - 'key' => 'chart_lang',
770 - 'compare' => 'NOT EXISTS',
771 - );
772 - } else {
773 - $query[] = array(
774 - 'key' => 'chart_lang',
775 - 'value' => $current_lang,
776 - 'compare' => '=',
777 - );
778 - }
779 - }
780 727
781 728 // add chart type filter to the query arguments
782 729 $type = filter_input( INPUT_GET, 'type' );
783 730 if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes(), true ) ) {
@@ -875,9 +822,9 @@
875 822
876 823 $this->getDisplayFilters( $query_args );
877 824
878 825 // Added by Ash/Upwork
879 - $filterByMeta = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
826 + $filterByMeta = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
880 827 if ( $filterByMeta ) {
881 828 $query = array(
882 829 'key' => Visualizer_Plugin::CF_SETTINGS,
883 830 'value' => $filterByMeta,
@@ -978,15 +925,8 @@
978 925 $css .= $arguments[0];
979 926 $settings = $arguments[1];
980 927 }
981 928
982 - if ( isset( $settings['controls']['ui']['labelStacking'] ) ) {
983 - unset( $settings['controls']['ui']['labelStacking'] );
984 - }
985 - if ( isset( $settings['controls']['ui']['orientation'] ) ) {
986 - unset( $settings['controls']['ui']['orientation'] );
987 - }
988 -
989 929 // add chart to the array
990 930 $charts[ $id ] = array(
991 931 'id' => $chart->ID,
992 932 'type' => $type,
@@ -1005,30 +945,26 @@
1005 945 'language' => $this->get_language(),
1006 946 'map_api_key' => get_option( 'visualizer-map-api-key' ),
1007 947 'charts' => $charts,
1008 948 'urls' => array(
1009 - 'base' => esc_url( add_query_arg( array( 'vpage' => false, 'vaction' => false ) ) ),
1010 - 'create' => esc_url(
1011 - add_query_arg(
1012 - array(
1013 - 'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
1014 - 'library' => 'yes',
1015 - 'type' => isset( $_GET['type'] ) ? $_GET['type'] : '',
1016 - 'chart-library' => isset( $_GET['chart-library'] ) ? $_GET['chart-library'] : '',
1017 - 'vaction' => false,
1018 - ),
1019 - $ajaxurl
1020 - )
949 + 'base' => add_query_arg( array( 'vpage' => false, 'vaction' => false ) ),
950 + 'create' => add_query_arg(
951 + array(
952 + 'action' => Visualizer_Plugin::ACTION_CREATE_CHART,
953 + 'library' => 'yes',
954 + 'type' => isset( $_GET['type'] ) ? $_GET['type'] : '',
955 + 'chart-library' => isset( $_GET['chart-library'] ) ? $_GET['chart-library'] : '',
956 + 'vaction' => false,
957 + ),
958 + $ajaxurl
1021 959 ),
1022 - 'edit' => esc_url(
1023 - add_query_arg(
1024 - array(
1025 - 'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
1026 - 'library' => 'yes',
1027 - 'vaction' => false,
1028 - ),
1029 - $ajaxurl
1030 - )
960 + 'edit' => add_query_arg(
961 + array(
962 + 'action' => Visualizer_Plugin::ACTION_EDIT_CHART,
963 + 'library' => 'yes',
964 + 'vaction' => false,
965 + ),
966 + $ajaxurl
1031 967 ),
1032 968 ),
1033 969 'page_type' => 'library',
1034 970 'is_front' => false,
@@ -1103,9 +1039,9 @@
1103 1039 esc_html__( 'Docs', 'visualizer' )
1104 1040 );
1105 1041 // flattr link
1106 1042 $plugin_meta[] = sprintf(
1107 - '<a style="color:red" href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'pluginrow' ) . '" target="_blank">%s</a>',
1043 + '<a style="color:red" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank">%s</a>',
1108 1044 esc_html__( 'Pro Addon', 'visualizer' )
1109 1045 );
1110 1046 }
1111 1047
@@ -1121,65 +1057,6 @@
1121 1057 if ( Visualizer_Module::is_pro() ) {
1122 1058 return true;
1123 1059 }
1124 1060 return 'yes' === get_option( 'visualizer-new-user', 'yes' ) ? false : true;
1125 - }
1126 -
1127 - /**
1128 - * Multilingual Support.
1129 - *
1130 - * @param int $chart_id Chart ID.
1131 - * @return bool Default false
1132 - */
1133 - public function addMultilingualSupport( $chart_id ) {
1134 - global $sitepress;
1135 - if ( Visualizer_Module::is_pro() ) {
1136 - return;
1137 - }
1138 - if ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) {
1139 - $language = icl_get_languages();
1140 - $current_lang = icl_get_current_language();
1141 - $default_lang = icl_get_default_language();
1142 - $post_info = wpml_get_language_information( null, $chart_id );
1143 - $translations = array();
1144 - if ( ! empty( $post_info ) && ( $default_lang === $post_info['language_code'] ) ) {
1145 - $trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER );
1146 - $translations = $sitepress->get_element_translations( $trid );
1147 - }
1148 - if ( empty( $translations ) ) {
1149 - return;
1150 - }
1151 - ?>
1152 - <hr><div class="visualizer-languages-list only-pro">
1153 - <?php
1154 - foreach ( $language as $lang ) {
1155 - $lang_code = $lang['code'];
1156 - if ( $current_lang !== $lang_code ) {
1157 - ?>
1158 - <a href="javascript:;">
1159 - <img src="<?php echo esc_url( $lang['country_flag_url'] ); ?>" alt="<?php echo esc_attr( $lang['translated_name'] ); ?>">
1160 - </a>
1161 - <?php
1162 - }
1163 - }
1164 - ?>
1165 - <a href="<?php echo tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'wpml-support', 'visualizer_render_char' ); ?>"target="_blank"><?php esc_html_e( 'Upgrade to PRO to active this translation for charts', 'visualizer' ); ?></a>
1166 - </div>
1167 - <?php
1168 - }
1169 - }
1170 -
1171 - /**
1172 - * Check chart is enabled or not.
1173 - *
1174 - * @param string $type Chart ID.
1175 - *
1176 - * @return bool Default false
1177 - */
1178 - public static function checkChartStatus( $type ) {
1179 - $types = self::_getChartTypesLocalized( false, false, false, true );
1180 - if ( isset( $types[ $type ] ) ) {
1181 - return ! empty( $types[ $type ]['enabled'] );
1182 - }
1183 - return false;
1184 1061 }
1185 1062 }