PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.3
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 +45 -20 3.10.153.11.3 View file →
@@ -52,8 +52,9 @@
52 52 public function __construct( Visualizer_Plugin $plugin ) {
53 53 parent::__construct( $plugin );
54 54 $this->_addAction( 'load-post.php', 'enqueueMediaScripts' );
55 55 $this->_addAction( 'load-post-new.php', 'enqueueMediaScripts' );
56 + $this->_addAction( 'enqueue_block_editor_assets', 'enqueueMediaScripts' );
56 57 $this->_addAction( 'admin_footer', 'renderTemplates' );
57 58 $this->_addAction( 'admin_enqueue_scripts', 'enqueueLibraryScripts', null, 0 );
58 59 $this->_addAction( 'admin_menu', 'registerAdminMenu' );
59 60 $this->_addFilter( 'media_view_strings', 'setupMediaViewStrings' );
@@ -75,14 +76,41 @@
75 76 $this->_addAction( 'admin_init', 'init' );
76 77
77 78 $this->_addAction( 'visualizer_chart_languages', 'addMultilingualSupport' );
78 79
80 + $this->_addFilter( 'admin_footer_text', 'render_review_notice' );
81 +
79 82 if ( defined( 'TI_CYPRESS_TESTING' ) ) {
80 83 $this->load_cypress_hooks();
81 84 }
82 85
83 86 }
87 + /**
88 + * Display review notice.
89 + */
90 + public function render_review_notice( $footer_text ) {
91 + $current_screen = get_current_screen();
84 92
93 + $visualizer_page_ids = ['toplevel_page_visualizer', 'visualizer_page_viz-support', 'visualizer_page_ti-about-visualizer' ];
94 +
95 + if ( ! empty( $current_screen ) && isset( $current_screen->id ) ) {
96 + foreach ( $visualizer_page_ids as $page_to_check ) {
97 + if ( strpos( $current_screen->id, $page_to_check ) !== false ) {
98 + $footer_text = sprintf(
99 + __( 'Enjoying %1$s? %2$s %3$s rating. Thank you for being so supportive!', 'visualizer' ),
100 + '<b>Visualizer</b>',
101 + esc_html__( 'You can help us by leaving a', 'visualizer' ),
102 + '<a href="https://wordpress.org/support/plugin/visualizer/reviews/" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
103 + );
104 + break;
105 + }
106 + }
107 + }
108 +
109 + return $footer_text;
110 + }
111 +
112 +
85 113 /**
86 114 * Define the hooks that are needed for cypress.
87 115 *
88 116 * @since 3.4.0
@@ -113,23 +141,16 @@
113 141 if ( apply_filters( 'visualizer_is_business', false ) ) {
114 142 return;
115 143 }
116 144
117 - $license = __( 'PRO', 'visualizer' );
118 - if ( Visualizer_Module::is_pro() ) {
119 - switch ( $plan ) {
120 - case 1:
121 - $license = __( 'Developer', 'visualizer' );
122 - break;
123 - }
124 - }
145 + $is_new_personal = apply_filters( 'visualizer_is_new_personal', false );
125 146
126 147 $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' ),
148 + '0.16' => __( '10 minutes', 'visualizer' ),
149 + '1' => __( 'Each hour', 'visualizer' ),
150 + '12' => __( 'Each 12 hours', 'visualizer' ),
151 + '24' => __( 'Each day', 'visualizer' ),
152 + '72' => __( 'Each 3 days', 'visualizer' ),
132 153 );
133 154
134 155 switch ( $feature ) {
135 156 case 'json':
@@ -134,9 +155,9 @@
134 155 switch ( $feature ) {
135 156 case 'json':
136 157 case 'csv':
137 158 // no more schedules if pro is already active.
138 - if ( Visualizer_Module::is_pro() ) {
159 + if ( Visualizer_Module::is_pro() && ! $is_new_personal ) {
139 160 return;
140 161 }
141 162 break;
142 163 case 'wp':
@@ -146,9 +167,9 @@
146 167 default:
147 168 return;
148 169 }
149 170
150 - echo '<optgroup disabled label="' . sprintf( __( 'More in the %s version', 'visualizer' ), $license ) . '">';
171 + echo '<optgroup disabled label="' . __( 'Upgrade required', 'visualizer' ) . '">';
151 172 foreach ( $hours as $hour => $desc ) {
152 173 echo '<option disabled>' . $desc . '</option>';
153 174 }
154 175 echo '</optgroup>';
@@ -309,9 +330,11 @@
309 330 * @access public
310 331 */
311 332 public function enqueueMediaScripts() {
312 333 global $typenow;
313 - if ( post_type_supports( $typenow, 'editor' ) ) {
334 + global $current_screen;
335 +
336 + if ( post_type_supports( $typenow, 'editor' ) || $current_screen->id === 'widgets' || $current_screen->id === 'customize' ) {
314 337 wp_enqueue_style( 'visualizer-media', VISUALIZER_ABSURL . 'css/media.css', array( 'media-views' ), Visualizer_Plugin::VERSION );
315 338
316 339 // Load all the assets for the different libraries we support.
317 340 $deps = array(
@@ -403,14 +426,14 @@
403 426 ),
404 427 'pie' => array(
405 428 'name' => esc_html__( 'Pie/Donut', 'visualizer' ),
406 429 'enabled' => true,
407 - 'supports' => $enabled ? array( 'Google Charts', 'ChartJS' ) : array( 'Google Charts' ),
430 + 'supports' => array( 'Google Charts', 'ChartJS' ),
408 431 ),
409 432 'line' => array(
410 433 'name' => esc_html__( 'Line', 'visualizer' ),
411 434 'enabled' => true,
412 - 'supports' => $enabled ? array( 'Google Charts', 'ChartJS' ) : array( 'Google Charts' ),
435 + 'supports' => array( 'Google Charts', 'ChartJS' ),
413 436 ),
414 437 'bar' => array(
415 438 'name' => esc_html__( 'Bar', 'visualizer' ),
416 439 'enabled' => true,
@@ -998,8 +1021,9 @@
998 1021 );
999 1022 }
1000 1023 // enqueue charts array
1001 1024 $ajaxurl = admin_url( 'admin-ajax.php' );
1025 +
1002 1026 wp_localize_script(
1003 1027 'visualizer-library',
1004 1028 'visualizer',
1005 1029 array(
@@ -1036,8 +1060,9 @@
1036 1060 'i10n' => array(
1037 1061 'copied' => __( 'The shortcode has been copied to your clipboard. Hit Ctrl-V/Cmd-V to paste it.', 'visualizer' ),
1038 1062 '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' ),
1039 1063 ),
1064 + 'is_pro_user' => Visualizer_Module::is_pro(),
1040 1065 )
1041 1066 );
1042 1067 // render library page
1043 1068 $render = new Visualizer_Render_Library();
@@ -1220,9 +1245,9 @@
1220 1245
1221 1246 $user_id = 'visualizer_' . preg_replace( '/[^\w\d]*/', '', get_site_url() ); // Use a normalized version of the site URL as a user ID.
1222 1247
1223 1248 $license_data = get_option( 'visualizer_pro_license_data', false );
1224 - if ( false !== $license_data ) {
1249 + if ( false !== $license_data && isset( $license_data->key ) ) {
1225 1250 $user_id = 'visualizer_' . $license_data->key;
1226 1251 }
1227 1252
1228 1253 return array(
@@ -1227,9 +1252,9 @@
1227 1252
1228 1253 return array(
1229 1254 'userId' => $user_id,
1230 1255 'attributes' => array(
1231 - 'days_since_install' => $install_category,
1256 + 'days_since_install' => strval( $install_category ),
1232 1257 'free_version' => $plugin_version,
1233 1258 'pro_version' => defined( 'VISUALIZER_PRO_VERSION' ) ? VISUALIZER_PRO_VERSION : '',
1234 1259 'license_status' => apply_filters( 'product_visualizer_license_status', 'invalid' ),
1235 1260 ),