← All changes
|
includes/abilities/widgets/wdesignkit-sync-widget-code.php
+12
-0
2.6.3
→
2.7.0
View file →
| @@ -63,8 +63,9 @@ | ||
| 63 | 63 | ], |
| 64 | 64 | 'execute_callback' => 'wdesignkit_mcp_sync_widget_code', |
| 65 | 65 | 'permission_callback' => 'wdesignkit_mcp_permission_callback', |
| 66 | 66 | 'meta' => [ |
| 67 | + 'public' => true, | |
| 67 | 68 | 'show_in_rest' => true, |
| 68 | 69 | 'mcp' => ['public' => true], |
| 69 | 70 | 'annotations' => [ |
| 70 | 71 | 'instructions' => implode("\n", [ |
| @@ -466,8 +467,19 @@ | ||
| 466 | 467 | 'diff' => $diff_summary, |
| 467 | 468 | 'preview' => [ |
| 468 | 469 | 'new_php_code' => $new_php_code, |
| 469 | 470 | ], |
| 471 | + ]; | |
| 472 | + } | |
| 473 | + | |
| 474 | + // Site-level opt-out for generated widget PHP (ClickUp 86d41zavc). This path regenerates | |
| 475 | + // register_controls() and rewrites the widget's .php, so it is a PHP write like any other | |
| 476 | + // and has to honour the same filter. Checked after the dry_run return above, so a preview | |
| 477 | + // still works on a locked-down site. | |
| 478 | + if (function_exists('wdesignkit_widget_php_write_allowed') && !wdesignkit_widget_php_write_allowed()) { | |
| 479 | + return [ | |
| 480 | + 'success' => false, | |
| 481 | + 'message' => "PHP was not rewritten for {$builder}/{$folder}: generated widget PHP writes are disabled on this site via the wdesignkit_allow_widget_php_write filter. Use dry_run: true to preview the change.", | |
| 470 | 482 | ]; |
| 471 | 483 | } |
| 472 | 484 | |
| 473 | 485 | $written = @file_put_contents($php_path, $new_php_code); |