| @@ -287,9 +287,9 @@ | ||
| 287 | 287 | * Create a new snippet. |
| 288 | 288 | * |
| 289 | 289 | * @param string $name Name of the snippet. |
| 290 | 290 | * @param string $code Code of the snippet. |
| 291 | - * @param string $scope Scope of the snippet: 'function', 'backend', 'frontend', 'scheduled', 'persistent'. | |
| 291 | + * @param string $scope Scope of the snippet: 'function', 'backend', 'frontend', 'scheduled', 'persistent', 'content_php', 'content_js'. | |
| 292 | 292 | * @param array $options Additional options: |
| 293 | 293 | * - target: 'php' or 'js' (for function snippets) |
| 294 | 294 | * - description: Description of the snippet |
| 295 | 295 | * - args: Arguments for function snippets |
| @@ -317,13 +317,13 @@ | ||
| 317 | 317 | if ( empty( $code ) ) { |
| 318 | 318 | throw new Exception( 'The snippet code is required.' ); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $validScopes = ['function', 'backend', 'frontend', 'scheduled', 'persistent']; | |
| 321 | + $validScopes = ['function', 'backend', 'frontend', 'scheduled', 'persistent', 'content_php', 'content_js']; | |
| 322 | 322 | if ( !in_array( $scope, $validScopes ) ) { |
| 323 | 323 | throw new Exception( sprintf( 'Invalid scope. Must be one of: %s', implode( ', ', $validScopes ) ) ); |
| 324 | 324 | } |
| 325 | - | |
| 325 | + | |
| 326 | 326 | // Extract options with defaults |
| 327 | 327 | $target = $options['target'] ?? 'php'; |
| 328 | 328 | $description = $options['description'] ?? ''; |
| 329 | 329 | $args = $options['args'] ?? []; |
| @@ -443,9 +443,9 @@ | ||
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // Validate scope if provided |
| 446 | 446 | if ( isset( $params['scope'] ) ) { |
| 447 | - $validScopes = ['function', 'backend', 'frontend', 'scheduled', 'persistent']; | |
| 447 | + $validScopes = ['function', 'backend', 'frontend', 'scheduled', 'persistent', 'content_php', 'content_js']; | |
| 448 | 448 | if ( !in_array( $params['scope'], $validScopes ) ) { |
| 449 | 449 | throw new Exception( sprintf( 'Invalid scope. Must be one of: %s', implode( ', ', $validScopes ) ) ); |
| 450 | 450 | } |
| 451 | 451 | } |
| @@ -775,9 +775,9 @@ | ||
| 775 | 775 | |
| 776 | 776 | /** |
| 777 | 777 | * Get snippets by scope. |
| 778 | 778 | * |
| 779 | - * @param string $scope The scope to filter by: 'backend', 'frontend', 'function', 'scheduled', 'persistent'. | |
| 779 | + * @param string $scope The scope to filter by: 'backend', 'frontend', 'function', 'scheduled', 'persistent', 'content_php', 'content_js'. | |
| 780 | 780 | * @param array $filters Additional filters: 'active' (bool), 'tags' (array). |
| 781 | 781 | * @return array The list of snippets matching the criteria. |
| 782 | 782 | * @throws Exception If the scope is invalid. |
| 783 | 783 | */ |