Passed
Push — master ( afd9ab...a90ff6 )
by Christian
02:36
created
helper.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@
 block discarded – undo
8 8
 	$plugin  = basename(\PodloveSubscribeButton\PLUGIN_DIR) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME;
9 9
 	$blogids = $wpdb->get_col("SELECT blog_id FROM " . $wpdb->blogs);
10 10
 
11
-	if (!is_array($blogids))
12
-		return;
11
+	if (!is_array($blogids)) {
12
+			return;
13
+	}
13 14
 
14 15
 	foreach ($blogids as $blog_id) {
15 16
 		switch_to_blog($blog_id);
Please login to merge, or discard this patch.
model/button.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -115,8 +115,9 @@  discard block
 block discarded – undo
115 115
 						'variant' => 'high'
116 116
 					);
117 117
 
118
-				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 )
119
-					$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
118
+				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 ) {
119
+									$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
120
+				}
120 121
 
121 122
 				$feeds[] = $new_feed;
122 123
 			}
@@ -177,11 +178,13 @@  discard block
 block discarded – undo
177 178
 	 * @return string
178 179
 	 */
179 180
 	private static function interpret_autowidth_attribute($autowidth) {
180
-		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' )
181
-			return '';
181
+		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' ) {
182
+					return '';
183
+		}
182 184
 
183
-		if ( $autowidth !== 'default' && $autowidth !== 'on' )
184
-			return '';
185
+		if ( $autowidth !== 'default' && $autowidth !== 'on' ) {
186
+					return '';
187
+		}
185 188
 
186 189
 		return ' auto';
187 190
 	}
Please login to merge, or discard this patch.
version.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
 }
56 56
 
57 57
 function run_database_migrations() {
58
-	if (get_option('podlove_subscribe_button_plugin_database_version') >= DATABASE_VERSION)
59
-		return;
58
+	if (get_option('podlove_subscribe_button_plugin_database_version') >= DATABASE_VERSION) {
59
+			return;
60
+	}
60 61
 
61 62
 	if (is_multisite()) {
62 63
 		set_time_limit(0); // may take a while, depending on network size
@@ -74,7 +75,7 @@  discard block
 block discarded – undo
74 75
 function migrate_for_current_blog() {
75 76
 	$database_version = get_option('podlove_subscribe_button_plugin_database_version');
76 77
 
77
-	for ($i = $database_version+1; $i <= DATABASE_VERSION; $i++) { 
78
+	for ($i = $database_version+1; $i <= DATABASE_VERSION; $i++) {
78 79
 		\PodloveSubscribeButton\run_migrations_for_version($i);
79 80
 		update_option('podlove_subscribe_button_plugin_database_version', $i);
80 81
 	}
Please login to merge, or discard this patch.
settings/buttons_list_table.php 1 patch
Braces   +6 added lines, -5 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
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	function column_button_preview( $button ) {
35
-		if ( ! $button->feeds )
36
-			return;
35
+		if ( ! $button->feeds ) {
36
+					return;
37
+		}
37 38
 
38 39
 		$is_network = is_network_admin();
39 40
 
@@ -51,7 +52,7 @@  discard block
 block discarded – undo
51 52
 		return $button->id;
52 53
 	}
53 54
 
54
-	function get_columns(){
55
+	function get_columns() {
55 56
 		return array(
56 57
 			'name'    => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
57 58
 			'button_preview'    => __( 'Preview', 'podlove-subscribe-button' )
Please login to merge, or discard this patch.
model/base.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,11 +45,13 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	private static function unserialize_property($property) {
48
-		if ( ! isset($property) )
49
-			return;
48
+		if ( ! isset($property) ) {
49
+					return;
50
+		}
50 51
 
51
-		if ( $unserialized_string = is_serialized($property) )
52
-			return unserialize($property);
52
+		if ( $unserialized_string = is_serialized($property) ) {
53
+					return unserialize($property);
54
+		}
53 55
 
54 56
 		return $property;
55 57
 	}
@@ -319,8 +321,9 @@  discard block
 block discarded – undo
319 321
 	 */
320 322
 	public function update_attributes( $attributes ) {
321 323
 
322
-		if ( ! is_array( $attributes ) )
323
-			return false;
324
+		if ( ! is_array( $attributes ) ) {
325
+					return false;
326
+		}
324 327
 
325 328
 		$request = filter_input_array(INPUT_POST); // Do this for security reasons
326 329
 			
@@ -429,12 +432,14 @@  discard block
 block discarded – undo
429 432
 		
430 433
 		$defaults = $this->default_values();
431 434
 
432
-		if ( ! is_array( $defaults ) || empty( $defaults ) )
433
-			return;
435
+		if ( ! is_array( $defaults ) || empty( $defaults ) ) {
436
+					return;
437
+		}
434 438
 
435 439
 		foreach ( $defaults as $property => $value ) {
436
-			if ( $this->$property === null )
437
-				$this->$property = $value;
440
+			if ( $this->$property === null ) {
441
+							$this->$property = $value;
442
+			}
438 443
 		}
439 444
 
440 445
 	}
@@ -495,8 +500,9 @@  discard block
 block discarded – undo
495 500
 		global $wpdb;
496 501
 		
497 502
 		$property_sql = array();
498
-		foreach ( static::properties() as $property )
499
-			$property_sql[] = "`{$property['name']}` {$property['type']}";
503
+		foreach ( static::properties() as $property ) {
504
+					$property_sql[] = "`{$property['name']}` {$property['type']}";
505
+		}
500 506
 		
501 507
 		$sql = 'CREATE TABLE IF NOT EXISTS '
502 508
 		     . static::table_name()
Please login to merge, or discard this patch.
widget.php 1 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
 	}	
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
settings/buttons.php 1 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
 		$post = filter_input_array(INPUT_POST);
52 53
 
@@ -81,8 +82,9 @@  discard block
 block discarded – undo
81 82
 	 * Process form: delete a format
82 83
 	 */
83 84
 	public static function delete() {
84
-		if ( null ==  filter_input(INPUT_GET, 'button') )
85
-			return;
85
+		if ( null ==  filter_input(INPUT_GET, 'button') ) {
86
+					return;
87
+		}
86 88
 
87 89
 		$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') ) );
88 90
 		$button->delete();
@@ -104,8 +106,9 @@  discard block
 block discarded – undo
104 106
 	}
105 107
 
106 108
 	public static function process_form() {
107
-		if ( null === filter_input(INPUT_GET, 'button') )
108
-			return;
109
+		if ( null === filter_input(INPUT_GET, 'button') ) {
110
+					return;
111
+		}
109 112
 
110 113
 		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
111 114
 
Please login to merge, or discard this patch.
podlove.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.