PluginProbe
ZIP AI – AI Website Builder & AI Agent / 0.0.13
ZIP AI – AI Website Builder & AI Agent v0.0.13
0.0.13 0.0.12 0.0.11 0.0.10 0.0.9 trunk 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8
← All changes | inc/react/react-manager.php +1 -125 0.0.9 → 0.0.13 View file →
@@ -202,33 +202,16 @@
202 202 'tool-hooks',
203 203 'zipwpIframeConfig',
204 204 array(
205 205 'nonce' => wp_create_nonce( 'zip_ai_iframe' ),
206 - 'restNonce' => wp_create_nonce( 'wp_rest' ),
207 206 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
208 207 'displayMode' => $this->is_fullpage_screen() ? 'fullpage' : 'sidebar',
209 208 'adminHomeUrl' => admin_url(),
210 209 'userId' => get_current_user_id(),
211 210 'authUrl' => $auth_url,
212 - 'websiteContext' => array(
213 - 'site_url' => get_site_url(),
214 - 'admin_url' => admin_url(),
215 - 'site_title' => get_bloginfo( 'name' ),
216 - 'site_tagline' => get_bloginfo( 'description' ),
217 - 'language' => get_bloginfo( 'language' ),
218 - 'timezone' => wp_timezone_string(),
219 - 'date_format' => get_option( 'date_format' ),
220 - 'time_format' => get_option( 'time_format' ),
221 - 'is_multisite' => is_multisite(),
222 - ),
223 - 'pageContext' => $this->get_current_page_context(),
224 211 'activeProduct' => Product_Context::detect(),
225 212 'isBlockEditor' => $this->is_block_editor_screen(),
226 213 'isPostEditScreen' => $this->is_post_edit_screen(),
227 - 'themeContext' => array(
228 - 'color_palette' => $this->get_theme_color_palette(),
229 - ),
230 - 'installedPlugins' => $this->get_installed_plugins_versions(),
231 214 'setupGate' => $this->get_setup_gate(),
232 215 )
233 216 );
234 217
@@ -292,10 +275,10 @@
292 275 // the menu entry is hidden for anyone who would only get a
293 276 // permission error after clicking it.
294 277 'canManageConnection' => current_user_can( 'manage_options' ),
295 278 'displayMode' => $this->is_fullpage_screen() ? 'fullpage' : 'sidebar',
279 + 'adminHomeUrl' => admin_url(),
296 280 'fullPageUrl' => admin_url( 'options-general.php?page=zip-ai-assistant' ),
297 - 'adminHomeUrl' => admin_url(),
298 281 'userId' => get_current_user_id(),
299 282 'domain' => wp_parse_url( home_url(), PHP_URL_HOST ),
300 283 'site_url' => home_url(),
301 284 'user' => array(
@@ -302,9 +285,8 @@
302 285 'id' => get_current_user_id(),
303 286 'email' => Helper::get_setting( 'user_email', '' ),
304 287 'name' => Helper::get_setting( 'user_name', '' ),
305 288 ),
306 - 'isFreshSite' => (bool) get_option( 'fresh_site', false ),
307 289 'expireAt' => $expire_at,
308 290 // Brand context for on-brand palette generation (colour picker).
309 291 'brandContext' => $brand_context,
310 292 'nonce' => wp_create_nonce( 'zip_ai_iframe' ),
@@ -324,9 +306,8 @@
324 306 // ZipWP chat loads. (Theme/plugin lifecycle MCP tools now run
325 307 // server-side and do not use this.)
326 308 'updatesNonce' => wp_create_nonce( 'updates' ),
327 309 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
328 - 'authUrl' => $auth_url,
329 310 )
330 311 );
331 312 }
332 313
@@ -476,48 +457,8 @@
476 457 $this->enqueue_script( 'bridge-host' );
477 458 }
478 459
479 460 /**
480 - * Get current page/post context from PHP.
481 - *
482 - * @since 1.0.0
483 - * @return array<string, int|string|null>
484 - */
485 - private function get_current_page_context() {
486 - global $post;
487 -
488 - $context = array(
489 - 'post_id' => null,
490 - 'post_type' => null,
491 - 'post_title' => null,
492 - 'post_status' => null,
493 - );
494 -
495 - if ( $post instanceof \WP_Post ) {
496 - $context['post_id'] = $post->ID;
497 - $context['post_type'] = $post->post_type;
498 - $context['post_title'] = $post->post_title;
499 - $context['post_status'] = $post->post_status;
500 - return $context;
501 - }
502 -
503 - if ( is_admin() ) {
504 - $post_id = isset( $_GET['post'] ) && is_scalar( $_GET['post'] ) ? absint( $_GET['post'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
505 - if ( $post_id ) {
506 - $admin_post = get_post( $post_id );
507 - if ( $admin_post instanceof \WP_Post ) {
508 - $context['post_id'] = $admin_post->ID;
509 - $context['post_type'] = $admin_post->post_type;
510 - $context['post_title'] = $admin_post->post_title;
511 - $context['post_status'] = $admin_post->post_status;
512 - }
513 - }
514 - }
515 -
516 - return $context;
517 - }
518 -
519 - /**
520 461 * Authoritative server-side check for whether the current screen is the
521 462 * NATIVE WordPress post/page editor (post.php / post-new.php, screen base
522 463 * 'post'). The JS bridge falls back to this when `wp.data` /
523 464 * `core/block-editor` are not yet initialized at iframe boot — without
@@ -599,73 +540,8 @@
599 540 $auth_middleware
600 541 );
601 542
602 543 return $auth_url;
603 - }
604 -
605 - /**
606 - * Get theme color palette formatted as CSS variables.
607 - *
608 - * @since 1.0.0
609 - * @return array<string, string>
610 - */
611 - private function get_theme_color_palette() {
612 - if ( ! function_exists( 'astra_get_palette_colors' ) ) {
613 - return array();
614 - }
615 -
616 - $palette_data = astra_get_palette_colors();
617 - if ( ! is_array( $palette_data ) ) {
618 - return array();
619 - }
620 -
621 - $current_palette = is_string( $palette_data['currentPalette'] ?? null ) ? $palette_data['currentPalette'] : '';
622 - $palettes = is_array( $palette_data['palettes'] ?? null ) ? $palette_data['palettes'] : array();
623 -
624 - if ( '' === $current_palette || empty( $palettes[ $current_palette ] ) ) {
625 - return array();
626 - }
627 -
628 - $colors = $palettes[ $current_palette ];
629 - if ( ! is_array( $colors ) ) {
630 - return array();
631 - }
632 -
633 - $formatted_palette = array();
634 -
635 - foreach ( $colors as $index => $color ) {
636 - if ( ! is_scalar( $color ) ) {
637 - continue;
638 - }
639 - $formatted_palette[ '--ast-global-color-' . $index ] = (string) $color;
640 - }
641 -
642 - return $formatted_palette;
643 - }
644 -
645 - /**
646 - * Get installed plugins with their versions.
647 - *
648 - * @since 1.0.0
649 - * @return array<string, string>
650 - */
651 - private function get_installed_plugins_versions() {
652 - if ( ! function_exists( 'get_plugins' ) ) {
653 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
654 - }
655 -
656 - $all_plugins = get_plugins();
657 - $plugin_versions = array();
658 -
659 - foreach ( $all_plugins as $plugin_file => $plugin_data ) {
660 - $slug = dirname( $plugin_file );
661 - if ( '.' === $slug ) {
662 - $slug = basename( $plugin_file, '.php' );
663 - }
664 - $plugin_versions[ $slug ] = is_string( $plugin_data['Version'] ?? null ) ? $plugin_data['Version'] : '0.0.0';
665 - }
666 -
667 - return $plugin_versions;
668 544 }
669 545
670 546 /**
671 547 * Build the Spectra setup-gate descriptor for the React notice.