@@ -35,7 +35,7 @@ |
||
35 | 35 | 'big' => __( 'Big', 'podlove-subscribe-button' ), |
36 | 36 | ); |
37 | 37 | |
38 | - $language = array( 'de', 'en', 'eo', 'fi', 'fr', 'nl', 'zh', 'ja', ); |
|
38 | + $language = array( 'de', 'en', 'eo', 'fi', 'fr', 'nl', 'zh', 'ja',); |
|
39 | 39 | |
40 | 40 | return $$property; |
41 | 41 |
@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | */ |
98 | 98 | private function get_feeds_as_array( $feeds = array() ) { |
99 | 99 | foreach ( $feeds as $feed ) { |
100 | - if ( isset( Defaults::media_types()[ $feed['format'] ]['extension'] ) ) { |
|
100 | + if ( isset( Defaults::media_types()[ $feed[ 'format' ] ][ 'extension' ] ) ) { |
|
101 | 101 | $new_feed = array( |
102 | 102 | 'type' => 'audio', |
103 | - 'format' => Defaults::media_types()[ $feed['format'] ]['extension'], |
|
104 | - 'url' => $feed['url'], |
|
103 | + 'format' => Defaults::media_types()[ $feed[ 'format' ] ][ 'extension' ], |
|
104 | + 'url' => $feed[ 'url' ], |
|
105 | 105 | 'variant' => 'high', |
106 | 106 | ); |
107 | 107 | |
108 | - if ( isset( $feed['itunesfeedid'] ) && $feed['itunesfeedid'] > 0 ) { |
|
109 | - $new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid']; |
|
108 | + if ( isset( $feed[ 'itunesfeedid' ] ) && $feed[ 'itunesfeedid' ] > 0 ) { |
|
109 | + $new_feed[ 'directory-url-itunes' ] = "https://itunes.apple.com/podcast/id" . $feed[ 'itunesfeedid' ]; |
|
110 | 110 | } |
111 | 111 | |
112 | - $feeds[] = $new_feed; |
|
112 | + $feeds[ ] = $new_feed; |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | } |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | |
159 | 159 | return array( |
160 | 160 | // $attribute => $value |
161 | - 'size' => ( $size == 'default' ? $options['size'] : $size ) . self::interpret_autowidth_attribute( $autowidth ), |
|
162 | - 'style' => ( $style == 'default' ? $options['style'] : $style ), |
|
163 | - 'format' => ( $format == 'default' ? $options['format'] : $format ), |
|
164 | - 'color' => ( isset( $color ) ? $color : $options['color'] ), |
|
161 | + 'size' => ( $size == 'default' ? $options[ 'size' ] : $size ) . self::interpret_autowidth_attribute( $autowidth ), |
|
162 | + 'style' => ( $style == 'default' ? $options[ 'style' ] : $style ), |
|
163 | + 'format' => ( $format == 'default' ? $options[ 'format' ] : $format ), |
|
164 | + 'color' => ( isset( $color ) ? $color : $options[ 'color' ] ), |
|
165 | 165 | 'json-data' => 'podcastData' . $this->id |
166 | 166 | ); |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @return string |
174 | 174 | */ |
175 | 175 | private static function interpret_autowidth_attribute( $autowidth ) { |
176 | - if ( $autowidth == 'default' && get_option( 'podlove_psb_defaults' )['autowidth'] !== 'on' ) |
|
176 | + if ( $autowidth == 'default' && get_option( 'podlove_psb_defaults' )[ 'autowidth' ] !== 'on' ) |
|
177 | 177 | return ''; |
178 | 178 | |
179 | 179 | if ( $autowidth !== 'default' && $autowidth !== 'on' ) |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | parent::__construct( |
29 | 29 | 'podlove_subscribe_button_wp_plugin_widget', |
30 | 30 | ( Helpers::is_podlove_publisher_active() ? 'Podlove Subscribe Button (WordPress plugin)' : 'Podlove Subscribe Button' ), |
31 | - array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ), ) |
|
31 | + array( 'description' => __( 'Adds a Podlove Subscribe Button to your Sidebar', 'podlove-subscribe-button' ),) |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function widget( $args, $instance ) { |
37 | 37 | // Fetch the (network)button by it's name |
38 | 38 | if ( ! $button = Model\Button::get_button_by_name( $instance[ 'button' ] ) ) { |
39 | - return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args['button'] ); |
|
39 | + return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | echo $args[ 'before_widget' ]; |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | public function form( $instance ) { |
65 | 65 | $options = get_option( 'podlove_psb_defaults' ); |
66 | 66 | |
67 | - $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
68 | - $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
69 | - $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : $options['size']; |
|
70 | - $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : $options['style']; |
|
71 | - $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : $options['format']; |
|
67 | + $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
68 | + $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
69 | + $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : $options[ 'size' ]; |
|
70 | + $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : $options[ 'style' ]; |
|
71 | + $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : $options[ 'format' ]; |
|
72 | 72 | $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true; |
73 | - $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
74 | - $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : $options['color']; |
|
75 | - $language = isset( $instance[ 'language' ] ) ? $instance[ 'language' ] : $options['language']; |
|
73 | + $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
74 | + $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : $options[ 'color' ]; |
|
75 | + $language = isset( $instance[ 'language' ] ) ? $instance[ 'language' ] : $options[ 'language' ]; |
|
76 | 76 | |
77 | 77 | $buttons = Model\Button::all(); |
78 | 78 | if ( is_multisite() ) { |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $language = get_option( 'WPLANG' ); |
69 | 69 | } |
70 | 70 | |
71 | - $lang_code = strtolower( explode( '_', $language )[0] ); |
|
71 | + $lang_code = strtolower( explode( '_', $language )[ 0 ] ); |
|
72 | 72 | |
73 | 73 | if ( in_array( $lang_code, \PodloveSubscribeButton\Defaults::button( 'language' ) ) ) { |
74 | 74 | return $lang_code; |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | $option = get_option( 'podlove_psb_defaults' ); |
113 | 113 | } |
114 | 114 | |
115 | - switch ( $args['type'] ) { |
|
115 | + switch ( $args[ 'type' ] ) { |
|
116 | 116 | case 'checkbox': |
117 | 117 | ?> |
118 | - <input type="checkbox" name="<?php echo "podlove_psb_defaults[{$args['label_for']}]"; ?>" |
|
119 | - id="<?php echo "podlove_psb_defaults[{$args['label_for']}]"; ?>" <?php checked( $option[ $args['label_for'] ], 'on' ); ?> /> |
|
118 | + <input type="checkbox" name="<?php echo "podlove_psb_defaults[{$args[ 'label_for' ]}]"; ?>" |
|
119 | + id="<?php echo "podlove_psb_defaults[{$args[ 'label_for' ]}]"; ?>" <?php checked( $option[ $args[ 'label_for' ] ], 'on' ); ?> /> |
|
120 | 120 | <?php |
121 | 121 | break; |
122 | 122 | |
123 | 123 | case 'color': |
124 | 124 | ?> |
125 | 125 | <input id="podlove_psb_defaults[color]" name="podlove_psb_defaults[color]" class="podlove_subscribe_button_color" |
126 | - value="<?php echo $option['color'] ?>"/> |
|
126 | + value="<?php echo $option[ 'color' ] ?>"/> |
|
127 | 127 | <?php |
128 | 128 | break; |
129 | 129 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ?> |
132 | 132 | <select name="podlove_psb_defaults[language]" id="podlove_psb_defaults[language]"> |
133 | 133 | <?php foreach ( Defaults::button( 'language' ) as $value ) : ?> |
134 | - <option value="<?php echo $value; ?>" <?php selected( $option['language'], $value ); ?>><?php echo $value; ?></option> |
|
134 | + <option value="<?php echo $value; ?>" <?php selected( $option[ 'language' ], $value ); ?>><?php echo $value; ?></option> |
|
135 | 135 | <?php endforeach; ?> |
136 | 136 | </select> |
137 | 137 | <?php |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | case 'select': |
142 | 142 | ?> |
143 | - <select name="podlove_psb_defaults[<?php echo $args['label_for']; ?>]" id="podlove_psb_defaults[<?php echo $args['label_for']; ?>]"> |
|
144 | - <?php foreach ( Defaults::button( $args['label_for'] ) as $value => $description ) { ?> |
|
145 | - <option value="<?php echo $value; ?>" <?php selected( $option[ $args['label_for'] ], $value ); ?>><?php echo $description; ?></option> |
|
143 | + <select name="podlove_psb_defaults[<?php echo $args[ 'label_for' ]; ?>]" id="podlove_psb_defaults[<?php echo $args[ 'label_for' ]; ?>]"> |
|
144 | + <?php foreach ( Defaults::button( $args[ 'label_for' ] ) as $value => $description ) { ?> |
|
145 | + <option value="<?php echo $value; ?>" <?php selected( $option[ $args[ 'label_for' ] ], $value ); ?>><?php echo $description; ?></option> |
|
146 | 146 | <?php } ?> |
147 | 147 | </select> |
148 | 148 | <?php break; |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | |
155 | 155 | $output = $input; |
156 | 156 | |
157 | - if ( ! array_key_exists('autowidth', $input ) ) { |
|
158 | - $output['autowidth'] = 'off'; |
|
157 | + if ( ! array_key_exists( 'autowidth', $input ) ) { |
|
158 | + $output[ 'autowidth' ] = 'off'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $output; |
@@ -352,7 +352,7 @@ |
||
352 | 352 | |
353 | 353 | //Verify Post Referring Page |
354 | 354 | check_admin_referer( 'podlove-psb-options' ); |
355 | - update_site_option( 'podlove_psb_defaults', $_POST['podlove_psb_defaults'] ); |
|
355 | + update_site_option( 'podlove_psb_defaults', $_POST[ 'podlove_psb_defaults' ] ); |
|
356 | 356 | |
357 | 357 | //Redirect to Network Settings Page |
358 | 358 | wp_redirect( add_query_arg( array( 'page' => 'podlove-subscribe-button', 'updated' => 'true' ), network_admin_url( 'settings.php' ) ) ); |
@@ -135,7 +135,7 @@ |
||
135 | 135 | 'podlove_subscribe_button_default_format', |
136 | 136 | 'podlove_subscribe_button_default_language', |
137 | 137 | ); |
138 | - $options = array(); |
|
138 | + $options = array(); |
|
139 | 139 | |
140 | 140 | foreach ( $old_options as $option ) { |
141 | 141 |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | * @return string|void |
200 | 200 | */ |
201 | 201 | public static function shortcode( $args ) { |
202 | - if ( ! $args || ! isset( $args['button'] ) ) { |
|
202 | + if ( ! $args || ! isset( $args[ 'button' ] ) ) { |
|
203 | 203 | return __( 'You need to create a Button first and provide its ID.', 'podlove-subscribe-button' ); |
204 | 204 | } else { |
205 | - $buttonid = $args['button']; |
|
205 | + $buttonid = $args[ 'button' ]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Fetch the (network)button by it's name |
209 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args['button'] ) ) { |
|
210 | - return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args['button'] ); |
|
209 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name( $args[ 'button' ] ) ) { |
|
210 | + return sprintf( __( 'Oops. There is no button with the ID "%s".', 'podlove-subscribe-button' ), $args[ 'button' ] ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | // Get button styling and options |
@@ -216,19 +216,19 @@ discard block |
||
216 | 216 | $style = self::get_attribute( 'style', self::get_array_value_with_fallback( $args, 'style' ) ); |
217 | 217 | $format = self::get_attribute( 'format', self::get_array_value_with_fallback( $args, 'format' ) ); |
218 | 218 | |
219 | - if ( isset( $args['language'] ) ) { |
|
220 | - $language = $args['language']; |
|
219 | + if ( isset( $args[ 'language' ] ) ) { |
|
220 | + $language = $args[ 'language' ]; |
|
221 | 221 | } else { |
222 | 222 | $language = self::get_attribute( 'language', self::get_array_value_with_fallback( $args, 'language' ) ); |
223 | 223 | } |
224 | 224 | |
225 | - if ( isset( $args['color'] ) ) { |
|
226 | - $color = $args['color']; |
|
225 | + if ( isset( $args[ 'color' ] ) ) { |
|
226 | + $color = $args[ 'color' ]; |
|
227 | 227 | } else { |
228 | 228 | $color = self::get_attribute( 'color', self::get_array_value_with_fallback( $args, 'color' ) ); |
229 | 229 | } |
230 | 230 | |
231 | - if ( isset( $args['hide'] ) && $args['hide'] == 'true' ) { |
|
231 | + if ( isset( $args[ 'hide' ] ) && $args[ 'hide' ] == 'true' ) { |
|
232 | 232 | $hide = true; |
233 | 233 | } else { |
234 | 234 | $hide = false; |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | parent::__construct( array( |
23 | 23 | 'singular' => 'feed', // singular name of the listed records |
24 | 24 | 'plural' => 'feeds', // plural name of the listed records |
25 | - 'ajax' => false, // does this table support ajax? |
|
25 | + 'ajax' => false, // does this table support ajax? |
|
26 | 26 | ) ); |
27 | 27 | |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function column_name( $button ) { |
31 | 31 | |
32 | - $target = 'shortcode-' . str_replace(" ","-", $button->name ); |
|
32 | + $target = 'shortcode-' . str_replace( " ", "-", $button->name ); |
|
33 | 33 | $copy_button = '<a class="copy-btn" data-clipboard-action="copy" data-clipboard-target=".' . $target . '">Copy Shortcode</a>'; |
34 | 34 | |
35 | 35 | $actions = array( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | return sprintf( '%1$s %2$s', |
42 | 42 | /*$1%s*/ |
43 | - '<p><b>'.$button->title . '</b></p><code class="' . $target . '">[podlove-subscribe-button button="' . $button->name . '"]</code>', |
|
43 | + '<p><b>' . $button->title . '</b></p><code class="' . $target . '">[podlove-subscribe-button button="' . $button->name . '"]</code>', |
|
44 | 44 | /*$3%s*/ |
45 | 45 | $this->row_actions( $actions ) |
46 | 46 | ); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | |
60 | 60 | $preview = "<div class='podlove-button-preview-container'>"; |
61 | 61 | $preview .= $button->render( |
62 | - $options['size'], |
|
63 | - $options['autowidth'], |
|
64 | - $options['style'], |
|
65 | - $options['format'], |
|
66 | - $options['color'], |
|
62 | + $options[ 'size' ], |
|
63 | + $options[ 'autowidth' ], |
|
64 | + $options[ 'style' ], |
|
65 | + $options[ 'format' ], |
|
66 | + $options[ 'color' ], |
|
67 | 67 | false, |
68 | 68 | false, |
69 | - $options['language'] |
|
69 | + $options[ 'language' ] |
|
70 | 70 | ); |
71 | 71 | $preview .= "</div>"; |
72 | 72 |