> */ public static function schema_fragment(): array { return array( 'apply_wp_slash' => array( 'type' => 'boolean', 'default' => true, 'description' => __( 'Apply wp_slash() to caller-supplied strings before writing. Default true; keeps literal backslashes intact (e.g. PHP namespaces \\Foo\\Bar, regex \\d+, Windows paths C:\\Users). Set false only when the caller has already slashed the payload — otherwise WordPress core will silently strip backslashes.', 'acrossai-abilities-manager' ), ), ); } /** * Meta annotation advertising the flag on the ability's `meta` block. Lets * discovery tooling and AI clients see that this ability supports the * apply_wp_slash opt-out without fetching the full input_schema. * * Merge into an ability's top-level `meta` array as * 'input_flags' => Slash_Input::meta_flags(), * * @return array> */ public static function meta_flags(): array { return array( 'apply_wp_slash' => array( 'default' => true, 'summary' => __( 'Toggle wp_slash() on caller-supplied strings before the core write. Default true preserves backslashes; false skips escaping.', 'acrossai-abilities-manager' ), 'schema_path' => 'input_schema.properties.apply_wp_slash', ), ); } /** * Wrap $value with wp_slash() unless the ability input explicitly opts out. * * Missing key OR true → slash. Only literal boolean false skips. * * @param mixed $value Value about to be handed to a WP core write function. * @param array $input Ability input payload. * @return mixed Slashed value, or the original value if opted out. */ public static function slash( $value, array $input ) { if ( false === ( $input['apply_wp_slash'] ?? true ) ) { return $value; } return wp_slash( $value ); } }