Merged in feature/81-dev-dev01 (pull request #5)

auto-patch  81-dev-dev01-2023-12-05T22_45_26

* auto-patch  81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
Tony Volpe
2023-12-05 23:05:59 +00:00
parent ba16964e7a
commit 725d3043d5
1463 changed files with 142461 additions and 89421 deletions

View File

@@ -100,8 +100,6 @@ class WP_Widget_Archives extends WP_Widget {
$label = __( 'Select Post' );
break;
}
$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
?>
<option value=""><?php echo esc_html( $label ); ?></option>
@@ -109,8 +107,8 @@ class WP_Widget_Archives extends WP_Widget {
</select>
<script<?php echo $type_attr; ?>>
/* <![CDATA[ */
<?php ob_start(); ?>
<script>
(function() {
var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
function onSelectChange() {
@@ -120,9 +118,9 @@ class WP_Widget_Archives extends WP_Widget {
}
dropdown.onchange = onSelectChange;
})();
/* ]]> */
</script>
<?php
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
} else {
$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';

View File

@@ -66,7 +66,7 @@ class WP_Widget_Calendar extends WP_Widget {
echo '</div>';
echo $args['after_widget'];
self::$instance++;
++self::$instance;
}
/**

View File

@@ -92,11 +92,10 @@ class WP_Widget_Categories extends WP_Widget {
echo '</form>';
$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
ob_start();
?>
<script<?php echo $type_attr; ?>>
/* <![CDATA[ */
<script>
(function() {
var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );
function onCatChange() {
@@ -106,10 +105,10 @@ class WP_Widget_Categories extends WP_Widget {
}
dropdown.onchange = onCatChange;
})();
/* ]]> */
</script>
<?php
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
} else {
$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
@@ -203,5 +202,4 @@ class WP_Widget_Categories extends WP_Widget {
</p>
<?php
}
}

View File

@@ -189,13 +189,25 @@ class WP_Widget_Media_Audio extends WP_Widget_Media {
?>
<script type="text/html" id="tmpl-wp-media-widget-audio-preview">
<# if ( data.error && 'missing_attachment' === data.error ) { #>
<div class="notice notice-error notice-alt notice-missing-attachment">
<p><?php echo $this->l10n['missing_attachment']; ?></p>
</div>
<?php
wp_admin_notice(
$this->l10n['missing_attachment'],
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ),
)
);
?>
<# } else if ( data.error ) { #>
<div class="notice notice-error notice-alt">
<p><?php _e( 'Unable to preview media due to an unknown error.' ); ?></p>
</div>
<?php
wp_admin_notice(
__( 'Unable to preview media due to an unknown error.' ),
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt' ),
)
);
?>
<# } else if ( data.model && data.model.src ) { #>
<?php wp_underscore_audio_template(); ?>
<# } #>

View File

@@ -248,6 +248,8 @@ class WP_Widget_Media_Gallery extends WP_Widget_Media {
protected function has_content( $instance ) {
if ( ! empty( $instance['ids'] ) ) {
$attachments = wp_parse_id_list( $instance['ids'] );
// Prime attachment post caches.
_prime_post_caches( $attachments, false, false );
foreach ( $attachments as $attachment ) {
if ( 'attachment' !== get_post_type( $attachment ) ) {
return false;

View File

@@ -240,12 +240,11 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
}
$attr = array(
'class' => $classes,
'src' => $instance['url'],
'alt' => $instance['alt'],
'width' => $instance['width'],
'height' => $instance['height'],
'decoding' => 'async',
'class' => $classes,
'src' => $instance['url'],
'alt' => $instance['alt'],
'width' => $instance['width'],
'height' => $instance['height'],
);
$loading_optimization_attr = wp_get_loading_optimization_attributes(
@@ -363,13 +362,25 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
</script>
<script type="text/html" id="tmpl-wp-media-widget-image-preview">
<# if ( data.error && 'missing_attachment' === data.error ) { #>
<div class="notice notice-error notice-alt notice-missing-attachment">
<p><?php echo $this->l10n['missing_attachment']; ?></p>
</div>
<?php
wp_admin_notice(
$this->l10n['missing_attachment'],
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ),
)
);
?>
<# } else if ( data.error ) { #>
<div class="notice notice-error notice-alt">
<p><?php _e( 'Unable to preview media due to an unknown error.' ); ?></p>
</div>
<?php
wp_admin_notice(
__( 'Unable to preview media due to an unknown error.' ),
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt' ),
)
);
?>
<# } else if ( data.url ) { #>
<img class="attachment-thumb" src="{{ data.url }}" draggable="false" alt="{{ data.alt }}"
<# if ( ! data.alt && data.currentFilename ) { #>

View File

@@ -228,17 +228,35 @@ class WP_Widget_Media_Video extends WP_Widget_Media {
?>
<script type="text/html" id="tmpl-wp-media-widget-video-preview">
<# if ( data.error && 'missing_attachment' === data.error ) { #>
<div class="notice notice-error notice-alt notice-missing-attachment">
<p><?php echo $this->l10n['missing_attachment']; ?></p>
</div>
<?php
wp_admin_notice(
$this->l10n['missing_attachment'],
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ),
)
);
?>
<# } else if ( data.error && 'unsupported_file_type' === data.error ) { #>
<div class="notice notice-error notice-alt notice-missing-attachment">
<p><?php echo $this->l10n['unsupported_file_type']; ?></p>
</div>
<?php
wp_admin_notice(
$this->l10n['unsupported_file_type'],
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'notice-missing-attachment' ),
)
);
?>
<# } else if ( data.error ) { #>
<div class="notice notice-error notice-alt">
<p><?php _e( 'Unable to preview media due to an unknown error.' ); ?></p>
</div>
<?php
wp_admin_notice(
__( 'Unable to preview media due to an unknown error.' ),
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt' ),
)
);
?>
<# } else if ( data.is_oembed && data.model.poster ) { #>
<a href="{{ data.model.src }}" target="_blank" class="media-widget-video-link">
<img src="{{ data.model.poster }}" />

View File

@@ -373,7 +373,7 @@ abstract class WP_Widget_Media extends WP_Widget {
$use_count = 0;
foreach ( $this->get_settings() as $instance ) {
if ( isset( $instance['attachment_id'] ) && $instance['attachment_id'] === $post->ID ) {
$use_count++;
++$use_count;
}
}

View File

@@ -182,5 +182,4 @@ class WP_Widget_Pages extends WP_Widget {
</p>
<?php
}
}

View File

@@ -91,5 +91,4 @@ class WP_Widget_Search extends WP_Widget {
$instance['title'] = sanitize_text_field( $new_instance['title'] );
return $instance;
}
}

View File

@@ -495,13 +495,21 @@ class WP_Widget_Text extends WP_Widget {
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<div class="notice inline notice-info notice-alt">
<?php if ( ! isset( $instance['visual'] ) ) : ?>
<p><?php _e( 'This widget may contain code that may work better in the &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
<?php else : ?>
<p><?php _e( 'This widget may have contained code that may work better in the &#8220;Custom HTML&#8221; widget. If you have not yet, how about trying that widget instead?' ); ?></p>
<?php endif; ?>
</div>
<?php
if ( ! isset( $instance['visual'] ) ) {
$widget_info_message = __( 'This widget may contain code that may work better in the &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' );
} else {
$widget_info_message = __( 'This widget may have contained code that may work better in the &#8220;Custom HTML&#8221; widget. If you have not yet, how about trying that widget instead?' );
}
wp_admin_notice(
$widget_info_message,
array(
'type' => 'info',
'additional_classes' => array( 'notice-alt', 'inline' ),
)
);
?>
<p>
<label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>"><?php echo esc_textarea( $instance['text'] ); ?></textarea>