@@ -15,49 +15,49 @@ discard block |
||
15 | 15 | $correct_php_version = version_compare( phpversion(), "5.3", ">=" ); |
16 | 16 | |
17 | 17 | if ( ! $correct_php_version ) { |
18 | - _e("Podlove Subscribe Button Plugin requires <strong>PHP 5.3</strong> or higher.<br>", 'podlove-subscribe-button'); |
|
19 | - echo __("You are running PHP ", 'podlove-subscribe-button') . phpversion(); |
|
18 | + _e( "Podlove Subscribe Button Plugin requires <strong>PHP 5.3</strong> or higher.<br>", 'podlove-subscribe-button' ); |
|
19 | + echo __( "You are running PHP ", 'podlove-subscribe-button' ) . phpversion(); |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
23 | 23 | // Constants |
24 | -require('constants.php'); |
|
25 | -require('settings/buttons.php'); |
|
24 | +require( 'constants.php' ); |
|
25 | +require( 'settings/buttons.php' ); |
|
26 | 26 | // Models |
27 | -require('model/base.php'); |
|
28 | -require('model/button.php'); |
|
29 | -require('model/network_button.php'); |
|
27 | +require( 'model/base.php' ); |
|
28 | +require( 'model/button.php' ); |
|
29 | +require( 'model/network_button.php' ); |
|
30 | 30 | // Table |
31 | -require('settings/buttons_list_table.php'); |
|
31 | +require( 'settings/buttons_list_table.php' ); |
|
32 | 32 | // Media Types |
33 | -require('media_types.php'); |
|
33 | +require( 'media_types.php' ); |
|
34 | 34 | // Widget |
35 | -require('widget.php'); |
|
35 | +require( 'widget.php' ); |
|
36 | 36 | // Version control |
37 | -require('version.php'); |
|
37 | +require( 'version.php' ); |
|
38 | 38 | // Helper functions |
39 | -require('helper.php'); |
|
39 | +require( 'helper.php' ); |
|
40 | 40 | |
41 | -add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') ); |
|
41 | +add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu' ) ); |
|
42 | 42 | if ( is_multisite() ) |
43 | - add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') ); |
|
43 | + add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu' ) ); |
|
44 | 44 | |
45 | 45 | add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) ); |
46 | 46 | register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) ); |
47 | 47 | |
48 | 48 | // Register Settings |
49 | -add_action( 'admin_init', function () { |
|
50 | - $settings = array('size', 'autowidth', 'style', 'format', 'color'); |
|
49 | +add_action( 'admin_init', function() { |
|
50 | + $settings = array( 'size', 'autowidth', 'style', 'format', 'color' ); |
|
51 | 51 | |
52 | - foreach ($settings as $setting) { |
|
52 | + foreach ( $settings as $setting ) { |
|
53 | 53 | register_setting( 'podlove-subscribe-button', 'podlove_subscribe_button_default_' . $setting ); |
54 | 54 | } |
55 | 55 | } ); |
56 | 56 | |
57 | 57 | add_shortcode( 'podlove-subscribe-button', array( 'PodloveSubscribeButton', 'shortcode' ) ); |
58 | 58 | |
59 | -add_action( 'plugins_loaded', function () { |
|
60 | - load_plugin_textdomain( 'podlove-subscribe-button', false, dirname(plugin_basename( __FILE__)) . '/languages/'); |
|
59 | +add_action( 'plugins_loaded', function() { |
|
60 | + load_plugin_textdomain( 'podlove-subscribe-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
61 | 61 | } ); |
62 | 62 | |
63 | 63 | PodloveSubscribeButton::run(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $pages = array( 'settings_page_podlove-subscribe-button', 'widgets.php' ); |
75 | 75 | |
76 | - if ( ! in_array( $hook, $pages ) ) { |
|
76 | + if ( ! in_array( $hook, $pages ) ) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'Podlove Subscribe Button', |
104 | 104 | 'manage_options', |
105 | 105 | 'podlove-subscribe-button', |
106 | - array( 'PodloveSubscribeButton\Settings\Buttons', 'page') |
|
106 | + array( 'PodloveSubscribeButton\Settings\Buttons', 'page' ) |
|
107 | 107 | ); |
108 | 108 | } |
109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'Podlove Subscribe Button', |
115 | 115 | 'manage_options', |
116 | 116 | 'podlove-subscribe-button', |
117 | - array( 'PodloveSubscribeButton\Settings\Buttons', 'page') |
|
117 | + array( 'PodloveSubscribeButton\Settings\Buttons', 'page' ) |
|
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
@@ -133,56 +133,56 @@ discard block |
||
133 | 133 | 'format' => 'rectangle' |
134 | 134 | ); |
135 | 135 | |
136 | - foreach ($default_values as $option => $default_value) { |
|
137 | - if ( ! get_option('podlove_subscribe_button_default_' . $option ) ) { |
|
138 | - update_option('podlove_subscribe_button_default_' . $option, $default_value); |
|
136 | + foreach ( $default_values as $option => $default_value ) { |
|
137 | + if ( ! get_option( 'podlove_subscribe_button_default_' . $option ) ) { |
|
138 | + update_option( 'podlove_subscribe_button_default_' . $option, $default_value ); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | public static function shortcode( $args ) { |
144 | - if ( ! $args || ! isset($args['button']) ) { |
|
145 | - return __('You need to create a Button first and provide its ID.', 'podlove-subscribe-button'); |
|
144 | + if ( ! $args || ! isset( $args[ 'button' ] ) ) { |
|
145 | + return __( 'You need to create a Button first and provide its ID.', 'podlove-subscribe-button' ); |
|
146 | 146 | } else { |
147 | - $buttonid = $args['button']; |
|
147 | + $buttonid = $args[ 'button' ]; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // 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'] ); |
|
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 | 153 | |
154 | 154 | // Get button styling and options |
155 | - $autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') ); |
|
156 | - $size = self::get_attribute( 'size', self::get_array_value_with_fallback($args, 'size') ); |
|
157 | - $style = self::get_attribute( 'style', self::get_array_value_with_fallback($args, 'style') ); |
|
158 | - $format = self::get_attribute( 'format', self::get_array_value_with_fallback($args, 'format') ); |
|
159 | - $color = self::get_attribute( 'color', self::get_array_value_with_fallback($args, 'color') ); |
|
160 | - |
|
161 | - if ( isset($args['language']) ) { |
|
162 | - $language = $args['language']; |
|
155 | + $autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback( $args, 'width' ) ); |
|
156 | + $size = self::get_attribute( 'size', self::get_array_value_with_fallback( $args, 'size' ) ); |
|
157 | + $style = self::get_attribute( 'style', self::get_array_value_with_fallback( $args, 'style' ) ); |
|
158 | + $format = self::get_attribute( 'format', self::get_array_value_with_fallback( $args, 'format' ) ); |
|
159 | + $color = self::get_attribute( 'color', self::get_array_value_with_fallback( $args, 'color' ) ); |
|
160 | + |
|
161 | + if ( isset( $args[ 'language' ] ) ) { |
|
162 | + $language = $args[ 'language' ]; |
|
163 | 163 | } else { |
164 | 164 | $language = 'en'; |
165 | 165 | } |
166 | 166 | |
167 | - if ( isset($args['color']) ) { |
|
168 | - $color = $args['color']; |
|
167 | + if ( isset( $args[ 'color' ] ) ) { |
|
168 | + $color = $args[ 'color' ]; |
|
169 | 169 | } else { |
170 | - $color = get_option('podlove_subscribe_button_default_color', '#599677'); |
|
170 | + $color = get_option( 'podlove_subscribe_button_default_color', '#599677' ); |
|
171 | 171 | } |
172 | 172 | |
173 | - if ( isset($args['hide']) && $args['hide'] == 'true' ) { |
|
173 | + if ( isset( $args[ 'hide' ] ) && $args[ 'hide' ] == 'true' ) { |
|
174 | 174 | $hide = TRUE; |
175 | 175 | } else { |
176 | 176 | $hide = FALSE; |
177 | 177 | } |
178 | 178 | |
179 | 179 | // Render button |
180 | - return $button->render($size, $autowidth, $style, $format, $color, $hide, $buttonid, $language); |
|
180 | + return $button->render( $size, $autowidth, $style, $format, $color, $hide, $buttonid, $language ); |
|
181 | 181 | } |
182 | 182 | |
183 | - public static function get_array_value_with_fallback($args, $key) { |
|
184 | - if ( isset($args[$key]) ) |
|
185 | - return $args[$key]; |
|
183 | + public static function get_array_value_with_fallback( $args, $key ) { |
|
184 | + if ( isset( $args[ $key ] ) ) |
|
185 | + return $args[ $key ]; |
|
186 | 186 | |
187 | 187 | return FALSE; |
188 | 188 | } |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * @param string $attribute_value |
193 | 193 | * @return string |
194 | 194 | */ |
195 | - private static function get_attribute($attribute=NULL, $attribute_value=NULL) { |
|
196 | - if ( isset($attribute_value) && ctype_alnum($attribute_value) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) { |
|
195 | + private static function get_attribute( $attribute = NULL, $attribute_value = NULL ) { |
|
196 | + if ( isset( $attribute_value ) && ctype_alnum( $attribute_value ) && key_exists( $attribute_value, \PodloveSubscribeButton\Model\Button::$$attribute ) ) { |
|
197 | 197 | return $attribute_value; |
198 | 198 | } else { |
199 | - return get_option('podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[$attribute]); |
|
199 | + return get_option( 'podlove_subscribe_button_default_' . $attribute, \PodloveSubscribeButton\Model\Button::$properties[ $attribute ] ); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -211,6 +211,6 @@ discard block |
||
211 | 211 | if ( $width_attribute && $width_attribute !== 'auto' ) |
212 | 212 | return 'off'; |
213 | 213 | |
214 | - return get_option('podlove_subscribe_button_default_autowidth', 'on'); |
|
214 | + return get_option( 'podlove_subscribe_button_default_autowidth', 'on' ); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | \ No newline at end of file |
@@ -6,11 +6,11 @@ discard block |
||
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 |
||
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'); ?>&action=new&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' ); ?>&action=new&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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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"' : '' |
@@ -26,8 +26,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -10,14 +10,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |