GRAYBYTE WORDPRESS FILE MANAGER7709

Server IP : 68.65.123.43 / Your IP : 216.73.216.162
System : Linux server266.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
PHP Version : 8.0.30
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/inteuuod/ai.internsifyafrica.com/wp-includes/blocks/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/ai.internsifyafrica.com/wp-includes/blocks//gallery.php
<?php
/**
 * Server-side rendering of the `core/gallery` block.
 *
 * @package WordPress
 */

/**
 * Handles backwards compatibility for Gallery Blocks,
 * whose images feature a `data-id` attribute.
 *
 * Now that the Gallery Block contains inner Image Blocks,
 * we add a custom `data-id` attribute before rendering the gallery
 * so that the Image Block can pick it up in its render_callback.
 *
 * @param array $parsed_block The block being rendered.
 * @return array The migrated block object.
 */
function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
	if ( 'core/gallery' === $parsed_block['blockName'] ) {
		foreach ( $parsed_block['innerBlocks'] as $key => $inner_block ) {
			if ( 'core/image' === $inner_block['blockName'] ) {
				if ( ! isset( $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) && isset( $inner_block['attrs']['id'] ) ) {
					$parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] = esc_attr( $inner_block['attrs']['id'] );
				}
			}
		}
	}

	return $parsed_block;
}

add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );

/**
 * Renders the `core/gallery` block on the server.
 *
 * @param array  $attributes Attributes of the block being rendered.
 * @param string $content Content of the block being rendered.
 * @return string The content of the block being rendered.
 */
function block_core_gallery_render( $attributes, $content ) {
	// Adds a style tag for the --wp--style--unstable-gallery-gap var.
	// The Gallery block needs to recalculate Image block width based on
	// the current gap setting in order to maintain the number of flex columns
	// so a css var is added to allow this.

	$gap = $attributes['style']['spacing']['blockGap'] ?? null;
	// Skip if gap value contains unsupported characters.
	// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
	// because we only want to match against the value, not the CSS attribute.
	if ( is_array( $gap ) ) {
		foreach ( $gap as $key => $value ) {
			// Make sure $value is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
			$value = is_string( $value ) ? $value : '';
			$value = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value;

			// Get spacing CSS variable from preset value if provided.
			if ( is_string( $value ) && str_contains( $value, 'var:preset|spacing|' ) ) {
				$index_to_splice = strrpos( $value, '|' ) + 1;
				$slug            = _wp_to_kebab_case( substr( $value, $index_to_splice ) );
				$value           = "var(--wp--preset--spacing--$slug)";
			}

			$gap[ $key ] = $value;
		}
	} else {
		// Make sure $gap is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
		$gap = is_string( $gap ) ? $gap : '';
		$gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;

		// Get spacing CSS variable from preset value if provided.
		if ( is_string( $gap ) && str_contains( $gap, 'var:preset|spacing|' ) ) {
			$index_to_splice = strrpos( $gap, '|' ) + 1;
			$slug            = _wp_to_kebab_case( substr( $gap, $index_to_splice ) );
			$gap             = "var(--wp--preset--spacing--$slug)";
		}
	}

	$unique_gallery_classname = wp_unique_id( 'wp-block-gallery-' );
	$processed_content        = new WP_HTML_Tag_Processor( $content );
	$processed_content->next_tag();
	$processed_content->add_class( $unique_gallery_classname );

	// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
	// gap on the gallery.
	$fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
	$gap_value    = $gap ? $gap : $fallback_gap;
	$gap_column   = $gap_value;

	if ( is_array( $gap_value ) ) {
		$gap_row    = isset( $gap_value['top'] ) ? $gap_value['top'] : $fallback_gap;
		$gap_column = isset( $gap_value['left'] ) ? $gap_value['left'] : $fallback_gap;
		$gap_value  = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column;
	}

	// The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`.
	if ( '0' === $gap_column ) {
		$gap_column = '0px';
	}

	// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
	$gallery_styles = array(
		array(
			'selector'     => ".wp-block-gallery.{$unique_gallery_classname}",
			'declarations' => array(
				'--wp--style--unstable-gallery-gap' => $gap_column,
				'gap'                               => $gap_value,
			),
		),
	);

	wp_style_engine_get_stylesheet_from_css_rules(
		$gallery_styles,
		array(
			'context' => 'block-supports',
		)
	);

	// The WP_HTML_Tag_Processor class calls get_updated_html() internally
	// when the instance is treated as a string, but here we explicitly
	// convert it to a string.
	$updated_content = $processed_content->get_updated_html();

	/*
	 * Randomize the order of image blocks. Ideally we should shuffle
	 * the `$parsed_block['innerBlocks']` via the `render_block_data` hook.
	 * However, this hook doesn't apply inner block updates when blocks are
	 * nested.
	 * @todo: In the future, if this hook supports updating innerBlocks in
	 * nested blocks, it should be refactored.
	 *
	 * @see: https://github.com/WordPress/gutenberg/pull/58733
	 */
	if ( empty( $attributes['randomOrder'] ) ) {
		return $updated_content;
	}

	// This pattern matches figure elements with the `wp-block-image` class to
	// avoid the gallery's wrapping `figure` element and extract images only.
	$pattern = '/<figure[^>]*\bwp-block-image\b[^>]*>.*?<\/figure>/';

	// Find all Image blocks.
	preg_match_all( $pattern, $updated_content, $matches );
	if ( ! $matches ) {
		return $updated_content;
	}
	$image_blocks = $matches[0];

	// Randomize the order of Image blocks.
	shuffle( $image_blocks );
	$i       = 0;
	$content = preg_replace_callback(
		$pattern,
		static function () use ( $image_blocks, &$i ) {
			$new_image_block = $image_blocks[ $i ];
			++$i;
			return $new_image_block;
		},
		$updated_content
	);

	return $content;
}
/**
 * Registers the `core/gallery` block on server.
 */
function register_block_core_gallery() {
	register_block_type_from_metadata(
		__DIR__ . '/gallery',
		array(
			'render_callback' => 'block_core_gallery_render',
		)
	);
}

add_action( 'init', 'register_block_core_gallery' );

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 13 2025 02:32:20
inteuuod / inteuuod
0755
archives
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
audio
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
avatar
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
block
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
button
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
buttons
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
calendar
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
categories
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
code
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
column
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
columns
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-author-name
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-content
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-date
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-edit-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-reply-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comment-template
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments-pagination
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments-pagination-next
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments-pagination-numbers
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments-pagination-previous
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
comments-title
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
cover
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
details
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
embed
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
file
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
footnotes
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
freeform
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
gallery
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
group
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
heading
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
home-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
html
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
image
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
latest-comments
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
latest-posts
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
legacy-widget
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
list
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
list-item
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
loginout
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
media-text
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
missing
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
more
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
navigation
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
navigation-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
navigation-submenu
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
nextpage
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
page-list
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
page-list-item
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
paragraph
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
pattern
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-author
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-author-biography
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-author-name
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-comments-form
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-content
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-date
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-excerpt
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-featured-image
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-navigation-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-template
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-terms
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
post-title
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
preformatted
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
pullquote
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-no-results
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-pagination
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-pagination-next
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-pagination-numbers
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-pagination-previous
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
query-title
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
quote
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
read-more
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
rss
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
search
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
separator
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
shortcode
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
site-logo
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
site-tagline
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
site-title
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
social-link
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
social-links
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
spacer
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
table
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
tag-cloud
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
template-part
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
term-description
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
text-columns
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
verse
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
video
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
widget-group
--
July 11 2025 00:52:32
inteuuod / inteuuod
0755
.htaccess
0.124 KB
July 11 2025 00:52:32
inteuuod / inteuuod
0444
archives.php
2.887 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
avatar.php
5.511 KB
April 09 2024 20:33:28
inteuuod / inteuuod
0644
block.php
2.993 KB
March 05 2024 00:38:24
inteuuod / inteuuod
0644
blocks-json.php
167.852 KB
February 20 2024 21:46:26
inteuuod / inteuuod
0644
calendar.php
5.705 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
categories.php
2.811 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
comment-author-name.php
2.046 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comment-content.php
2.364 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comment-date.php
1.559 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comment-edit-link.php
1.636 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comment-reply-link.php
1.989 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comment-template.php
4.352 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
comments-pagination-next.php
1.811 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
comments-pagination-numbers.php
1.557 KB
April 13 2022 00:42:48
inteuuod / inteuuod
0644
comments-pagination-previous.php
1.607 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
comments-pagination.php
1.134 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
comments-title.php
2.67 KB
September 21 2022 01:13:30
inteuuod / inteuuod
0644
comments.php
6.469 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
cover.php
2.452 KB
June 28 2023 00:05:30
inteuuod / inteuuod
0644
file.php
2.405 KB
February 13 2024 23:42:18
inteuuod / inteuuod
0644
footnotes.php
3.683 KB
February 28 2024 01:18:24
inteuuod / inteuuod
0644
gallery.php
6.232 KB
February 10 2024 04:52:22
inteuuod / inteuuod
0644
heading.php
1.233 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
home-link.php
5.506 KB
February 10 2024 04:52:22
inteuuod / inteuuod
0644
image.php
10.536 KB
February 13 2024 23:42:18
inteuuod / inteuuod
0644
index.php
4.478 KB
October 30 2023 22:24:22
inteuuod / inteuuod
0644
latest-comments.php
4.885 KB
April 13 2022 00:42:48
inteuuod / inteuuod
0644
latest-posts.php
8.17 KB
October 10 2023 21:00:20
inteuuod / inteuuod
0644
legacy-widget.php
3.811 KB
October 18 2022 23:26:02
inteuuod / inteuuod
0644
loginout.php
1.348 KB
November 09 2021 00:59:22
inteuuod / inteuuod
0644
navigation-link.php
12.88 KB
February 20 2024 21:46:26
inteuuod / inteuuod
0644
navigation-submenu.php
8.814 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
navigation.php
57.238 KB
March 28 2024 18:01:20
inteuuod / inteuuod
0644
page-list-item.php
0.334 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
page-list.php
13.137 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
pattern.php
2.118 KB
January 31 2024 23:29:56
inteuuod / inteuuod
0644
post-author-biography.php
1.414 KB
April 13 2022 00:42:48
inteuuod / inteuuod
0644
post-author-name.php
1.705 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
post-author.php
2.507 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
post-comments-form.php
2.684 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
post-content.php
2.068 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
post-date.php
2.289 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
post-excerpt.php
3.329 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
post-featured-image.php
8.826 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
post-navigation-link.php
4.687 KB
February 10 2024 04:52:22
inteuuod / inteuuod
0644
post-template.php
5.521 KB
March 06 2024 00:29:18
inteuuod / inteuuod
0644
post-terms.php
3.549 KB
February 10 2024 04:52:22
inteuuod / inteuuod
0644
post-title.php
2.029 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
query-no-results.php
1.711 KB
September 26 2023 23:53:26
inteuuod / inteuuod
0644
query-pagination-next.php
3.6 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
query-pagination-numbers.php
4.565 KB
February 13 2024 23:42:18
inteuuod / inteuuod
0644
query-pagination-previous.php
3.056 KB
January 30 2024 07:37:12
inteuuod / inteuuod
0644
query-pagination.php
1.111 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
query-title.php
2.012 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
query.php
6.147 KB
February 13 2024 23:42:18
inteuuod / inteuuod
0644
read-more.php
1.75 KB
February 07 2023 23:30:10
inteuuod / inteuuod
0644
require-dynamic-blocks.php
3.852 KB
November 01 2023 00:44:06
inteuuod / inteuuod
0644
require-static-blocks.php
0.523 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
rss.php
3.834 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
search.php
22.791 KB
March 05 2024 00:38:24
inteuuod / inteuuod
0644
shortcode.php
0.681 KB
June 26 2020 23:03:48
inteuuod / inteuuod
0644
site-logo.php
5.794 KB
June 27 2023 23:54:20
inteuuod / inteuuod
0644
site-tagline.php
0.971 KB
June 22 2021 19:30:50
inteuuod / inteuuod
0644
site-title.php
1.729 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
social-link.php
62.158 KB
February 10 2024 04:52:22
inteuuod / inteuuod
0644
tag-cloud.php
1.37 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
template-part.php
9.715 KB
June 25 2024 00:45:18
inteuuod / inteuuod
0644
term-description.php
1.268 KB
February 07 2023 17:34:52
inteuuod / inteuuod
0644
widget-group.php
2.115 KB
October 18 2022 23:26:02
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF