@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function widget( $args, $instance ) { |
| 28 | 28 | // Fetch the (network)button by it's name |
| 29 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) ) |
|
| 30 | - return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 29 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) ) { |
|
| 30 | + return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | echo $args['before_widget']; |
| 33 | 34 | echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title']; |
@@ -40,8 +41,9 @@ discard block |
||
| 40 | 41 | \PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color') |
| 41 | 42 | ); |
| 42 | 43 | |
| 43 | - if ( strlen($instance['infotext']) ) |
|
| 44 | - echo wpautop($instance['infotext']); |
|
| 44 | + if ( strlen($instance['infotext']) ) { |
|
| 45 | + echo wpautop($instance['infotext']); |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | echo $args['after_widget']; |
| 47 | 49 | } |
@@ -52,8 +54,9 @@ discard block |
||
| 52 | 54 | } |
| 53 | 55 | |
| 54 | 56 | $buttons = \PodloveSubscribeButton\Model\Button::all(); |
| 55 | - if ( is_multisite() ) |
|
| 56 | - $network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all(); |
|
| 57 | + if ( is_multisite() ) { |
|
| 58 | + $network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all(); |
|
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | $buttons_as_options = function ($buttons) { |
| 59 | 62 | foreach ($buttons as $subscribebutton) { |
@@ -86,8 +89,10 @@ discard block |
||
| 86 | 89 | <optgroup label="<?php _e('Network', 'podlove-subscribe-button' ); ?>"> |
| 87 | 90 | <?php $buttons_as_options($network_buttons); ?> |
| 88 | 91 | </optgroup> |
| 89 | - <?php else : |
|
| 92 | + <?php else { |
|
| 93 | + : |
|
| 90 | 94 | $buttons_as_options($buttons); |
| 95 | +} |
|
| 91 | 96 | endif; ?> |
| 92 | 97 | </select> |
| 93 | 98 | |
@@ -139,6 +144,6 @@ discard block |
||
| 139 | 144 | return $instance; |
| 140 | 145 | } |
| 141 | 146 | } |
| 142 | -add_action( 'widgets_init', function(){ |
|
| 147 | +add_action( 'widgets_init', function() { |
|
| 143 | 148 | register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' ); |
| 144 | 149 | }); |
| 145 | 150 | \ No newline at end of file |