GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 3b4963...d53694 )
by Christian
02:09
created
constants.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,6 +3,6 @@
 block discarded – undo
3 3
 namespace PodloveSubscribeButton;
4 4
 
5 5
 define( __NAMESPACE__ . '\PLUGIN_FILE_NAME', strtolower( preg_replace( '/([a-z])([A-Z])/', '$1-$2', __NAMESPACE__ ) ) . '.php' );
6
-define( __NAMESPACE__ . '\PLUGIN_DIR' , plugin_dir_path( dirname(__FILE__) ) );
6
+define( __NAMESPACE__ . '\PLUGIN_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
7 7
 define( __NAMESPACE__ . '\PLUGIN_FILE', PLUGIN_DIR . PLUGIN_FILE_NAME );
8
-define( __NAMESPACE__ . '\PLUGIN_URL' , plugins_url( '', PLUGIN_FILE ) );
9 8
\ No newline at end of file
9
+define( __NAMESPACE__ . '\PLUGIN_URL', plugins_url( '', PLUGIN_FILE ) );
10 10
\ No newline at end of file
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
@@ -140,5 +140,5 @@
 block discarded – undo
140 140
 	}
141 141
 }
142 142
 add_action( 'widgets_init', function(){
143
-     register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
143
+	 register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
144 144
 });
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function widget( $args, $instance ) {
28 28
 		// Fetch the (network)button by it's name
29
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) )
30
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
29
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) ) {
30
+					return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
31
+		}
31 32
 
32 33
 		echo $args['before_widget'];
33 34
 		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
@@ -40,8 +41,9 @@  discard block
 block discarded – undo
40 41
 				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
41 42
 			);
42 43
 		
43
-		if ( strlen($instance['infotext']) )
44
-			echo wpautop($instance['infotext']);
44
+		if ( strlen($instance['infotext']) ) {
45
+					echo wpautop($instance['infotext']);
46
+		}
45 47
 
46 48
 		echo $args['after_widget'];
47 49
 	}	
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
52 54
 		}
53 55
 
54 56
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
55
-		if ( is_multisite() )
56
-			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
57
+		if ( is_multisite() ) {
58
+					$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
59
+		}
57 60
 
58 61
 		$buttons_as_options = function ($buttons) {
59 62
 			foreach ($buttons as $subscribebutton) {
@@ -86,8 +89,10 @@  discard block
 block discarded – undo
86 89
 					<optgroup label="<?php _e('Network', 'podlove-subscribe-button' ); ?>">
87 90
 						<?php $buttons_as_options($network_buttons); ?>
88 91
 					</optgroup>
89
-				<?php else : 
92
+				<?php else {
93
+	: 
90 94
 					$buttons_as_options($buttons);
95
+}
91 96
 				 endif; ?>
92 97
 			</select>
93 98
 
@@ -139,6 +144,6 @@  discard block
 block discarded – undo
139 144
 		return $instance;
140 145
 	}
141 146
 }
142
-add_action( 'widgets_init', function(){
147
+add_action( 'widgets_init', function() {
143 148
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
144 149
 });
145 150
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 		parent::__construct(
11 11
 					'podlove_subscribe_button_wp_plugin_widget',
12 12
 					( self::is_podlove_publisher_active() ? 'Podlove Subscribe Button (WordPress plugin)' : 'Podlove Subscribe Button' ),
13
-					array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ), )
13
+					array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ),)
14 14
 				);
15 15
 	}
16 16
 
17
-	public static $widget_settings = array('infotext', 'title', 'size', 'style', 'format', 'autowidth', 'button', 'color');
17
+	public static $widget_settings = array( 'infotext', 'title', 'size', 'style', 'format', 'autowidth', 'button', 'color' );
18 18
 
19 19
 	public static function is_podlove_publisher_active() {
20
-		if ( is_plugin_active("podlove-podcasting-plugin-for-wordpress/podlove.php") ) {
20
+		if ( is_plugin_active( "podlove-podcasting-plugin-for-wordpress/podlove.php" ) ) {
21 21
 			return true;
22 22
 		}
23 23
 
@@ -26,38 +26,38 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function widget( $args, $instance ) {
28 28
 		// Fetch the (network)button by it's name
29
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) )
30
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
29
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $instance[ 'button' ] ) )
30
+			return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] );
31 31
 
32
-		echo $args['before_widget'];
33
-		echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
32
+		echo $args[ 'before_widget' ];
33
+		echo $args[ 'before_title' ] . apply_filters( 'widget_title', $instance[ 'title' ] ) . $args[ 'after_title' ];
34 34
 
35 35
 		echo $button->render(
36
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'size'),
37
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'autowidth'),
38
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'style'),
39
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'format'), 
40
-				\PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color')
36
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'size' ),
37
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'autowidth' ),
38
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'style' ),
39
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'format' ), 
40
+				\PodloveSubscribeButton::get_array_value_with_fallback( $instance, 'color' )
41 41
 			);
42 42
 		
43
-		if ( strlen($instance['infotext']) )
44
-			echo wpautop($instance['infotext']);
43
+		if ( strlen( $instance[ 'infotext' ] ) )
44
+			echo wpautop( $instance[ 'infotext' ] );
45 45
 
46
-		echo $args['after_widget'];
46
+		echo $args[ 'after_widget' ];
47 47
 	}	
48 48
 
49 49
 	public function form( $instance ) {
50
-		foreach (self::$widget_settings as $setting) {
51
-			$$setting = isset( $instance[$setting] ) ? $instance[$setting] : '';
50
+		foreach ( self::$widget_settings as $setting ) {
51
+			$$setting = isset( $instance[ $setting ] ) ? $instance[ $setting ] : '';
52 52
 		}
53 53
 
54 54
 		$buttons = \PodloveSubscribeButton\Model\Button::all();
55 55
 		if ( is_multisite() )
56 56
 			$network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all();
57 57
 
58
-		$buttons_as_options = function ($buttons) {
59
-			foreach ($buttons as $subscribebutton) {
60
-				echo "<option value='".$subscribebutton->name."' ".( $subscribebutton->name == $button ? 'selected=\"selected\"' : '' )." >".$subscribebutton->title." (".$subscribebutton->name.")</option>";
58
+		$buttons_as_options = function( $buttons ) {
59
+			foreach ( $buttons as $subscribebutton ) {
60
+				echo "<option value='" . $subscribebutton->name . "' " . ( $subscribebutton->name == $button ? 'selected=\"selected\"' : '' ) . " >" . $subscribebutton->title . " (" . $subscribebutton->name . ")</option>";
61 61
 			}
62 62
 		}
63 63
 		?>
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 			<label for="<?php echo $this->get_field_id( 'button' ); ?>"><?php _e( 'Button', 'podlove-subscribe-button' ); ?></label> 
80 80
 			<select class="widefat" id="<?php echo $this->get_field_id( 'button' ); ?>"
81 81
 				      name="<?php echo $this->get_field_name( 'button' ); ?>">
82
-				<?php if ( isset($network_buttons) && count($network_buttons) > 0 ) : ?>
83
-					<optgroup label="<?php _e('Local', 'podlove-subscribe-button' ); ?>">
84
-						<?php $buttons_as_options($buttons); ?>
82
+				<?php if ( isset( $network_buttons ) && count( $network_buttons ) > 0 ) : ?>
83
+					<optgroup label="<?php _e( 'Local', 'podlove-subscribe-button' ); ?>">
84
+						<?php $buttons_as_options( $buttons ); ?>
85 85
 					</optgroup>
86
-					<optgroup label="<?php _e('Network', 'podlove-subscribe-button' ); ?>">
87
-						<?php $buttons_as_options($network_buttons); ?>
86
+					<optgroup label="<?php _e( 'Network', 'podlove-subscribe-button' ); ?>">
87
+						<?php $buttons_as_options( $network_buttons ); ?>
88 88
 					</optgroup>
89 89
 				<?php else : 
90
-					$buttons_as_options($buttons);
90
+					$buttons_as_options( $buttons );
91 91
 				 endif; ?>
92 92
 			</select>
93 93
 
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 				)
112 112
 			);
113 113
 
114
-			foreach ($customize_options as $slug => $properties) : ?>
115
-				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php echo $properties['name']; ?></label>
114
+			foreach ( $customize_options as $slug => $properties ) : ?>
115
+				<label for="<?php echo $this->get_field_id( $slug ); ?>"><?php echo $properties[ 'name' ]; ?></label>
116 116
 				<select class="widefat" id="<?php echo $this->get_field_id( $slug ); ?>" name="<?php echo $this->get_field_name( $slug ); ?>">
117
-					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php printf( __( 'Default %s', 'podlove-subscribe-button' ), $properties['name'] ) ?></option>
117
+					<option value="default" <?php echo ( $$slug == 'default' ? 'selected="selected"' : '' ); ?>><?php printf( __( 'Default %s', 'podlove-subscribe-button' ), $properties[ 'name' ] ) ?></option>
118 118
 					<optgroup>
119
-						<?php foreach ( $properties['options'] as $property => $name ) : ?>
119
+						<?php foreach ( $properties[ 'options' ] as $property => $name ) : ?>
120 120
 						<option value="<?php echo $property; ?>" <?php echo ( $$slug == $property ? 'selected="selected"' : '' ); ?>><?php echo $name; ?></option>
121 121
 						<?php endforeach; ?>
122 122
 					</optgroup>
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 	public function update( $new_instance, $old_instance ) {
133 133
 		$instance = array();
134 134
 
135
-		foreach (self::$widget_settings as $setting) {
136
-			$instance[$setting]  = ( ! empty( $new_instance[$setting] ) ) ? strip_tags( $new_instance[$setting] ) : '';
135
+		foreach ( self::$widget_settings as $setting ) {
136
+			$instance[ $setting ] = ( ! empty( $new_instance[ $setting ] ) ) ? strip_tags( $new_instance[ $setting ] ) : '';
137 137
 		}
138 138
 
139 139
 		return $instance;
140 140
 	}
141 141
 }
142
-add_action( 'widgets_init', function(){
142
+add_action( 'widgets_init', function() {
143 143
      register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' );
144 144
 });
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
helper.php 2 patches
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.
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.
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   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PodloveSubscribeButton;
3 3
 
4
-if( ! class_exists( 'WP_List_Table' ) ){
4
+if ( ! class_exists( 'WP_List_Table' ) ) {
5 5
     require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6 6
 }
7 7
 
8 8
 class Button_List_Table extends \WP_List_Table {
9 9
 
10
-	function __construct(){
10
+	function __construct() {
11 11
 		global $status, $page;
12 12
 		        
13 13
 		// Set parent defaults
14 14
 		parent::__construct( array(
15
-		    'singular'  => 'feed',   // singular name of the listed records
16
-		    'plural'    => 'feeds',  // plural name of the listed records
15
+		    'singular'  => 'feed', // singular name of the listed records
16
+		    'plural'    => 'feeds', // plural name of the listed records
17 17
 		    'ajax'      => false  // does this table support ajax?
18 18
 		) );
19 19
 	}
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			'delete' => Settings\Buttons::get_action_link( $button, __( 'Delete', 'podlove-subscribe-button' ), 'confirm_delete' )
26 26
 		);
27 27
 	
28
-		return sprintf('%1$s %2$s',
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
 		);
@@ -41,7 +41,7 @@  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>";
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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' )
@@ -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.
model/button.php 2 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.
model/base.php 3 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.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -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
 	}
@@ -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
 	
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return array property names
134 134
 	 */
135 135
 	public static function property_names() {
136
-		return array_map( function ( $p ) { return $p['name']; } , static::properties() );
136
+		return array_map( function( $p ) { return $p[ 'name' ]; } , static::properties() );
137 137
 	}
138 138
 	
139 139
 	/**
@@ -171,7 +171,7 @@  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;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
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,9 +195,9 @@  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;
@@ -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,7 +219,7 @@  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;
@@ -243,9 +243,9 @@  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;
@@ -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;
@@ -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;
@@ -322,18 +322,18 @@  discard block
 block discarded – undo
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
 
@@ -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
 	}
@@ -459,8 +459,8 @@  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
 	}
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
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
 		}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
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()
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
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
 		}
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.
version.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 add_action( 'admin_init', '\PodloveSubscribeButton\run_database_migrations', 5 );
47 47
 
48 48
 function maybe_run_database_migrations() {
49
-	$database_version = get_option('podlove_subscribe_button_plugin_database_version');
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
@@ -55,28 +55,28 @@  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)
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 74
 function migrate_for_current_blog() {
75
-	$database_version = get_option('podlove_subscribe_button_plugin_database_version');
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
 
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.
podlove.php 2 patches
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 require('helper.php');
40 40
 
41 41
 add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
42
-if ( is_multisite() )
42
+if ( is_multisite() ) {
43 43
 	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
44
+}
44 45
 
45 46
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
46 47
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
 	public static function build_models() {
122 123
 		// Build Databases
123 124
 		\PodloveSubscribeButton\Model\Button::build();
124
-		if ( is_multisite() )
125
-			\PodloveSubscribeButton\Model\NetworkButton::build();
125
+		if ( is_multisite() ) {
126
+					\PodloveSubscribeButton\Model\NetworkButton::build();
127
+		}
126 128
 
127 129
 		// Set Button "default" values
128 130
 		$default_values = array(
@@ -148,8 +150,9 @@  discard block
 block discarded – undo
148 150
 		}
149 151
 
150 152
 		// Fetch the (network)button by it's name
151
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
152
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
153
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) {
154
+					return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
155
+		}
153 156
 
154 157
 		// Get button styling and options
155 158
 		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
@@ -181,8 +184,9 @@  discard block
 block discarded – undo
181 184
 	}
182 185
 
183 186
 	public static function get_array_value_with_fallback($args, $key) {
184
-		if ( isset($args[$key]) )
185
-			return $args[$key];
187
+		if ( isset($args[$key]) ) {
188
+					return $args[$key];
189
+		}
186 190
 
187 191
 		return false;
188 192
 	}
@@ -206,10 +210,12 @@  discard block
 block discarded – undo
206 210
 	 * @return string
207 211
 	 */
208 212
 	private static function interpret_width_attribute( $width_attribute = null ) {
209
-		if ( $width_attribute == 'auto' )
210
-			return 'on';
211
-		if ( $width_attribute && $width_attribute !== 'auto' )
212
-			return 'off';
213
+		if ( $width_attribute == 'auto' ) {
214
+					return 'on';
215
+		}
216
+		if ( $width_attribute && $width_attribute !== 'auto' ) {
217
+					return 'off';
218
+		}
213 219
 
214 220
 		return get_option('podlove_subscribe_button_default_autowidth', 'on');
215 221
 	}
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 // Constants
25
-require('constants.php');
26
-require('settings/buttons.php');
25
+require( 'constants.php' );
26
+require( 'settings/buttons.php' );
27 27
 // Models
28
-require('model/base.php');
29
-require('model/button.php');
30
-require('model/network_button.php');
28
+require( 'model/base.php' );
29
+require( 'model/button.php' );
30
+require( 'model/network_button.php' );
31 31
 // Table
32
-require('settings/buttons_list_table.php');
32
+require( 'settings/buttons_list_table.php' );
33 33
 // Media Types
34
-require('media_types.php');
34
+require( 'media_types.php' );
35 35
 // Widget
36
-require('widget.php');
36
+require( 'widget.php' );
37 37
 // Version control
38
-require('version.php');
38
+require( 'version.php' );
39 39
 // Helper functions
40
-require('helper.php');
40
+require( 'helper.php' );
41 41
 
42
-add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') );
42
+add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu' ) );
43 43
 if ( is_multisite() )
44
-	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') );
44
+	add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu' ) );
45 45
 
46 46
 add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) );
47 47
 register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) );
48 48
 
49 49
 // Register Settings
50
-add_action( 'admin_init', function () {
51
-	$settings = array('size', 'autowidth', 'style', 'format', 'color');
50
+add_action( 'admin_init', function() {
51
+	$settings = array( 'size', 'autowidth', 'style', 'format', 'color' );
52 52
 
53
-	foreach ($settings as $setting) {
53
+	foreach ( $settings as $setting ) {
54 54
 		register_setting( 'podlove-subscribe-button', 'podlove_subscribe_button_default_' . $setting );
55 55
 	}
56 56
 } );
57 57
 
58 58
 add_shortcode( 'podlove-subscribe-button', array( 'PodloveSubscribeButton', 'shortcode' ) );
59 59
 
60
-add_action( 'plugins_loaded', function () {
61
-	load_plugin_textdomain( 'podlove-subscribe-button', false, dirname(plugin_basename( __FILE__)) . '/languages/');
60
+add_action( 'plugins_loaded', function() {
61
+	load_plugin_textdomain( 'podlove-subscribe-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
62 62
 } );
63 63
 
64 64
 PodloveSubscribeButton::run();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$pages = array( 'settings_page_podlove-subscribe-button', 'widgets.php' );
76 76
 
77
-		if ( ! in_array( $hook, $pages )  ) {
77
+		if ( ! in_array( $hook, $pages ) ) {
78 78
 			return;
79 79
 		}
80 80
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				'Podlove Subscribe Button',
105 105
 				'manage_options',
106 106
 				'podlove-subscribe-button',
107
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
107
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
108 108
 			);
109 109
 	}
110 110
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 				'Podlove Subscribe Button',
116 116
 				'manage_options',
117 117
 				'podlove-subscribe-button',
118
-				array( 'PodloveSubscribeButton\Settings\Buttons', 'page')
118
+				array( 'PodloveSubscribeButton\Settings\Buttons', 'page' )
119 119
 			);
120 120
 	}
121 121
 
@@ -134,56 +134,56 @@  discard block
 block discarded – undo
134 134
 				'format' => 'rectangle'
135 135
 			);
136 136
 
137
-		foreach ($default_values as $option => $default_value) {
138
-			if ( ! get_option('podlove_subscribe_button_default_' . $option ) ) {
139
-				update_option('podlove_subscribe_button_default_' . $option, $default_value);
137
+		foreach ( $default_values as $option => $default_value ) {
138
+			if ( ! get_option( 'podlove_subscribe_button_default_' . $option ) ) {
139
+				update_option( 'podlove_subscribe_button_default_' . $option, $default_value );
140 140
 			}
141 141
 		}
142 142
 	}
143 143
 
144 144
 	public static function shortcode( $args ) {
145
-		if ( ! $args || ! isset($args['button']) ) {
146
-			return __('You need to create a Button first and provide its ID.', 'podlove-subscribe-button');
145
+		if ( ! $args || ! isset( $args[ 'button' ] ) ) {
146
+			return __( 'You need to create a Button first and provide its ID.', 'podlove-subscribe-button' );
147 147
 		} else {
148
-			$buttonid = $args['button'];
148
+			$buttonid = $args[ 'button' ];
149 149
 		}
150 150
 
151 151
 		// Fetch the (network)button by it's name
152
-		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) )
153
-			return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] );
152
+		if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) )
153
+			return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] );
154 154
 
155 155
 		// Get button styling and options
156
-		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') );
157
-		$size = self::get_attribute( 'size', self::get_array_value_with_fallback($args, 'size') );
158
-		$style = self::get_attribute( 'style', self::get_array_value_with_fallback($args, 'style') );
159
-		$format = self::get_attribute( 'format', self::get_array_value_with_fallback($args, 'format') );
160
-		$color = self::get_attribute( 'color', self::get_array_value_with_fallback($args, 'color') );
161
-
162
-		if ( isset($args['language']) ) {
163
-			$language = $args['language'];
156
+		$autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback( $args, 'width' ) );
157
+		$size = self::get_attribute( 'size', self::get_array_value_with_fallback( $args, 'size' ) );
158
+		$style = self::get_attribute( 'style', self::get_array_value_with_fallback( $args, 'style' ) );
159
+		$format = self::get_attribute( 'format', self::get_array_value_with_fallback( $args, 'format' ) );
160
+		$color = self::get_attribute( 'color', self::get_array_value_with_fallback( $args, 'color' ) );
161
+
162
+		if ( isset( $args[ 'language' ] ) ) {
163
+			$language = $args[ 'language' ];
164 164
 		} else {
165 165
 			$language = 'en';
166 166
 		}
167 167
 
168
-		if ( isset($args['color']) ) {
169
-			$color = $args['color'];
168
+		if ( isset( $args[ 'color' ] ) ) {
169
+			$color = $args[ 'color' ];
170 170
 		} else {
171
-			$color = get_option('podlove_subscribe_button_default_color', '#599677');
171
+			$color = get_option( 'podlove_subscribe_button_default_color', '#599677' );
172 172
 		}
173 173
 
174
-		if ( isset($args['hide']) && $args['hide'] == 'true' ) {
174
+		if ( isset( $args[ 'hide' ] ) && $args[ 'hide' ] == 'true' ) {
175 175
 			$hide = true;
176 176
 		} else {
177 177
 			$hide = false;
178 178
 		}
179 179
 
180 180
 		// Render button
181
-		return $button->render($size, $autowidth, $style, $format, $color, $hide, $buttonid, $language);
181
+		return $button->render( $size, $autowidth, $style, $format, $color, $hide, $buttonid, $language );
182 182
 	}
183 183
 
184
-	public static function get_array_value_with_fallback($args, $key) {
185
-		if ( isset($args[$key]) )
186
-			return $args[$key];
184
+	public static function get_array_value_with_fallback( $args, $key ) {
185
+		if ( isset( $args[ $key ] ) )
186
+			return $args[ $key ];
187 187
 
188 188
 		return false;
189 189
 	}
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 * @param  string $attribute_value
194 194
 	 * @return string
195 195
 	 */
196
-	private static function get_attribute($attribute=null, $attribute_value=null) {
197
-		if ( isset($attribute_value) && ctype_alnum($attribute_value) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
196
+	private static function get_attribute( $attribute = null, $attribute_value = null ) {
197
+		if ( isset( $attribute_value ) && ctype_alnum( $attribute_value ) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) {
198 198
 			return $attribute_value;
199 199
 		} else {
200
-			return get_option('podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[$attribute]);
200
+			return get_option( 'podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[ $attribute ] );
201 201
 		}
202 202
 	}
203 203
 
@@ -212,6 +212,6 @@  discard block
 block discarded – undo
212 212
 		if ( $width_attribute && $width_attribute !== 'auto' )
213 213
 			return 'off';
214 214
 
215
-		return get_option('podlove_subscribe_button_default_autowidth', 'on');
215
+		return get_option( 'podlove_subscribe_button_default_autowidth', 'on' );
216 216
 	}
217 217
 }
218 218
\ No newline at end of file
Please login to merge, or discard this patch.
settings/buttons.php 2 patches
Spacing   +66 added lines, -66 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
-		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 __( 'Podlove Subscribe Button', 'podlove-subscribe-button' ); ?> <a href="?page=<?php echo filter_input(INPUT_GET, 'page'); ?>&amp;action=new&amp;network=<?php echo $is_network; ?>" class="add-new-h2"><?php _e( 'Add New', 'podlove-subscribe-button' ); ?></a></h2>
30
+			<h2><?php echo __( 'Podlove Subscribe Button', 'podlove-subscribe-button' ); ?> <a href="?page=<?php echo filter_input( INPUT_GET, 'page' ); ?>&amp;action=new&amp;network=<?php echo $is_network; ?>" class="add-new-h2"><?php _e( 'Add New', 'podlove-subscribe-button' ); ?></a></h2>
31 31
 			<?php
32 32
 
33 33
 			switch ( $action ) {
34
-				case 'new':   self::new_template();  break;
34
+				case 'new':   self::new_template(); break;
35 35
 				case 'edit':  self::edit_template(); break;
36 36
 				case 'index': self::view_template(); break;
37 37
 				default:      self::view_template(); break;
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 	 * Process form: save/update a format
46 46
 	 */
47 47
 	public static function save() {
48
-		if ( null == filter_input(INPUT_GET, 'button') )
48
+		if ( null == filter_input( INPUT_GET, 'button' ) )
49 49
 			return;
50 50
 
51
-		$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
 	/**
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 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
 
@@ -81,33 +81,33 @@  discard block
 block discarded – undo
81 81
 	 * Process form: delete a format
82 82
 	 */
83 83
 	public static function delete() {
84
-		if ( null ==  filter_input(INPUT_GET, 'button') )
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 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');
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 106
 	public static function process_form() {
107
-		if ( null === filter_input(INPUT_GET, 'button') )
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();
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
 	}
120 120
 
121 121
 	public static function new_template() {
122
-		if ( filter_input(INPUT_GET, 'network') == '1' ) {
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 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') );
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>';
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></h3>
160
+		<h3><?php _e( 'Default Settings', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label></th>
166
+				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e( 'Size', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label></th>
176
+				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e( 'Autowidth', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label></th>
182
+				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e( 'Color', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label></th>
188
+				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e( 'Style', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label></th>
198
+				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e( 'Format', 'podlove-subscribe-button' ); ?></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>
@@ -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-subscribe-button' ); ?></label>
226
+							<label for="podlove_button_name"><?php _e( 'Button ID', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></span>
230
+							<br /><span class="description"><?php _e( 'The ID will be used as in internal identifier for shortcodes.', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label>
235
+							<label for="podlove_button_title"><?php _e( 'Podcast Title', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label>
243
+							<label for="podlove_button_subtitle"><?php _e( 'Podcast Subtitle', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label>
251
+							<label for="podlove_button_description"><?php _e( 'Podcast Description', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label>
259
+							<label for="podlove-button-cover"><?php _e( 'Podcast Image URL', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></label>
277
+							<label for="feeds_table"><?php _e( 'Podcast Feeds', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></th>
284
-										<th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
285
-										<th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th>
286
-										<th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th>
283
+										<th><?php _e( 'URL', 'podlove-subscribe-button' ); ?></th>
284
+										<th><?php _e( 'iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
285
+										<th><?php _e( 'Media format', 'podlove-subscribe-button' ); ?></th>
286
+										<th><?php _e( 'Actions', 'podlove-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?></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-subscribe-button' ); ?>" 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-subscribe-button' ); ?>"  />
298
+				<input name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'podlove-subscribe-button' ); ?>" 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-subscribe-button' ); ?>"  />
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,7 +319,7 @@  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
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 
328 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.
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.