Current File : /dom550890/wp-includes/https-detection.php
<?php
/**
* HTTPS detection functions.
*
* @package WordPress
* @since 5.7.0
*/
/**
* Checks whether the website is using HTTPS.
*
* This is based on whether both the home and site URL are using HTTPS.
*
* @since 5.7.0
* @see wp_is_home_url_using_https()
* @see wp_is_site_url_using_https()
*
* @return bool True if using HTTPS, false otherwise.
*/
function wp_is_using_https() {
if ( ! wp_is_home_url_using_https() ) {
return false;
}
return wp_is_site_url_using_https();
}
/**
* Checks whether the current site URL is using HTTPS.
*
* @since 5.7.0
* @see home_url()
*
* @return bool True if using HTTPS, false otherwise.
*/
function wp_is_home_url_using_https() {
return 'https' === wp_parse_url( home_url(), PHP_URL_SCHEME );
}
/**
* Checks whether the current site's URL where WordPress is stored is using HTTPS.
*
* This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder)
* are accessible.
*
* @since 5.7.0
* @see site_url()
*
* @return bool True if using HTTPS, false otherwise.
*/
function wp_is_site_url_using_https() {
/*
* Use direct option access for 'siteurl' and manually run the 'site_url'
* filter because `site_url()` will adjust the scheme based on what the
* current request is using.
*/
/** This filter is documented in wp-includes/link-template.php */
$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null );
return 'https' === wp_parse_url( $site_url, PHP_URL_SCHEME );
}
/**
* Checks whether HTTPS is supported for the server and domain.
*
* This function makes an HTTP request through `wp_get_https_detection_errors()`
* to check for HTTPS support. As this process can be resource-intensive,
* it should be used cautiously, especially in performance-sensitive environments,
* to avoid potential latency issues.
*
* @since 5.7.0
*
* @return bool True if HTTPS is supported, false otherwise.
*/
function wp_is_https_supported() {
$https_detection_errors = wp_get_https_detection_errors();
// If there are errors, HTTPS is not supported.
return empty( $https_detection_errors );
}
/**
* Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors.
*
* This function checks for HTTPS support by making an HTTP request. As this process can be resource-intensive,
* it should be used cautiously, especially in performance-sensitive environments.
* It is called when HTTPS support needs to be validated.
*
* @since 6.4.0
* @access private
*
* @return array An array containing potential detection errors related to HTTPS, or an empty array if no errors are found.
*/
function wp_get_https_detection_errors() {
/**
* Short-circuits the process of detecting errors related to HTTPS support.
*
* Returning a `WP_Error` from the filter will effectively short-circuit the default logic of trying a remote
* request to the site over HTTPS, storing the errors array from the returned `WP_Error` instead.
*
* @since 6.4.0
*
* @param null|WP_Error $pre Error object to short-circuit detection,
* or null to continue with the default behavior.
*/
$support_errors = apply_filters( 'pre_wp_get_https_detection_errors', null );
if ( is_wp_error( $support_errors ) ) {
return $support_errors->errors;
}
$support_errors = new WP_Error();
$response = wp_remote_request(
home_url( '/', 'https' ),
array(
'headers' => array(
'Cache-Control' => 'no-cache',
),
'sslverify' => true,
)
);
if ( is_wp_error( $response ) ) {
$unverified_response = wp_remote_request(
home_url( '/', 'https' ),
array(
'headers' => array(
'Cache-Control' => 'no-cache',
),
'sslverify' => false,
)
);
if ( is_wp_error( $unverified_response ) ) {
$support_errors->add(
'https_request_failed',
__( 'HTTPS request failed.' )
);
} else {
$support_errors->add(
'ssl_verification_failed',
__( 'SSL verification failed.' )
);
}
$response = $unverified_response;
}
if ( ! is_wp_error( $response ) ) {
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
$support_errors->add( 'bad_response_code', wp_remote_retrieve_response_message( $response ) );
} elseif ( false === wp_is_local_html_output( wp_remote_retrieve_body( $response ) ) ) {
$support_errors->add( 'bad_response_source', __( 'It looks like the response did not come from this site.' ) );
}
}
return $support_errors->errors;
}
/**
* 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.
*
* @since 5.7.0
* @access private
*
* @param string $html Full HTML output string, e.g. from a HTTP response.
* @return bool|null True/false for whether HTML was generated by this site, null if unable to determine.
*/
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 str_contains( $html, $pattern );
}
// 2. 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 str_contains( $html, $pattern );
}
// Otherwise the result cannot be determined.
return null;
}
Zerion Mini Shell 1.0
Home - Professional Genealogists and Historians - LineagesSkip to content
Our talented staff of professional researchers can help you, whether you have hit a roadblock in your research or simply lack the time or training to tackle it yourself. Plus, our rates are 40% lower than many of our competitors! Check out our sample projects and then pick the research package that best fits your needs!
ENSLAVED PEOPLE & ENSLAVERS
Identifying the men and women who owned your ancestors during slavery requires finely honed skills and years of experience. Our expertise comes from having traced hundreds of African-American family trees. Choose the research package that best fits your needs, and we will start tracing your ancestors back to the slave period and look for their owners.
Genealogy Research that's Insightful, Thorough & Personal
Our staff of amazinggenealogistsand family historians cannot wait to start documenting your ancestry. They will work with you to plan and achieve your research goals.
We will need your help in bringing your ancestors back to life by supplying items not available in public records or online, such as photos, passages from diaries, family stories, unsolved mysteries, and other interesting details.
The end result will be a fun trip down several memory lanes, and you will want to share it with family and friends.
“When Alex Haley prodded me to have my ancestry traced, I reached out to Johni Cerny and she has been my genealogist for 34 years—tracing my African-American roots and the ancestry of many of my close friends. She eternally reminds all of us how we got to this planet. Johni also keeps my soul eternally smiling and nobody does it better!”
Quincy D. Jones
“Thank you, thank you, thank you…for the amazing work you did to identify my biological father. The DNA results were gibberish until you explained it in layman’s terms for me and then used it to find him. Now it is time for you to trace his ancestry. I can’t wait to see the results of that adventure!”
Janet Williamson
“Wow, the research package arrived a few days ago and I can hardly put it down. The report and all those wonderful documents tell an interesting story about my mother’s Graupman ancestors. We will treasure this forever! Let me know what else you can do to trace the Graupman line in German records.”
K. Meyer
“My sister always felt like the odd person out in our family. DNA testing confirmed we were half-siblings. In her late 60s, we didn’t hold out much hope for identifying her biological father. With over 1,000 matches, we turned to Lineages’ staff expert for help. A few months and a lot of hard work, they solved the mystery. Lineages gave my sister the gift of a lifetime. Thank you, Lineages!”
The Genealogical Proof Standard, also known as the GPS, is a set of genealogical standards established by the Board for Certification of Genealogists. It is a guideline that ensures researchers are engaging in thorough and reliable genealogical research. No matter the level of skill and experience you have, understanding what the GPS is and how…
As the New Year begins, it’s the perfect time to set meaningful goals that connect us with our past and enrich our present. While many resolutions focus on personal growth or wellness, delving into family history offers a unique opportunity to strengthen bonds, uncover fascinating stories, and preserve legacies for future generations. Whether you’re a…
Boxing Day, celebrated on December 26th, is a public holiday observed in many countries that were once part of the British Empire, including the United Kingdom, Canada, Australia, and New Zealand. The day traditionally follows Christmas Day and provides an opportunity for people to extend the holiday festivities. It is associated with the practice of…
This Christmas season, many of us are practicing traditions we have known since childhood. Some of these traditions may have been what our parents and grandparents have known since childhood. These traditions almost seem timeless. But would it surprise you to learn that the longstanding traditions of Christmas trees, caroling, and giving to charity may…
A very special thing about Christmas is the stories told, especially when set to music. Some of the best I have seen and heard are from The Tabernacle Choir at Temple Square. For your Christmas watching and listening, these are some of my very favorites: Music Videos What Shall We Give Silent Night Infant Holy,…
The history of the Philippines is enriched by a vibrant tapestry of cultures, languages, and international influences. When it comes to Filipino genealogy, understanding how to approach research in the Philippines greatly depends on understanding those various influences, as well as record types and how to access various records (which is where the big news…
Share their stories this Thanksgiving In the early autumn of 1621, the Pilgrims gathered to celebrate their successful harvest, as was the English custom. Among the surviving Pilgrims were 4 married women, 5 adolescent girls, 9 adolescent boys, 13 young children, and 22 men. Were one of these your ancestor? Approximately 10 million people in…
This is part two of a two-part series about researching ancestors in Ontario, Canada. This part will cover in-depth research techniques and resources that are unique to Ontario. Part one covered basic strategies and resources for Ontario research. On-site Records If you have researched your family for any amount of time, you know that not…
This is part one of a two-part series about researching ancestors in Ontario, Canada. Part one will focus on an overview of the most popular record types. Part II will be an overview of advanced resources. Do you have ancestors who lived in Ontario, Canada? Researching in Ontario can be a bit different than researching…
It’s 2024 and the internet has been changing the entire landscape of genealogy research for over two decades. So many historical records are online—from the big genealogy sites like Ancestry and FamilySearch to volunteer-created databases at local genealogical and historical societies. Even so, it would be a mistake to assume that everything you need is…