Issues (1386)

settings/buttons.php (93 issues)

1
<?php
0 ignored issues
show
Class file names should be based on the class name with "class-" prepended. Expected class-buttons.php, but found buttons.php.
Loading history...
2
3
namespace PodloveSubscribeButton\Settings;
4
5
class Buttons {
6
7
	public static function page() {
8
9
		$action = null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null;
10
		$is_network = is_network_admin();
11
12
		if ( $action == 'confirm_delete' && null !== filter_input(INPUT_GET, 'button') ) {
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
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') ) );
0 ignored issues
show
Use Yoda Condition checks, you must.
Loading history...
14
			?>
15
			<div class="updated">
16
				<p>
17
					<strong>
18
						<?php printf( __( 'You selected to delete the button "%s". Please confirm this action.', 'podlove-subscribe-button' ), $button->title ) ?>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
19
					</strong>
20
				</p>
21
				<p>
22
					<?php echo self::get_action_link( $button, __( 'Delete button permanently', 'podlove-subscribe-button' ), 'delete', 'button' ) ?>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
23
					<?php echo self::get_action_link( $button, __( "Don't change anything", 'podlove-subscribe-button' ), 'keep', 'button-primary' ) ?>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
24
				</p>
25
			</div>
26
			<?php
27
		}
28
		?>
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>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$is_network'.
Loading history...
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
31
			<?php
32
33
			switch ( $action ) {
34
				case 'new':   self::new_template();  break;
35
				case 'edit':  self::edit_template(); break;
36
				case 'index': self::view_template(); break;
37
				default:      self::view_template(); break;
38
			}
39
			?>
40
		</div>
41
		<?php
42
	}
43
44
	/**
45
	 * Process form: save/update a format
46
	 */
47
	public static function save() {
48
		if ( null == filter_input(INPUT_GET, 'button') )
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
49
			return;
50
51
		$post = filter_input_array(INPUT_POST);
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'] );
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 ) );
58
		} else {
59
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
60
		}
61
	}
62
	/**
63
	 * Process form: create a format
64
	 */
65
	public static function create() {
66
		global $wpdb;
67
68
		$post = filter_input_array(INPUT_POST);
69
70
		$button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
0 ignored issues
show
Parenthesis should always be used when instantiating a new object.
Loading history...
71
		$button->update_attributes( $post['podlove_button'] );
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 ) );
75
		} else {
76
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
77
		}
78
	}
79
80
	/**
81
	 * Process form: delete a format
82
	 */
83
	public static function delete() {
84
		if ( null ==  filter_input(INPUT_GET, 'button') )
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Expected 1 space after "=="; 2 found
Loading history...
85
			return;
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') ) );
88
		$button->delete();
89
90
		self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
91
	}
92
93
	/**
94
	 * Helper method: redirect to a certain page.
95
	 */
96
	public static function redirect( $action, $button_id = null, $params = array(), $network = false ) {
97
		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input(INPUT_GET, 'page');
98
		$show    = ( $button_id ) ? '&button=' . $button_id : '';
99
		$action  = '&action=' . $action;
100
101
		array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } );
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
102
103
		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
0 ignored issues
show
wp_redirect() found. Using wp_safe_redirect(), along with the allowed_redirect_hosts filter if needed, can help avoid any chances of malicious redirects within code. It is also important to remember to call exit() after a redirect so that no other unwanted code is executed.
Loading history...
104
	}
105
106
	public static function process_form() {
107
		if ( null === filter_input(INPUT_GET, 'button') )
108
			return;
109
110
		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
111
112
		if ( $action === 'save' ) {
0 ignored issues
show
Use Yoda Condition checks, you must.
Loading history...
113
			self::save();
114
		} elseif ( $action === 'create' ) {
0 ignored issues
show
Use Yoda Condition checks, you must.
Loading history...
115
			self::create();
116
		} elseif ( $action === 'delete' ) {
0 ignored issues
show
Use Yoda Condition checks, you must.
Loading history...
117
			self::delete();
118
		}
119
	}
120
121
	public static function new_template() {
122
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
123
			$button = new \PodloveSubscribeButton\Model\NetworkButton;
0 ignored issues
show
Parenthesis should always be used when instantiating a new object.
Loading history...
124
		} else {
125
			$button = new \PodloveSubscribeButton\Model\Button;
0 ignored issues
show
Parenthesis should always be used when instantiating a new object.
Loading history...
126
		}
127
128
		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'.
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
129
				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
130
		self::form_template( $button, 'create' );
131
	}
132
133
	public static function edit_template() {
134
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
135
			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') );
136
		} else {
137
			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') );
138
		}
139
140
		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), $button->title ) . '</h3>';
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
141
		self::form_template( $button, 'save' );
142
	}
143
144
	public static function view_template() {
145
		$is_network = is_network_admin();
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>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
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>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
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>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
150
		<?php
151
		$table = new \PodloveSubscribeButton\Button_List_Table;
0 ignored issues
show
Parenthesis should always be used when instantiating a new object.
Loading history...
152
		$table->prepare_items();
153
		$table->display();
154
155
		// Get the global button settings (with fallback to default values)
156
		$settings = \PodloveSubscribeButton\Model\Button::get_global_setting_with_fallback();
157
158
		if ( ! $is_network ) :
159
		?>
160
		<h3><?php _e('Default Settings', 'podlove-subscribe-button' ); ?></h3>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
161
		<form method="post" action="options.php">
162
			<?php settings_fields( 'podlove-subscribe-button' ); ?>
163
			<?php do_settings_sections( 'podlove-subscribe-button' ); ?>
164
			<table class="form-table">
165
				<tr valign="top">
166
				<th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e('Size', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
167
				<td>
168
					<select name="podlove_subscribe_button_default_size" id="podlove_subscribe_button_default_size">
169
						<?php foreach (\PodloveSubscribeButton\Model\Button::$size as $value => $description) : ?>
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
170
							<option value="<?php echo $value; ?>" <?php echo ( $settings['size'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
171
						<?php endforeach; ?>
172
					</select>
173
				</td>
174
				</tr>
175
				<tr valign="top">
176
				<th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e('Autowidth', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
177
				<td>
178
					<input type="checkbox" name="podlove_subscribe_button_default_autowidth" id="podlove_subscribe_button_default_autowidth" <?php echo ( $settings['autowidth'] == 'on' ? 'checked' : '' ) ?> />
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
179
				</td>
180
				</tr>
181
				<tr valign="top">
182
				<th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e('Color', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
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'] ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$settings'.
Loading history...
185
				</td>
186
				</tr>
187
				<tr valign="top">
188
				<th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e('Style', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
189
				<td>
190
					<select name="podlove_subscribe_button_default_style" id="podlove_subscribe_button_default_style">
191
						<?php foreach (\PodloveSubscribeButton\Model\Button::$style as $value => $description) : ?>
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
192
							<option value="<?php echo $value; ?>" <?php echo ( $settings['style'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
193
						<?php endforeach; ?>
194
					</select>
195
				</td>
196
				</tr>
197
				<tr valign="top">
198
				<th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e('Format', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
199
				<td>
200
					<select name="podlove_subscribe_button_default_format" id="podlove_subscribe_button_default_format">
201
						<?php foreach (\PodloveSubscribeButton\Model\Button::$format as $value => $description) : ?>
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
202
							<option value="<?php echo $value; ?>" <?php echo ( $settings['format'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
203
						<?php endforeach; ?>
204
					</select>
205
				</td>
206
				</tr>
207
			</table>
208
			<?php submit_button(); ?>
209
		</form>
210
		<?php
211
		endif;
212
	}
213
214
	private static function form_template( $button, $action ) {
215
		// Enqueue Scripts for Media Manager
216
		wp_enqueue_media();
217
		// Adjust if is_network
218
		$is_network = is_network_admin();
219
		?>
220
		<form method="post" action="<?php echo ( $is_network === true ? '/wp-admin/network/settings' : 'options-general' ) ?>.php?page=podlove-subscribe-button&button=<?php echo $button->id; ?>&action=<?php echo $action; ?>&network=<?php echo $is_network; ?>">
0 ignored issues
show
Use Yoda Condition checks, you must.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$action'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$is_network'.
Loading history...
221
			<input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
222
			<table class="form-table" border="0" cellspacing="0">
223
					<tbody>
224
					<tr>
225
						<td scope="row">
226
							<label for="podlove_button_name"><?php _e('Button ID', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
227
						</td>
228
						<td>
229
							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo $button->name; ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
230
							<br /><span class="description"><?php _e('The ID will be used as in internal identifier for shortcodes.', 'podlove-subscribe-button' ); ?></span>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
231
						</td>
232
					</tr>
233
					<tr>
234
						<td scope="row">
235
							<label for="podlove_button_title"><?php _e('Podcast Title', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
236
						</td>
237
						<td>
238
							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo $button->title; ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
239
						</td>
240
					</tr>
241
					<tr>
242
						<td scope="row">
243
							<label for="podlove_button_subtitle"><?php _e('Podcast Subtitle', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
244
						</td>
245
						<td>
246
							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo $button->subtitle; ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
247
						</td>
248
					</tr>
249
					<tr>
250
						<td scope="row">
251
							<label for="podlove_button_description"><?php _e('Podcast Description', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
252
						</td>
253
						<td>
254
							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo $button->description; ?></textarea>
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
255
						</td>
256
					</tr>
257
					<tr>
258
						<td scope="row">
259
							<label for="podlove-button-cover"><?php _e('Podcast Image URL', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
260
						</td>
261
						<td>
262
							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo $button->cover; ?>" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
263
							<a id="Podlove_cover_image_select" class="button" href="#">Select</a>
264
							<br /><img src="<?php echo $button->cover; ?>" alt="" style="width: 200px" />
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
265
							<script type="text/javascript">
266
								(function($) {
267
									$("#podlove-button-cover").on( 'change', function() {
268
										url = $(this).val();
269
										$(this).parent().find("img").attr("src", url);
270
									} );
271
								})(jQuery);
272
							</script>
273
						</td>
274
					</tr>
275
					<tr>
276
						<td scope="row">
277
							<label for="feeds_table"><?php _e('Podcast Feeds', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
278
						</td>
279
						<td>
280
							<table id="feeds_table" class="podlove_alternating" border="0" cellspacing="0">
281
								<thead>
282
									<tr>
283
										<th><?php _e('URL', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
284
										<th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
285
										<th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
286
										<th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
287
									</tr>
288
								</thead>
289
								<tbody id="feeds_table_body">
290
								</tbody>
291
							</table>
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>
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
294
						</td>
295
					</tr>
296
					</tbody>
297
				</table>
298
				<input name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', 'podlove-subscribe-button' ); ?>" type="submit" />
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
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' ); ?>"  />
0 ignored issues
show
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
300
301
				<script type="text/template" id="feed_line_template">
302
					<tr>
303
						<td>
304
							<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][url]" value="{{url}}" />
305
						</td>
306
						<td>
307
						<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][itunesfeedid]" value="{{itunesfeedid}}" />
308
						</td>
309
						<td>
310
							<select class="regular-text podlove-media-format" name="podlove_button[feeds][{{id}}][format]">
311
								<?php
312
									foreach (\PodloveSubscribeButton\MediaTypes::$audio as $id => $audio) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
313
										echo "<option value='".$id."'>".$audio['title']."</option>\n";
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$id'.
Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$audio'.
Loading history...
314
									}
315
								?>
316
							</select>
317
						</td>
318
						<td><i class="clickable podlove-icon-remove"></i></td>
319
					</tr>
320
				</script>
321
				<script type="text/javascript">
322
					var feeds = <?php echo json_encode($button->feeds); ?>;
0 ignored issues
show
json_encode() is discouraged. Use wp_json_encode() instead.
Loading history...
323
				</script>
324
		</form>
325
		<?php
326
	}
327
328
	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
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'),
332
			$action,
333
			$button->id,
334
			$type == 'button' ? ' class="button"' : ''
0 ignored issues
show
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
335
		);
336
	}
337
338
}