@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | require('helper.php'); |
| 41 | 41 | |
| 42 | 42 | add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') ); |
| 43 | -if ( is_multisite() ) |
|
| 43 | +if ( is_multisite() ) { |
|
| 44 | 44 | add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') ); |
| 45 | +} |
|
| 45 | 46 | |
| 46 | 47 | add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) ); |
| 47 | 48 | register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) ); |
@@ -129,8 +130,9 @@ discard block |
||
| 129 | 130 | public static function build_models() { |
| 130 | 131 | // Build Databases |
| 131 | 132 | \PodloveSubscribeButton\Model\Button::build(); |
| 132 | - if ( is_multisite() ) |
|
| 133 | - \PodloveSubscribeButton\Model\NetworkButton::build(); |
|
| 133 | + if ( is_multisite() ) { |
|
| 134 | + \PodloveSubscribeButton\Model\NetworkButton::build(); |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | // Set Button "default" values |
| 136 | 138 | $default_values = array( |
@@ -156,8 +158,9 @@ discard block |
||
| 156 | 158 | } |
| 157 | 159 | |
| 158 | 160 | // Fetch the (network)button by it's name |
| 159 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) |
|
| 160 | - return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 161 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) { |
|
| 162 | + return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 163 | + } |
|
| 161 | 164 | |
| 162 | 165 | // Get button styling and options |
| 163 | 166 | $autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') ); |
@@ -189,8 +192,9 @@ discard block |
||
| 189 | 192 | } |
| 190 | 193 | |
| 191 | 194 | public static function get_array_value_with_fallback($args, $key) { |
| 192 | - if ( isset($args[$key]) ) |
|
| 193 | - return $args[$key]; |
|
| 195 | + if ( isset($args[$key]) ) { |
|
| 196 | + return $args[$key]; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | return false; |
| 196 | 200 | } |
@@ -214,10 +218,12 @@ discard block |
||
| 214 | 218 | * @return string |
| 215 | 219 | */ |
| 216 | 220 | private static function interpret_width_attribute( $width_attribute = null ) { |
| 217 | - if ( $width_attribute == 'auto' ) |
|
| 218 | - return 'on'; |
|
| 219 | - if ( $width_attribute && $width_attribute !== 'auto' ) |
|
| 220 | - return 'off'; |
|
| 221 | + if ( $width_attribute == 'auto' ) { |
|
| 222 | + return 'on'; |
|
| 223 | + } |
|
| 224 | + if ( $width_attribute && $width_attribute !== 'auto' ) { |
|
| 225 | + return 'off'; |
|
| 226 | + } |
|
| 221 | 227 | |
| 222 | 228 | return get_option('podlove_subscribe_button_default_autowidth', 'on'); |
| 223 | 229 | } |