summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/widgets/flickr.php')
-rw-r--r--plugins/jetpack/modules/widgets/flickr.php30
1 files changed, 14 insertions, 16 deletions
diff --git a/plugins/jetpack/modules/widgets/flickr.php b/plugins/jetpack/modules/widgets/flickr.php
index 9fb80962..36b524da 100644
--- a/plugins/jetpack/modules/widgets/flickr.php
+++ b/plugins/jetpack/modules/widgets/flickr.php
@@ -1,4 +1,4 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Disable direct access/execution to/of the widget code.
*/
@@ -16,7 +16,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
/**
* Constructor.
*/
- function __construct() {
+ public function __construct() {
parent::__construct(
'flickr',
/** This filter is documented in modules/widgets/facebook-likebox.php */
@@ -36,7 +36,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
/**
* Enqueue style.
*/
- function enqueue_style() {
+ public function enqueue_style() {
wp_enqueue_style( 'flickr-widget-style', plugins_url( 'flickr/style.css', __FILE__ ), array(), '20170405' );
}
@@ -66,10 +66,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
public function widget( $args, $instance ) {
$instance = wp_parse_args( $instance, $this->defaults() );
- $image_size_string = 'small' == $instance['flickr_image_size'] ? '_m.jpg' : '_t.jpg';
-
if ( ! empty( $instance['flickr_rss_url'] ) ) {
-
/*
* Parse the URL, and rebuild a URL that's sure to display images.
* Some Flickr Feeds do not display images by default.
@@ -105,7 +102,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
);
}
}
- } // End if().
+ }
// Still no RSS feed URL? Get a default feed from Flickr to grab interesting photos.
if ( empty( $rss_url ) ) {
@@ -143,10 +140,10 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
$photos = Jetpack_Photon::filter_the_content( $photos );
}
- $flickr_home = $rss->get_link();
+ $flickr_home = $rss->get_link(); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Used in flickr/widget.php template file.
}
- echo $args['before_widget'];
+ echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( empty( $photos ) ) {
if ( current_user_can( 'edit_theme_options' ) ) {
printf(
@@ -157,9 +154,9 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
}
} else {
echo $args['before_title'] . $instance['title'] . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- require( dirname( __FILE__ ) . '/flickr/widget.php' );
+ require __DIR__ . '/flickr/widget.php';
}
- echo $args['after_widget'];
+ echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/** This action is already documented in modules/widgets/gravatar-profile.php */
do_action( 'jetpack_stats_extra', 'widget_view', 'flickr' );
}
@@ -171,7 +168,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
*/
public function form( $instance ) {
$instance = wp_parse_args( $instance, $this->defaults() );
- require( dirname( __FILE__ ) . '/flickr/form.php' );
+ require __DIR__ . '/flickr/form.php';
}
/**
@@ -181,9 +178,8 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
* @param array $old_instance Previously saved values from database.
* @return array Updated safe values to be saved.
*/
- public function update( $new_instance, $old_instance ) {
+ public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$instance = array();
- $defaults = $this->defaults();
if ( isset( $new_instance['title'] ) ) {
$instance['title'] = wp_kses( $new_instance['title'], array() );
@@ -199,7 +195,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
if (
isset( $new_instance['flickr_image_size'] ) &&
- in_array( $new_instance['flickr_image_size'], array( 'thumbnail', 'small', 'large' ) )
+ in_array( $new_instance['flickr_image_size'], array( 'thumbnail', 'small', 'large' ), true )
) {
$instance['flickr_image_size'] = $new_instance['flickr_image_size'];
} else {
@@ -218,7 +214,9 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
}
}
- // Register Jetpack_Flickr_Widget widget.
+ /**
+ * Register Jetpack_Flickr_Widget widget.
+ */
function jetpack_register_flickr_widget() {
register_widget( 'Jetpack_Flickr_Widget' );
}