wp_is_local_html_output
函数
wp_is_local_html_output ( $html )
- Access
- Private
- 参数
-
-
(string)
$html
Full HTML output string, e.g. from a HTTP response.- Required: 是
-
(string)
- 返回值
-
- (bool|null) True/false for whether HTML was generated by this site, null if unable to determine.
- 定义位置
-
-
wp-includes/https-detection.php
, line 204
-
wp-includes/https-detection.php
- 引入
- 5.7.0
- 弃用
- –
Checks whether a given HTML string is likely an output from this WordPress site.
This function attempts to check for various common WordPress patterns whether they are included in the HTML string.
Since any of these actions may be disabled through third-party code, this function may also return null to indicate
that it was not possible to determine ownership.
function wp_is_local_html_output( $html ) { // 1. Check if HTML includes the site's Really Simple Discovery link. if ( has_action( 'wp_head', 'rsd_link' ) ) { $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); // See rsd_link(). return false !== strpos( $html, $pattern ); } // 2. Check if HTML includes the site's Windows Live Writer manifest link. if ( has_action( 'wp_head', 'wlwmanifest_link' ) ) { // Try both HTTPS and HTTP since the URL depends on context. $pattern = preg_replace( '#^https?:(?=//)#', '', includes_url( 'wlwmanifest.xml' ) ); // See wlwmanifest_link(). return false !== strpos( $html, $pattern ); } // 3. Check if HTML includes the site's REST API link. if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) { // Try both HTTPS and HTTP since the URL depends on context. $pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); // See rest_output_link_wp_head(). return false !== strpos( $html, $pattern ); } // Otherwise the result cannot be determined. return null; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。