Submit
Path:
F:
/
Inetpub
/
vhosts
/
solasmarine.com.tr
/
httpdocs
/
wp-includes
/
blocks
/
File Content:
calendar.php
<?php /** * Server-side rendering of the `core/calendar` block. * * @package WordPress */ /** * Renders the `core/calendar` block on server. * * @since 5.2.0 * * @global int $monthnum. * @global int $year. * * @param array $attributes The block attributes. * * @return string Returns the block content. */ function render_block_core_calendar( $attributes ) { global $monthnum, $year; // Calendar shouldn't be rendered // when there are no published posts on the site. if ( ! block_core_calendar_has_published_posts() ) { if ( is_user_logged_in() ) { return '<div>' . __( 'The calendar block is hidden because there are no published posts.' ) . '</div>'; } return ''; } $previous_monthnum = $monthnum; $previous_year = $year; if ( isset( $attributes['month'] ) && isset( $attributes['year'] ) ) { $permalink_structure = get_option( 'permalink_structure' ); if ( str_contains( $permalink_structure, '%monthnum%' ) && str_contains( $permalink_structure, '%year%' ) ) { $monthnum = $attributes['month']; $year = $attributes['year']; } } $color_block_styles = array(); // Text color. $preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null; $custom_text_color = $attributes['style']['color']['text'] ?? null; $color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color; // Background Color. $preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null; $custom_background_color = $attributes['style']['color']['background'] ?? null; $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color; // Generate color styles and classes. $styles = wp_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) ); $inline_styles = empty( $styles['css'] ) ? '' : sprintf( ' style="%s"', esc_attr( $styles['css'] ) ); $classnames = empty( $styles['classnames'] ) ? '' : ' ' . esc_attr( $styles['classnames'] ); if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) { $classnames .= ' has-link-color'; } // Apply color classes and styles to the calendar. $calendar = str_replace( '<table', '<table' . $inline_styles, get_calendar( true, false ) ); $calendar = str_replace( 'class="wp-calendar-table', 'class="wp-calendar-table' . $classnames, $calendar ); $wrapper_attributes = get_block_wrapper_attributes(); $output = sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $calendar ); $monthnum = $previous_monthnum; $year = $previous_year; return $output; } /** * Registers the `core/calendar` block on server. * * @since 5.2.0 */ function register_block_core_calendar() { register_block_type_from_metadata( __DIR__ . '/calendar', array( 'render_callback' => 'render_block_core_calendar', ) ); } add_action( 'init', 'register_block_core_calendar' ); /** * Returns whether or not there are any published posts. * * Used to hide the calendar block when there are no published posts. * This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016 * * @since 5.9.0 * * @return bool Has any published posts or not. */ function block_core_calendar_has_published_posts() { // Multisite already has an option that stores the count of the published posts. // Let's use that for multisites. if ( is_multisite() ) { return 0 < (int) get_option( 'post_count' ); } // On single sites we try our own cached option first. $has_published_posts = get_option( 'wp_calendar_block_has_published_posts', null ); if ( null !== $has_published_posts ) { return (bool) $has_published_posts; } // No cache hit, let's update the cache and return the cached value. return block_core_calendar_update_has_published_posts(); } /** * Queries the database for any published post and saves * a flag whether any published post exists or not. * * @since 5.9.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @return bool Has any published posts or not. */ function block_core_calendar_update_has_published_posts() { global $wpdb; $has_published_posts = (bool) $wpdb->get_var( "SELECT 1 as test FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" ); update_option( 'wp_calendar_block_has_published_posts', $has_published_posts ); return $has_published_posts; } // We only want to register these functions and actions when // we are on single sites. On multi sites we use `post_count` option. if ( ! is_multisite() ) { /** * Handler for updating the has published posts flag when a post is deleted. * * @since 5.9.0 * * @param int $post_id Deleted post ID. */ function block_core_calendar_update_has_published_post_on_delete( $post_id ) { $post = get_post( $post_id ); if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { return; } block_core_calendar_update_has_published_posts(); } /** * Handler for updating the has published posts flag when a post status changes. * * @since 5.9.0 * * @param string $new_status The status the post is changing to. * @param string $old_status The status the post is changing from. * @param WP_Post $post Post object. */ function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) { if ( $new_status === $old_status ) { return; } if ( 'post' !== get_post_type( $post ) ) { return; } if ( 'publish' !== $new_status && 'publish' !== $old_status ) { return; } block_core_calendar_update_has_published_posts(); } add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' ); add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 ); }
Edit
Rename
Chmod
Delete
FILE
DIR
INFO
CMD
Name
Size
Permission
Action
accordion
---
0777
accordion-heading
---
0777
accordion-item
---
0777
accordion-panel
---
0777
archives
---
0777
audio
---
0777
avatar
---
0777
block
---
0777
breadcrumbs
---
0777
button
---
0777
buttons
---
0777
calendar
---
0777
categories
---
0777
code
---
0777
column
---
0777
columns
---
0777
comment-author-name
---
0777
comment-content
---
0777
comment-date
---
0777
comment-edit-link
---
0777
comment-reply-link
---
0777
comment-template
---
0777
comments
---
0777
comments-pagination
---
0777
comments-pagination-next
---
0777
comments-pagination-numbers
---
0777
comments-pagination-previous
---
0777
comments-title
---
0777
cover
---
0777
details
---
0777
embed
---
0777
file
---
0777
footnotes
---
0777
freeform
---
0777
gallery
---
0777
group
---
0777
heading
---
0777
home-link
---
0777
html
---
0777
icon
---
0777
image
---
0777
latest-comments
---
0777
latest-posts
---
0777
legacy-widget
---
0777
list
---
0777
list-item
---
0777
loginout
---
0777
math
---
0777
media-text
---
0777
missing
---
0777
more
---
0777
navigation
---
0777
navigation-link
---
0777
navigation-overlay-close
---
0777
navigation-submenu
---
0777
nextpage
---
0777
page-list
---
0777
page-list-item
---
0777
paragraph
---
0777
pattern
---
0777
post-author
---
0777
post-author-biography
---
0777
post-author-name
---
0777
post-comments-count
---
0777
post-comments-form
---
0777
post-comments-link
---
0777
post-content
---
0777
post-date
---
0777
post-excerpt
---
0777
post-featured-image
---
0777
post-navigation-link
---
0777
post-template
---
0777
post-terms
---
0777
post-time-to-read
---
0777
post-title
---
0777
preformatted
---
0777
pullquote
---
0777
query
---
0777
query-no-results
---
0777
query-pagination
---
0777
query-pagination-next
---
0777
query-pagination-numbers
---
0777
query-pagination-previous
---
0777
query-title
---
0777
query-total
---
0777
quote
---
0777
read-more
---
0777
rss
---
0777
search
---
0777
separator
---
0777
shortcode
---
0777
site-logo
---
0777
site-tagline
---
0777
site-title
---
0777
social-link
---
0777
social-links
---
0777
spacer
---
0777
table
---
0777
tag-cloud
---
0777
template-part
---
0777
term-count
---
0777
term-description
---
0777
term-name
---
0777
term-template
---
0777
terms-query
---
0777
text-columns
---
0777
verse
---
0777
video
---
0777
widget-group
---
0777
accordion-item.php
3041bytes
0666
accordion.php
1147bytes
0666
archives.php
4385bytes
0666
avatar.php
5634bytes
0666
block.php
4186bytes
0666
blocks-json.php
199123bytes
0666
breadcrumbs.php
19057bytes
0666
button.php
1752bytes
0666
calendar.php
6075bytes
0666
categories.php
4938bytes
0666
comment-author-name.php
2133bytes
0666
comment-content.php
2459bytes
0666
comment-date.php
1863bytes
0666
comment-edit-link.php
1713bytes
0666
comment-reply-link.php
2075bytes
0666
comment-template.php
4494bytes
0666
comments-pagination-next.php
1924bytes
0666
comments-pagination-numbers.php
1632bytes
0666
comments-pagination-previous.php
1790bytes
0666
comments-pagination.php
1261bytes
0666
comments-title.php
2787bytes
0666
comments.php
6784bytes
0666
cover.php
7422bytes
0666
details.php
1498bytes
0666
file.php
1879bytes
0666
footnotes.php
3818bytes
0666
gallery.php
9067bytes
0666
heading.php
1301bytes
0666
home-link.php
5438bytes
0666
icon.php
4139bytes
0666
image.php
17661bytes
0666
index.php
5111bytes
0666
latest-comments.php
5488bytes
0666
latest-posts.php
8843bytes
0666
legacy-widget.php
4011bytes
0666
list.php
1273bytes
0666
loginout.php
1664bytes
0666
media-text.php
4298bytes
0666
navigation-link.php
16221bytes
0666
navigation-overlay-close.php
1765bytes
0666
navigation-submenu.php
11744bytes
0666
navigation.php
64817bytes
0666
page-list-item.php
361bytes
0666
page-list.php
15069bytes
0666
paragraph.php
1139bytes
0666
pattern.php
1788bytes
0666
post-author-biography.php
1524bytes
0666
post-author-name.php
1951bytes
0666
post-author.php
2734bytes
0666
post-comments-count.php
1275bytes
0666
post-comments-form.php
2805bytes
0666
post-comments-link.php
2237bytes
0666
post-content.php
2347bytes
0666
post-date.php
3655bytes
0666
post-excerpt.php
4315bytes
0666
post-featured-image.php
9248bytes
0666
post-navigation-link.php
4807bytes
0666
post-template.php
5687bytes
0666
post-terms.php
3640bytes
0666
post-time-to-read.php
6411bytes
0666
post-title.php
2138bytes
0666
query-no-results.php
1847bytes
0666
query-pagination-next.php
3676bytes
0666
query-pagination-numbers.php
4700bytes
0666
query-pagination-previous.php
3473bytes
0666
query-pagination.php
1176bytes
0666
query-title.php
2771bytes
0666
query-total.php
2471bytes
0666
query.php
5690bytes
0666
read-more.php
1830bytes
0666
require-dynamic-blocks.php
4978bytes
0666
require-static-blocks.php
520bytes
0666
rss.php
4609bytes
0666
search.php
23817bytes
0666
shortcode.php
735bytes
0666
site-logo.php
6334bytes
0666
site-tagline.php
1203bytes
0666
site-title.php
1864bytes
0666
social-link.php
67602bytes
0666
tag-cloud.php
1590bytes
0666
template-part.php
10446bytes
0666
term-count.php
1843bytes
0666
term-description.php
1770bytes
0666
term-name.php
2038bytes
0666
term-template.php
4518bytes
0666
video.php
2733bytes
0666
widget-group.php
2438bytes
0666