| @@ -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">★★★★★</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, |
| @@ -1036,8 +1056,9 @@ | ||
| 1036 | 1056 | 'i10n' => array( |
| 1037 | 1057 | 'copied' => __( 'The shortcode has been copied to your clipboard. Hit Ctrl-V/Cmd-V to paste it.', 'visualizer' ), |
| 1038 | 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' ), |
| 1039 | 1059 | ), |
| 1060 | + 'is_pro_user' => Visualizer_Module::is_pro(), | |
| 1040 | 1061 | ) |
| 1041 | 1062 | ); |
| 1042 | 1063 | // render library page |
| 1043 | 1064 | $render = new Visualizer_Render_Library(); |
| @@ -1220,9 +1241,9 @@ | ||
| 1220 | 1241 | |
| 1221 | 1242 | $user_id = 'visualizer_' . preg_replace( '/[^\w\d]*/', '', get_site_url() ); // Use a normalized version of the site URL as a user ID. |
| 1222 | 1243 | |
| 1223 | 1244 | $license_data = get_option( 'visualizer_pro_license_data', false ); |
| 1224 | - if ( false !== $license_data ) { | |
| 1245 | + if ( false !== $license_data && isset( $license_data->key ) ) { | |
| 1225 | 1246 | $user_id = 'visualizer_' . $license_data->key; |
| 1226 | 1247 | } |
| 1227 | 1248 | |
| 1228 | 1249 | return array( |
| @@ -1227,9 +1248,9 @@ | ||
| 1227 | 1248 | |
| 1228 | 1249 | return array( |
| 1229 | 1250 | 'userId' => $user_id, |
| 1230 | 1251 | 'attributes' => array( |
| 1231 | - 'days_since_install' => $install_category, | |
| 1252 | + 'days_since_install' => strval( $install_category ), | |
| 1232 | 1253 | 'free_version' => $plugin_version, |
| 1233 | 1254 | 'pro_version' => defined( 'VISUALIZER_PRO_VERSION' ) ? VISUALIZER_PRO_VERSION : '', |
| 1234 | 1255 | 'license_status' => apply_filters( 'product_visualizer_license_status', 'invalid' ), |
| 1235 | 1256 | ), |