golden hour
/home/godaofbq/oxygenhyperbaric.com/wp-content/plugins/google-site-kit/includes/Core/Util
⬆️ Go Up
Upload
File/Folder
Size
Actions
Activation_Flag.php
3.25 KB
Del
OK
Activation_Notice.php
4.11 KB
Del
OK
Auto_Updates.php
4.17 KB
Del
OK
BC_Functions.php
4.68 KB
Del
OK
Block_Support.php
1.32 KB
Del
OK
Collection_Key_Cap_Filter.php
1.38 KB
Del
OK
Date.php
1.93 KB
Del
OK
Developer_Plugin_Installer.php
5.44 KB
Del
OK
Entity.php
3.2 KB
Del
OK
Entity_Factory.php
20.71 KB
Del
OK
Exit_Handler.php
836 B
Del
OK
Feature_Flags.php
2.22 KB
Del
OK
Google_Icon.php
1.58 KB
Del
OK
Google_URL_Matcher_Trait.php
3.02 KB
Del
OK
Google_URL_Normalizer.php
1.6 KB
Del
OK
Health_Checks.php
3.94 KB
Del
OK
Input.php
2.76 KB
Del
OK
Method_Proxy_Trait.php
1.09 KB
Del
OK
Migrate_Legacy_Keys.php
1.08 KB
Del
OK
Migration_1_123_0.php
4.54 KB
Del
OK
Migration_1_129_0.php
4.01 KB
Del
OK
Migration_1_150_0.php
3.12 KB
Del
OK
Migration_1_163_0.php
3.08 KB
Del
OK
Migration_1_3_0.php
2.97 KB
Del
OK
Migration_1_8_1.php
6.85 KB
Del
OK
Plugin_Status.php
1.36 KB
Del
OK
REST_Entity_Search_Controller.php
3.34 KB
Del
OK
Requires_Javascript_Trait.php
1.09 KB
Del
OK
Reset.php
9.69 KB
Del
OK
Reset_Persistent.php
666 B
Del
OK
Sanitize.php
1.04 KB
Del
OK
Scopes.php
2.59 KB
Del
OK
Sort.php
1.1 KB
Del
OK
Synthetic_WP_Query.php
4.08 KB
Del
OK
URL.php
5.4 KB
Del
OK
Uninstallation.php
3.8 KB
Del
OK
WP_Context_Switcher_Trait.php
2.13 KB
Del
OK
WP_Query_Factory.php
9.77 KB
Del
OK
Edit: Synthetic_WP_Query.php
<?php /** * Class Google\Site_Kit\Core\Util\Synthetic_WP_Query * * @package Google\Site_Kit * @copyright 2021 Google LLC * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * @link https://sitekit.withgoogle.com */ namespace Google\Site_Kit\Core\Util; use WP_Query; use WP_Post; /** * Class extending WordPress core's `WP_Query` for more self-contained behavior. * * @since 1.16.0 * @access private * @ignore */ final class Synthetic_WP_Query extends WP_Query { /** * The hash of the `$query` last parsed into `$query_vars`. * * @since 1.16.0 * @var string */ private $parsed_query_hash = ''; /** * Whether automatic 404 detection in `get_posts()` method is enabled. * * @since 1.16.0 * @var bool */ private $enable_404_detection = false; /** * Sets whether 404 detection in `get_posts()` method should be enabled. * * @since 1.16.0 * * @param bool $enable Whether or not to enable 404 detection. */ public function enable_404_detection( $enable ) { $this->enable_404_detection = (bool) $enable; } /** * Initiates object properties and sets default values. * * @since 1.16.0 */ public function init() { parent::init(); $this->parsed_query_hash = ''; } /** * Extends `WP_Query::parse_query()` to ensure it is not unnecessarily run twice. * * @since 1.16.0 * * @param string|array $query Optional. Array or string of query parameters. See `WP_Query::parse_query()`. */ public function parse_query( $query = '' ) { if ( ! empty( $query ) ) { $query_to_hash = wp_parse_args( $query ); } elseif ( ! isset( $this->query ) ) { $query_to_hash = $this->query_vars; } else { $query_to_hash = $this->query; } // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize $query_hash = md5( serialize( $query_to_hash ) ); // If this query was parsed before, bail early. if ( $query_hash === $this->parsed_query_hash ) { return; } parent::parse_query( $query ); // Set query hash for current `$query` and `$query_vars` properties. $this->parsed_query_hash = $query_hash; } /** * Extends `WP_Query::get_posts()` to include supplemental logic such as detecting a 404 state. * * The majority of the code is a copy of `WP::handle_404()`. * * @since 1.16.0 * * @return WP_Post[]|int[] Array of post objects or post IDs. */ public function get_posts() { $results = parent::get_posts(); // If 404 detection is not enabled, just return the results. if ( ! $this->enable_404_detection ) { return $results; } // Check if this is a single paginated post query. if ( $this->posts && $this->is_singular() && $this->post && ! empty( $this->query_vars['page'] ) ) { // If the post is actually paged and the 'page' query var is within bounds, it's all good. $next = '<!--nextpage-->'; if ( false !== strpos( $this->post->post_content, $next ) && (int) trim( $this->query_vars['page'], '/' ) <= ( substr_count( $this->post->post_content, $next ) + 1 ) ) { return $results; } // Otherwise, this query is out of bounds, so set a 404. $this->set_404(); return $results; } // If no posts were found, this is technically a 404. if ( ! $this->posts ) { // If this is a paginated query (i.e. out of bounds), always consider it a 404. if ( $this->is_paged() ) { $this->set_404(); return $results; } // If this is an author archive, don't consider it a 404 if the author exists. if ( $this->is_author() ) { $author = $this->get( 'author' ); if ( is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) { return $results; } } // If this is a valid taxonomy or post type archive, don't consider it a 404. if ( ( $this->is_category() || $this->is_tag() || $this->is_tax() || $this->is_post_type_archive() ) && $this->get_queried_object() ) { return $results; } // If this is a search results page or the home index, don't consider it a 404. if ( $this->is_home() || $this->is_search() ) { return $results; } // Otherwise, set a 404. $this->set_404(); } return $results; } }
Save