| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Disable direct access/execution to/of the widget code. |
| 4 | 4 | */ |
| 5 | 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | - exit; | |
| 6 | + exit( 0 ); | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. |
| 10 | 10 | |
| @@ -33,12 +33,8 @@ | ||
| 33 | 33 | 'customize_selective_refresh' => true, |
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - if ( is_active_widget( false, false, $this->id_base ) || is_active_widget( false, false, 'monster' ) || is_customize_preview() ) { | |
| 38 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ) ); | |
| 39 | - } | |
| 40 | - | |
| 41 | 37 | add_action( 'publish_post', array( __CLASS__, 'flush_cache' ) ); |
| 42 | 38 | add_action( 'deleted_post', array( __CLASS__, 'flush_cache' ) ); |
| 43 | 39 | add_action( 'switch_theme', array( __CLASS__, 'flush_cache' ) ); |
| 44 | 40 | } |
| @@ -67,8 +63,11 @@ | ||
| 67 | 63 | * @param array $args Display arguments. |
| 68 | 64 | * @param array $instance Widget settings for the instance. |
| 69 | 65 | */ |
| 70 | 66 | public function widget( $args, $instance ) { |
| 67 | + // Enqueue front end assets. | |
| 68 | + $this->enqueue_style(); | |
| 69 | + | |
| 71 | 70 | $cache_bucket = is_ssl() ? 'widget_authors_ssl' : 'widget_authors'; |
| 72 | 71 | |
| 73 | 72 | if ( '%BEG_OF_TITLE%' !== $args['before_title'] ) { |
| 74 | 73 | $output = wp_cache_get( $cache_bucket, 'widget' ); |
| @@ -226,8 +225,9 @@ | ||
| 226 | 225 | /** |
| 227 | 226 | * Outputs the widget settings form. |
| 228 | 227 | * |
| 229 | 228 | * @param array $instance Current settings. |
| 229 | + * @return string|void | |
| 230 | 230 | */ |
| 231 | 231 | public function form( $instance ) { |
| 232 | 232 | $instance = wp_parse_args( |
| 233 | 233 | $instance, |
| @@ -289,9 +289,9 @@ | ||
| 289 | 289 | * @return array |
| 290 | 290 | */ |
| 291 | 291 | public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 292 | 292 | $new_instance['title'] = wp_strip_all_tags( $new_instance['title'] ); |
| 293 | - $new_instance['all'] = isset( $new_instance['all'] ); | |
| 293 | + $new_instance['all'] = isset( $new_instance['all'] ) ? (bool) $new_instance['all'] : false; | |
| 294 | 294 | $new_instance['number'] = (int) $new_instance['number']; |
| 295 | 295 | $new_instance['avatar_size'] = (int) $new_instance['avatar_size']; |
| 296 | 296 | |
| 297 | 297 | self::flush_cache(); |