@@ -8,8 +8,9 @@ |
||
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 ); |
@@ -188,8 +188,9 @@ |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | // Fetch the (network)button by it's name |
191 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) ) |
|
192 | - return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] ); |
|
191 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) ) { |
|
192 | + return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] ); |
|
193 | + } |
|
193 | 194 | |
194 | 195 | // Get button styling and options |
195 | 196 | $autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback( $args, 'width' ) ); |
@@ -389,14 +389,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 ); |
@@ -45,11 +45,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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() |
@@ -113,16 +113,16 @@ |
||
113 | 113 | if ( isset( \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ] ) ) { |
114 | 114 | $new_feed = array( |
115 | 115 | 'type' => 'audio', |
116 | - 'format' => \PodloveSubscribeButton\MediaTypes::$audio[ $feed['format'] ]['extension'], |
|
117 | - 'url' => $feed['url'], |
|
116 | + 'format' => \PodloveSubscribeButton\MediaTypes::$audio[ $feed[ 'format' ] ][ 'extension' ], |
|
117 | + 'url' => $feed[ 'url' ], |
|
118 | 118 | 'variant' => 'high', |
119 | 119 | ); |
120 | 120 | |
121 | 121 | if ( isset( $feed[ 'itunesfeedid' ] ) && $feed[ 'itunesfeedid' ] > 0 ) { |
122 | - $new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid']; |
|
122 | + $new_feed[ 'directory-url-itunes' ] = "https://itunes.apple.com/podcast/id" . $feed[ 'itunesfeedid' ]; |
|
123 | 123 | } |
124 | 124 | |
125 | - $feeds[] = $new_feed; |
|
125 | + $feeds[ ] = $new_feed; |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | } |
@@ -186,11 +186,13 @@ |
||
186 | 186 | * @return string |
187 | 187 | */ |
188 | 188 | private static function interpret_autowidth_attribute( $autowidth ) { |
189 | - if ( $autowidth == 'default' && get_option( 'podlove_subscribe_button_default_autowidth' ) !== 'on' ) |
|
190 | - return ''; |
|
189 | + if ( $autowidth == 'default' && get_option( 'podlove_subscribe_button_default_autowidth' ) !== 'on' ) { |
|
190 | + return ''; |
|
191 | + } |
|
191 | 192 | |
192 | - if ( $autowidth !== 'default' && $autowidth !== 'on' ) |
|
193 | - return ''; |
|
193 | + if ( $autowidth !== 'default' && $autowidth !== 'on' ) { |
|
194 | + return ''; |
|
195 | + } |
|
194 | 196 | |
195 | 197 | return ' auto'; |
196 | 198 |
@@ -45,8 +45,9 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -2,7 +2,7 @@ discard block |
||
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 { |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | ); |
29 | 29 | |
30 | 30 | return sprintf( '%1$s %2$s', |
31 | - /*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>', |
|
32 | - /*$3%s*/ $this->row_actions( $actions ) |
|
31 | + /*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>', |
|
32 | + /*$3%s*/ $this->row_actions( $actions ) |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | parent::__construct( array( |
16 | 16 | 'singular' => 'feed', // singular name of the listed records |
17 | 17 | 'plural' => 'feeds', // plural name of the listed records |
18 | - 'ajax' => false, // does this table support ajax? |
|
18 | + 'ajax' => false, // does this table support ajax? |
|
19 | 19 | ) ); |
20 | 20 | |
21 | 21 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | parent::__construct( |
22 | 22 | 'podlove_subscribe_button_wp_plugin_widget', |
23 | 23 | ( \PodloveSubscribeButton\is_podlove_publisher_active() ? 'Podlove Subscribe Button (WordPress plugin)' : 'Podlove Subscribe Button' ), |
24 | - array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ), ) |
|
24 | + array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ),) |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function widget( $args, $instance ) { |
30 | 30 | // Fetch the (network)button by it's name |
31 | 31 | if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $instance[ 'button' ] ) ) { |
32 | - return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args['button'] ); |
|
32 | + return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | echo $args[ 'before_widget' ]; |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function form( $instance ) { |
55 | - $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
56 | - $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
57 | - $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : 'big'; |
|
58 | - $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : 'filled'; |
|
59 | - $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : 'cover'; |
|
55 | + $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
56 | + $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
57 | + $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : 'big'; |
|
58 | + $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : 'filled'; |
|
59 | + $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : 'cover'; |
|
60 | 60 | $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true; |
61 | - $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
62 | - $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91'; |
|
61 | + $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
62 | + $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91'; |
|
63 | 63 | |
64 | 64 | $buttons = \PodloveSubscribeButton\Model\Button::all(); |
65 | 65 | if ( is_multisite() ) { |
@@ -104,9 +104,11 @@ |
||
104 | 104 | echo "<option value='" . $subscribebutton->name . "' " . selected( $subscribebutton->name, $button ) . " >" . $subscribebutton->title . " (" . $subscribebutton->name . ")</option>"; |
105 | 105 | } ?> |
106 | 106 | </optgroup> |
107 | - <?php else : |
|
107 | + <?php else { |
|
108 | + : |
|
108 | 109 | foreach ( $buttons as $subscribebutton ) { |
109 | 110 | echo "<option value='" . $subscribebutton->name . "' " . selected( $subscribebutton->name, $button ) . " >" . $subscribebutton->title . " (" . $subscribebutton->name . ")</option>"; |
111 | +} |
|
110 | 112 | } |
111 | 113 | endif; ?> |
112 | 114 | </select> |