WordPress Transit semantic HTML and filter links related to the use of PHP function parsing, _php tutorial

Source: Internet
Author: User
Tags gopher nntp

WordPress Transit semantic HTML and filter links related to the use of PHP function parsing,


Esc_html () (escaped HTML)
The esc_html () function is used to escape HTML code so that the HTML code is not escaped.

Usage

Esc_html ($text);

Parameters

$text

(string) (must) the string to be escaped.

Default value: None

return value

Returns the escaped character (string).

Example

echo esc_html (' A link ');

The above code will output:

WordPress function: esc_html () (escaped HTML)

(To prevent the browser from transcoding, I cut a picture directly)

More

This function is located at: wp-includes/formatting.php


Esc_url () (Filter link)
Many URLs will have minor errors, using the Esc_url () function to block or correct these errors, and to reject unsafe protocols.

The work of the Esc_url () function is as follows:

Default deny is not url:defaulting to HTTP, HTTPS, FTP, FTPS, mailto, news, IRC, gopher, NNTP, feed, and telnet for the following protocols
Remove invalid characters and dangerous characters
Convert characters to HTML entity characters
How to use

Esc_url ($url, $protocols, $_context);

Parameters

$url

(string) (must) the URL to be filtered.

Default value: None

$protocols

(array) (optional) You can receive an array of protocols, and if not set, the default is: Defaulting to HTTP, HTTPS, FTP, FTPS, mailto, news, IRC, gopher, NNTP, feeds, and Telnet.

Default value: None

$_context

(string) (optional) How to return the URL.

Default value: (String) display

return value

(string) returns the filtered link.

Example

<?php echo esc_url (' www.endskin.com ');//output: http://www.endskin.com?>

More

This function is located at: wp-includes/formatting.php

Articles you may be interested in:

    • A detailed explanation of how to filter links and filter SQL statements in WordPress
    • A detailed description of the filter properties in WordPress development and the use of SQL statements function

http://www.bkjia.com/PHPjc/1084560.html www.bkjia.com true http://www.bkjia.com/PHPjc/1084560.html techarticle WordPress Transit semantic HTML and filter links related PHP functions using parsing, esc_html () (escaped HTML) esc_html () function is used to escape the HTML code, so that the HTML code is not escaped. Usage es ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.