Issues (1386)

settings/buttons.php (139 issues)

1
<?php
0 ignored issues
show
This file is missing a doc comment.
Loading history...
2
3
namespace PodloveSubscribeButton\Settings;
4
5
class Buttons {
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
6
7
	public static function page() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
8
9
		$action = null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
10
		$is_network = is_network_admin();
11
12
		if ( $action == 'confirm_delete' && null !== filter_input(INPUT_GET, 'button') ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
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
Inline PHP statement must end with a semicolon
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
Inline PHP statement must end with a semicolon
Loading history...
23
					<?php echo self::get_action_link( $button, __( "Don't change anything", 'podlove-subscribe-button' ), 'keep', 'button-primary' ) ?>
0 ignored issues
show
Inline PHP statement must end with a semicolon
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
31
			<?php
32
33
			switch ( $action ) {
34
				case 'new':   self::new_template();  break;
0 ignored issues
show
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
35
				case 'edit':  self::edit_template(); break;
0 ignored issues
show
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
36
				case 'index': self::view_template(); break;
0 ignored issues
show
The case body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.

switch ($expr) {
case "A":
    doSomething(); //right
    break;
case "B":

    doSomethingElse(); //wrong
    break;

}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
37
				default:      self::view_template(); break;
0 ignored issues
show
The default body in a switch statement must start on the line following the statement.

According to the PSR-2, the body of a default statement must start on the line immediately following the statement.

switch ($expr) {
    default:
        doSomething(); //right
        break;
}


switch ($expr) {
    default:

        doSomething(); //wrong
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
38
			}
39
			?>
40
		</div>
41
		<?php
42
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
49
			return;
50
51
		$post = filter_input_array(INPUT_POST);
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
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') ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
54
		$button->update_attributes( $post['podlove_button'] );
55
56
		if ( isset($post['submit_and_stay']) ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
57
			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
58
		} else {
59
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
60
		}
61
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
62
	/**
63
	 * Process form: create a format
64
	 */
65
	public static function create() {
66
		global $wpdb;
67
68
		$post = filter_input_array(INPUT_POST);
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
69
70
		$button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
71
		$button->update_attributes( $post['podlove_button'] );
72
73
		if ( isset($post['submit_and_stay']) ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
74
			self::redirect( 'edit', $button->id, array( 'network' => filter_input(INPUT_GET, 'network') ), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
75
		} else {
76
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
77
		}
78
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 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') ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
88
		$button->delete();
89
90
		self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
91
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
92
93
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$action" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$button_id" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$params" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$network" missing
Loading history...
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');
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 4 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
98
		$show    = ( $button_id ) ? '&button=' . $button_id : '';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 4 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
99
		$action  = '&action=' . $action;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
100
101
		array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } );
0 ignored issues
show
Expected 1 spaces between opening bracket and argument "$value"; 0 found
Loading history...
Assignments must be the first block of code on a line
Loading history...
Opening brace must be the last content on the line
Loading history...
Closing brace of nested function must be on a new line
Loading history...
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
102
103
		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
104
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
105
106
	public static function process_form() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::process_form" is not in camel caps format
Loading history...
107
		if ( null === filter_input(INPUT_GET, 'button') )
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
108
			return;
109
110
		$action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
111
112
		if ( $action === 'save' ) {
113
			self::save();
114
		} elseif ( $action === 'create' ) {
115
			self::create();
116
		} elseif ( $action === 'delete' ) {
117
			self::delete();
118
		}
119
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
120
121
	public static function new_template() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::new_template" is not in camel caps format
Loading history...
122
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
123
			$button = new \PodloveSubscribeButton\Model\NetworkButton;
124
		} else {
125
			$button = new \PodloveSubscribeButton\Model\Button;
126
		}
127
128
		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'.
0 ignored issues
show
Concat operator must be surrounded by a single space
Loading history...
129
				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
130
		self::form_template( $button, 'create' );
131
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
132
133
	public static function edit_template() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::edit_template" is not in camel caps format
Loading history...
134
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
135
			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
136
		} else {
137
			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') );
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
138
		}
139
140
		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), $button->title ) . '</h3>';
141
		self::form_template( $button, 'save' );
142
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
143
144
	public static function view_template() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::view_template" is not in camel caps format
Loading history...
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
150
		<?php
151
		$table = new \PodloveSubscribeButton\Button_List_Table;
152
		$table->prepare_items();
153
		$table->display();
154
155
		// Get the global button settings (with fallback to default values)
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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) : ?>
170
							<option value="<?php echo $value; ?>" <?php echo ( $settings['size'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal selected does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

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
Expected 1 spaces after opening bracket; 0 found
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
Inline PHP statement must end with a semicolon
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
Expected 1 spaces after opening bracket; 0 found
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
Inline PHP statement must end with a semicolon
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
Expected 1 spaces after opening bracket; 0 found
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) : ?>
192
							<option value="<?php echo $value; ?>" <?php echo ( $settings['style'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal selected does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

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
Expected 1 spaces after opening bracket; 0 found
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) : ?>
202
							<option value="<?php echo $value; ?>" <?php echo ( $settings['format'] == $value ? "selected" : '' ); ?>><?php echo $description; ?></option>
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal selected does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
203
						<?php endforeach; ?>
204
					</select>
205
				</td>
206
				</tr>
207
			</table>
208
			<?php submit_button(); ?>
209
		</form>
210
		<?php
211
		endif;
212
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
213
214
	private static function form_template( $button, $action ) {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::form_template" is not in camel caps format
Loading history...
215
		// Enqueue Scripts for Media Manager
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
216
		wp_enqueue_media();
217
		// Adjust if is_network
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
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
Inline PHP statement must end with a semicolon
Loading history...
221
			<input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" />
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
Expected 1 spaces after opening bracket; 0 found
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; ?>" />
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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; ?>" />
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
Expected 1 spaces after opening bracket; 0 found
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; ?>" />
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
Expected 1 spaces after opening bracket; 0 found
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>
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
Expected 1 spaces after opening bracket; 0 found
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; ?>" />
263
							<a id="Podlove_cover_image_select" class="button" href="#">Select</a>
264
							<br /><img src="<?php echo $button->cover; ?>" alt="" style="width: 200px" />
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
284
										<th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
285
										<th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
286
										<th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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
Expected 1 spaces after opening bracket; 0 found
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) {
313
										echo "<option value='".$id."'>".$audio['title']."</option>\n";
0 ignored issues
show
Concat operator must be surrounded by a single space
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
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
323
				</script>
324
		</form>
325
		<?php
326
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
327
328
	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
0 ignored issues
show
Coding Style Documentation introduced by
Missing function doc comment
Loading history...
Method name "Buttons::get_action_link" is not in camel caps format
Loading history...
329
		return sprintf(
330
			'<a href="?page=%s&action=%s&button=%s&network='.is_network_admin().'"%s>' . $title . '</a>',
0 ignored issues
show
Concat operator must be surrounded by a single space
Loading history...
331
			filter_input(INPUT_GET, 'page'),
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
332
			$action,
333
			$button->id,
334
			$type == 'button' ? ' class="button"' : ''
335
		);
336
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
337
338
}