| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: Visualizer: Tables and Charts for WordPress |
| 4 | 4 | Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs/ |
| 5 | 5 | Description: Effortlessly create and embed responsive charts and tables with Visualizer, a powerful WordPress plugin that enhances data presentation from multiple sources. |
| 6 | - Version: 4.0.3 | |
| 6 | + Version: 4.0.9 | |
| 7 | 7 | Author: Themeisle |
| 8 | 8 | Author URI: http://themeisle.com |
| 9 | 9 | License: GPL v2.0 or later |
| 10 | 10 | WordPress Available: yes |
| @@ -144,8 +144,11 @@ | ||
| 144 | 144 | |
| 145 | 145 | // AI Chart Builder module (AJAX endpoints for the React wizard). |
| 146 | 146 | $plugin->setModule( Visualizer_Module_AIBuilder::NAME ); |
| 147 | 147 | |
| 148 | + // Abilities API integration (no-op when the API is not available). | |
| 149 | + $plugin->setModule( Visualizer_Module_Abilities::NAME ); | |
| 150 | + | |
| 148 | 151 | $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php'; |
| 149 | 152 | if ( is_readable( $vendor_file ) ) { |
| 150 | 153 | include_once $vendor_file; |
| 151 | 154 | } |
| @@ -151,9 +154,9 @@ | ||
| 151 | 154 | } |
| 152 | 155 | |
| 153 | 156 | $action_scheduler_file = VISUALIZER_ABSPATH . '/vendor/woocommerce/action-scheduler/action-scheduler.php'; |
| 154 | 157 | |
| 155 | - if ( is_readable( $action_scheduler_file ) ) { | |
| 158 | + if ( visualizer_can_use_action_scheduler() && is_readable( $action_scheduler_file ) ) { | |
| 156 | 159 | require_once $action_scheduler_file; |
| 157 | 160 | } |
| 158 | 161 | |
| 159 | 162 | add_filter( 'themeisle_sdk_products', 'visualizer_register_sdk', 10, 1 ); |
| @@ -179,8 +182,27 @@ | ||
| 179 | 182 | 'upgrade_link' => esc_url( tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'sidebarMenuUpgrade', 'index' ) ), |
| 180 | 183 | ); |
| 181 | 184 | } |
| 182 | 185 | ); |
| 186 | + add_filter( | |
| 187 | + 'visualizer_ai_connect_metadata', | |
| 188 | + function () { | |
| 189 | + return array( | |
| 190 | + 'name' => 'Visualizer', | |
| 191 | + 'notice_cases' => array( | |
| 192 | + __( 'build a chart from your numbers', 'visualizer' ), | |
| 193 | + __( 'update a table with new data', 'visualizer' ), | |
| 194 | + __( 'refresh charts from their data source', 'visualizer' ), | |
| 195 | + ), | |
| 196 | + 'prompts' => array( | |
| 197 | + __( 'Create a Visualizer pie chart "Traffic by channel" with Organic 5400, Direct 2100 and Social 1300, and add it to my Analytics page.', 'visualizer' ), | |
| 198 | + __( 'Refresh every chart that pulls from a remote CSV, JSON or database source.', 'visualizer' ), | |
| 199 | + __( 'Change my "Monthly sales" chart to a bar chart and add September: 12,400.', 'visualizer' ), | |
| 200 | + ), | |
| 201 | + 'ability_prefix' => 'visualizer', | |
| 202 | + ); | |
| 203 | + } | |
| 204 | + ); | |
| 183 | 205 | |
| 184 | 206 | if ( ! defined( 'TI_E2E_TESTING' ) && 'yes' === get_option( 'visualizer_logger_flag', 'no' ) ) { |
| 185 | 207 | add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' ); |
| 186 | 208 | add_filter( |
| @@ -214,8 +236,23 @@ | ||
| 214 | 236 | return $products; |
| 215 | 237 | } |
| 216 | 238 | ); |
| 217 | 239 | } |
| 240 | +} | |
| 241 | + | |
| 242 | +/** | |
| 243 | + * Whether the bundled Action Scheduler can run against this wpdb. | |
| 244 | + * | |
| 245 | + * The bundled library calls wpdb::db_server_info() unguarded when it claims a | |
| 246 | + * queue batch, and core only added that method in WordPress 5.5. Loading it | |
| 247 | + * without the method available fatals, so those sites stay on WP-Cron instead. | |
| 248 | + * | |
| 249 | + * @return bool | |
| 250 | + */ | |
| 251 | +function visualizer_can_use_action_scheduler() { | |
| 252 | + global $wpdb; | |
| 253 | + | |
| 254 | + return isset( $wpdb ) && is_callable( array( $wpdb, 'db_server_info' ) ); | |
| 218 | 255 | } |
| 219 | 256 | |
| 220 | 257 | /** |
| 221 | 258 | * Registers with the SDK |