mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-04-26 12:38:03 +08:00
- Organize files in folders according to the desired structure - Use directory iterator to loop through all files and folders (makes generation more robust)
2.3 KiB
2.3 KiB
WP_CLI\Utils\esc_like()
First half of escaping for LIKE special characters % and _ before preparing for MySQL.
Usage
WP_CLI\Utils\esc_like( $text )
$text (string) The raw text to be escaped. The input typed by the user should have no
@return (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()
@return (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()
Notes
Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.
Copied from core "wp-includes/wp-db.php". Avoids dependency on WP 4.4 wpdb. extra or deleted slashes. or real_escape next.
Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.
Related
- WP_CLI\Utils\write_csv() - Write data as CSV to a given file.
- WP_CLI\Utils\http_request() - Make a HTTP request to a remote URL.
- WP_CLI\Utils\get_named_sem_ver() - Compare two version strings to get the named semantic version.
- WP_CLI\Utils\parse_ssh_url() - Parse a SSH url for its host, port, and path.
- WP_CLI\Utils\basename() - Locale-independent version of basename()
- WP_CLI\Utils\isPiped() - Checks whether the output of the current script is a TTY or a pipe / redirect
- WP_CLI\Utils\proc_open_compat() - Windows compatible `proc_open()`. Works around bug in PHP, and also deals with *nix-like `ENV_VAR=blah cmd` environment variable prefixes.