summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/widgets/gallery.php')
-rw-r--r--plugins/jetpack/modules/widgets/gallery.php33
1 files changed, 27 insertions, 6 deletions
diff --git a/plugins/jetpack/modules/widgets/gallery.php b/plugins/jetpack/modules/widgets/gallery.php
index 0b525c63..0ad87d40 100644
--- a/plugins/jetpack/modules/widgets/gallery.php
+++ b/plugins/jetpack/modules/widgets/gallery.php
@@ -23,12 +23,18 @@ class Jetpack_Gallery_Widget extends WP_Widget {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
- $this->WP_Widget( 'gallery', apply_filters( 'jetpack_widget_name', __( 'Gallery', 'jetpack' ) ), $widget_ops, $control_ops );
+ parent::__construct(
+ 'gallery',
+ /** This filter is documented in modules/widgets/facebook-likebox.php */
+ apply_filters( 'jetpack_widget_name', __( 'Gallery', 'jetpack' ) ),
+ $widget_ops,
+ $control_ops
+ );
}
/**
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
- * @param array $instance The settings for the particular instance of the widget
+ * @param array $instance The settings for the particular instance of the widget.
*/
public function widget( $args, $instance ) {
$instance = wp_parse_args( (array) $instance, $this->defaults() );
@@ -69,6 +75,7 @@ class Jetpack_Gallery_Widget extends WP_Widget {
echo $before_widget . "\n";
+ /** This filter is documented in core/src/wp-includes/default-widgets.php */
$title = apply_filters( 'widget_title', $instance['title'] );
if ( $title )
@@ -78,7 +85,17 @@ class Jetpack_Gallery_Widget extends WP_Widget {
$method = $instance['type'] . '_widget';
- // Allow the width of a gallery to be altered by themes or other code
+ /**
+ * Allow the width of a gallery to be altered by themes or other code.
+ *
+ * @module widgets
+ *
+ * @since 2.5.0
+ *
+ * @param int self::DEFAULT_WIDTH Default gallery width. Default is 265.
+ * @param string $args Display arguments including before_title, after_title, before_widget, and after_widget.
+ * @param array $instance The settings for the particular instance of the widget.
+ */
$this->_instance_width = apply_filters( 'gallery_widget_content_width', self::DEFAULT_WIDTH, $args, $instance );
// Register a filter to modify the tiled_gallery_content_width, so Jetpack_Tiled_Gallery
@@ -234,6 +251,7 @@ class Jetpack_Gallery_Widget extends WP_Widget {
$max_width = min( intval( $content_width ), $max_width );
$color = Jetpack_Options::get_option( 'slideshow_background_color', 'black' );
+ $autostart = isset( $attr['autostart'] ) ? $attr['autostart'] : true;
$js_attr = array(
'gallery' => $gallery,
@@ -242,6 +260,7 @@ class Jetpack_Gallery_Widget extends WP_Widget {
'height' => $max_height,
'trans' => 'fade',
'color' => $color,
+ 'autostart' => $autostart,
);
$html = $slideshow->slideshow_js( $js_attr );
@@ -366,9 +385,11 @@ class Jetpack_Gallery_Widget extends WP_Widget {
wp_enqueue_media();
wp_enqueue_script( 'gallery-widget-admin', plugins_url( '/gallery/js/admin.js', __FILE__ ), array(
- 'media-models',
- 'media-views'
- ) );
+ 'media-models',
+ 'media-views'
+ ),
+ '20150501'
+ );
$js_settings = array(
'thumbSize' => self::THUMB_SIZE