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:
@@ -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';
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class WP_Widget_Calendar extends WP_Widget {
|
||||
echo '</div>';
|
||||
echo $args['after_widget'];
|
||||
|
||||
self::$instance++;
|
||||
++self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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(); ?>
|
||||
<# } #>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 ) { #>
|
||||
|
||||
@@ -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 }}" />
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,5 +182,4 @@ class WP_Widget_Pages extends WP_Widget {
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,5 +91,4 @@ class WP_Widget_Search extends WP_Widget {
|
||||
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 “Custom HTML” 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 “Custom HTML” 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 “Custom HTML” widget. How about trying that widget instead?' );
|
||||
} else {
|
||||
$widget_info_message = __( 'This widget may have contained code that may work better in the “Custom HTML” 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>
|
||||
|
||||
Reference in New Issue
Block a user