PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.7
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 +27 -104 3.10.23.7.7 View file →
@@ -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
@@ -688,12 +686,22 @@
688 686 'viz-support',
689 687 array( $this, 'renderSupportPage' )
690 688 );
691 689
690 + if ( ! Visualizer_Module::is_pro() ) {
691 + add_submenu_page(
692 + Visualizer_Plugin::NAME,
693 + __( 'Get Visualizer Pro', 'visualizer' ),
694 + __( 'Get Visualizer Pro', 'visualizer' ),
695 + 'edit_posts',
696 + 'viz-get-pro',
697 + '__return_null'
698 + );
699 + add_action( 'admin_footer', array( $this, 'handleGetProSubMenu' ) );
700 + }
692 701 remove_submenu_page( Visualizer_Plugin::NAME, Visualizer_Plugin::NAME );
693 702
694 703 add_action( "load-{$this->_libraryPage}", array( $this, 'addScreenOptions' ) );
695 - add_action( 'admin_footer', array( $this, 'handleGetProSubMenu' ) );
696 704 }
697 705
698 706 /**
699 707 * Handle get pro plugin submenu.
@@ -698,35 +706,32 @@
698 706 /**
699 707 * Handle get pro plugin submenu.
700 708 */
701 709 public function handleGetProSubMenu() {
702 - if ( ! Visualizer_Module::is_pro() ) {
703 - ?>
710 + ?>
704 711 <style type="text/css">
705 - #toplevel_page_visualizer ul.wp-submenu li:last-child {
712 + #toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li {
706 713 background: #FF7E65;
707 714 font-size: 14px;
708 715 font-weight: 600;
709 716 color: #fff;
710 717 }
711 - #toplevel_page_visualizer ul.wp-submenu li:last-child > a {
718 + #toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li > a {
712 719 color: #fff !important;
713 720 }
714 - #toplevel_page_visualizer ul.wp-submenu li:last-child > a:hover {
721 + #toplevel_page_visualizer ul.wp-submenu li.wp-first-item + li + li + li > a:hover {
715 722 box-shadow: inherit;
716 723 }
717 724 </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 - }
725 + <script type="text/javascript">
726 + jQuery( document ).ready( function() {
727 + jQuery( '#toplevel_page_visualizer' ).on( 'click', 'li:not(.wp-submenu-head, .wp-first-item):eq(2)', function( e ) {
728 + e.preventDefault();
729 + window.open( 'https://themeisle.com/plugins/visualizer-charts-and-graphs/upgrade/#pricing', '_blank' );
730 + } );
731 + } );
732 + </script>
733 + <?php
729 734 }
730 735
731 736 /**
732 737 * Adds the screen options for pagination.
@@ -760,24 +765,8 @@
760 765 * Adds the display filters to be used in the meta_query while displaying the charts.
761 766 */
762 767 private function getDisplayFilters( &$query_args ) {
763 768 $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 769
781 770 // add chart type filter to the query arguments
782 771 $type = filter_input( INPUT_GET, 'type' );
783 772 if ( $type && in_array( $type, Visualizer_Plugin::getChartTypes(), true ) ) {
@@ -875,9 +864,9 @@
875 864
876 865 $this->getDisplayFilters( $query_args );
877 866
878 867 // Added by Ash/Upwork
879 - $filterByMeta = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
868 + $filterByMeta = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
880 869 if ( $filterByMeta ) {
881 870 $query = array(
882 871 'key' => Visualizer_Plugin::CF_SETTINGS,
883 872 'value' => $filterByMeta,
@@ -978,15 +967,8 @@
978 967 $css .= $arguments[0];
979 968 $settings = $arguments[1];
980 969 }
981 970
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 971 // add chart to the array
990 972 $charts[ $id ] = array(
991 973 'id' => $chart->ID,
992 974 'type' => $type,
@@ -1045,9 +1027,9 @@
1045 1027 $render->types = self::_getChartTypesLocalized( false, false, false, true );
1046 1028 $render->custom_css = $css;
1047 1029 $render->pagination = paginate_links(
1048 1030 array(
1049 - 'base' => add_query_arg( array( 'vpage' => '%#%', 'vaction' => false ) ),
1031 + 'base' => esc_url( add_query_arg( array( 'vpage' => '%#%', 'vaction' => false ) ) ),
1050 1032 'format' => '',
1051 1033 'current' => $page,
1052 1034 'total' => $query->max_num_pages,
1053 1035 'type' => 'array',
@@ -1103,9 +1085,9 @@
1103 1085 esc_html__( 'Docs', 'visualizer' )
1104 1086 );
1105 1087 // flattr link
1106 1088 $plugin_meta[] = sprintf(
1107 - '<a style="color:red" href="' . tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'pluginrow' ) . '" target="_blank">%s</a>',
1089 + '<a style="color:red" href="' . Visualizer_Plugin::PRO_TEASER_URL . '" target="_blank">%s</a>',
1108 1090 esc_html__( 'Pro Addon', 'visualizer' )
1109 1091 );
1110 1092 }
1111 1093
@@ -1121,65 +1103,6 @@
1121 1103 if ( Visualizer_Module::is_pro() ) {
1122 1104 return true;
1123 1105 }
1124 1106 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 1107 }
1185 1108 }