PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.1
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 +115 -19 3.10.33.11.1 View file →
@@ -75,14 +75,41 @@
75 75 $this->_addAction( 'admin_init', 'init' );
76 76
77 77 $this->_addAction( 'visualizer_chart_languages', 'addMultilingualSupport' );
78 78
79 + $this->_addFilter( 'admin_footer_text', 'render_review_notice' );
80 +
79 81 if ( defined( 'TI_CYPRESS_TESTING' ) ) {
80 82 $this->load_cypress_hooks();
81 83 }
82 84
83 85 }
86 + /**
87 + * Display review notice.
88 + */
89 + public function render_review_notice( $footer_text ) {
90 + $current_screen = get_current_screen();
84 91
92 + $visualizer_page_ids = ['toplevel_page_visualizer', 'visualizer_page_viz-support', 'visualizer_page_ti-about-visualizer' ];
93 +
94 + if ( ! empty( $current_screen ) && isset( $current_screen->id ) ) {
95 + foreach ( $visualizer_page_ids as $page_to_check ) {
96 + if ( strpos( $current_screen->id, $page_to_check ) !== false ) {
97 + $footer_text = sprintf(
98 + __( 'Enjoying %1$s? %2$s %3$s rating. Thank you for being so supportive!', 'visualizer' ),
99 + '<b>Visualizer</b>',
100 + esc_html__( 'You can help us by leaving a', 'visualizer' ),
101 + '<a href="https://wordpress.org/support/plugin/visualizer/reviews/" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
102 + );
103 + break;
104 + }
105 + }
106 + }
107 +
108 + return $footer_text;
109 + }
110 +
111 +
85 112 /**
86 113 * Define the hooks that are needed for cypress.
87 114 *
88 115 * @since 3.4.0
@@ -113,23 +140,16 @@
113 140 if ( apply_filters( 'visualizer_is_business', false ) ) {
114 141 return;
115 142 }
116 143
117 - $license = __( 'PRO', 'visualizer' );
118 - if ( Visualizer_Module::is_pro() ) {
119 - switch ( $plan ) {
120 - case 1:
121 - $license = __( 'Developer', 'visualizer' );
122 - break;
123 - }
124 - }
144 + $is_new_personal = apply_filters( 'visualizer_is_new_personal', false );
125 145
126 146 $hours = array(
127 - '0' => __( 'Live', 'visualizer' ),
128 - '1' => __( 'Each hour', 'visualizer' ),
129 - '12' => __( 'Each 12 hours', 'visualizer' ),
130 - '24' => __( 'Each day', 'visualizer' ),
131 - '72' => __( 'Each 3 days', 'visualizer' ),
147 + '0.16' => __( '10 minutes', 'visualizer' ),
148 + '1' => __( 'Each hour', 'visualizer' ),
149 + '12' => __( 'Each 12 hours', 'visualizer' ),
150 + '24' => __( 'Each day', 'visualizer' ),
151 + '72' => __( 'Each 3 days', 'visualizer' ),
132 152 );
133 153
134 154 switch ( $feature ) {
135 155 case 'json':
@@ -134,9 +154,9 @@
134 154 switch ( $feature ) {
135 155 case 'json':
136 156 case 'csv':
137 157 // no more schedules if pro is already active.
138 - if ( Visualizer_Module::is_pro() ) {
158 + if ( Visualizer_Module::is_pro() && ! $is_new_personal ) {
139 159 return;
140 160 }
141 161 break;
142 162 case 'wp':
@@ -146,9 +166,9 @@
146 166 default:
147 167 return;
148 168 }
149 169
150 - echo '<optgroup disabled label="' . sprintf( __( 'More in the %s version', 'visualizer' ), $license ) . '">';
170 + echo '<optgroup disabled label="' . __( 'Upgrade required', 'visualizer' ) . '">';
151 171 foreach ( $hours as $hour => $desc ) {
152 172 echo '<option disabled>' . $desc . '</option>';
153 173 }
154 174 echo '</optgroup>';
@@ -403,14 +423,14 @@
403 423 ),
404 424 'pie' => array(
405 425 'name' => esc_html__( 'Pie/Donut', 'visualizer' ),
406 426 'enabled' => true,
407 - 'supports' => $enabled ? array( 'Google Charts', 'ChartJS' ) : array( 'Google Charts' ),
427 + 'supports' => array( 'Google Charts', 'ChartJS' ),
408 428 ),
409 429 'line' => array(
410 430 'name' => esc_html__( 'Line', 'visualizer' ),
411 431 'enabled' => true,
412 - 'supports' => $enabled ? array( 'Google Charts', 'ChartJS' ) : array( 'Google Charts' ),
432 + 'supports' => array( 'Google Charts', 'ChartJS' ),
413 433 ),
414 434 'bar' => array(
415 435 'name' => esc_html__( 'Bar', 'visualizer' ),
416 436 'enabled' => true,
@@ -670,9 +690,9 @@
670 690 Visualizer_Plugin::NAME,
671 691 __( 'Chart Library', 'visualizer' ),
672 692 __( 'Chart Library', 'visualizer' ),
673 693 'edit_posts',
674 - admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME )
694 + 'admin.php?page=' . Visualizer_Plugin::NAME
675 695 );
676 696 add_submenu_page(
677 697 Visualizer_Plugin::NAME,
678 698 __( 'Add New Chart', 'visualizer' ),
@@ -677,9 +697,9 @@
677 697 Visualizer_Plugin::NAME,
678 698 __( 'Add New Chart', 'visualizer' ),
679 699 __( 'Add New Chart', 'visualizer' ),
680 700 'edit_posts',
681 - admin_url( 'admin.php?page=' . Visualizer_Plugin::NAME . '&vaction=addnew' )
701 + 'admin.php?page=' . Visualizer_Plugin::NAME . '&vaction=addnew'
682 702 );
683 703 add_submenu_page(
684 704 Visualizer_Plugin::NAME,
685 705 __( 'Support', 'visualizer' ),
@@ -899,8 +919,9 @@
899 919 * @access public
900 920 */
901 921 public function renderSupportPage() {
902 922 wp_enqueue_style( 'visualizer-upsell', VISUALIZER_ABSURL . 'css/upsell.css', array(), Visualizer_Plugin::VERSION );
923 + $this->load_survey();
903 924 include_once VISUALIZER_ABSPATH . '/templates/support.php';
904 925 }
905 926
906 927 /**
@@ -1035,8 +1056,9 @@
1035 1056 'i10n' => array(
1036 1057 'copied' => __( 'The shortcode has been copied to your clipboard. Hit Ctrl-V/Cmd-V to paste it.', 'visualizer' ),
1037 1058 'conflict' => __( 'We have detected a potential conflict with another component that prevents Visualizer from functioning properly. Please disable any of the following components if they are activated on your instance: Modern Events Calendar plugin, Acronix plugin. In case the aforementioned components are not activated or you continue to see this error message, please disable all other plugins and enable them one by one to find out the component that is causing the conflict.', 'visualizer' ),
1038 1059 ),
1060 + 'is_pro_user' => Visualizer_Module::is_pro(),
1039 1061 )
1040 1062 );
1041 1063 // render library page
1042 1064 $render = new Visualizer_Render_Library();
@@ -1052,8 +1074,11 @@
1052 1074 'total' => $query->max_num_pages,
1053 1075 'type' => 'array',
1054 1076 )
1055 1077 );
1078 +
1079 + $this->load_survey();
1080 +
1056 1081 $render->render();
1057 1082 }
1058 1083
1059 1084 /**
@@ -1180,6 +1205,77 @@
1180 1205 if ( isset( $types[ $type ] ) ) {
1181 1206 return ! empty( $types[ $type ]['enabled'] );
1182 1207 }
1183 1208 return false;
1209 + }
1210 +
1211 + /**
1212 + * Get the survey metadata.
1213 + *
1214 + * @return array The survey metadata.
1215 + */
1216 + private function get_survey_metadata() {
1217 + $install_date = get_option( 'visualizer_install', false );
1218 + $install_category = 0;
1219 +
1220 + if ( false !== $install_date ) {
1221 + $days_since_install = round( ( time() - $install_date ) / DAY_IN_SECONDS );
1222 +
1223 + if ( 0 === $days_since_install || 1 === $days_since_install ) {
1224 + $install_category = 0;
1225 + } elseif ( 1 < $days_since_install && 8 > $days_since_install ) {
1226 + $install_category = 7;
1227 + } elseif ( 8 <= $days_since_install && 31 > $days_since_install ) {
1228 + $install_category = 30;
1229 + } elseif ( 30 < $days_since_install && 90 > $days_since_install ) {
1230 + $install_category = 90;
1231 + } elseif ( 90 <= $days_since_install ) {
1232 + $install_category = 91;
1233 + }
1234 + }
1235 +
1236 + $plugin_data = get_plugin_data( VISUALIZER_BASEFILE, false, false );
1237 + $plugin_version = '';
1238 + if ( ! empty( $plugin_data['Version'] ) ) {
1239 + $plugin_version = $plugin_data['Version'];
1240 + }
1241 +
1242 + $user_id = 'visualizer_' . preg_replace( '/[^\w\d]*/', '', get_site_url() ); // Use a normalized version of the site URL as a user ID.
1243 +
1244 + $license_data = get_option( 'visualizer_pro_license_data', false );
1245 + if ( false !== $license_data && isset( $license_data->key ) ) {
1246 + $user_id = 'visualizer_' . $license_data->key;
1247 + }
1248 +
1249 + return array(
1250 + 'userId' => $user_id,
1251 + 'attributes' => array(
1252 + 'days_since_install' => strval( $install_category ),
1253 + 'free_version' => $plugin_version,
1254 + 'pro_version' => defined( 'VISUALIZER_PRO_VERSION' ) ? VISUALIZER_PRO_VERSION : '',
1255 + 'license_status' => apply_filters( 'product_visualizer_license_status', 'invalid' ),
1256 + ),
1257 + );
1258 + }
1259 +
1260 + /**
1261 + * Load the survey.
1262 + */
1263 + private function load_survey() {
1264 +
1265 + if ( defined( 'TI_CYPRESS_TESTING' ) ) {
1266 + return;
1267 + }
1268 +
1269 + $survey_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'survey' );
1270 +
1271 + if ( empty( $survey_handler ) ) {
1272 + return;
1273 + }
1274 +
1275 + $metadata = $this->get_survey_metadata();
1276 +
1277 + do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' );
1278 + wp_enqueue_script( 'visualizer_chart_survey', VISUALIZER_ABSURL . 'js/survey.js', array( $survey_handler ), $metadata['attributes']['free_version'], true );
1279 + wp_localize_script( 'visualizer_chart_survey', 'visualizerSurveyData', $metadata );
1184 1280 }
1185 1281 }