PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / trunk
Code Engine – PHP Snippets, AI Functions & Automation for WordPress vtrunk
0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 0.3.8 All 32 releases
← All changes | classes/api.php +5 -5 0.5.0trunk View file →
@@ -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 */