Priority File Manager

📁 public_html
Base Directory:
/home/ecedu/public_html/wp-includes/blocks
NameTypeSizeActions
📁 .. Folder -
📁 archives Folder -
📄 archives.php File 2994
Edit Download
📁 audio Folder -
📁 avatar Folder -
📄 avatar.php File 5745
Edit Download
📁 block Folder -
📄 block.php File 3314
Edit Download
📄 blocks-json.php File 193945
Edit Download
📁 button Folder -
📄 button.php File 1805
Edit Download
📁 buttons Folder -
📁 calendar Folder -
📄 calendar.php File 6075
Edit Download
📁 categories Folder -
📄 categories.php File 4010
Edit Download
📁 code Folder -
📁 column Folder -
📁 columns Folder -
📁 comment-author-name Folder -
📄 comment-author-name.php File 2133
Edit Download
📁 comment-content Folder -
📄 comment-content.php File 2459
Edit Download
📁 comment-date Folder -
📄 comment-date.php File 1863
Edit Download
📁 comment-edit-link Folder -
📄 comment-edit-link.php File 1713
Edit Download
📁 comment-reply-link Folder -
📄 comment-reply-link.php File 2075
Edit Download
📁 comment-template Folder -
📄 comment-template.php File 4494
Edit Download
📁 comments Folder -
📁 comments-pagination Folder -
📁 comments-pagination-next Folder -
📄 comments-pagination-next.php File 1924
Edit Download
📁 comments-pagination-numbers Folder -
📄 comments-pagination-numbers.php File 1632
Edit Download
📁 comments-pagination-previous Folder -
📄 comments-pagination-previous.php File 1790
Edit Download
📄 comments-pagination.php File 1199
Edit Download
📁 comments-title Folder -
📄 comments-title.php File 2772
Edit Download
📄 comments.php File 6767
Edit Download
📁 cover Folder -
📄 cover.php File 3175
Edit Download
📁 details Folder -
📁 embed Folder -
📁 file Folder -
📄 file.php File 1793
Edit Download
📁 footnotes Folder -
📄 footnotes.php File 3771
Edit Download
📁 freeform Folder -
📁 gallery Folder -
📄 gallery.php File 6438
Edit Download
📁 group Folder -
📁 heading Folder -
📄 heading.php File 1301
Edit Download
📁 home-link Folder -
📄 home-link.php File 5438
Edit Download
📁 html Folder -
📁 image Folder -
📄 image.php File 12023
Edit Download
📄 index.php File 5111
Edit Download
📁 latest-comments Folder -
📄 latest-comments.php File 5040
Edit Download
📁 latest-posts Folder -
📄 latest-posts.php File 8542
Edit Download
📁 legacy-widget Folder -
📄 legacy-widget.php File 3997
Edit Download
📁 list Folder -
📁 list-item Folder -
📄 list.php File 1273
Edit Download
📁 loginout Folder -
📄 loginout.php File 1418
Edit Download
📁 media-text Folder -
📄 media-text.php File 4383
Edit Download
📁 missing Folder -
📁 more Folder -
📁 navigation Folder -
📁 navigation-link Folder -
📄 navigation-link.php File 13913
Edit Download
📁 navigation-submenu Folder -
📄 navigation-submenu.php File 9943
Edit Download
📄 navigation.php File 49620
Edit Download
📁 nextpage Folder -
📁 page-list Folder -
📁 page-list-item Folder -
📄 page-list-item.php File 361
Edit Download
📄 page-list.php File 13611
Edit Download
📁 paragraph Folder -
📁 pattern Folder -
📄 pattern.php File 1788
Edit Download
📁 post-author Folder -
📁 post-author-biography Folder -
📄 post-author-biography.php File 1524
Edit Download
📁 post-author-name Folder -
📄 post-author-name.php File 1951
Edit Download
📄 post-author.php File 2734
Edit Download
📁 post-comments-form Folder -
📄 post-comments-form.php File 2805
Edit Download
📁 post-content Folder -
📄 post-content.php File 2156
Edit Download
📁 post-date Folder -
📄 post-date.php File 3124
Edit Download
📁 post-excerpt Folder -
📄 post-excerpt.php File 3447
Edit Download
📁 post-featured-image Folder -
📄 post-featured-image.php File 9363
Edit Download
📁 post-navigation-link Folder -
📄 post-navigation-link.php File 4837
Edit Download
📁 post-template Folder -
📄 post-template.php File 5749
Edit Download
📁 post-terms Folder -
📄 post-terms.php File 3640
Edit Download
📁 post-title Folder -
📄 post-title.php File 2138
Edit Download
📁 preformatted Folder -
📁 pullquote Folder -
📁 query Folder -
📁 query-no-results Folder -
📄 query-no-results.php File 1847
Edit Download
📁 query-pagination Folder -
📁 query-pagination-next Folder -
📄 query-pagination-next.php File 3787
Edit Download
📁 query-pagination-numbers Folder -
📄 query-pagination-numbers.php File 4770
Edit Download
📁 query-pagination-previous Folder -
📄 query-pagination-previous.php File 3584
Edit Download
📄 query-pagination.php File 1176
Edit Download
📁 query-title Folder -
📄 query-title.php File 2098
Edit Download
📁 query-total Folder -
📄 query-total.php File 2535
Edit Download
📄 query.php File 5690
Edit Download
📁 quote Folder -
📁 read-more Folder -
📄 read-more.php File 1830
Edit Download
📄 require-dynamic-blocks.php File 4163
Edit Download
📄 require-static-blocks.php File 501
Edit Download
📁 rss Folder -
📄 rss.php File 4073
Edit Download
📁 search Folder -
📄 search.php File 23016
Edit Download
📁 separator Folder -
📁 shortcode Folder -
📄 shortcode.php File 735
Edit Download
📁 site-logo Folder -
📄 site-logo.php File 6334
Edit Download
📁 site-tagline Folder -
📄 site-tagline.php File 1203
Edit Download
📁 site-title Folder -
📄 site-title.php File 1853
Edit Download
📁 social-link Folder -
📄 social-link.php File 65174
Edit Download
📁 social-links Folder -
📁 spacer Folder -
📁 table Folder -
📁 tag-cloud Folder -
📄 tag-cloud.php File 1590
Edit Download
📁 template-part Folder -
📄 template-part.php File 10154
Edit Download
📁 term-description Folder -
📄 term-description.php File 1336
Edit Download
📁 text-columns Folder -
📁 verse Folder -
📁 video Folder -
📁 widget-group Folder -
📄 widget-group.php File 2438
Edit Download

View File: media-text.php

<?php
/**
 * Server-side rendering of the `core/media-text` block.
 *
 * @package WordPress
 */

/**
 * Renders the `core/media-text` block on server.
 *
 * @since 6.6.0
 *
 * @param array  $attributes The block attributes.
 * @param string $content    The block rendered content.
 *
 * @return string Returns the Media & Text block markup, if useFeaturedImage is true.
 */
function render_block_core_media_text( $attributes, $content ) {
	if ( false === $attributes['useFeaturedImage'] ) {
		return $content;
	}

	if ( in_the_loop() ) {
		update_post_thumbnail_cache();
	}

	$current_featured_image = get_the_post_thumbnail_url();
	if ( ! $current_featured_image ) {
		return $content;
	}

	$has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition'];
	$image_fill         = isset( $attributes['imageFill'] ) && $attributes['imageFill'];
	$focal_point        = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%';
	$unique_id          = 'wp-block-media-text__media-' . wp_unique_id();

	$block_tag_processor = new WP_HTML_Tag_Processor( $content );
	$block_query         = array(
		'tag_name'   => 'div',
		'class_name' => 'wp-block-media-text',
	);

	while ( $block_tag_processor->next_tag( $block_query ) ) {
		if ( $image_fill ) {
			// The markup below does not work with the deprecated `is-image-fill` class.
			$block_tag_processor->remove_class( 'is-image-fill' );
			$block_tag_processor->add_class( 'is-image-fill-element' );
		}
	}

	$content = $block_tag_processor->get_updated_html();

	$media_tag_processor   = new WP_HTML_Tag_Processor( $content );
	$wrapping_figure_query = array(
		'tag_name'   => 'figure',
		'class_name' => 'wp-block-media-text__media',
	);

	if ( $has_media_on_right ) {
		// Loop through all the figure tags and set a bookmark on the last figure tag.
		while ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) {
			$media_tag_processor->set_bookmark( 'last_figure' );
		}
		if ( $media_tag_processor->has_bookmark( 'last_figure' ) ) {
			$media_tag_processor->seek( 'last_figure' );
			// Insert a unique ID to identify the figure tag.
			$media_tag_processor->set_attribute( 'id', $unique_id );
		}
	} else {
		if ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) {
			// Insert a unique ID to identify the figure tag.
			$media_tag_processor->set_attribute( 'id', $unique_id );
		}
	}

	$content = $media_tag_processor->get_updated_html();

	// Add the image tag inside the figure tag, and update the image attributes
	// in order to display the featured image.
	$media_size_slug = isset( $attributes['mediaSizeSlug'] ) ? $attributes['mediaSizeSlug'] : 'full';
	$image_tag       = '<img class="wp-block-media-text__featured_image">';
	$content         = preg_replace(
		'/(<figure\s+id="' . preg_quote( $unique_id, '/' ) . '"\s+class="wp-block-media-text__media"\s*>)/',
		'$1' . $image_tag,
		$content
	);

	$image_tag_processor = new WP_HTML_Tag_Processor( $content );
	if ( $image_tag_processor->next_tag(
		array(
			'tag_name' => 'figure',
			'id'       => $unique_id,
		)
	) ) {
		// The ID is only used to ensure that the correct figure tag is selected,
		// and can now be removed.
		$image_tag_processor->remove_attribute( 'id' );
		if ( $image_tag_processor->next_tag(
			array(
				'tag_name'   => 'img',
				'class_name' => 'wp-block-media-text__featured_image',
			)
		) ) {
			$image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) );
			$image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug );
			$image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) );
			if ( $image_fill ) {
				$image_tag_processor->set_attribute( 'style', 'object-position:' . $focal_point . ';' );
			}

			$content = $image_tag_processor->get_updated_html();
		}
	}

	return $content;
}

/**
 * Registers the `core/media-text` block renderer on server.
 *
 * @since 6.6.0
 */
function register_block_core_media_text() {
	register_block_type_from_metadata(
		__DIR__ . '/media-text',
		array(
			'render_callback' => 'render_block_core_media_text',
		)
	);
}
add_action( 'init', 'register_block_core_media_text' );