GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( c84114...9a61a5 )
by Eric
04:21
created
podlove.php 2 patches
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 require('helper.php');
40 40
 
41 41
 add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
42
-if ( is_multisite() )
42
+if ( is_multisite() ) {
43 43
 	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
44
+}
44 45
 
45 46
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
46 47
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
 	public static function build_models() {
122 123
 		// Build Databases
123 124
 		\PodloveSubscribeButton\Model\Button::build();
124
-		if ( is_multisite() )
125
-			\PodloveSubscribeButton\Model\NetworkButton::build();
125
+		if ( is_multisite() ) {
126
+					\PodloveSubscribeButton\Model\NetworkButton::build();
127
+		}
126 128
 
127 129
 		// Set Button "default" values
128 130
 		$default_values = array(
@@ -148,8 +150,9 @@  discard block
 block discarded – undo
148 150
 		}
149 151
 
150 152
 		// Fetch the (network)button by it's name
151
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
152
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
153
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) {
154
+					return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
155
+		}
153 156
 
154 157
 		// Get button styling and options
155 158
 		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
@@ -181,8 +184,9 @@  discard block
 block discarded – undo
181 184
 	}
182 185
 
183 186
 	public static function get_array_value_with_fallback($args, $key) {
184
-		if ( isset($args[$key]) )
185
-			return $args[$key];
187
+		if ( isset($args[$key]) ) {
188
+					return $args[$key];
189
+		}
186 190
 
187 191
 		return false;
188 192
 	}
@@ -206,10 +210,12 @@  discard block
 block discarded – undo
206 210
 	 * @return string
207 211
 	 */
208 212
 	private static function interpret_width_attribute( $width_attribute = null ) {
209
-		if ( $width_attribute == 'auto' )
210
-			return 'on';
211
-		if ( $width_attribute && $width_attribute !== 'auto' )
212
-			return 'off';
213
+		if ( $width_attribute == 'auto' ) {
214
+					return 'on';
215
+		}
216
+		if ( $width_attribute && $width_attribute !== 'auto' ) {
217
+					return 'off';
218
+		}
213 219
 
214 220
 		return get_option('podlove_subscribe_button_default_autowidth', 'on');
215 221
 	}
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -22,32 +22,32 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 // Constants
25
-require('constants.php');
26
-require('settings/buttons.php');
25
+require( 'constants.php' );
26
+require( 'settings/buttons.php' );
27 27
 // Models
28
-require('model/base.php');
29
-require('model/button.php');
30
-require('model/network_button.php');
28
+require( 'model/base.php' );
29
+require( 'model/button.php' );
30
+require( 'model/network_button.php' );
31 31
 // Table
32
-require('settings/buttons_list_table.php');
32
+require( 'settings/buttons_list_table.php' );
33 33
 // Media Types
34
-require('media_types.php');
34
+require( 'media_types.php' );
35 35
 // Widget
36
-require('widget.php');
36
+require( 'widget.php' );
37 37
 // Version control
38
-require('version.php');
38
+require( 'version.php' );
39 39
 // Helper functions
40
-require('helper.php');
40
+require( 'helper.php' );
41 41
 
42
-add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
42
+add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu' ) );
43 43
 if ( is_multisite() )
44
-	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
44
+	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu' ) );
45 45
 
46 46
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
47 47
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
48 48
 
49 49
 // Register Settings
50
-add_action( 'admin_init', function () {
50
+add_action( 'admin_init', function() {
51 51
 	$settings = array( 'size', 'autowidth', 'style', 'format', 'color' );
52 52
 
53 53
 	foreach ( $settings as $setting ) {
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 
65 65
 add_shortcode( 'podlove-subscribe-button', array( 'PodloveSubscribeButton', 'shortcode' ) );
66 66
 
67
-add_action( 'plugins_loaded', function () {
68
-	load_plugin_textdomain( 'podlove-subscribe-button', false, dirname(plugin_basename( __FILE__)) . '/languages/');
67
+add_action( 'plugins_loaded', function() {
68
+	load_plugin_textdomain( 'podlove-subscribe-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
69 69
 } );
70 70
 
71 71
 PodloveSubscribeButton::run();
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$pages = array( 'settings_page_podlove-subscribe-button', 'widgets.php' );
83 83
 
84
-		if ( ! in_array( $hook, $pages )  ) {
84
+		if ( ! in_array( $hook, $pages ) ) {
85 85
 			return;
86 86
 		}
87 87
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 				'Podlove Subscribe Button',
108 108
 				'manage_options',
109 109
 				'podlove-subscribe-button',
110
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
110
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
111 111
 			);
112 112
 	}
113 113
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				'Podlove Subscribe Button',
119 119
 				'manage_options',
120 120
 				'podlove-subscribe-button',
121
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
121
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
122 122
 			);
123 123
 	}
124 124
 
@@ -137,56 +137,56 @@  discard block
 block discarded – undo
137 137
 				'format' => 'rectangle'
138 138
 			);
139 139
 
140
-		foreach ($default_values as $option => $default_value) {
141
-			if ( ! get_option('podlove_subscribe_button_default_' . $option ) ) {
142
-				update_option('podlove_subscribe_button_default_' . $option, $default_value);
140
+		foreach ( $default_values as $option => $default_value ) {
141
+			if ( ! get_option( 'podlove_subscribe_button_default_' . $option ) ) {
142
+				update_option( 'podlove_subscribe_button_default_' . $option, $default_value );
143 143
 			}
144 144
 		}
145 145
 	}
146 146
 
147 147
 	public static function shortcode( $args ) {
148
-		if ( ! $args || ! isset($args['button']) ) {
149
-			return __('You need to create a Button first and provide its ID.', 'podlove-subscribe-button');
148
+		if ( ! $args || ! isset( $args[ 'button' ] ) ) {
149
+			return __( 'You need to create a Button first and provide its ID.', 'podlove-subscribe-button' );
150 150
 		} else {
151
-			$buttonid = $args['button'];
151
+			$buttonid = $args[ 'button' ];
152 152
 		}
153 153
 
154 154
 		// Fetch the (network)button by it's name
155
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
156
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
155
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) )
156
+			return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] );
157 157
 
158 158
 		// Get button styling and options
159
-		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
160
-		$size = self::get_attribute( 'size', self::get_array_value_with_fallback($args, 'size') );
161
-		$style = self::get_attribute( 'style', self::get_array_value_with_fallback($args, 'style') );
162
-		$format = self::get_attribute( 'format', self::get_array_value_with_fallback($args, 'format') );
163
-		$color = self::get_attribute( 'color', self::get_array_value_with_fallback($args, 'color') );
164
-
165
-		if ( isset($args['language']) ) {
166
-			$language = $args['language'];
159
+		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback( $args, 'width' ) );
160
+		$size = self::get_attribute( 'size', self::get_array_value_with_fallback( $args, 'size' ) );
161
+		$style = self::get_attribute( 'style', self::get_array_value_with_fallback( $args, 'style' ) );
162
+		$format = self::get_attribute( 'format', self::get_array_value_with_fallback( $args, 'format' ) );
163
+		$color = self::get_attribute( 'color', self::get_array_value_with_fallback( $args, 'color' ) );
164
+
165
+		if ( isset( $args[ 'language' ] ) ) {
166
+			$language = $args[ 'language' ];
167 167
 		} else {
168 168
 			$language = 'en';
169 169
 		}
170 170
 
171
-		if ( isset($args['color']) ) {
172
-			$color = $args['color'];
171
+		if ( isset( $args[ 'color' ] ) ) {
172
+			$color = $args[ 'color' ];
173 173
 		} else {
174
-			$color = get_option('podlove_subscribe_button_default_color', '#599677');
174
+			$color = get_option( 'podlove_subscribe_button_default_color', '#599677' );
175 175
 		}
176 176
 
177
-		if ( isset($args['hide']) && $args['hide'] == 'true' ) {
177
+		if ( isset( $args[ 'hide' ] ) && $args[ 'hide' ] == 'true' ) {
178 178
 			$hide = true;
179 179
 		} else {
180 180
 			$hide = false;
181 181
 		}
182 182
 
183 183
 		// Render button
184
-		return $button->render($size, $autowidth, $style, $format, $color, $hide, $buttonid, $language);
184
+		return $button->render( $size, $autowidth, $style, $format, $color, $hide, $buttonid, $language );
185 185
 	}
186 186
 
187
-	public static function get_array_value_with_fallback($args, $key) {
188
-		if ( isset($args[$key]) )
189
-			return $args[$key];
187
+	public static function get_array_value_with_fallback( $args, $key ) {
188
+		if ( isset( $args[ $key ] ) )
189
+			return $args[ $key ];
190 190
 
191 191
 		return false;
192 192
 	}
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 * @param  string $attribute_value
197 197
 	 * @return string
198 198
 	 */
199
-	private static function get_attribute($attribute=null, $attribute_value=null) {
200
-		if ( isset($attribute_value) && ctype_alnum($attribute_value) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
199
+	private static function get_attribute( $attribute = null, $attribute_value = null ) {
200
+		if ( isset( $attribute_value ) && ctype_alnum( $attribute_value ) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
201 201
 			return $attribute_value;
202 202
 		} else {
203
-			return get_option('podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[$attribute]);
203
+			return get_option( 'podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[ $attribute ] );
204 204
 		}
205 205
 	}
206 206
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		if ( $width_attribute && $width_attribute !== 'auto' )
216 216
 			return 'off';
217 217
 
218
-		return get_option('podlove_subscribe_button_default_autowidth', 'on');
218
+		return get_option( 'podlove_subscribe_button_default_autowidth', 'on' );
219 219
 	}
220 220
 
221 221
 	public static function sanitize_settings( $input = null ) {
Please login to merge, or discard this patch.
widget.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
 	public function form( $instance ) {
50 50
 
51
-        $title     = isset( $instance[ 'title' ] )     ? $instance[ 'title' ]     : '';
52
-        $button = isset( $instance[ 'button' ] )    ? $instance[ 'button' ]    : '';
53
-        $size      = isset( $instance[ 'size' ] )      ? $instance[ 'size' ]      : 'big';
54
-        $style     = isset( $instance[ 'style' ] )     ? $instance[ 'style' ]     : 'filled';
55
-        $format    = isset( $instance[ 'format' ] )    ? $instance[ 'format' ]    : 'cover';
56
-        $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true;
57
-        $infotext  = isset( $instance[ 'infotext' ] )  ? $instance[ 'infotext' ]  : '';
58
-        $color     = isset( $instance[ 'color' ] )     ? $instance[ 'color' ]     : '#75ad91';
51
+		$title     = isset( $instance[ 'title' ] )     ? $instance[ 'title' ]     : '';
52
+		$button = isset( $instance[ 'button' ] )    ? $instance[ 'button' ]    : '';
53
+		$size      = isset( $instance[ 'size' ] )      ? $instance[ 'size' ]      : 'big';
54
+		$style     = isset( $instance[ 'style' ] )     ? $instance[ 'style' ]     : 'filled';
55
+		$format    = isset( $instance[ 'format' ] )    ? $instance[ 'format' ]    : 'cover';
56
+		$autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true;
57
+		$infotext  = isset( $instance[ 'infotext' ] )  ? $instance[ 'infotext' ]  : '';
58
+		$color     = isset( $instance[ 'color' ] )     ? $instance[ 'color' ]     : '#75ad91';
59 59
 
60 60
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
61 61
 		if ( is_multisite() )
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 						foreach ($buttons as $subscribebutton) {
86 86
 							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
87 87
 						}
88
-                        ?>
88
+						?>
89 89
                     </optgroup>
90 90
                     <optgroup label="<?php _e('Network', 'podlove'); ?>">
91 91
 						<?php
92 92
 						foreach ($network_buttons as $subscribebutton) {
93 93
 							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
94 94
 						}
95
-                        ?>
95
+						?>
96 96
                     </optgroup>
97 97
 				<?php else :
98 98
 					foreach ($buttons as $subscribebutton) {
@@ -150,5 +150,5 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 }
152 152
 add_action( 'widgets_init', function(){
153
-     register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
153
+	 register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
154 154
 });
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 		parent::__construct(
11 11
 					'podlove_subscribe_button_wp_plugin_widget',
12 12
 					( self::is_podlove_publisher_active() ? 'Podlove Subscribe Button (WordPress plugin)' : 'Podlove Subscribe Button' ),
13
-					array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ), )
13
+					array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ),)
14 14
 				);
15 15
 	}
16 16
 
17
-	public static $widget_settings = array('infotext', 'title', 'size', 'style', 'format', 'autowidth', 'button', 'color');
17
+	public static $widget_settings = array( 'infotext', 'title', 'size', 'style', 'format', 'autowidth', 'button', 'color' );
18 18
 
19 19
 	public static function is_podlove_publisher_active() {
20
-		if ( is_plugin_active("podlove-podcasting-plugin-for-wordpress/podlove.php") ) {
20
+		if ( is_plugin_active( "podlove-podcasting-plugin-for-wordpress/podlove.php" ) ) {
21 21
 			return true;
22 22
 		}
23 23
 
@@ -26,36 +26,36 @@  discard block
 block discarded – undo
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
-		echo $args['before_widget'];
33
-		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
32
+		echo $args[ 'before_widget' ];
33
+		echo $args[ 'before_title' ] . apply_filters( 'widget_title', $instance[ 'title' ] ) . $args[ 'after_title' ];
34 34
 
35 35
 		echo $button->render(
36
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'size'),
37
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'autowidth'),
38
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'style'),
39
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'format'),
40
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
36
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'size' ),
37
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'autowidth' ),
38
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'style' ),
39
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'format' ),
40
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'color' )
41 41
 			);
42 42
 
43
-		if ( strlen($instance['infotext']) )
44
-			echo wpautop($instance['infotext']);
43
+		if ( strlen( $instance[ 'infotext' ] ) )
44
+			echo wpautop( $instance[ 'infotext' ] );
45 45
 
46
-		echo $args['after_widget'];
46
+		echo $args[ 'after_widget' ];
47 47
 	}
48 48
 
49 49
 	public function form( $instance ) {
50 50
 
51
-        $title     = isset( $instance[ 'title' ] )     ? $instance[ 'title' ]     : '';
52
-        $button = isset( $instance[ 'button' ] )    ? $instance[ 'button' ]    : '';
53
-        $size      = isset( $instance[ 'size' ] )      ? $instance[ 'size' ]      : 'big';
54
-        $style     = isset( $instance[ 'style' ] )     ? $instance[ 'style' ]     : 'filled';
55
-        $format    = isset( $instance[ 'format' ] )    ? $instance[ 'format' ]    : 'cover';
51
+        $title     = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : '';
52
+        $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : '';
53
+        $size      = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : 'big';
54
+        $style     = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : 'filled';
55
+        $format    = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : 'cover';
56 56
         $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true;
57
-        $infotext  = isset( $instance[ 'infotext' ] )  ? $instance[ 'infotext' ]  : '';
58
-        $color     = isset( $instance[ 'color' ] )     ? $instance[ 'color' ]     : '#75ad91';
57
+        $infotext  = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : '';
58
+        $color     = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91';
59 59
 
60 60
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
61 61
 		if ( is_multisite() )
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 		?>
64 64
         <p>
65 65
             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'podlove-subscribe-button' ); ?></label>
66
-            <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr($title); ?>" />
66
+            <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" />
67 67
 
68 68
             <label for="<?php echo $this->get_field_id( 'color' ); ?>"><?php _e( 'Color', 'podlove-subscribe-button' ); ?></label>
69
-            <input class="podlove_subscribe_button_color" id="<?php echo $this->get_field_id( 'color' ); ?>" name="<?php echo $this->get_field_name( 'color' ); ?>" value="<?php echo esc_attr($color); ?>" />
69
+            <input class="podlove_subscribe_button_color" id="<?php echo $this->get_field_id( 'color' ); ?>" name="<?php echo $this->get_field_name( 'color' ); ?>" value="<?php echo esc_attr( $color ); ?>" />
70 70
             <style type="text/css">
71 71
                 .sp-replacer {
72 72
                     display: flex;
@@ -79,24 +79,24 @@  discard block
 block discarded – undo
79 79
             <label for="<?php echo $this->get_field_id( 'button' ); ?>"><?php _e( 'Button', 'podlove-subscribe-button' ); ?></label>
80 80
             <select class="widefat" id="<?php echo $this->get_field_id( 'button' ); ?>"
81 81
                     name="<?php echo $this->get_field_name( 'button' ); ?>">
82
-				<?php if ( isset($network_buttons) && count($network_buttons) > 0 ) : ?>
83
-                    <optgroup label="<?php _e('Local', 'podlove'); ?>">
82
+				<?php if ( isset( $network_buttons ) && count( $network_buttons ) > 0 ) : ?>
83
+                    <optgroup label="<?php _e( 'Local', 'podlove' ); ?>">
84 84
 						<?php
85
-						foreach ($buttons as $subscribebutton) {
86
-							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
85
+						foreach ( $buttons as $subscribebutton ) {
86
+							echo "<option value='" . sanitize_title( $subscribebutton->name ) . "' " . selected( sanitize_title( $subscribebutton->name ), $button ) . " >" . sanitize_title( $subscribebutton->title ) . " (" . sanitize_title( $subscribebutton->name ) . ")</option>";
87 87
 						}
88 88
                         ?>
89 89
                     </optgroup>
90
-                    <optgroup label="<?php _e('Network', 'podlove'); ?>">
90
+                    <optgroup label="<?php _e( 'Network', 'podlove' ); ?>">
91 91
 						<?php
92
-						foreach ($network_buttons as $subscribebutton) {
93
-							echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
92
+						foreach ( $network_buttons as $subscribebutton ) {
93
+							echo "<option value='" . sanitize_title( $subscribebutton->name ) . "' " . selected( sanitize_title( $subscribebutton->name ), $button ) . " >" . sanitize_title( $subscribebutton->title ) . " (" . sanitize_title( $subscribebutton->name ) . ")</option>";
94 94
 						}
95 95
                         ?>
96 96
                     </optgroup>
97 97
 				<?php else :
98
-					foreach ($buttons as $subscribebutton) {
99
-						echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
98
+					foreach ( $buttons as $subscribebutton ) {
99
+						echo "<option value='" . sanitize_title( $subscribebutton->name ) . "' " . selected( sanitize_title( $subscribebutton->name ), $button ) . " >" . sanitize_title( $subscribebutton->title ) . " (" . sanitize_title( $subscribebutton->name ) . ")</option>";
100 100
 					}
101 101
 				endif; ?>
102 102
             </select>
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 				)
122 122
 			);
123 123
 
124
-			foreach ($customize_options as $slug => $properties) : ?>
125
-				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php echo $properties['name']; ?></label>
124
+			foreach ( $customize_options as $slug => $properties ) : ?>
125
+				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php echo $properties[ 'name' ]; ?></label>
126 126
 				<select class="widefat" id="<?php echo $this->get_field_id( $slug ); ?>" name="<?php echo $this->get_field_name( $slug ); ?>">
127
-					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php printf( __( 'Default %s', 'podlove-subscribe-button' ), $properties['name'] ) ?></option>
127
+					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php printf( __( 'Default %s', 'podlove-subscribe-button' ), $properties[ 'name' ] ) ?></option>
128 128
 					<optgroup>
129
-						<?php foreach ( $properties['options'] as $property => $name ) : ?>
129
+						<?php foreach ( $properties[ 'options' ] as $property => $name ) : ?>
130 130
 						<option value="<?php echo $property; ?>" <?php echo ( $$slug == $property ? 'selected="selected"' : '' ); ?>><?php echo $name; ?></option>
131 131
 						<?php endforeach; ?>
132 132
 					</optgroup>
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	public function update( $new_instance, $old_instance ) {
143 143
 		$instance = array();
144 144
 
145
-		foreach (self::$widget_settings as $setting) {
146
-			$instance[$setting]  = ( ! empty( $new_instance[$setting] ) ) ? strip_tags( $new_instance[$setting] ) : '';
145
+		foreach ( self::$widget_settings as $setting ) {
146
+			$instance[ $setting ] = ( ! empty( $new_instance[ $setting ] ) ) ? strip_tags( $new_instance[ $setting ] ) : '';
147 147
 		}
148 148
 
149 149
 		return $instance;
150 150
 	}
151 151
 }
152
-add_action( 'widgets_init', function(){
152
+add_action( 'widgets_init', function() {
153 153
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
154 154
 });
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
@@ -58,8 +60,9 @@  discard block
 block discarded – undo
58 60
         $color     = isset( $instance[ 'color' ] )     ? $instance[ 'color' ]     : '#75ad91';
59 61
 
60 62
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
61
-		if ( is_multisite() )
62
-			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
63
+		if ( is_multisite() ) {
64
+					$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
65
+		}
63 66
 		?>
64 67
         <p>
65 68
             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'podlove-subscribe-button' ); ?></label>
@@ -94,9 +97,11 @@  discard block
 block discarded – undo
94 97
 						}
95 98
                         ?>
96 99
                     </optgroup>
97
-				<?php else :
100
+				<?php else {
101
+	:
98 102
 					foreach ($buttons as $subscribebutton) {
99 103
 						echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>";
104
+}
100 105
 					}
101 106
 				endif; ?>
102 107
             </select>
@@ -149,6 +154,6 @@  discard block
 block discarded – undo
149 154
 		return $instance;
150 155
 	}
151 156
 }
152
-add_action( 'widgets_init', function(){
157
+add_action( 'widgets_init', function() {
153 158
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
154 159
 });
Please login to merge, or discard this patch.
model/button.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 * @param  string $name
44 44
 	 * @return object||FALSE
45 45
 	 */
46
-	public static function get_button_by_name($name) {
47
-		if ( $button = \PodloveSubscribeButton\Model\Button::find_one_by_property('name', $name) ) {
46
+	public static function get_button_by_name( $name ) {
47
+		if ( $button = \PodloveSubscribeButton\Model\Button::find_one_by_property( 'name', $name ) ) {
48 48
 			return $button;
49 49
 		}
50 50
 
51
-		if ( $network_button = \PodloveSubscribeButton\Model\NetworkButton::find_one_by_property('name', $name) ) {
51
+		if ( $network_button = \PodloveSubscribeButton\Model\NetworkButton::find_one_by_property( 'name', $name ) ) {
52 52
 			$network_button->id = $network_button->id . 'N';
53 53
 			return $network_button;
54 54
 		}
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @param  array
62 62
 	 * @return array
63 63
 	 */
64
-	public static function get_global_setting_with_fallback( $settings=array() ) {
65
-		foreach (self::$properties as $property => $default) {
66
-			$settings[$property] = ( get_option('podlove_subscribe_button_default_' . $property) ? get_option('podlove_subscribe_button_default_' . $property) : $default );
64
+	public static function get_global_setting_with_fallback( $settings = array() ) {
65
+		foreach ( self::$properties as $property => $default ) {
66
+			$settings[ $property ] = ( get_option( 'podlove_subscribe_button_default_' . $property ) ? get_option( 'podlove_subscribe_button_default_' . $property ) : $default );
67 67
 		}
68 68
 
69 69
 		return $settings;
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * @param  boolean $hide
80 80
 	 * @return string
81 81
 	 */
82
-	public function render( $size='big', $autowidth='on', $style='filled', $format='rectangle', $color='#599677', $hide = false, $buttonid = false, $language='en' ) {
82
+	public function render( $size = 'big', $autowidth = 'on', $style = 'filled', $format = 'rectangle', $color = '#599677', $hide = false, $buttonid = false, $language = 'en' ) {
83 83
 		$button_styling = array_merge(
84
-				$this->get_button_styling($size, $autowidth, $style, $format, $color),
84
+				$this->get_button_styling( $size, $autowidth, $style, $format, $color ),
85 85
 				array(
86 86
 						'hide' => $hide,
87 87
 						'language' => $language
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
 		return $this->provide_button_html(
92 92
 			array(
93
-				'title' => sanitize_text_field($this->title),
94
-				'subtitle' => sanitize_text_field($this->subtitle),
95
-				'description' => sanitize_textarea_field($this->description),
96
-				'cover' => sanitize_text_field($this->cover),
97
-				'feeds' => $this->get_feeds_as_array($this->feeds)
93
+				'title' => sanitize_text_field( $this->title ),
94
+				'subtitle' => sanitize_text_field( $this->subtitle ),
95
+				'description' => sanitize_textarea_field( $this->description ),
96
+				'cover' => sanitize_text_field( $this->cover ),
97
+				'feeds' => $this->get_feeds_as_array( $this->feeds )
98 98
 			), $button_styling );
99 99
 	}
100 100
 
@@ -102,25 +102,25 @@  discard block
 block discarded – undo
102 102
 	 * Provides the feed as an array in the required format
103 103
 	 * @return array
104 104
 	 */
105
-	private function get_feeds_as_array( $feeds=array() ) {
105
+	private function get_feeds_as_array( $feeds = array() ) {
106 106
 		$returnedFeeds = array();
107 107
 
108
-		if (! $feeds)
108
+		if ( ! $feeds )
109 109
 			return $returnedFeeds;
110 110
 
111
-		foreach ($feeds as $feed) {
112
-			if ( isset(\PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension']) ) {
111
+		foreach ( $feeds as $feed ) {
112
+			if ( isset( \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ] ) ) {
113 113
 				$new_feed = array(
114 114
 						'type' => 'audio',
115
-						'format' => \PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension'],
116
-						'url' => $feed['url'],
115
+						'format' => \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ],
116
+						'url' => $feed[ 'url' ],
117 117
 						'variant' => 'high'
118 118
 					);
119 119
 
120
-				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 )
121
-					$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
120
+				if ( isset( $feed[ 'itunesfeedid' ] ) && $feed[ 'itunesfeedid' ] > 0 )
121
+					$new_feed[ 'directory-url-itunes' ] = "https://itunes.apple.com/podcast/id" . $feed[ 'itunesfeedid' ];
122 122
 
123
-				$returnedFeeds[] = $new_feed;
123
+				$returnedFeeds[ ] = $new_feed;
124 124
 			}
125 125
 		}
126 126
 
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 	 * @param  string $data_attributes
135 135
 	 * @return string
136 136
 	 */
137
-	private function provide_button_html($podcast_data, $button_styling, $data_attributes="") {
137
+	private function provide_button_html( $podcast_data, $button_styling, $data_attributes = "" ) {
138 138
 		// Create data attributes for Button
139
-		foreach ($button_styling as $attribute => $value) {
139
+		foreach ( $button_styling as $attribute => $value ) {
140 140
 			$data_attributes .= 'data-' . $attribute . '="' . $value . '" ';
141 141
 		}
142 142
 
143 143
 		return"
144 144
 			<script>
145
-				podcastData".$this->id . " = ".json_encode($podcast_data)."
145
+				podcastData".$this->id . " = " . json_encode( $podcast_data ) . "
146 146
 			</script>
147 147
 			<script
148 148
 				class=\"podlove-subscribe-button\"
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 	 * @param  string $color
161 161
 	 * @return array
162 162
 	 */
163
-	public function get_button_styling($size, $autowidth, $style, $format, $color) {
163
+	public function get_button_styling( $size, $autowidth, $style, $format, $color ) {
164 164
 
165 165
 		return array(
166 166
 				// $attribute => $value
167
-				'size' => ( $size == 'default' ? get_option('podlove_subscribe_button_default_size', $size) : $size )
168
-			 	. self::interpret_autowidth_attribute($autowidth),
169
-				'style' => ( $style == 'default' ? get_option('podlove_subscribe_button_default_style', $style) : $style ),
170
-				'format' => ( $format == 'default' ? get_option('podlove_subscribe_button_default_format', $format) : $format ),
171
-				'color' => ( isset($color) ? $color : get_option('podlove_subscribe_button_default_color', $color) ),
167
+				'size' => ( $size == 'default' ? get_option( 'podlove_subscribe_button_default_size', $size ) : $size )
168
+			 	. self::interpret_autowidth_attribute( $autowidth ),
169
+				'style' => ( $style == 'default' ? get_option( 'podlove_subscribe_button_default_style', $style ) : $style ),
170
+				'format' => ( $format == 'default' ? get_option( 'podlove_subscribe_button_default_format', $format ) : $format ),
171
+				'color' => ( isset( $color ) ? $color : get_option( 'podlove_subscribe_button_default_color', $color ) ),
172 172
 				'json-data' => 'podcastData' . $this->id
173 173
 			);
174 174
 	}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param  string $autowidth
179 179
 	 * @return string
180 180
 	 */
181
-	private static function interpret_autowidth_attribute($autowidth) {
182
-		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' )
181
+	private static function interpret_autowidth_attribute( $autowidth ) {
182
+		if ( $autowidth == 'default' && get_option( 'podlove_subscribe_button_default_autowidth' ) !== 'on' )
183 183
 			return '';
184 184
 
185 185
 		if ( $autowidth !== 'default' && $autowidth !== 'on' )
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 	private function get_feeds_as_array( $feeds=array() ) {
106 106
 		$returnedFeeds = array();
107 107
 
108
-		if (! $feeds)
109
-			return $returnedFeeds;
108
+		if (! $feeds) {
109
+					return $returnedFeeds;
110
+		}
110 111
 
111 112
 		foreach ($feeds as $feed) {
112 113
 			if ( isset(\PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension']) ) {
@@ -117,8 +118,9 @@  discard block
 block discarded – undo
117 118
 						'variant' => 'high'
118 119
 					);
119 120
 
120
-				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 )
121
-					$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
121
+				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 ) {
122
+									$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
123
+				}
122 124
 
123 125
 				$returnedFeeds[] = $new_feed;
124 126
 			}
@@ -179,11 +181,13 @@  discard block
 block discarded – undo
179 181
 	 * @return string
180 182
 	 */
181 183
 	private static function interpret_autowidth_attribute($autowidth) {
182
-		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' )
183
-			return '';
184
+		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' ) {
185
+					return '';
186
+		}
184 187
 
185
-		if ( $autowidth !== 'default' && $autowidth !== 'on' )
186
-			return '';
188
+		if ( $autowidth !== 'default' && $autowidth !== 'on' ) {
189
+					return '';
190
+		}
187 191
 
188 192
 		return ' auto';
189 193
 	}
Please login to merge, or discard this patch.
settings/buttons_list_table.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace PodloveSubscribeButton;
3 3
 
4 4
 if( ! class_exists( 'WP_List_Table' ) ){
5
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
5
+	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6 6
 }
7 7
 
8 8
 class Button_List_Table extends \WP_List_Table {
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 		// Set parent defaults
14 14
 		parent::__construct( array(
15
-		    'singular'  => 'feed',   // singular name of the listed records
16
-		    'plural'    => 'feeds',  // plural name of the listed records
17
-		    'ajax'      => false  // does this table support ajax?
15
+			'singular'  => 'feed',   // singular name of the listed records
16
+			'plural'    => 'feeds',  // plural name of the listed records
17
+			'ajax'      => false  // does this table support ajax?
18 18
 		) );
19 19
 	}
20 20
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		);
27 27
 
28 28
 		return sprintf('%1$s %2$s',
29
-		    /*$1%s*/ sanitize_title($button->title) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field($button->name) . '"]</code>',
30
-		    /*$3%s*/ $this->row_actions( $actions )
29
+			/*$1%s*/ sanitize_title($button->title) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field($button->name) . '"]</code>',
30
+			/*$3%s*/ $this->row_actions( $actions )
31 31
 		);
32 32
 	}
33 33
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
 		// register pagination options & calculations
91 91
 		$this->set_pagination_args( array(
92
-		    'total_items' => $total_items,
93
-		    'per_page'    => $per_page,
94
-		    'total_pages' => ceil( $total_items / $per_page )
92
+			'total_items' => $total_items,
93
+			'per_page'    => $per_page,
94
+			'total_pages' => ceil( $total_items / $per_page )
95 95
 		) );
96 96
 	}
97 97
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PodloveSubscribeButton;
3 3
 
4
-if( ! class_exists( 'WP_List_Table' ) ){
4
+if ( ! class_exists( 'WP_List_Table' ) ) {
5 5
     require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6 6
 }
7 7
 
8 8
 class Button_List_Table extends \WP_List_Table {
9 9
 
10
-	function __construct(){
10
+	function __construct() {
11 11
 		global $status, $page;
12 12
 
13 13
 		// Set parent defaults
14 14
 		parent::__construct( array(
15
-		    'singular'  => 'feed',   // singular name of the listed records
16
-		    'plural'    => 'feeds',  // plural name of the listed records
15
+		    'singular'  => 'feed', // singular name of the listed records
16
+		    'plural'    => 'feeds', // plural name of the listed records
17 17
 		    'ajax'      => false  // does this table support ajax?
18 18
 		) );
19 19
 	}
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 			'delete' => Settings\Buttons::get_action_link( $button, __( 'Delete', 'podlove-subscribe-button' ), 'confirm_delete' )
26 26
 		);
27 27
 
28
-		return sprintf('%1$s %2$s',
29
-		    /*$1%s*/ sanitize_title($button->title) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field($button->name) . '"]</code>',
28
+		return sprintf( '%1$s %2$s',
29
+		    /*$1%s*/ sanitize_title( $button->title ) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field( $button->name ) . '"]</code>',
30 30
 		    /*$3%s*/ $this->row_actions( $actions )
31 31
 		);
32 32
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return $button->id;
58 58
 	}
59 59
 
60
-	function get_columns(){
60
+	function get_columns() {
61 61
 		return array(
62 62
 			'name'    => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
63 63
 			'button_preview'    => __( 'Preview', 'podlove-subscribe-button' ),
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		// get total items
84 84
 		$total_items = count( $data );
85 85
 		// extrage page for current page only
86
-		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ) , $per_page );
86
+		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
87 87
 		// add items to table
88 88
 		$this->items = $data;
89 89
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PodloveSubscribeButton;
3 3
 
4
-if( ! class_exists( 'WP_List_Table' ) ){
4
+if( ! class_exists( 'WP_List_Table' ) ) {
5 5
     require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6 6
 }
7 7
 
8 8
 class Button_List_Table extends \WP_List_Table {
9 9
 
10
-	function __construct(){
10
+	function __construct() {
11 11
 		global $status, $page;
12 12
 
13 13
 		// Set parent defaults
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return $button->id;
58 58
 	}
59 59
 
60
-	function get_columns(){
60
+	function get_columns() {
61 61
 		return array(
62 62
 			'name'    => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
63 63
 			'button_preview'    => __( 'Preview', 'podlove-subscribe-button' ),
Please login to merge, or discard this patch.
settings/buttons.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		if ( null == filter_input(INPUT_GET, 'button') )
49 49
 			return;
50 50
 
51
-        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
52
-            return;
53
-        }
51
+		if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
52
+			return;
53
+		}
54 54
 
55 55
 		$post = filter_input_array(INPUT_POST);
56 56
 
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 		if ( null === filter_input(INPUT_GET, 'button') )
112 112
 			return;
113 113
 
114
-        $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
114
+		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
115 115
 
116
-        if (!in_array($action, ['save', 'create', 'delete'])) {
117
-            return;
118
-        }
116
+		if (!in_array($action, ['save', 'create', 'delete'])) {
117
+			return;
118
+		}
119 119
 
120
-        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
121
-            return;
122
-        }            
120
+		if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
121
+			return;
122
+		}            
123 123
 
124 124
 		if ( $action === 'save' ) {
125 125
 			self::save();
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			filter_input(INPUT_GET, 'page'),
345 345
 			$action,
346 346
 			$button->id,
347
-            wp_create_nonce(),
347
+			wp_create_nonce(),
348 348
 			$type == 'button' ? ' class="button"' : ''
349 349
 		);
350 350
 	}
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
 
7 7
 	public static function page() {
8 8
 
9
-		$action = null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null;
9
+		$action = null !== filter_input( INPUT_GET, 'action' ) ? filter_input( INPUT_GET, 'action' ) : null;
10 10
 		$is_network = is_network_admin();
11 11
 
12
-		if ( $action == 'confirm_delete' && null !== filter_input(INPUT_GET, 'button') ) {
13
-			$button = ( $is_network === true ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( (int) filter_input(INPUT_GET, 'button') ) : \PodloveSubscribeButton\Model\Button::find_by_id( (int) filter_input(INPUT_GET, 'button') ) );
12
+		if ( $action == 'confirm_delete' && null !== filter_input( INPUT_GET, 'button' ) ) {
13
+			$button = ( $is_network === true ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( (int) filter_input( INPUT_GET, 'button' ) ) : \PodloveSubscribeButton\Model\Button::find_by_id( (int) filter_input( INPUT_GET, 'button' ) ) );
14 14
 			?>
15 15
 			<div class="updated">
16 16
 				<p>
17 17
 					<strong>
18
-						<?php printf( __( 'You selected to delete the button "%s". Please confirm this action.', 'podlove-subscribe-button' ), sanitize_title($button->title) ) ?>
18
+						<?php printf( __( 'You selected to delete the button "%s". Please confirm this action.', 'podlove-subscribe-button' ), sanitize_title( $button->title ) ) ?>
19 19
 					</strong>
20 20
 				</p>
21 21
 				<p>
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 		?>
29 29
 		<div class="wrap">
30
-			<h2><?php echo __( 'Podlove Subscribe Button', 'podlove-subscribe-button' ); ?> <a href="?page=<?php echo filter_input(INPUT_GET, 'page'); ?>&amp;action=new&amp;network=<?php echo $is_network; ?>" class="add-new-h2"><?php _e( 'Add New', 'podlove-subscribe-button' ); ?></a></h2>
30
+			<h2><?php echo __( 'Podlove Subscribe Button', 'podlove-subscribe-button' ); ?> <a href="?page=<?php echo filter_input( INPUT_GET, 'page' ); ?>&amp;action=new&amp;network=<?php echo $is_network; ?>" class="add-new-h2"><?php _e( 'Add New', 'podlove-subscribe-button' ); ?></a></h2>
31 31
 			<?php
32 32
 
33 33
 			switch ( $action ) {
34
-				case 'new':   self::new_template();  break;
34
+				case 'new':   self::new_template(); break;
35 35
 				case 'edit':  self::edit_template(); break;
36 36
 				case 'index': self::view_template(); break;
37 37
 				default:      self::view_template(); break;
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
 	 * Process form: save/update a format
46 46
 	 */
47 47
 	public static function save() {
48
-		if ( null == filter_input(INPUT_GET, 'button') )
48
+		if ( null == filter_input( INPUT_GET, 'button' ) )
49 49
 			return;
50 50
 
51
-        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
51
+        if ( ! wp_verify_nonce( $_REQUEST[ '_psb_nonce' ] ) ) {
52 52
             return;
53 53
         }
54 54
 
55
-		$post = filter_input_array(INPUT_POST);
55
+		$post = filter_input_array( INPUT_POST );
56 56
 
57
-		$button = ( filter_input(INPUT_GET, 'network') === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') ) );
58
-		$button->update_attributes( $post['podlove_button'] );
57
+		$button = ( filter_input( INPUT_GET, 'network' ) === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input( INPUT_GET, 'button' ) ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input( INPUT_GET, 'button' ) ) );
58
+		$button->update_attributes( $post[ 'podlove_button' ] );
59 59
 
60
-		if ( isset($post['submit_and_stay']) ) {
61
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
60
+		if ( isset( $post[ 'submit_and_stay' ] ) ) {
61
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
62 62
 		} else {
63
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
63
+			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
64 64
 		}
65 65
 	}
66 66
 	/**
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 	public static function create() {
70 70
 		global $wpdb;
71 71
 
72
-		$post = filter_input_array(INPUT_POST);
72
+		$post = filter_input_array( INPUT_POST );
73 73
 
74
-		$button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
75
-		$button->update_attributes( $post['podlove_button'] );
74
+		$button = ( filter_input( INPUT_GET, 'network' ) === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
75
+		$button->update_attributes( $post[ 'podlove_button' ] );
76 76
 
77
-		if ( isset($post['submit_and_stay']) ) {
78
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
77
+		if ( isset( $post[ 'submit_and_stay' ] ) ) {
78
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
79 79
 		} else {
80
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
80
+			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
81 81
 		}
82 82
 	}
83 83
 
@@ -85,39 +85,39 @@  discard block
 block discarded – undo
85 85
 	 * Process form: delete a format
86 86
 	 */
87 87
 	public static function delete() {
88
-		if ( null ==  filter_input(INPUT_GET, 'button') )
88
+		if ( null == filter_input( INPUT_GET, 'button' ) )
89 89
 			return;
90 90
 
91
-		$button = ( filter_input(INPUT_GET, 'network') === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') ) );
91
+		$button = ( filter_input( INPUT_GET, 'network' ) === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input( INPUT_GET, 'button' ) ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input( INPUT_GET, 'button' ) ) );
92 92
 		$button->delete();
93 93
 
94
-		self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
94
+		self::redirect( 'index', null, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
95 95
 	}
96 96
 
97 97
 	/**
98 98
 	 * Helper method: redirect to a certain page.
99 99
 	 */
100 100
 	public static function redirect( $action, $button_id = null, $params = array(), $network = false ) {
101
-		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input(INPUT_GET, 'page');
101
+		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input( INPUT_GET, 'page' );
102 102
 		$show    = ( $button_id ) ? '&button=' . $button_id : '';
103 103
 		$action  = '&action=' . $action;
104 104
 
105
-		array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } );
105
+		array_walk( $params, function( &$value, $key ) { $value = "&$key=$value"; } );
106 106
 
107 107
 		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
108 108
 	}
109 109
 
110 110
 	public static function process_form() {
111
-		if ( null === filter_input(INPUT_GET, 'button') )
111
+		if ( null === filter_input( INPUT_GET, 'button' ) )
112 112
 			return;
113 113
 
114
-        $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
114
+        $action = ( null !== filter_input( INPUT_GET, 'action' ) ? filter_input( INPUT_GET, 'action' ) : null );
115 115
 
116
-        if (!in_array($action, ['save', 'create', 'delete'])) {
116
+        if ( ! in_array( $action, [ 'save', 'create', 'delete' ] ) ) {
117 117
             return;
118 118
         }
119 119
 
120
-        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
120
+        if ( ! wp_verify_nonce( $_REQUEST[ '_psb_nonce' ] ) ) {
121 121
             return;
122 122
         }            
123 123
 
@@ -131,34 +131,34 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	public static function new_template() {
134
-		if ( filter_input(INPUT_GET, 'network') == '1' ) {
134
+		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
135 135
 			$button = new \PodloveSubscribeButton\Model\NetworkButton;
136 136
 		} else {
137 137
 			$button = new \PodloveSubscribeButton\Model\Button;
138 138
 		}
139 139
 
140
-		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'.
140
+		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>' .
141 141
 				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
142 142
 		self::form_template( $button, 'create' );
143 143
 	}
144 144
 
145 145
 	public static function edit_template() {
146
-		if ( filter_input(INPUT_GET, 'network') == '1' ) {
147
-			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') );
146
+		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
147
+			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input( INPUT_GET, 'button' ) );
148 148
 		} else {
149
-			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') );
149
+			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input( INPUT_GET, 'button' ) );
150 150
 		}
151 151
 
152
-		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), sanitize_text_field($button->title) ) . '</h3>';
152
+		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), sanitize_text_field( $button->title ) ) . '</h3>';
153 153
 		self::form_template( $button, 'save' );
154 154
 	}
155 155
 
156 156
 	public static function view_template() {
157 157
 		$is_network = is_network_admin();
158 158
 		?>
159
-		<p><?php _e('This plugin allows easy inclusion of the Podlove Subscribe Button. Put it in your sidebar with a simple widget or include the button in pages and/or posts with a simple shortcode.', 'podlove-subscribe-button' ); ?></p>
160
-		<p><?php _e('Start by adding a button for each of your podcasts here. You can then add the button to your sidebar by adding the <a href="widgets.php">Podlove Subscribe Button widget</a>.', 'podlove-subscribe-button' ); ?></p>
161
-		<p><?php _e('If you want to display the button inside a page or article, you can also use the <code>[podlove-subscribe-button]</code> shortcode anywhere.', 'podlove-subscribe-button' ); ?></p>
159
+		<p><?php _e( 'This plugin allows easy inclusion of the Podlove Subscribe Button. Put it in your sidebar with a simple widget or include the button in pages and/or posts with a simple shortcode.', 'podlove-subscribe-button' ); ?></p>
160
+		<p><?php _e( 'Start by adding a button for each of your podcasts here. You can then add the button to your sidebar by adding the <a href="widgets.php">Podlove Subscribe Button widget</a>.', 'podlove-subscribe-button' ); ?></p>
161
+		<p><?php _e( 'If you want to display the button inside a page or article, you can also use the <code>[podlove-subscribe-button]</code> shortcode anywhere.', 'podlove-subscribe-button' ); ?></p>
162 162
 		<?php
163 163
 		$table = new \PodloveSubscribeButton\Button_List_Table;
164 164
 		$table->prepare_items();
@@ -169,49 +169,49 @@  discard block
 block discarded – undo
169 169
 
170 170
 		if ( ! $is_network ) :
171 171
 		?>
172
-		<h3><?php _e('Default Settings', 'podlove-subscribe-button' ); ?></h3>
172
+		<h3><?php _e( 'Default Settings', 'podlove-subscribe-button' ); ?></h3>
173 173
 		<form method="post" action="options.php">
174 174
 			<?php settings_fields( 'podlove-subscribe-button' ); ?>
175 175
 			<?php do_settings_sections( 'podlove-subscribe-button' ); ?>
176 176
 			<table class="form-table">
177 177
 				<tr valign="top">
178
-				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e('Size', 'podlove-subscribe-button' ); ?></label></th>
178
+				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e( 'Size', 'podlove-subscribe-button' ); ?></label></th>
179 179
 				<td>
180 180
 					<select name="podlove_subscribe_button_default_size" id="podlove_subscribe_button_default_size">
181
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$size as $value => $description) : ?>
182
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['size'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
181
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$size as $value => $description ) : ?>
182
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'size' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
183 183
 						<?php endforeach; ?>
184 184
 					</select>
185 185
 				</td>
186 186
 				</tr>
187 187
 				<tr valign="top">
188
-				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e('Autowidth', 'podlove-subscribe-button' ); ?></label></th>
188
+				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e( 'Autowidth', 'podlove-subscribe-button' ); ?></label></th>
189 189
 				<td>
190
-					<input type="checkbox" name="podlove_subscribe_button_default_autowidth" id="podlove_subscribe_button_default_autowidth" <?php echo ( $settings['autowidth'] == 'on' ? 'checked' : '' ) ?> />
190
+					<input type="checkbox" name="podlove_subscribe_button_default_autowidth" id="podlove_subscribe_button_default_autowidth" <?php echo ( $settings[ 'autowidth' ] == 'on' ? 'checked' : '' ) ?> />
191 191
 				</td>
192 192
 				</tr>
193 193
 				<tr valign="top">
194
-				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e('Color', 'podlove-subscribe-button' ); ?></label></th>
194
+				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e( 'Color', 'podlove-subscribe-button' ); ?></label></th>
195 195
 				<td>
196
-					<input id="podlove_subscribe_button_default_color" name="podlove_subscribe_button_default_color" class="podlove_subscribe_button_color" value="<?php echo $settings['color'] ?>" />
196
+					<input id="podlove_subscribe_button_default_color" name="podlove_subscribe_button_default_color" class="podlove_subscribe_button_color" value="<?php echo $settings[ 'color' ] ?>" />
197 197
 				</td>
198 198
 				</tr>
199 199
 				<tr valign="top">
200
-				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e('Style', 'podlove-subscribe-button' ); ?></label></th>
200
+				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e( 'Style', 'podlove-subscribe-button' ); ?></label></th>
201 201
 				<td>
202 202
 					<select name="podlove_subscribe_button_default_style" id="podlove_subscribe_button_default_style">
203
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$style as $value => $description) : ?>
204
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['style'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
203
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$style as $value => $description ) : ?>
204
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'style' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
205 205
 						<?php endforeach; ?>
206 206
 					</select>
207 207
 				</td>
208 208
 				</tr>
209 209
 				<tr valign="top">
210
-				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e('Format', 'podlove-subscribe-button' ); ?></label></th>
210
+				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e( 'Format', 'podlove-subscribe-button' ); ?></label></th>
211 211
 				<td>
212 212
 					<select name="podlove_subscribe_button_default_format" id="podlove_subscribe_button_default_format">
213
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$format as $value => $description) : ?>
214
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['format'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
213
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$format as $value => $description ) : ?>
214
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'format' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
215 215
 						<?php endforeach; ?>
216 216
 					</select>
217 217
 				</td>
@@ -236,45 +236,45 @@  discard block
 block discarded – undo
236 236
 					<tbody>
237 237
 					<tr>
238 238
 						<td scope="row">
239
-							<label for="podlove_button_name"><?php _e('Button ID', 'podlove-subscribe-button' ); ?></label>
239
+							<label for="podlove_button_name"><?php _e( 'Button ID', 'podlove-subscribe-button' ); ?></label>
240 240
 						</td>
241 241
 						<td>
242
-							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo esc_attr($button->name); ?>" />
243
-							<br /><span class="description"><?php _e('The ID will be used as in internal identifier for shortcodes.', 'podlove-subscribe-button' ); ?></span>
242
+							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo esc_attr( $button->name ); ?>" />
243
+							<br /><span class="description"><?php _e( 'The ID will be used as in internal identifier for shortcodes.', 'podlove-subscribe-button' ); ?></span>
244 244
 						</td>
245 245
 					</tr>
246 246
 					<tr>
247 247
 						<td scope="row">
248
-							<label for="podlove_button_title"><?php _e('Podcast Title', 'podlove-subscribe-button' ); ?></label>
248
+							<label for="podlove_button_title"><?php _e( 'Podcast Title', 'podlove-subscribe-button' ); ?></label>
249 249
 						</td>
250 250
 						<td>
251
-							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo esc_attr($button->title); ?>" />
251
+							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo esc_attr( $button->title ); ?>" />
252 252
 						</td>
253 253
 					</tr>
254 254
 					<tr>
255 255
 						<td scope="row">
256
-							<label for="podlove_button_subtitle"><?php _e('Podcast Subtitle', 'podlove-subscribe-button' ); ?></label>
256
+							<label for="podlove_button_subtitle"><?php _e( 'Podcast Subtitle', 'podlove-subscribe-button' ); ?></label>
257 257
 						</td>
258 258
 						<td>
259
-							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo esc_attr($button->subtitle); ?>" />
259
+							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo esc_attr( $button->subtitle ); ?>" />
260 260
 						</td>
261 261
 					</tr>
262 262
 					<tr>
263 263
 						<td scope="row">
264
-							<label for="podlove_button_description"><?php _e('Podcast Description', 'podlove-subscribe-button' ); ?></label>
264
+							<label for="podlove_button_description"><?php _e( 'Podcast Description', 'podlove-subscribe-button' ); ?></label>
265 265
 						</td>
266 266
 						<td>
267
-							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo esc_attr($button->description); ?></textarea>
267
+							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo esc_attr( $button->description ); ?></textarea>
268 268
 						</td>
269 269
 					</tr>
270 270
 					<tr>
271 271
 						<td scope="row">
272
-							<label for="podlove-button-cover"><?php _e('Podcast Image URL', 'podlove-subscribe-button' ); ?></label>
272
+							<label for="podlove-button-cover"><?php _e( 'Podcast Image URL', 'podlove-subscribe-button' ); ?></label>
273 273
 						</td>
274 274
 						<td>
275
-							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo esc_attr($button->cover); ?>" />
275
+							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo esc_attr( $button->cover ); ?>" />
276 276
 							<a id="Podlove_cover_image_select" class="button" href="#">Select</a>
277
-							<br /><img src="<?php echo sanitize_text_field($button->cover); ?>" alt="" style="width: 200px" />
277
+							<br /><img src="<?php echo sanitize_text_field( $button->cover ); ?>" alt="" style="width: 200px" />
278 278
 							<script type="text/javascript">
279 279
 								(function($) {
280 280
 									$("#podlove-button-cover").on( 'change', function() {
@@ -287,29 +287,29 @@  discard block
 block discarded – undo
287 287
 					</tr>
288 288
 					<tr>
289 289
 						<td scope="row">
290
-							<label for="feeds_table"><?php _e('Podcast Feeds', 'podlove-subscribe-button' ); ?></label>
290
+							<label for="feeds_table"><?php _e( 'Podcast Feeds', 'podlove-subscribe-button' ); ?></label>
291 291
 						</td>
292 292
 						<td>
293 293
 							<table id="feeds_table" class="podlove_alternating" border="0" cellspacing="0">
294 294
 								<thead>
295 295
 									<tr>
296
-										<th><?php _e('URL', 'podlove-subscribe-button' ); ?></th>
297
-										<th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
298
-										<th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th>
299
-										<th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th>
296
+										<th><?php _e( 'URL', 'podlove-subscribe-button' ); ?></th>
297
+										<th><?php _e( 'iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
298
+										<th><?php _e( 'Media format', 'podlove-subscribe-button' ); ?></th>
299
+										<th><?php _e( 'Actions', 'podlove-subscribe-button' ); ?></th>
300 300
 									</tr>
301 301
 								</thead>
302 302
 								<tbody id="feeds_table_body">
303 303
 								</tbody>
304 304
 							</table>
305 305
 							<input type="button" class="button add_feed" value="+" />
306
-							<p><span class="description"><?php _e('Provide all Feeds with their corresponding Media File Type. The Subscribe Button will then automatically provide the most suitable feed to the subscriber with respect to their Podcast Client.', 'podlove-subscribe-button' ); ?></span></p>
306
+							<p><span class="description"><?php _e( 'Provide all Feeds with their corresponding Media File Type. The Subscribe Button will then automatically provide the most suitable feed to the subscriber with respect to their Podcast Client.', 'podlove-subscribe-button' ); ?></span></p>
307 307
 						</td>
308 308
 					</tr>
309 309
 					</tbody>
310 310
 				</table>
311
-				<input name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', 'podlove-subscribe-button' ); ?>" type="submit" />
312
-				<input type="submit" name="submit_and_stay" id="submit_and_stay" class="button" value="<?php _e('Save Changes and Continue Editing', 'podlove-subscribe-button' ); ?>"  />
311
+				<input name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'podlove-subscribe-button' ); ?>" type="submit" />
312
+				<input type="submit" name="submit_and_stay" id="submit_and_stay" class="button" value="<?php _e( 'Save Changes and Continue Editing', 'podlove-subscribe-button' ); ?>"  />
313 313
 
314 314
 				<script type="text/template" id="feed_line_template">
315 315
 					<tr>
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 						<td>
323 323
 							<select class="regular-text podlove-media-format" name="podlove_button[feeds][{{id}}][format]">
324 324
 								<?php
325
-									foreach (\PodloveSubscribeButton\MediaTypes::$audio as $id => $audio) {
326
-										echo "<option value='".$id."'>".$audio['title']."</option>\n";
325
+									foreach ( \PodloveSubscribeButton\MediaTypes::$audio as $id => $audio ) {
326
+										echo "<option value='" . $id . "'>" . $audio[ 'title' ] . "</option>\n";
327 327
 									}
328 328
 								?>
329 329
 							</select>
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 					</tr>
333 333
 				</script>
334 334
 				<script type="text/javascript">
335
-					var feeds = <?php echo json_encode($button->feeds); ?>;
335
+					var feeds = <?php echo json_encode( $button->feeds ); ?>;
336 336
 				</script>
337 337
 		</form>
338 338
 		<?php
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 
341 341
 	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
342 342
 		return sprintf(
343
-			'<a href="?page=%s&action=%s&button=%s&network='.is_network_admin().'&_psb_nonce=%s"%s>' . $title . '</a>',
344
-			filter_input(INPUT_GET, 'page'),
343
+			'<a href="?page=%s&action=%s&button=%s&network=' . is_network_admin() . '&_psb_nonce=%s"%s>' . $title . '</a>',
344
+			filter_input( INPUT_GET, 'page' ),
345 345
 			$action,
346 346
 			$button->id,
347 347
             wp_create_nonce(),
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 	 * Process form: save/update a format
46 46
 	 */
47 47
 	public static function save() {
48
-		if ( null == filter_input(INPUT_GET, 'button') )
49
-			return;
48
+		if ( null == filter_input(INPUT_GET, 'button') ) {
49
+					return;
50
+		}
50 51
 
51 52
         if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
52 53
             return;
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 	 * Process form: delete a format
86 87
 	 */
87 88
 	public static function delete() {
88
-		if ( null ==  filter_input(INPUT_GET, 'button') )
89
-			return;
89
+		if ( null ==  filter_input(INPUT_GET, 'button') ) {
90
+					return;
91
+		}
90 92
 
91 93
 		$button = ( filter_input(INPUT_GET, 'network') === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') ) );
92 94
 		$button->delete();
@@ -108,8 +110,9 @@  discard block
 block discarded – undo
108 110
 	}
109 111
 
110 112
 	public static function process_form() {
111
-		if ( null === filter_input(INPUT_GET, 'button') )
112
-			return;
113
+		if ( null === filter_input(INPUT_GET, 'button') ) {
114
+					return;
115
+		}
113 116
 
114 117
         $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
115 118
 
Please login to merge, or discard this patch.