Passed
Push — master ( 9284a7...b818a9 )
by Christian
01:18
created
helper.php 2 patches
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 
3 3
 namespace PodloveSubscribeButton;
4 4
 
5
-function for_every_podcast_blog($callback) {
5
+function for_every_podcast_blog ( $callback ) {
6 6
 	global $wpdb;
7 7
 
8
-	$plugin  = basename(\PodloveSubscribeButton\PLUGIN_DIR) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME;
9
-	$blogids = $wpdb->get_col("SELECT blog_id FROM " . $wpdb->blogs);
8
+	$plugin  = basename( \PodloveSubscribeButton\PLUGIN_DIR ) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME;
9
+	$blogids = $wpdb->get_col( "SELECT blog_id FROM " . $wpdb->blogs );
10 10
 
11
-	if (!is_array($blogids))
11
+	if ( ! is_array( $blogids ) )
12 12
 		return;
13 13
 
14
-	foreach ($blogids as $blog_id) {
15
-		switch_to_blog($blog_id);
16
-		if (is_plugin_active($plugin)) {
14
+	foreach ( $blogids as $blog_id ) {
15
+		switch_to_blog( $blog_id );
16
+		if ( is_plugin_active( $plugin ) ) {
17 17
 			$callback();
18 18
 		}
19 19
 		restore_current_blog();
Please login to merge, or discard this patch.
podlove.php 3 patches
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
38 38
 require('helper.php');
39 39
 
40 40
 add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
41
-if ( is_multisite() )
41
+if ( is_multisite() ) {
42 42
 	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
43
+}
43 44
 
44 45
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
45 46
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
@@ -95,8 +96,9 @@  discard block
 block discarded – undo
95 96
 	public static function build_models() {
96 97
 		// Build Databases
97 98
 		\PodloveSubscribeButton\Model\Button::build();
98
-		if ( is_multisite() )
99
-			\PodloveSubscribeButton\Model\NetworkButton::build();
99
+		if ( is_multisite() ) {
100
+					\PodloveSubscribeButton\Model\NetworkButton::build();
101
+		}
100 102
 
101 103
 		// Set Button "default" values
102 104
 		$default_values = array(
@@ -122,8 +124,9 @@  discard block
 block discarded – undo
122 124
 		}
123 125
 
124 126
 		// Fetch the (network)button by it's name
125
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
126
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
127
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) {
128
+					return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
129
+		}
127 130
 
128 131
 		// Get button styling and options
129 132
 		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
@@ -155,8 +158,9 @@  discard block
 block discarded – undo
155 158
 	}
156 159
 
157 160
 	public static function get_array_value_with_fallback($args, $key) {
158
-		if ( isset($args[$key]) )
159
-			return $args[$key];
161
+		if ( isset($args[$key]) ) {
162
+					return $args[$key];
163
+		}
160 164
 
161 165
 		return FALSE;
162 166
 	}
@@ -180,10 +184,12 @@  discard block
 block discarded – undo
180 184
 	 * @return string
181 185
 	 */
182 186
 	private static function interpret_width_attribute( $width_attribute = NULL ) {
183
-		if ( $width_attribute == 'auto' )
184
-			return 'on';
185
-		if ( $width_attribute && $width_attribute !== 'auto' )
186
-			return 'off';
187
+		if ( $width_attribute == 'auto' ) {
188
+					return 'on';
189
+		}
190
+		if ( $width_attribute && $width_attribute !== 'auto' ) {
191
+					return 'off';
192
+		}
187 193
 
188 194
 		return get_option('podlove_subscribe_button_default_autowidth', 'on');
189 195
 	}
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -14,85 +14,85 @@  discard block
 block discarded – undo
14 14
 $correct_php_version = version_compare( phpversion(), "5.3", ">=" );
15 15
 
16 16
 if ( ! $correct_php_version ) {
17
-	_e("Podlove Subscribe Button Plugin requires <strong>PHP 5.3</strong> or higher.<br>", 'podlove-subscribe-button');
18
-	echo __("You are running PHP ", 'podlove-subscribe-button') . phpversion();
17
+	_e( "Podlove Subscribe Button Plugin requires <strong>PHP 5.3</strong> or higher.<br>", 'podlove-subscribe-button' );
18
+	echo __( "You are running PHP ", 'podlove-subscribe-button' ) . phpversion();
19 19
 	exit;
20 20
 }
21 21
 
22 22
 // Constants
23
-require('constants.php');
24
-require('settings/buttons.php');
23
+require( 'constants.php' );
24
+require( 'settings/buttons.php' );
25 25
 // Models
26
-require('model/base.php');
27
-require('model/button.php');
28
-require('model/network_button.php');
26
+require( 'model/base.php' );
27
+require( 'model/button.php' );
28
+require( 'model/network_button.php' );
29 29
 // Table
30
-require('settings/buttons_list_table.php');
30
+require( 'settings/buttons_list_table.php' );
31 31
 // Media Types
32
-require('media_types.php');
32
+require( 'media_types.php' );
33 33
 // Widget
34
-require('widget.php');
34
+require( 'widget.php' );
35 35
 // Version control
36
-require('version.php');
36
+require( 'version.php' );
37 37
 // Helper functions
38
-require('helper.php');
38
+require( 'helper.php' );
39 39
 
40
-add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
40
+add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu' ) );
41 41
 if ( is_multisite() )
42
-	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
42
+	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu' ) );
43 43
 
44 44
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
45 45
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
46 46
 
47
-add_action( 'admin_enqueue_scripts', function () {
48
-	wp_register_style( 'podlove-subscribe-button', plugin_dir_url(__FILE__).'style.css' );
47
+add_action( 'admin_enqueue_scripts', function() {
48
+	wp_register_style( 'podlove-subscribe-button', plugin_dir_url( __FILE__ ) . 'style.css' );
49 49
 	wp_enqueue_style( 'podlove-subscribe-button' );
50 50
 
51
-	wp_enqueue_style('podlove-subscribe-button-spectrum', plugin_dir_url(__FILE__). 'js/spectrum/spectrum.css');
52
-	wp_enqueue_script('podlove-subscribe-button-spectrum', plugin_dir_url(__FILE__). 'js/spectrum/spectrum.js', array('jquery'));
53
-	wp_enqueue_script('podlove-subscribe-button-admin-tools', plugin_dir_url(__FILE__). 'js/admin.js', array('jquery'));
51
+	wp_enqueue_style( 'podlove-subscribe-button-spectrum', plugin_dir_url( __FILE__ ) . 'js/spectrum/spectrum.css' );
52
+	wp_enqueue_script( 'podlove-subscribe-button-spectrum', plugin_dir_url( __FILE__ ) . 'js/spectrum/spectrum.js', array( 'jquery' ) );
53
+	wp_enqueue_script( 'podlove-subscribe-button-admin-tools', plugin_dir_url( __FILE__ ) . 'js/admin.js', array( 'jquery' ) );
54 54
 } );
55 55
 
56 56
 // Register Settings
57
-add_action( 'admin_init', function () {
58
-	$settings = array('size', 'autowidth', 'style', 'format', 'color');
57
+add_action( 'admin_init', function() {
58
+	$settings = array( 'size', 'autowidth', 'style', 'format', 'color' );
59 59
 
60
-	foreach ($settings as $setting) {
60
+	foreach ( $settings as $setting ) {
61 61
 		register_setting( 'podlove-subscribe-button', 'podlove_subscribe_button_default_' . $setting );
62 62
 	}
63 63
 } );
64 64
 
65 65
 add_shortcode( 'podlove-subscribe-button', array( 'PodloveSubscribeButton', 'shortcode' ) );
66 66
 
67
-add_action( 'plugins_loaded', function () {
67
+add_action( 'plugins_loaded', function() {
68 68
 	load_plugin_textdomain( 'podlove-subscribe-button' );
69 69
 } );
70 70
 
71 71
 
72 72
 class PodloveSubscribeButton {
73 73
 
74
-	public static function admin_menu() {
74
+	public static function admin_menu () {
75 75
 		add_options_page(
76 76
 				'Podlove Subscribe Button Options',
77 77
 				'Podlove Subscribe Button',
78 78
 				'manage_options',
79 79
 				'podlove-subscribe-button',
80
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
80
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
81 81
 			);
82 82
 	}
83 83
 
84
-	public static function admin_network_menu() {
84
+	public static function admin_network_menu () {
85 85
 		add_submenu_page(
86 86
 				'settings.php',
87 87
 				'Podlove Subscribe Button Options',
88 88
 				'Podlove Subscribe Button',
89 89
 				'manage_options',
90 90
 				'podlove-subscribe-button',
91
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
91
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
92 92
 			);
93 93
 	}
94 94
 
95
-	public static function build_models() {
95
+	public static function build_models () {
96 96
 		// Build Databases
97 97
 		\PodloveSubscribeButton\Model\Button::build();
98 98
 		if ( is_multisite() )
@@ -107,56 +107,56 @@  discard block
 block discarded – undo
107 107
 				'format' => 'rectangle'
108 108
 			);
109 109
 
110
-		foreach ($default_values as $option => $default_value) {
111
-			if ( ! get_option('podlove_subscribe_button_default_' . $option ) ) {
112
-				update_option('podlove_subscribe_button_default_' . $option, $default_value);
110
+		foreach ( $default_values as $option => $default_value ) {
111
+			if ( ! get_option( 'podlove_subscribe_button_default_' . $option ) ) {
112
+				update_option( 'podlove_subscribe_button_default_' . $option, $default_value );
113 113
 			}
114 114
 		}
115 115
 	}
116 116
 
117
-	public static function shortcode( $args ) {
118
-		if ( ! $args || ! isset($args['button']) ) {
119
-			return __('You need to create a Button first and provide its ID.', 'podlove-subscribe-button');
117
+	public static function shortcode ( $args ) {
118
+		if ( ! $args || ! isset( $args[ 'button' ] ) ) {
119
+			return __( 'You need to create a Button first and provide its ID.', 'podlove-subscribe-button' );
120 120
 		} else {
121
-			$buttonid = $args['button'];
121
+			$buttonid = $args[ 'button' ];
122 122
 		}
123 123
 
124 124
 		// Fetch the (network)button by it's name
125
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
126
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
125
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) )
126
+			return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] );
127 127
 
128 128
 		// Get button styling and options
129
-		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
130
-		$size = self::get_attribute( 'size', self::get_array_value_with_fallback($args, 'size') );
131
-		$style = self::get_attribute( 'style', self::get_array_value_with_fallback($args, 'style') );
132
-		$format = self::get_attribute( 'format', self::get_array_value_with_fallback($args, 'format') );
133
-		$color = self::get_attribute( 'color', self::get_array_value_with_fallback($args, 'color') );
134
-
135
-		if ( isset($args['language']) ) {
136
-			$language = $args['language'];
129
+		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback( $args, 'width' ) );
130
+		$size = self::get_attribute( 'size', self::get_array_value_with_fallback( $args, 'size' ) );
131
+		$style = self::get_attribute( 'style', self::get_array_value_with_fallback( $args, 'style' ) );
132
+		$format = self::get_attribute( 'format', self::get_array_value_with_fallback( $args, 'format' ) );
133
+		$color = self::get_attribute( 'color', self::get_array_value_with_fallback( $args, 'color' ) );
134
+
135
+		if ( isset( $args[ 'language' ] ) ) {
136
+			$language = $args[ 'language' ];
137 137
 		} else {
138 138
 			$language = 'en';
139 139
 		}
140 140
 
141
-		if ( isset($args['color']) ) {
142
-			$color = $args['color'];
141
+		if ( isset( $args[ 'color' ] ) ) {
142
+			$color = $args[ 'color' ];
143 143
 		} else {
144
-			$color = get_option('podlove_subscribe_button_default_color', '#599677');
144
+			$color = get_option( 'podlove_subscribe_button_default_color', '#599677' );
145 145
 		}
146 146
 
147
-		if ( isset($args['hide']) && $args['hide'] == 'true' ) {
147
+		if ( isset( $args[ 'hide' ] ) && $args[ 'hide' ] == 'true' ) {
148 148
 			$hide = TRUE;
149 149
 		} else {
150 150
 			$hide = FALSE;
151 151
 		}
152 152
 
153 153
 		// Render button
154
-		return $button->render($size, $autowidth, $style, $format, $color, $hide, $buttonid, $language);
154
+		return $button->render( $size, $autowidth, $style, $format, $color, $hide, $buttonid, $language );
155 155
 	}
156 156
 
157
-	public static function get_array_value_with_fallback($args, $key) {
158
-		if ( isset($args[$key]) )
159
-			return $args[$key];
157
+	public static function get_array_value_with_fallback ( $args, $key ) {
158
+		if ( isset( $args[ $key ] ) )
159
+			return $args[ $key ];
160 160
 
161 161
 		return FALSE;
162 162
 	}
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 	 * @param  string $attribute_value
167 167
 	 * @return string
168 168
 	 */
169
-	private static function get_attribute($attribute=NULL, $attribute_value=NULL) {
170
-		if ( isset($attribute_value) && ctype_alnum($attribute_value) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
169
+	private static function get_attribute ( $attribute = NULL, $attribute_value = NULL ) {
170
+		if ( isset( $attribute_value ) && ctype_alnum( $attribute_value ) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
171 171
 			return $attribute_value;
172 172
 		} else {
173
-			return get_option('podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[$attribute]);
173
+			return get_option( 'podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[ $attribute ] );
174 174
 		}
175 175
 	}
176 176
 
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 	 * @param  string $width_attribute
180 180
 	 * @return string
181 181
 	 */
182
-	private static function interpret_width_attribute( $width_attribute = NULL ) {
182
+	private static function interpret_width_attribute ( $width_attribute = NULL ) {
183 183
 		if ( $width_attribute == 'auto' )
184 184
 			return 'on';
185 185
 		if ( $width_attribute && $width_attribute !== 'auto' )
186 186
 			return 'off';
187 187
 
188
-		return get_option('podlove_subscribe_button_default_autowidth', 'on');
188
+		return get_option( 'podlove_subscribe_button_default_autowidth', 'on' );
189 189
 	}
190 190
 }
191 191
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 		}
146 146
 
147 147
 		if ( isset($args['hide']) && $args['hide'] == 'true' ) {
148
-			$hide = TRUE;
148
+			$hide = true;
149 149
 		} else {
150
-			$hide = FALSE;
150
+			$hide = false;
151 151
 		}
152 152
 
153 153
 		// Render button
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		if ( isset($args[$key]) )
159 159
 			return $args[$key];
160 160
 
161
-		return FALSE;
161
+		return false;
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @param  string $attribute_value
167 167
 	 * @return string
168 168
 	 */
169
-	private static function get_attribute($attribute=NULL, $attribute_value=NULL) {
169
+	private static function get_attribute($attribute=null, $attribute_value=null) {
170 170
 		if ( isset($attribute_value) && ctype_alnum($attribute_value) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
171 171
 			return $attribute_value;
172 172
 		} else {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param  string $width_attribute
180 180
 	 * @return string
181 181
 	 */
182
-	private static function interpret_width_attribute( $width_attribute = NULL ) {
182
+	private static function interpret_width_attribute( $width_attribute = null ) {
183 183
 		if ( $width_attribute == 'auto' )
184 184
 			return 'on';
185 185
 		if ( $width_attribute && $width_attribute !== 'auto' )
Please login to merge, or discard this patch.
model/button.php 3 patches
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.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 * @param  string $name
45 45
 	 * @return object||FALSE
46 46
 	 */
47
-	public static function get_button_by_name($name) {
48
-		if ( $button = \PodloveSubscribeButton\Model\Button::find_one_by_property('name', $name) ) {
47
+	public static function get_button_by_name ( $name ) {
48
+		if ( $button = \PodloveSubscribeButton\Model\Button::find_one_by_property( 'name', $name ) ) {
49 49
 			return $button;
50 50
 		}
51 51
 
52
-		if ( $network_button = \PodloveSubscribeButton\Model\NetworkButton::find_one_by_property('name', $name) ) {
52
+		if ( $network_button = \PodloveSubscribeButton\Model\NetworkButton::find_one_by_property( 'name', $name ) ) {
53 53
 			$network_button->id = $network_button->id . 'N';
54 54
 			return $network_button;
55 55
 		}
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param  array
63 63
 	 * @return array
64 64
 	 */
65
-	public static function get_global_setting_with_fallback( $settings=array() ) {
66
-		foreach (self::$properties as $property => $default) {
67
-			$settings[$property] = ( get_option('podlove_subscribe_button_default_' . $property) ? get_option('podlove_subscribe_button_default_' . $property) : $default );
65
+	public static function get_global_setting_with_fallback ( $settings = array() ) {
66
+		foreach ( self::$properties as $property => $default ) {
67
+			$settings[ $property ] = ( get_option( 'podlove_subscribe_button_default_' . $property ) ? get_option( 'podlove_subscribe_button_default_' . $property ) : $default );
68 68
 		}
69 69
 
70 70
 		return $settings;
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param  boolean $buttonid
82 82
 	 * @return string
83 83
 	 */
84
-	public function render( $size='big', $autowidth='on', $style='filled', $format='rectangle', $color='#599677', $hide = FALSE, $buttonid = FALSE, $language='en' ) {
84
+	public function render ( $size = 'big', $autowidth = 'on', $style = 'filled', $format = 'rectangle', $color = '#599677', $hide = FALSE, $buttonid = FALSE, $language = 'en' ) {
85 85
 		$button_styling = array_merge(
86
-				$this->get_button_styling($size, $autowidth, $style, $format, $color),
86
+				$this->get_button_styling( $size, $autowidth, $style, $format, $color ),
87 87
 				array(
88 88
 						'hide' => $hide,
89 89
 						'buttonid' => $buttonid,
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 				'subtitle' => $this->subtitle,
98 98
 				'description' => $this->description,
99 99
 				'cover' => $this->cover,
100
-				'feeds' => $this->get_feeds_as_array($this->feeds)
100
+				'feeds' => $this->get_feeds_as_array( $this->feeds )
101 101
 			), $button_styling );
102 102
 	}
103 103
 
@@ -105,20 +105,20 @@  discard block
 block discarded – undo
105 105
 	 * Provides the feed as an array in the required format
106 106
 	 * @return array
107 107
 	 */
108
-	private function get_feeds_as_array( $feeds=array() ) {
109
-		foreach ($feeds as $feed) {
110
-			if ( isset(\PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension']) ) {
108
+	private function get_feeds_as_array ( $feeds = array() ) {
109
+		foreach ( $feeds as $feed ) {
110
+			if ( isset( \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ] ) ) {
111 111
 				$new_feed = array(
112 112
 						'type' => 'audio',
113
-						'format' => \PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension'],
114
-						'url' => $feed['url'],
113
+						'format' => \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ],
114
+						'url' => $feed[ 'url' ],
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
-				$feeds[] = $new_feed;
121
+				$feeds[ ] = $new_feed;
122 122
 			}
123 123
 		}
124 124
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 * @param  string $data_attributes
133 133
 	 * @return string 
134 134
 	 */
135
-	private function provide_button_html($podcast_data, $button_styling, $data_attributes="") {
135
+	private function provide_button_html ( $podcast_data, $button_styling, $data_attributes = "" ) {
136 136
 		// Create data attributes for Button
137
-		foreach ($button_styling as $attribute => $value) {
137
+		foreach ( $button_styling as $attribute => $value ) {
138 138
 			$data_attributes .= 'data-' . $attribute . '="' . $value . '" ';
139 139
 		}
140 140
 
141 141
 		return"
142 142
 			<script>
143
-				podcastData".$this->id . " = ".json_encode($podcast_data)."
143
+				podcastData".$this->id . " = " . json_encode( $podcast_data ) . "
144 144
 			</script>
145 145
 			<script 
146 146
 				class=\"podlove-subscribe-button\" 
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
 	 * @param  string $color
159 159
 	 * @return array
160 160
 	 */
161
-	public function get_button_styling($size, $autowidth, $style, $format, $color) {
161
+	public function get_button_styling ( $size, $autowidth, $style, $format, $color ) {
162 162
 
163 163
 		return array(
164 164
 				// $attribute => $value
165
-				'size' => ( $size == 'default' ? get_option('podlove_subscribe_button_default_size', $size) : $size )
166
-			 	. self::interpret_autowidth_attribute($autowidth),
167
-				'style' => ( $style == 'default' ? get_option('podlove_subscribe_button_default_style', $style) : $style ),
168
-				'format' => ( $format == 'default' ? get_option('podlove_subscribe_button_default_format', $format) : $format ),
169
-				'color' => ( isset($color) ? $color : get_option('podlove_subscribe_button_default_color', $color) ),
165
+				'size' => ( $size == 'default' ? get_option( 'podlove_subscribe_button_default_size', $size ) : $size )
166
+			 	. self::interpret_autowidth_attribute( $autowidth ),
167
+				'style' => ( $style == 'default' ? get_option( 'podlove_subscribe_button_default_style', $style ) : $style ),
168
+				'format' => ( $format == 'default' ? get_option( 'podlove_subscribe_button_default_format', $format ) : $format ),
169
+				'color' => ( isset( $color ) ? $color : get_option( 'podlove_subscribe_button_default_color', $color ) ),
170 170
 				'json-data' => 'podcastData' . $this->id
171 171
 			);
172 172
 	}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	 * @param  string $autowidth
177 177
 	 * @return string
178 178
 	 */
179
-	private static function interpret_autowidth_attribute($autowidth) {
180
-		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' )
179
+	private static function interpret_autowidth_attribute ( $autowidth ) {
180
+		if ( $autowidth == 'default' && get_option( 'podlove_subscribe_button_default_autowidth' ) !== 'on' )
181 181
 			return '';
182 182
 
183 183
 		if ( $autowidth !== 'default' && $autowidth !== 'on' )
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			return $network_button;
55 55
 		}
56 56
 
57
-		return FALSE;
57
+		return false;
58 58
 	}
59 59
 
60 60
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param  boolean $buttonid
82 82
 	 * @return string
83 83
 	 */
84
-	public function render( $size='big', $autowidth='on', $style='filled', $format='rectangle', $color='#599677', $hide = FALSE, $buttonid = FALSE, $language='en' ) {
84
+	public function render( $size='big', $autowidth='on', $style='filled', $format='rectangle', $color='#599677', $hide = false, $buttonid = false, $language='en' ) {
85 85
 		$button_styling = array_merge(
86 86
 				$this->get_button_styling($size, $autowidth, $style, $format, $color),
87 87
 				array(
Please login to merge, or discard this patch.
model/base.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
 			$this->set_defaults();
390 390
 
391 391
 			$sql = 'INSERT INTO '
392
-			     . static::table_name()
393
-			     . ' ( '
394
-			     . implode( ',', static::property_names() )
395
-			     . ' ) '
396
-			     . 'VALUES'
397
-			     . ' ( '
398
-			     . implode( ',', array_map( array( $this, 'property_name_to_sql_value' ), static::property_names() ) )
399
-			     . ' );'
392
+				 . static::table_name()
393
+				 . ' ( '
394
+				 . implode( ',', static::property_names() )
395
+				 . ' ) '
396
+				 . 'VALUES'
397
+				 . ' ( '
398
+				 . implode( ',', array_map( array( $this, 'property_name_to_sql_value' ), static::property_names() ) )
399
+				 . ' );'
400 400
 			;
401 401
 			$success = $wpdb->query( $sql );
402 402
 			if ( $success ) {
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 			}
405 405
 		} else {
406 406
 			$sql = 'UPDATE ' . static::table_name()
407
-			     . ' SET '
408
-			     . implode( ',', array_map( array( $this, 'property_name_to_sql_update_statement' ), static::property_names() ) )
409
-			     . ' WHERE id = ' . $this->id
407
+				 . ' SET '
408
+				 . implode( ',', array_map( array( $this, 'property_name_to_sql_update_statement' ), static::property_names() ) )
409
+				 . ' WHERE id = ' . $this->id
410 410
 			;
411 411
 
412 412
 			$success = $wpdb->query( $sql );
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
 		global $wpdb;
455 455
 		
456 456
 		$sql = 'DELETE FROM '
457
-		     . static::table_name()
458
-		     . ' WHERE id = ' . $this->id;
457
+			 . static::table_name()
458
+			 . ' WHERE id = ' . $this->id;
459 459
 
460 460
 		$rows_affected = $wpdb->query( $sql );
461 461
 
462
-	    do_action('podlove_model_delete', $this);
463
-	    do_action('podlove_model_change', $this);
462
+		do_action('podlove_model_delete', $this);
463
+		do_action('podlove_model_change', $this);
464 464
 
465 465
 		return $rows_affected !== false;
466 466
 	}
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 			$property_sql[] = "`{$property['name']}` {$property['type']}";
500 500
 		
501 501
 		$sql = 'CREATE TABLE IF NOT EXISTS '
502
-		     . static::table_name()
503
-		     . ' ('
504
-		     . implode( ',', $property_sql )
505
-		     . ' ) CHARACTER SET utf8;'
502
+			 . static::table_name()
503
+			 . ' ('
504
+			 . implode( ',', $property_sql )
505
+			 . ' ) CHARACTER SET utf8;'
506 506
 		;
507 507
 		
508 508
 		$wpdb->query( $sql );
Please login to merge, or discard this 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.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	private $data = array();
16 16
 	
17
-	public function __set( $name, $value ) {
17
+	public function __set ( $name, $value ) {
18 18
 		if ( static::has_property( $name ) ) {
19 19
 			$this->set_property( $name, $value );
20 20
 		} else {
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 		}
23 23
 	}
24 24
 	
25
-	private function set_property( $name, $value ) {
25
+	private function set_property ( $name, $value ) {
26 26
 		$this->data[ $name ] = $value;
27 27
 	}
28 28
 	
29
-	public function __get( $name ) {
29
+	public function __get ( $name ) {
30 30
 		if ( static::has_property( $name ) ) {
31 31
 			return $this->get_property( $name );
32 32
 		} elseif ( property_exists( $this, $name ) ) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		}
37 37
 	}
38 38
 	
39
-	private function get_property( $name ) {
39
+	private function get_property ( $name ) {
40 40
 		if ( isset( $this->data[ $name ] ) ) {
41 41
 			return $this->data[ $name ];
42 42
 		} else {
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 		}
45 45
 	}
46 46
 
47
-	private static function unserialize_property($property) {
48
-		if ( ! isset($property) )
47
+	private static function unserialize_property ( $property ) {
48
+		if ( ! isset( $property ) )
49 49
 			return;
50 50
 
51
-		if ( $unserialized_string = is_serialized($property) )
52
-			return unserialize($property);
51
+		if ( $unserialized_string = is_serialized( $property ) )
52
+			return unserialize( $property );
53 53
 
54 54
 		return $property;
55 55
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 
64 64
 	 * @return string database table name
65 65
 	 */
66
-	public static function table_name() {
66
+	public static function table_name () {
67 67
 		global $wpdb;
68 68
 		
69 69
 		// prefix with $wpdb prefix
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @param string $name Name of the property / column
80 80
 	 * @param string $type mySQL column type 
81 81
 	 */
82
-	public static function property( $name, $type, $args = array() ) {
82
+	public static function property ( $name, $type, $args = array() ) {
83 83
 		$class = get_called_class();
84 84
 		
85 85
 		if ( ! isset( static::$properties[ $class ] ) ) {
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 		// "id" columns and those ending on "_id" get an index by default
90 90
 		$index = $name == 'id' || stripos( $name, '_id' );
91 91
 		// but if the argument is set, it overrides the default
92
-		if (isset($args['index'])) {
93
-			$index = $args['index'];
92
+		if ( isset( $args[ 'index' ] ) ) {
93
+			$index = $args[ 'index' ];
94 94
 		}
95 95
 		
96
-		static::$properties[ $class ][] = array(
96
+		static::$properties[ $class ][ ] = array(
97 97
 			'name'  => $name,
98 98
 			'type'  => $type,
99 99
 			'index' => $index,
100
-			'index_length' => isset($args['index_length']) ? $args['index_length'] : null,
101
-			'unique' => isset($args['unique']) ? $args['unique'] : null
100
+			'index_length' => isset( $args[ 'index_length' ] ) ? $args[ 'index_length' ] : null,
101
+			'unique' => isset( $args[ 'unique' ] ) ? $args[ 'unique' ] : null
102 102
 		);
103 103
 	}
104 104
 	
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * 
108 108
 	 * @return array property list
109 109
 	 */
110
-	private static function properties() {
110
+	private static function properties () {
111 111
 		$class = get_called_class();
112 112
 		
113 113
 		if ( ! isset( static::$properties[ $class ] ) ) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @param string $name name of the property to test
124 124
 	 * @return bool True if the property exists, else false.
125 125
 	 */
126
-	public static function has_property( $name ) {
126
+	public static function has_property ( $name ) {
127 127
 		return in_array( $name, static::property_names() );
128 128
 	}
129 129
 	
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * 
133 133
 	 * @return array property names
134 134
 	 */
135
-	public static function property_names() {
136
-		return array_map( function ( $p ) { return $p['name']; } , static::properties() );
135
+	public static function property_names () {
136
+		return array_map( function( $p ) { return $p[ 'name' ]; } , static::properties() );
137 137
 	}
138 138
 	
139 139
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * 
142 142
 	 * @return bool True if there is at least one entry, else false.
143 143
 	 */
144
-	public static function has_entries() {
144
+	public static function has_entries () {
145 145
 		return static::count() > 0;
146 146
 	}
147 147
 	
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 	 * 
151 151
 	 * @return int number of rows
152 152
 	 */
153
-	public static function count() {
153
+	public static function count () {
154 154
 		global $wpdb;
155 155
 		
156 156
 		$sql = 'SELECT COUNT(*) FROM ' . static::table_name();
157 157
 		return (int) $wpdb->get_var( $sql );
158 158
 	}
159 159
 
160
-	public static function find_by_id( $id ) {
160
+	public static function find_by_id ( $id ) {
161 161
 		global $wpdb;
162 162
 		
163 163
 		$class = get_called_class();
@@ -171,20 +171,20 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 		
173 173
 		foreach ( $row as $property => $value ) {
174
-			$model->$property = static::unserialize_property($value);
174
+			$model->$property = static::unserialize_property( $value );
175 175
 		}
176 176
 		
177 177
 		return $model;
178 178
 	}
179 179
 
180
-	public static function find_all_by_property( $property, $value ) {
180
+	public static function find_all_by_property ( $property, $value ) {
181 181
 		global $wpdb;
182 182
 		
183 183
 		$class = get_called_class();
184 184
 		$models = array();
185 185
 		
186 186
 		$rows = $wpdb->get_results(
187
-			'SELECT * FROM ' . static::table_name() . ' WHERE ' . $property .  ' = \'' . $value . '\''
187
+			'SELECT * FROM ' . static::table_name() . ' WHERE ' . $property . ' = \'' . $value . '\''
188 188
 		);
189 189
 		
190 190
 		if ( ! $rows ) {
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 			$model = new $class();
196 196
 			$model->flag_as_not_new();
197 197
 			foreach ( $row as $property => $value ) {
198
-				$model->$property = static::unserialize_property($value);
198
+				$model->$property = static::unserialize_property( $value );
199 199
 			}
200
-			$models[] = $model;
200
+			$models[ ] = $model;
201 201
 		}
202 202
 		
203 203
 		return $models;
204 204
 	}
205 205
 
206
-	public static function find_one_by_property( $property, $value ) {
206
+	public static function find_one_by_property ( $property, $value ) {
207 207
 		global $wpdb;
208 208
 		
209 209
 		$class = get_called_class();
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$model->flag_as_not_new();
212 212
 		
213 213
 		$row = $wpdb->get_row(
214
-			'SELECT * FROM ' . static::table_name() . ' WHERE ' . $property .  ' = \'' . $value . '\' LIMIT 0,1'
214
+			'SELECT * FROM ' . static::table_name() . ' WHERE ' . $property . ' = \'' . $value . '\' LIMIT 0,1'
215 215
 		);
216 216
 		
217 217
 		if ( ! $row ) {
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 		}
220 220
 		
221 221
 		foreach ( $row as $property => $value ) {
222
-			$model->$property = static::unserialize_property($value);
222
+			$model->$property = static::unserialize_property( $value );
223 223
 		}
224 224
 		
225 225
 		return $model;
226 226
 	}
227 227
 
228
-	public static function find_all_by_where( $where ) {
228
+	public static function find_all_by_where ( $where ) {
229 229
 		global $wpdb;
230 230
 		
231 231
 		$class = get_called_class();
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
 			$model = new $class();
244 244
 			$model->flag_as_not_new();
245 245
 			foreach ( $row as $property => $value ) {
246
-				$model->$property = static::unserialize_property($value);
246
+				$model->$property = static::unserialize_property( $value );
247 247
 			}
248
-			$models[] = $model;
248
+			$models[ ] = $model;
249 249
 		}
250 250
 		
251 251
 		return $models;
252 252
 	}
253 253
 	
254
-	public static function find_one_by_where( $where ) {
254
+	public static function find_one_by_where ( $where ) {
255 255
 		global $wpdb;
256 256
 		
257 257
 		$class = get_called_class();
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		}
268 268
 		
269 269
 		foreach ( $row as $property => $value ) {
270
-			$model->$property = static::unserialize_property($value);
270
+			$model->$property = static::unserialize_property( $value );
271 271
 		}
272 272
 		
273 273
 		return $model;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param  string $sql_suffix optional SQL, appended after FROM clause
279 279
 	 * @return array list of model objects
280 280
 	 */
281
-	public static function all( $sql_suffix = '' ) {
281
+	public static function all ( $sql_suffix = '' ) {
282 282
 		global $wpdb;
283 283
 		
284 284
 		$class = get_called_class();
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 			$model = new $class();
291 291
 			$model->flag_as_not_new();
292 292
 			foreach ( $row as $property => $value ) {
293
-				$model->$property = static::unserialize_property($value);
293
+				$model->$property = static::unserialize_property( $value );
294 294
 			}
295
-			$models[] = $model;
295
+			$models[ ] = $model;
296 296
 		}
297 297
 		
298 298
 		return $models;
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 	/**
302 302
 	 * True if not yet saved to database. Else false.
303 303
 	 */
304
-	public function is_new() {
304
+	public function is_new () {
305 305
 		return $this->is_new;
306 306
 	}
307 307
 	
308
-	public function flag_as_not_new() {
308
+	public function flag_as_not_new () {
309 309
 		$this->is_new = false;
310 310
 	}
311 311
 
@@ -317,23 +317,23 @@  discard block
 block discarded – undo
317 317
 	 * @param  array $attributes
318 318
 	 * @return bool
319 319
 	 */
320
-	public function update_attributes( $attributes ) {
320
+	public function update_attributes ( $attributes ) {
321 321
 
322 322
 		if ( ! is_array( $attributes ) )
323 323
 			return false;
324 324
 
325
-		$request = filter_input_array(INPUT_POST); // Do this for security reasons
325
+		$request = filter_input_array( INPUT_POST ); // Do this for security reasons
326 326
 			
327 327
 		foreach ( $attributes as $key => $value ) {
328
-			if ( is_array($value) ) {
329
-				$this->{$key} = serialize($value);
328
+			if ( is_array( $value ) ) {
329
+				$this->{$key} = serialize( $value );
330 330
 			} else {
331
-				$this->{$key} = esc_sql($value);
331
+				$this->{$key} = esc_sql( $value );
332 332
 			}
333 333
 		}
334 334
 		
335
-		if ( isset( $request['checkboxes'] ) && is_array( $request['checkboxes'] ) ) {
336
-			foreach ( $request['checkboxes'] as $checkbox ) {
335
+		if ( isset( $request[ 'checkboxes' ] ) && is_array( $request[ 'checkboxes' ] ) ) {
336
+			foreach ( $request[ 'checkboxes' ] as $checkbox ) {
337 337
 				if ( isset( $attributes[ $checkbox ] ) && $attributes[ $checkbox ] === 'on' ) {
338 338
 					$this->$checkbox = 1;
339 339
 				} else {
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 		// @todo this is the wrong place to do this!
346 346
 		// The feed password is the only "passphrase" which is saved. It is not encrypted!
347 347
 		// However, we keep this function for later use
348
-		if ( isset( $request['passwords'] ) && is_array( $request['passwords'] ) ) {
349
-			foreach ( $request['passwords'] as $password ) {
348
+		if ( isset( $request[ 'passwords' ] ) && is_array( $request[ 'passwords' ] ) ) {
349
+			foreach ( $request[ 'passwords' ] as $password ) {
350 350
 				$this->$password = $attributes[ $password ];
351 351
 			}
352 352
 		}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 * @param  mixed  $value
361 361
 	 * @return (bool) query success
362 362
 	 */
363
-	public function update_attribute($attribute, $value) {
363
+	public function update_attribute ( $attribute, $value ) {
364 364
 		global $wpdb;
365 365
 
366 366
 		$this->$attribute = $value;
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			"UPDATE %s SET %s = '%s' WHERE id = %s",
370 370
 			static::table_name(),
371 371
 			$attribute,
372
-			mysqli_real_escape_string($value),
372
+			mysqli_real_escape_string( $value ),
373 373
 			$this->id
374 374
 		);
375 375
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * 
382 382
 	 * @todo use wpdb::insert()
383 383
 	 */
384
-	public function save() {
384
+	public function save () {
385 385
 		global $wpdb;
386 386
 
387 387
 		if ( $this->is_new() ) {
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 
415 415
 		$this->is_new = false;
416 416
 
417
-		do_action('podlove_model_save', $this);
418
-		do_action('podlove_model_change', $this);
417
+		do_action( 'podlove_model_save', $this );
418
+		do_action( 'podlove_model_change', $this );
419 419
 
420 420
 		return $success;
421 421
 	}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 * 
426 426
 	 * @return array
427 427
 	 */
428
-	private function set_defaults() {
428
+	private function set_defaults () {
429 429
 		
430 430
 		$defaults = $this->default_values();
431 431
 
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
 	 * 
447 447
 	 * @return array
448 448
 	 */
449
-	public function default_values() {
449
+	public function default_values () {
450 450
 		return array();
451 451
 	}
452 452
 	
453
-	public function delete() {
453
+	public function delete () {
454 454
 		global $wpdb;
455 455
 		
456 456
 		$sql = 'DELETE FROM '
@@ -459,23 +459,23 @@  discard block
 block discarded – undo
459 459
 
460 460
 		$rows_affected = $wpdb->query( $sql );
461 461
 
462
-	    do_action('podlove_model_delete', $this);
463
-	    do_action('podlove_model_change', $this);
462
+	    do_action( 'podlove_model_delete', $this );
463
+	    do_action( 'podlove_model_change', $this );
464 464
 
465 465
 		return $rows_affected !== false;
466 466
 	}
467 467
 
468
-	private function property_name_to_sql_update_statement( $p ) {
468
+	private function property_name_to_sql_update_statement ( $p ) {
469 469
 		global $wpdb;
470 470
 
471 471
 		if ( $this->$p !== NULL && $this->$p !== '' ) {
472
-			return sprintf( "%s = '%s'", $p, ( is_array($this->$p) ? serialize($this->$p) : $this->$p ) );
472
+			return sprintf( "%s = '%s'", $p, ( is_array( $this->$p ) ? serialize( $this->$p ) : $this->$p ) );
473 473
 		} else {
474 474
 			return "$p = NULL";
475 475
 		}
476 476
 	}
477 477
 	
478
-	private function property_name_to_sql_value( $p ) {
478
+	private function property_name_to_sql_value ( $p ) {
479 479
 		global $wpdb;
480 480
 
481 481
 		if ( $this->$p !== NULL && $this->$p !== '' ) {
@@ -491,12 +491,12 @@  discard block
 block discarded – undo
491 491
 	 * Automatically includes an id column as auto incrementing primary key.
492 492
 	 * @todo allow model changes
493 493
 	 */
494
-	public static function build() {
494
+	public static function build () {
495 495
 		global $wpdb;
496 496
 		
497 497
 		$property_sql = array();
498 498
 		foreach ( static::properties() as $property )
499
-			$property_sql[] = "`{$property['name']}` {$property['type']}";
499
+			$property_sql[ ] = "`{$property[ 'name' ]}` {$property[ 'type' ]}";
500 500
 		
501 501
 		$sql = 'CREATE TABLE IF NOT EXISTS '
502 502
 		     . static::table_name()
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
 	 * - equals "id" or contains "_id"
518 518
 	 * - doesn't have an index yet
519 519
 	 */
520
-	public static function build_indices() {
520
+	public static function build_indices () {
521 521
 		global $wpdb;
522 522
 
523 523
 		$indices_sql = 'SHOW INDEX FROM `' . static::table_name() . '`';
524 524
 		$indices = $wpdb->get_results( $indices_sql );
525
-		$index_columns = array_map( function($index){ return $index->Column_name; }, $indices );
525
+		$index_columns = array_map( function( $index ) { return $index->Column_name; }, $indices );
526 526
 
527 527
 		foreach ( static::properties() as $property ) {
528 528
 
529
-			if ( $property['index'] && ! in_array( $property['name'], $index_columns ) ) {
530
-				$length = isset($property['index_length']) ? '(' . (int) $property['index_length'] . ')' : '';
531
-				$unique = isset($property['unique']) && $property['unique'] ? 'UNIQUE' : '';
532
-				$sql = 'ALTER TABLE `' . static::table_name() . '` ADD ' . $unique . ' INDEX `' . $property['name'] . '` (' . $property['name'] . $length . ')';
529
+			if ( $property[ 'index' ] && ! in_array( $property[ 'name' ], $index_columns ) ) {
530
+				$length = isset( $property[ 'index_length' ] ) ? '(' . (int) $property[ 'index_length' ] . ')' : '';
531
+				$unique = isset( $property[ 'unique' ] ) && $property[ 'unique' ] ? 'UNIQUE' : '';
532
+				$sql = 'ALTER TABLE `' . static::table_name() . '` ADD ' . $unique . ' INDEX `' . $property[ 'name' ] . '` (' . $property[ 'name' ] . $length . ')';
533 533
 				$wpdb->query( $sql );
534 534
 			}
535 535
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * Model identifier.
540 540
 	 */
541
-	public static function name() {
541
+	public static function name () {
542 542
 		// get name of implementing class
543 543
 		$table_name = get_called_class();
544 544
 		// replace backslashes from namespace by underscores
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		} elseif ( property_exists( $this, $name ) ) {
33 33
 			return $this->$name;
34 34
 		} else {
35
-			return NULL;
35
+			return null;
36 36
 		}
37 37
 	}
38 38
 	
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		if ( isset( $this->data[ $name ] ) ) {
41 41
 			return $this->data[ $name ];
42 42
 		} else {
43
-			return NULL;
43
+			return null;
44 44
 		}
45 45
 	}
46 46
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$row = $wpdb->get_row( 'SELECT * FROM ' . static::table_name() . ' WHERE id = ' . (int) $id );
168 168
 		
169 169
 		if ( ! $row ) {
170
-			return NULL;
170
+			return null;
171 171
 		}
172 172
 		
173 173
 		foreach ( $row as $property => $value ) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		);
216 216
 		
217 217
 		if ( ! $row ) {
218
-			return NULL;
218
+			return null;
219 219
 		}
220 220
 		
221 221
 		foreach ( $row as $property => $value ) {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		);
264 264
 		
265 265
 		if ( ! $row ) {
266
-			return NULL;
266
+			return null;
267 267
 		}
268 268
 		
269 269
 		foreach ( $row as $property => $value ) {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			return;
434 434
 
435 435
 		foreach ( $defaults as $property => $value ) {
436
-			if ( $this->$property === NULL )
436
+			if ( $this->$property === null )
437 437
 				$this->$property = $value;
438 438
 		}
439 439
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	private function property_name_to_sql_update_statement( $p ) {
469 469
 		global $wpdb;
470 470
 
471
-		if ( $this->$p !== NULL && $this->$p !== '' ) {
471
+		if ( $this->$p !== null && $this->$p !== '' ) {
472 472
 			return sprintf( "%s = '%s'", $p, ( is_array($this->$p) ? serialize($this->$p) : $this->$p ) );
473 473
 		} else {
474 474
 			return "$p = NULL";
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	private function property_name_to_sql_value( $p ) {
479 479
 		global $wpdb;
480 480
 
481
-		if ( $this->$p !== NULL && $this->$p !== '' ) {
481
+		if ( $this->$p !== null && $this->$p !== '' ) {
482 482
 			return sprintf( "'%s'", $this->$p );
483 483
 		} else {
484 484
 			return 'NULL';
Please login to merge, or discard this patch.
settings/buttons.php 3 patches
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.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Buttons {
6 6
 
7
-	public static function page() {
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>
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 		?>
29 29
 		<div class="wrap">
30
-			<h2><?php echo __( 'Podcast 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 echo __( 'Add New', 'podlove-subscribe-button' ); ?></a></h2>
30
+			<h2><?php echo __( 'Podcast 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 echo __( '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;
@@ -44,70 +44,70 @@  discard block
 block discarded – undo
44 44
 	/**
45 45
 	 * Process form: save/update a format
46 46
 	 */
47
-	public static function save() {
48
-		if ( null == filter_input(INPUT_GET, 'button') )
47
+	public static function save () {
48
+		if ( null == filter_input( INPUT_GET, 'button' ) )
49 49
 			return;
50 50
 
51
-		$post = filter_input_array(INPUT_POST);
51
+		$post = filter_input_array( INPUT_POST );
52 52
 
53
-		$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') ) );
54
-		$button->update_attributes( $post['podlove_button'] );
53
+		$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' ) ) );
54
+		$button->update_attributes( $post[ 'podlove_button' ] );
55 55
 
56
-		if ( isset($post['submit_and_stay']) ) {
57
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
56
+		if ( isset( $post[ 'submit_and_stay' ] ) ) {
57
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? TRUE : FALSE ) );
58 58
 		} else {
59
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
59
+			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? TRUE : FALSE ) );
60 60
 		}
61 61
 	}
62 62
 	/**
63 63
 	 * Process form: create a format
64 64
 	 */
65
-	public static function create() {
65
+	public static function create () {
66 66
 		global $wpdb;
67 67
 
68
-		$post = filter_input_array(INPUT_POST);
68
+		$post = filter_input_array( INPUT_POST );
69 69
 
70
-		$button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
71
-		$button->update_attributes( $post['podlove_button'] );
70
+		$button = ( filter_input( INPUT_GET, 'network' ) === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
71
+		$button->update_attributes( $post[ 'podlove_button' ] );
72 72
 
73
-		if ( isset($post['submit_and_stay']) ) {
74
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
73
+		if ( isset( $post[ 'submit_and_stay' ] ) ) {
74
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? TRUE : FALSE ) );
75 75
 		} else {
76
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
76
+			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? TRUE : FALSE ) );
77 77
 		}
78 78
 	}
79 79
 
80 80
 	/**
81 81
 	 * Process form: delete a format
82 82
 	 */
83
-	public static function delete() {
84
-		if ( null ==  filter_input(INPUT_GET, 'button') )
83
+	public static function delete () {
84
+		if ( null == filter_input( INPUT_GET, 'button' ) )
85 85
 			return;
86 86
 
87
-		$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') ) );
87
+		$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 88
 		$button->delete();
89 89
 
90
-		self::redirect( 'index', NULL, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
90
+		self::redirect( 'index', NULL, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? TRUE : FALSE ) );
91 91
 	}
92 92
 
93 93
 	/**
94 94
 	 * Helper method: redirect to a certain page.
95 95
 	 */
96
-	public static function redirect( $action, $button_id = NULL, $params = array(), $network = FALSE ) {
97
-		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input(INPUT_GET, 'page');
96
+	public static function redirect ( $action, $button_id = NULL, $params = array(), $network = FALSE ) {
97
+		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input( INPUT_GET, 'page' );
98 98
 		$show    = ( $button_id ) ? '&button=' . $button_id : '';
99 99
 		$action  = '&action=' . $action;
100 100
 
101
-		array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } );
101
+		array_walk( $params, function( &$value, $key ) { $value = "&$key=$value"; } );
102 102
 
103 103
 		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
104 104
 	}
105 105
 
106
-	public static function process_form() {
107
-		if ( null === filter_input(INPUT_GET, 'button') )
106
+	public static function process_form () {
107
+		if ( null === filter_input( INPUT_GET, 'button' ) )
108 108
 			return;
109 109
 
110
-		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : NULL );
110
+		$action = ( null !== filter_input( INPUT_GET, 'action' ) ? filter_input( INPUT_GET, 'action' ) : NULL );
111 111
 
112 112
 		if ( $action === 'save' ) {
113 113
 			self::save();
@@ -118,35 +118,35 @@  discard block
 block discarded – undo
118 118
 		}
119 119
 	}
120 120
 
121
-	public static function new_template() {
122
-		if ( filter_input(INPUT_GET, 'network') == '1' ) {
121
+	public static function new_template () {
122
+		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
123 123
 			$button = new \PodloveSubscribeButton\Model\NetworkButton;
124 124
 		} else {
125 125
 			$button = new \PodloveSubscribeButton\Model\Button;
126 126
 		}
127 127
 
128
-		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'.
128
+		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>' .
129 129
 				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
130 130
 		self::form_template( $button, 'create' );
131 131
 	}
132 132
 
133
-	public static function edit_template() {
134
-		if ( filter_input(INPUT_GET, 'network') == '1' ) {
135
-			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') );
133
+	public static function edit_template () {
134
+		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
135
+			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input( INPUT_GET, 'button' ) );
136 136
 		} else {
137
-			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') );
137
+			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input( INPUT_GET, 'button' ) );
138 138
 		}
139 139
 
140 140
 		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), $button->title ) . '</h3>';
141 141
 		self::form_template( $button, 'save' );
142 142
 	}
143 143
 
144
-	public static function view_template() {
144
+	public static function view_template () {
145 145
 		$is_network = is_network_admin();
146 146
 		?>
147
-		<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'); ?></p>
148
-		<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'); ?></p>
149
-		<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'); ?></p>
147
+		<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' ); ?></p>
148
+		<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' ); ?></p>
149
+		<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' ); ?></p>
150 150
 		<?php
151 151
 		$table = new \PodloveSubscribeButton\Button_List_Table;
152 152
 		$table->prepare_items();
@@ -157,49 +157,49 @@  discard block
 block discarded – undo
157 157
 
158 158
 		if ( ! $is_network ) :
159 159
 		?>
160
-		<h3><?php _e('Default Settings', 'podlove'); ?></h3>
160
+		<h3><?php _e( 'Default Settings', 'podlove' ); ?></h3>
161 161
 		<form method="post" action="options.php">
162 162
 			<?php settings_fields( 'podlove-subscribe-button' ); ?>
163 163
 			<?php do_settings_sections( 'podlove-subscribe-button' ); ?>
164 164
 			<table class="form-table">
165 165
 				<tr valign="top">
166
-				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e('Size', 'podlove'); ?></label></th>
166
+				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e( 'Size', 'podlove' ); ?></label></th>
167 167
 				<td>
168 168
 					<select name="podlove_subscribe_button_default_size" id="podlove_subscribe_button_default_size">
169
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$size as $value => $description) : ?>
170
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['size'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
169
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$size as $value => $description ) : ?>
170
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'size' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
171 171
 						<?php endforeach; ?>
172 172
 					</select>
173 173
 				</td>
174 174
 				</tr>
175 175
 				<tr valign="top">
176
-				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e('Autowidth', 'podlove'); ?></label></th>
176
+				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e( 'Autowidth', 'podlove' ); ?></label></th>
177 177
 				<td>
178
-					<input type="checkbox" name="podlove_subscribe_button_default_autowidth" id="podlove_subscribe_button_default_autowidth" <?php echo ( $settings['autowidth'] == 'on' ? 'checked' : '' ) ?> />
178
+					<input type="checkbox" name="podlove_subscribe_button_default_autowidth" id="podlove_subscribe_button_default_autowidth" <?php echo ( $settings[ 'autowidth' ] == 'on' ? 'checked' : '' ) ?> />
179 179
 				</td>
180 180
 				</tr>
181 181
 				<tr valign="top">
182
-				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e('Color', 'podlove'); ?></label></th>
182
+				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e( 'Color', 'podlove' ); ?></label></th>
183 183
 				<td>
184
-					<input id="podlove_subscribe_button_default_color" name="podlove_subscribe_button_default_color" class="podlove_subscribe_button_color" value="<?php echo $settings['color'] ?>" />
184
+					<input id="podlove_subscribe_button_default_color" name="podlove_subscribe_button_default_color" class="podlove_subscribe_button_color" value="<?php echo $settings[ 'color' ] ?>" />
185 185
 				</td>
186 186
 				</tr>
187 187
 				<tr valign="top">
188
-				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e('Style', 'podlove'); ?></label></th>
188
+				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e( 'Style', 'podlove' ); ?></label></th>
189 189
 				<td>
190 190
 					<select name="podlove_subscribe_button_default_style" id="podlove_subscribe_button_default_style">
191
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$style as $value => $description) : ?>
192
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['style'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
191
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$style as $value => $description ) : ?>
192
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'style' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
193 193
 						<?php endforeach; ?>
194 194
 					</select>
195 195
 				</td>
196 196
 				</tr>
197 197
 				<tr valign="top">
198
-				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e('Format', 'podlove'); ?></label></th>
198
+				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e( 'Format', 'podlove' ); ?></label></th>
199 199
 				<td>
200 200
 					<select name="podlove_subscribe_button_default_format" id="podlove_subscribe_button_default_format">
201
-						<?php foreach (\PodloveSubscribeButton\Model\Button::$format as $value => $description) : ?>
202
-							<option value="<?php echo $value; ?>" <?php echo ( $settings['format'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
201
+						<?php foreach ( \PodloveSubscribeButton\Model\Button::$format as $value => $description ) : ?>
202
+							<option value="<?php echo $value; ?>" <?php echo ( $settings[ 'format' ] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
203 203
 						<?php endforeach; ?>
204 204
 					</select>
205 205
 				</td>
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		endif;
212 212
 	}
213 213
 
214
-	private static function form_template( $button, $action ) {
214
+	private static function form_template ( $button, $action ) {
215 215
 		// Enqueue Scripts for Media Manager
216 216
 		wp_enqueue_media();
217 217
 		// Adjust if is_network
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
 					<tbody>
224 224
 					<tr>
225 225
 						<td scope="row">
226
-							<label for="podlove_button_name"><?php _e('Button ID', 'podlove'); ?></label>
226
+							<label for="podlove_button_name"><?php _e( 'Button ID', 'podlove' ); ?></label>
227 227
 						</td>
228 228
 						<td>
229 229
 							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo $button->name; ?>" />
230
-							<br /><span class="description"><?php _e('The ID will be used as in internal identifier for shortcodes.', 'podlove'); ?></span>
230
+							<br /><span class="description"><?php _e( 'The ID will be used as in internal identifier for shortcodes.', 'podlove' ); ?></span>
231 231
 						</td>
232 232
 					</tr>
233 233
 					<tr>
234 234
 						<td scope="row">
235
-							<label for="podlove_button_title"><?php _e('Podcast Title', 'podlove'); ?></label>
235
+							<label for="podlove_button_title"><?php _e( 'Podcast Title', 'podlove' ); ?></label>
236 236
 						</td>
237 237
 						<td>
238 238
 							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo $button->title; ?>" />
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 					</tr>
241 241
 					<tr>
242 242
 						<td scope="row">
243
-							<label for="podlove_button_subtitle"><?php _e('Podcast Subtitle', 'podlove'); ?></label>
243
+							<label for="podlove_button_subtitle"><?php _e( 'Podcast Subtitle', 'podlove' ); ?></label>
244 244
 						</td>
245 245
 						<td>
246 246
 							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo $button->subtitle; ?>" />
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 					</tr>
249 249
 					<tr>
250 250
 						<td scope="row">
251
-							<label for="podlove_button_description"><?php _e('Podcast Description', 'podlove'); ?></label>
251
+							<label for="podlove_button_description"><?php _e( 'Podcast Description', 'podlove' ); ?></label>
252 252
 						</td>
253 253
 						<td>
254 254
 							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo $button->description; ?></textarea>
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					</tr>
257 257
 					<tr>
258 258
 						<td scope="row">
259
-							<label for="podlove-button-cover"><?php _e('Podcast Image URL', 'podlove'); ?></label>
259
+							<label for="podlove-button-cover"><?php _e( 'Podcast Image URL', 'podlove' ); ?></label>
260 260
 						</td>
261 261
 						<td>
262 262
 							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo $button->cover; ?>" />
@@ -274,29 +274,29 @@  discard block
 block discarded – undo
274 274
 					</tr>
275 275
 					<tr>
276 276
 						<td scope="row">
277
-							<label for="feeds_table"><?php _e('Podcast Feeds', 'podlove'); ?></label>
277
+							<label for="feeds_table"><?php _e( 'Podcast Feeds', 'podlove' ); ?></label>
278 278
 						</td>
279 279
 						<td>
280 280
 							<table id="feeds_table" class="podlove_alternating" border="0" cellspacing="0">
281 281
 								<thead>
282 282
 									<tr>
283
-										<th><?php _e('URL', 'podlove'); ?></th>
284
-										<th><?php _e('iTunes feed ID', 'podlove'); ?></th>
285
-										<th><?php _e('Media format', 'podlove'); ?></th>
286
-										<th><?php _e('Actions', 'podlove'); ?></th>
283
+										<th><?php _e( 'URL', 'podlove' ); ?></th>
284
+										<th><?php _e( 'iTunes feed ID', 'podlove' ); ?></th>
285
+										<th><?php _e( 'Media format', 'podlove' ); ?></th>
286
+										<th><?php _e( 'Actions', 'podlove' ); ?></th>
287 287
 									</tr>
288 288
 								</thead>
289 289
 								<tbody id="feeds_table_body">
290 290
 								</tbody>
291 291
 							</table>
292 292
 							<input type="button" class="button add_feed" value="+" />
293
-							<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'); ?></span></p>
293
+							<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' ); ?></span></p>
294 294
 						</td>
295 295
 					</tr>
296 296
 					</tbody>
297 297
 				</table>
298
-				<input name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', 'podlove'); ?>" type="submit" />
299
-				<input type="submit" name="submit_and_stay" id="submit_and_stay" class="button" value="<?php _e('Save Changes and Continue Editing', 'podlove'); ?>"  />
298
+				<input name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'podlove' ); ?>" type="submit" />
299
+				<input type="submit" name="submit_and_stay" id="submit_and_stay" class="button" value="<?php _e( 'Save Changes and Continue Editing', 'podlove' ); ?>"  />
300 300
 
301 301
 				<script type="text/template" id="feed_line_template">
302 302
 					<tr>
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 						<td>
310 310
 							<select class="regular-text podlove-media-format" name="podlove_button[feeds][{{id}}][format]">
311 311
 								<?php
312
-									foreach (\PodloveSubscribeButton\MediaTypes::$audio as $id => $audio) {
313
-										echo "<option value='".$id."'>".$audio['title']."</option>\n";
312
+									foreach ( \PodloveSubscribeButton\MediaTypes::$audio as $id => $audio ) {
313
+										echo "<option value='" . $id . "'>" . $audio[ 'title' ] . "</option>\n";
314 314
 									}
315 315
 								?>
316 316
 							</select>
@@ -319,16 +319,16 @@  discard block
 block discarded – undo
319 319
 					</tr>
320 320
 				</script>
321 321
 				<script type="text/javascript">
322
-					var feeds = <?php echo json_encode($button->feeds); ?>;
322
+					var feeds = <?php echo json_encode( $button->feeds ); ?>;
323 323
 				</script>
324 324
 		</form>
325 325
 		<?php
326 326
 	}
327 327
 
328
-	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
328
+	public static function get_action_link ( $button, $title, $action = 'edit', $type = 'link' ) {
329 329
 		return sprintf(
330
-			'<a href="?page=%s&action=%s&button=%s&network='.is_network_admin().'"%s>' . $title . '</a>',
331
-			filter_input(INPUT_GET, 'page'),
330
+			'<a href="?page=%s&action=%s&button=%s&network=' . is_network_admin() . '"%s>' . $title . '</a>',
331
+			filter_input( INPUT_GET, 'page' ),
332 332
 			$action,
333 333
 			$button->id,
334 334
 			$type == 'button' ? ' class="button"' : ''
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  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 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') ) );
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>
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 		$button->update_attributes( $post['podlove_button'] );
55 55
 
56 56
 		if ( isset($post['submit_and_stay']) ) {
57
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
57
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
58 58
 		} else {
59
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
59
+			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
60 60
 		}
61 61
 	}
62 62
 	/**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		$button->update_attributes( $post['podlove_button'] );
72 72
 
73 73
 		if ( isset($post['submit_and_stay']) ) {
74
-			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
74
+			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
75 75
 		} else {
76
-			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
76
+			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
77 77
 		}
78 78
 	}
79 79
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$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 88
 		$button->delete();
89 89
 
90
-		self::redirect( 'index', NULL, array(), ( filter_input(INPUT_GET, 'network') === '1' ? TRUE : FALSE ) );
90
+		self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
91 91
 	}
92 92
 
93 93
 	/**
94 94
 	 * Helper method: redirect to a certain page.
95 95
 	 */
96
-	public static function redirect( $action, $button_id = NULL, $params = array(), $network = FALSE ) {
96
+	public static function redirect( $action, $button_id = null, $params = array(), $network = false ) {
97 97
 		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input(INPUT_GET, 'page');
98 98
 		$show    = ( $button_id ) ? '&button=' . $button_id : '';
99 99
 		$action  = '&action=' . $action;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		if ( null === filter_input(INPUT_GET, 'button') )
108 108
 			return;
109 109
 
110
-		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : NULL );
110
+		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
111 111
 
112 112
 		if ( $action === 'save' ) {
113 113
 			self::save();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		// Adjust if is_network
218 218
 		$is_network = is_network_admin();
219 219
 		?>
220
-		<form method="post" action="<?php echo ( $is_network === TRUE ? '/wp-admin/network/settings' : 'options-general' ) ?>.php?page=podlove-subscribe-button&button=<?php echo $button->id; ?>&action=<?php echo $action; ?>&network=<?php echo $is_network; ?>">
220
+		<form method="post" action="<?php echo ( $is_network === true ? '/wp-admin/network/settings' : 'options-general' ) ?>.php?page=podlove-subscribe-button&button=<?php echo $button->id; ?>&action=<?php echo $action; ?>&network=<?php echo $is_network; ?>">
221 221
 			<input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" />
222 222
 			<table class="form-table" border="0" cellspacing="0">
223 223
 					<tbody>
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*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>',
30
-		    /*$3%s*/ $this->row_actions( $actions )
29
+			/*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>',
30
+			/*$3%s*/ $this->row_actions( $actions )
31 31
 		);
32 32
 	}
33 33
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 		
84 84
 		// register pagination options & calculations
85 85
 		$this->set_pagination_args( array(
86
-		    'total_items' => $total_items,
87
-		    'per_page'    => $per_page,
88
-		    'total_pages' => ceil( $total_items / $per_page )
86
+			'total_items' => $total_items,
87
+			'per_page'    => $per_page,
88
+			'total_pages' => ceil( $total_items / $per_page )
89 89
 		) );
90 90
 	}
91 91
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@  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
 	}
20 20
 	
21
-	function column_name( $button ) {
21
+	function column_name ( $button ) {
22 22
 
23 23
 		$actions = array(
24 24
 			'edit'   => Settings\Buttons::get_action_link( $button, __( 'Edit', 'podlove-subscribe-button' ), 'edit' ),
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',
28
+		return sprintf( '%1$s %2$s',
29 29
 		    /*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>',
30 30
 		    /*$3%s*/ $this->row_actions( $actions )
31 31
 		);
32 32
 	}
33 33
 
34
-	function column_button_preview( $button ) {
34
+	function column_button_preview ( $button ) {
35 35
 		if ( ! $button->feeds )
36 36
 			return;
37 37
 
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
 			. $button->render(
42 42
 					'big',
43 43
 					'false',
44
-					get_option('podlove_subscribe_button_default_style', 'filled'),
44
+					get_option( 'podlove_subscribe_button_default_style', 'filled' ),
45 45
 					'rectangle'
46 46
 				) 
47 47
 			. "</div>";
48 48
 	}
49 49
 	
50
-	function column_id( $button ) {
50
+	function column_id ( $button ) {
51 51
 		return $button->id;
52 52
 	}
53 53
 
54
-	function get_columns(){
54
+	function get_columns () {
55 55
 		return array(
56 56
 			'name'    => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
57 57
 			'button_preview'    => __( 'Preview', 'podlove-subscribe-button' )
58 58
 		);
59 59
 	}
60 60
 	
61
-	function prepare_items() {
61
+	function prepare_items () {
62 62
 		// number of items per page
63 63
 		$per_page = 1000;
64 64
 		
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		// get total items
78 78
 		$total_items = count( $data );
79 79
 		// extrage page for current page only
80
-		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ) , $per_page );
80
+		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
81 81
 		// add items to table
82 82
 		$this->items = $data;
83 83
 		
Please login to merge, or discard this 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.
widget.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,5 +139,5 @@
 block discarded – undo
139 139
 	}
140 140
 }
141 141
 add_action( 'widgets_init', function(){
142
-     register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
142
+	 register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
143 143
 });
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -6,57 +6,57 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Podlove_Subscribe_Button_Widget extends \WP_Widget {
8 8
 
9
-	public function __construct() {
9
+	public function __construct () {
10 10
 		parent::__construct(
11 11
 					'podlove_subscribe_button_wp_plugin_widget',
12 12
 					( self::is_podlove_publisher_active() ? 'Podlove Subscribe Button' : 'Podlove Subscribe Button (WordPress plugin)' ),
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
-	public static function is_podlove_publisher_active() {
20
-		if ( is_plugin_active("podlove-publisher/plugin.php") )
19
+	public static function is_podlove_publisher_active () {
20
+		if ( is_plugin_active( "podlove-publisher/plugin.php" ) )
21 21
 			return true;
22 22
 
23 23
 		return false;
24 24
 	}
25 25
 
26
-	public function widget( $args, $instance ) {
26
+	public function widget ( $args, $instance ) {
27 27
 		// Fetch the (network)button by it's name
28
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) )
29
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
28
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $instance[ 'button' ] ) )
29
+			return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] );
30 30
 
31
-		echo $args['before_widget'];
32
-		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
31
+		echo $args[ 'before_widget' ];
32
+		echo $args[ 'before_title' ] . apply_filters( 'widget_title', $instance[ 'title' ] ) . $args[ 'after_title' ];
33 33
 
34 34
 		echo $button->render(
35
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'size'),
36
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'autowidth'),
37
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'style'),
38
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'format'), 
39
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
35
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'size' ),
36
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'autowidth' ),
37
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'style' ),
38
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'format' ), 
39
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'color' )
40 40
 			);
41 41
 		
42
-		if ( strlen($instance['infotext']) )
43
-			echo wpautop($instance['infotext']);
42
+		if ( strlen( $instance[ 'infotext' ] ) )
43
+			echo wpautop( $instance[ 'infotext' ] );
44 44
 
45
-		echo $args['after_widget'];
45
+		echo $args[ 'after_widget' ];
46 46
 	}	
47 47
 
48
-	public function form( $instance ) {
49
-		foreach (self::$widget_settings as $setting) {
50
-			$$setting = isset( $instance[$setting] ) ? $instance[$setting] : '';
48
+	public function form ( $instance ) {
49
+		foreach ( self::$widget_settings as $setting ) {
50
+			$$setting = isset( $instance[ $setting ] ) ? $instance[ $setting ] : '';
51 51
 		}
52 52
 
53 53
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
54 54
 		if ( is_multisite() )
55 55
 			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
56 56
 
57
-		$buttons_as_options = function ($buttons) {
58
-			foreach ($buttons as $subscribebutton) {
59
-				echo "<option value='".$subscribebutton->name."' ".( $subscribebutton->name == $button ? 'selected=\"selected\"' : '' )." >".$subscribebutton->title." (".$subscribebutton->name.")</option>";
57
+		$buttons_as_options = function( $buttons ) {
58
+			foreach ( $buttons as $subscribebutton ) {
59
+				echo "<option value='" . $subscribebutton->name . "' " . ( $subscribebutton->name == $button ? 'selected=\"selected\"' : '' ) . " >" . $subscribebutton->title . " (" . $subscribebutton->name . ")</option>";
60 60
 			}
61 61
 		}
62 62
 		?>
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 			<label for="<?php echo $this->get_field_id( 'button' ); ?>"><?php _e( 'Button', 'podlove-subscribe-button' ); ?></label> 
79 79
 			<select class="widefat" id="<?php echo $this->get_field_id( 'button' ); ?>"
80 80
 				      name="<?php echo $this->get_field_name( 'button' ); ?>">
81
-				<?php if ( isset($network_buttons) && count($network_buttons) > 0 ) : ?>
82
-					<optgroup label="<?php _e('Local', 'podlove'); ?>">
83
-						<?php $buttons_as_options($buttons); ?>
81
+				<?php if ( isset( $network_buttons ) && count( $network_buttons ) > 0 ) : ?>
82
+					<optgroup label="<?php _e( 'Local', 'podlove' ); ?>">
83
+						<?php $buttons_as_options( $buttons ); ?>
84 84
 					</optgroup>
85
-					<optgroup label="<?php _e('Network', 'podlove'); ?>">
86
-						<?php $buttons_as_options($network_buttons); ?>
85
+					<optgroup label="<?php _e( 'Network', 'podlove' ); ?>">
86
+						<?php $buttons_as_options( $network_buttons ); ?>
87 87
 					</optgroup>
88 88
 				<?php else : 
89
-					$buttons_as_options($buttons);
89
+					$buttons_as_options( $buttons );
90 90
 				 endif; ?>
91 91
 			</select>
92 92
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 						)
111 111
 				);
112 112
 
113
-			foreach ($customize_options as $slug => $properties) : ?>
114
-				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php _e( $properties['name'], 'podlove-subscribe-button' ); ?></label> 
113
+			foreach ( $customize_options as $slug => $properties ) : ?>
114
+				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php _e( $properties[ 'name' ], 'podlove-subscribe-button' ); ?></label> 
115 115
 				<select class="widefat" id="<?php echo $this->get_field_id( $slug ); ?>" name="<?php echo $this->get_field_name( $slug ); ?>">
116
-					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php _e( 'Default ' . $properties['name'], 'podlove-subscribe-button' ) ?></option>
116
+					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php _e( 'Default ' . $properties[ 'name' ], 'podlove-subscribe-button' ) ?></option>
117 117
 					<optgroup>
118
-						<?php foreach ( $properties['options'] as $property => $name ) : ?>
118
+						<?php foreach ( $properties[ 'options' ] as $property => $name ) : ?>
119 119
 						<option value="<?php echo $property; ?>" <?php echo ( $$slug == $property ? 'selected="selected"' : '' ); ?>><?php _e( $name, 'podlove-subscribe-button' ) ?></option>
120 120
 						<?php endforeach; ?>
121 121
 					</optgroup>
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 		<?php 
129 129
 	}
130 130
 
131
-	public function update( $new_instance, $old_instance ) {
131
+	public function update ( $new_instance, $old_instance ) {
132 132
 		$instance = array();
133 133
 
134
-		foreach (self::$widget_settings as $setting) {
135
-			$instance[$setting]  = ( ! empty( $new_instance[$setting] ) ) ? strip_tags( $new_instance[$setting] ) : '';
134
+		foreach ( self::$widget_settings as $setting ) {
135
+			$instance[ $setting ] = ( ! empty( $new_instance[ $setting ] ) ) ? strip_tags( $new_instance[ $setting ] ) : '';
136 136
 		}
137 137
 
138 138
 		return $instance;
139 139
 	}
140 140
 }
141
-add_action( 'widgets_init', function(){
141
+add_action( 'widgets_init', function() {
142 142
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
143 143
 });
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +16 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,16 +17,18 @@  discard block
 block discarded – undo
17 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-publisher/plugin.php") )
21
-			return true;
20
+		if ( is_plugin_active("podlove-publisher/plugin.php") ) {
21
+					return true;
22
+		}
22 23
 
23 24
 		return false;
24 25
 	}
25 26
 
26 27
 	public function widget( $args, $instance ) {
27 28
 		// Fetch the (network)button by it's name
28
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) )
29
-			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
+		}
30 32
 
31 33
 		echo $args['before_widget'];
32 34
 		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
@@ -39,8 +41,9 @@  discard block
 block discarded – undo
39 41
 				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
40 42
 			);
41 43
 		
42
-		if ( strlen($instance['infotext']) )
43
-			echo wpautop($instance['infotext']);
44
+		if ( strlen($instance['infotext']) ) {
45
+					echo wpautop($instance['infotext']);
46
+		}
44 47
 
45 48
 		echo $args['after_widget'];
46 49
 	}	
@@ -51,8 +54,9 @@  discard block
 block discarded – undo
51 54
 		}
52 55
 
53 56
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
54
-		if ( is_multisite() )
55
-			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
57
+		if ( is_multisite() ) {
58
+					$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
59
+		}
56 60
 
57 61
 		$buttons_as_options = function ($buttons) {
58 62
 			foreach ($buttons as $subscribebutton) {
@@ -85,8 +89,10 @@  discard block
 block discarded – undo
85 89
 					<optgroup label="<?php _e('Network', 'podlove'); ?>">
86 90
 						<?php $buttons_as_options($network_buttons); ?>
87 91
 					</optgroup>
88
-				<?php else : 
92
+				<?php else {
93
+	: 
89 94
 					$buttons_as_options($buttons);
95
+}
90 96
 				 endif; ?>
91 97
 			</select>
92 98
 
@@ -138,6 +144,6 @@  discard block
 block discarded – undo
138 144
 		return $instance;
139 145
 	}
140 146
 }
141
-add_action( 'widgets_init', function(){
147
+add_action( 'widgets_init', function() {
142 148
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
143 149
 });
144 150
\ No newline at end of file
Please login to merge, or discard this patch.
model/network_button.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 
4 4
 class NetworkButton extends Button {
5 5
 
6
-	public static function table_name() {
6
+	public static function table_name () {
7 7
 		global $wpdb;
8 8
 		
9 9
 		// prefix with $wpdb prefix
Please login to merge, or discard this patch.
version.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 add_action( 'admin_init', '\PodloveSubscribeButton\maybe_run_database_migrations' );
46 46
 add_action( 'admin_init', '\PodloveSubscribeButton\run_database_migrations', 5 );
47 47
 
48
-function maybe_run_database_migrations() {
49
-	$database_version = get_option('podlove_subscribe_button_plugin_database_version');
48
+function maybe_run_database_migrations () {
49
+	$database_version = get_option( 'podlove_subscribe_button_plugin_database_version' );
50 50
 
51 51
 	if ( $database_version === false ) {
52 52
 		// plugin has just been installed or Plugin Version < 1.3
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
 	}
55 55
 }
56 56
 
57
-function run_database_migrations() {
58
-	if (get_option('podlove_subscribe_button_plugin_database_version') >= DATABASE_VERSION)
57
+function run_database_migrations () {
58
+	if ( get_option( 'podlove_subscribe_button_plugin_database_version' ) >= DATABASE_VERSION )
59 59
 		return;
60 60
 
61
-	if (is_multisite()) {
62
-		set_time_limit(0); // may take a while, depending on network size
63
-		\PodloveSubscribeButton\for_every_podcast_blog(function() { migrate_for_current_blog(); });
61
+	if ( is_multisite() ) {
62
+		set_time_limit( 0 ); // may take a while, depending on network size
63
+		\PodloveSubscribeButton\for_every_podcast_blog( function() { migrate_for_current_blog(); });
64 64
 	} else {
65 65
 		migrate_for_current_blog();
66 66
 	}
67 67
 
68
-	if (isset($_REQUEST['_wp_http_referer']) && $_REQUEST['_wp_http_referer']) {
69
-		wp_redirect($_REQUEST['_wp_http_referer']);
68
+	if ( isset( $_REQUEST[ '_wp_http_referer' ] ) && $_REQUEST[ '_wp_http_referer' ] ) {
69
+		wp_redirect( $_REQUEST[ '_wp_http_referer' ] );
70 70
 		exit;
71 71
 	}
72 72
 }
73 73
 
74
-function migrate_for_current_blog() {
75
-	$database_version = get_option('podlove_subscribe_button_plugin_database_version');
74
+function migrate_for_current_blog () {
75
+	$database_version = get_option( 'podlove_subscribe_button_plugin_database_version' );
76 76
 
77
-	for ($i = $database_version+1; $i <= DATABASE_VERSION; $i++) { 
78
-		\PodloveSubscribeButton\run_migrations_for_version($i);
79
-		update_option('podlove_subscribe_button_plugin_database_version', $i);
77
+	for ( $i = $database_version + 1; $i <= DATABASE_VERSION; $i++ ) { 
78
+		\PodloveSubscribeButton\run_migrations_for_version( $i );
79
+		update_option( 'podlove_subscribe_button_plugin_database_version', $i );
80 80
 	}
81 81
 }
82 82
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  * 
88 88
  * @param  int $version
89 89
  */
90
-function run_migrations_for_version( $version ) {
90
+function run_migrations_for_version ( $version ) {
91 91
 	global $wpdb;
92 92
 	
93 93
 	switch ( $version ) {}
Please login to merge, or discard this 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.