GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (1495)

settings/buttons.php (165 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 doc comment for class Buttons
Loading history...
6
7
	public static function page() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function page()
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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 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' ), sanitize_title($button->title) ) ?>
0 ignored issues
show
Inline PHP statement must end with a semicolon
Loading history...
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 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
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
49
			return;
50
51
        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
52
            return;
53
        }
54
55
		$post = filter_input_array(INPUT_POST);
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
56
57
		$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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
58
		$button->update_attributes( $post['podlove_button'] );
59
60
		if ( isset($post['submit_and_stay']) ) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
61
			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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
62
		} else {
63
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
64
		}
65
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
66
	/**
67
	 * Process form: create a format
68
	 */
69
	public static function create() {
70
		global $wpdb;
71
72
		$post = filter_input_array(INPUT_POST);
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
73
74
		$button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
75
		$button->update_attributes( $post['podlove_button'] );
76
77
		if ( isset($post['submit_and_stay']) ) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
78
			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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
79
		} else {
80
			self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
81
		}
82
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
83
84
	/**
85
	 * Process form: delete a format
86
	 */
87
	public static function delete() {
88
		if ( null ==  filter_input(INPUT_GET, 'button') )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
89
			return;
90
91
		$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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
92
		$button->delete();
93
94
		self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
95
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
96
97
	/**
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...
98
	 * Helper method: redirect to a certain page.
99
	 */
100
	public static function redirect( $action, $button_id = null, $params = array(), $network = false ) {
101
		$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 parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
102
		$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...
103
		$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...
104
105
		array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
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...
106
107
		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
108
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
109
110
	public static function process_form() {
0 ignored issues
show
Method name "Buttons::process_form" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function process_form()
Loading history...
111
		if ( null === filter_input(INPUT_GET, 'button') )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
112
			return;
113
114
        $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
115
116
        if (!in_array($action, ['save', 'create', 'delete'])) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
117
            return;
118
        }
119
120
        if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
121
            return;
122
        }            
123
124
		if ( $action === 'save' ) {
125
			self::save();
126
		} elseif ( $action === 'create' ) {
127
			self::create();
128
		} elseif ( $action === 'delete' ) {
129
			self::delete();
130
		}
131
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
132
133
	public static function new_template() {
0 ignored issues
show
Method name "Buttons::new_template" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function new_template()
Loading history...
134
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
135
			$button = new \PodloveSubscribeButton\Model\NetworkButton;
136
		} else {
137
			$button = new \PodloveSubscribeButton\Model\Button;
138
		}
139
140
		echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'.
0 ignored issues
show
Concat operator must be surrounded by a single space
Loading history...
141
				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
142
		self::form_template( $button, 'create' );
143
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
144
145
	public static function edit_template() {
0 ignored issues
show
Method name "Buttons::edit_template" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function edit_template()
Loading history...
146
		if ( filter_input(INPUT_GET, 'network') == '1' ) {
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
147
			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
148
		} else {
149
			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') );
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
150
		}
151
152
		echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), sanitize_text_field($button->title) ) . '</h3>';
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
153
		self::form_template( $button, 'save' );
154
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
155
156
	public static function view_template() {
0 ignored issues
show
Method name "Buttons::view_template" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function view_template()
Loading history...
157
		$is_network = is_network_admin();
158
		?>
159
		<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 parenthesis; 0 found
Loading history...
160
		<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 parenthesis; 0 found
Loading history...
161
		<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 parenthesis; 0 found
Loading history...
162
		<?php
163
		$table = new \PodloveSubscribeButton\Button_List_Table;
164
		$table->prepare_items();
165
		$table->display();
166
167
		// 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...
168
		$settings = \PodloveSubscribeButton\Model\Button::get_global_setting_with_fallback();
169
170
		if ( ! $is_network ) :
171
		?>
172
		<h3><?php _e('Default Settings', 'podlove-subscribe-button' ); ?></h3>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
173
		<form method="post" action="options.php">
174
			<?php settings_fields( 'podlove-subscribe-button' ); ?>
175
			<?php do_settings_sections( 'podlove-subscribe-button' ); ?>
176
			<table class="form-table">
177
				<tr valign="top">
178
				<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 parenthesis; 0 found
Loading history...
179
				<td>
180
					<select name="podlove_subscribe_button_default_size" id="podlove_subscribe_button_default_size">
181
						<?php foreach (\PodloveSubscribeButton\Model\Button::$size as $value => $description) : ?>
182
							<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...
183
						<?php endforeach; ?>
184
					</select>
185
				</td>
186
				</tr>
187
				<tr valign="top">
188
				<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 parenthesis; 0 found
Loading history...
189
				<td>
190
					<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...
191
				</td>
192
				</tr>
193
				<tr valign="top">
194
				<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 parenthesis; 0 found
Loading history...
195
				<td>
196
					<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...
197
				</td>
198
				</tr>
199
				<tr valign="top">
200
				<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 parenthesis; 0 found
Loading history...
201
				<td>
202
					<select name="podlove_subscribe_button_default_style" id="podlove_subscribe_button_default_style">
203
						<?php foreach (\PodloveSubscribeButton\Model\Button::$style as $value => $description) : ?>
204
							<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...
205
						<?php endforeach; ?>
206
					</select>
207
				</td>
208
				</tr>
209
				<tr valign="top">
210
				<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 parenthesis; 0 found
Loading history...
211
				<td>
212
					<select name="podlove_subscribe_button_default_format" id="podlove_subscribe_button_default_format">
213
						<?php foreach (\PodloveSubscribeButton\Model\Button::$format as $value => $description) : ?>
214
							<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...
215
						<?php endforeach; ?>
216
					</select>
217
				</td>
218
				</tr>
219
			</table>
220
			<?php submit_button(); ?>
221
		</form>
222
		<?php
223
		endif;
224
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
225
226
	private static function form_template( $button, $action ) {
0 ignored issues
show
Method name "Buttons::form_template" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function form_template()
Loading history...
227
		// Enqueue Scripts for Media Manager
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
228
		wp_enqueue_media();
229
		// Adjust if is_network
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
230
		$is_network = is_network_admin();
231
		?>
232
		<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...
233
            <?php wp_nonce_field(-1, '_psb_nonce'); ?>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
234
			<input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" />
235
			<table class="form-table" border="0" cellspacing="0">
236
					<tbody>
237
					<tr>
238
						<td scope="row">
239
							<label for="podlove_button_name"><?php _e('Button ID', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
240
						</td>
241
						<td>
242
							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo esc_attr($button->name); ?>" />
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
243
							<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 parenthesis; 0 found
Loading history...
244
						</td>
245
					</tr>
246
					<tr>
247
						<td scope="row">
248
							<label for="podlove_button_title"><?php _e('Podcast Title', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
249
						</td>
250
						<td>
251
							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo esc_attr($button->title); ?>" />
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
252
						</td>
253
					</tr>
254
					<tr>
255
						<td scope="row">
256
							<label for="podlove_button_subtitle"><?php _e('Podcast Subtitle', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
257
						</td>
258
						<td>
259
							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo esc_attr($button->subtitle); ?>" />
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
260
						</td>
261
					</tr>
262
					<tr>
263
						<td scope="row">
264
							<label for="podlove_button_description"><?php _e('Podcast Description', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
265
						</td>
266
						<td>
267
							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo esc_attr($button->description); ?></textarea>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
268
						</td>
269
					</tr>
270
					<tr>
271
						<td scope="row">
272
							<label for="podlove-button-cover"><?php _e('Podcast Image URL', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
273
						</td>
274
						<td>
275
							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo esc_attr($button->cover); ?>" />
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
276
							<a id="Podlove_cover_image_select" class="button" href="#">Select</a>
277
							<br /><img src="<?php echo sanitize_text_field($button->cover); ?>" alt="" style="width: 200px" />
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
278
							<script type="text/javascript">
279
								(function($) {
280
									$("#podlove-button-cover").on( 'change', function() {
281
										url = $(this).val();
282
										$(this).parent().find("img").attr("src", url);
283
									} );
284
								})(jQuery);
285
							</script>
286
						</td>
287
					</tr>
288
					<tr>
289
						<td scope="row">
290
							<label for="feeds_table"><?php _e('Podcast Feeds', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
291
						</td>
292
						<td>
293
							<table id="feeds_table" class="podlove_alternating" border="0" cellspacing="0">
294
								<thead>
295
									<tr>
296
										<th><?php _e('URL', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
297
										<th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
298
										<th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
299
										<th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
300
									</tr>
301
								</thead>
302
								<tbody id="feeds_table_body">
303
								</tbody>
304
							</table>
305
							<input type="button" class="button add_feed" value="+" />
306
							<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 parenthesis; 0 found
Loading history...
307
						</td>
308
					</tr>
309
					</tbody>
310
				</table>
311
				<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 parenthesis; 0 found
Loading history...
312
				<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 parenthesis; 0 found
Loading history...
313
314
				<script type="text/template" id="feed_line_template">
315
					<tr>
316
						<td>
317
							<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][url]" value="{{url}}" />
318
						</td>
319
						<td>
320
						<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][itunesfeedid]" value="{{itunesfeedid}}" />
321
						</td>
322
						<td>
323
							<select class="regular-text podlove-media-format" name="podlove_button[feeds][{{id}}][format]">
324
								<?php
325
									foreach (\PodloveSubscribeButton\MediaTypes::$audio as $id => $audio) {
326
										echo "<option value='".$id."'>".$audio['title']."</option>\n";
0 ignored issues
show
Concat operator must be surrounded by a single space
Loading history...
327
									}
328
								?>
329
							</select>
330
						</td>
331
						<td><i class="clickable podlove-icon-remove"></i></td>
332
					</tr>
333
				</script>
334
				<script type="text/javascript">
335
					var feeds = <?php echo json_encode($button->feeds); ?>;
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
336
				</script>
337
		</form>
338
		<?php
339
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
340
341
	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
0 ignored issues
show
Method name "Buttons::get_action_link" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function get_action_link()
Loading history...
342
		return sprintf(
343
			'<a href="?page=%s&action=%s&button=%s&network='.is_network_admin().'&_psb_nonce=%s"%s>' . $title . '</a>',
0 ignored issues
show
Concat operator must be surrounded by a single space
Loading history...
344
			filter_input(INPUT_GET, 'page'),
0 ignored issues
show
Expected 1 spaces after opening parenthesis; 0 found
Loading history...
Expected 1 spaces before closing parenthesis; 0 found
Loading history...
345
			$action,
346
			$button->id,
347
            wp_create_nonce(),
348
			$type == 'button' ? ' class="button"' : ''
349
		);
350
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
351
352
}
353