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.
Passed
Push — master ( b1fd0a...70bbd7 )
by Christian
02:58
created

Buttons::get_action_link()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 1
nop 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
introduced by
Filenames should be all lowercase with hyphens as word separators. Expected buttons.php, but found Buttons.php.
Loading history...
introduced by
Class file names should be based on the class name with "class-" prepended. Expected class-buttons.php, but found Buttons.php.
Loading history...
2
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
3
 * @author    Podlove <[email protected]>
4
 * @copyright Copyright (c) 2014-2018, Podlove
5
 * @license   https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
6
 * @package   Podlove\PodloveSubscribeButton
7
 */
8
9
namespace PodloveSubscribeButton\Settings;
10
11
use PodloveSubscribeButton\Defaults;
12
13
class Buttons {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for class Buttons
Loading history...
14
15
	public static function page() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function page()
Loading history...
16
17
		$action = null !== filter_input( INPUT_GET, 'action' ) ? filter_input( INPUT_GET, 'action' ) : null;
0 ignored issues
show
Coding Style introduced by
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...
18
		$is_network = is_network_admin();
19
20
		if ( $action == 'confirm_delete' && null !== filter_input( INPUT_GET, 'button' ) ) {
0 ignored issues
show
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
introduced by
Use Yoda Condition checks, you must.
Loading history...
21
			$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
introduced by
Use Yoda Condition checks, you must.
Loading history...
22
			?>
23
			<div class="updated">
24
				<p>
25
					<strong>
26
						<?php printf( __( 'You selected to delete the button "%s". Please confirm this action.', 'podlove-subscribe-button' ), $button->title ) ?>
0 ignored issues
show
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
introduced by
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...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
27
					</strong>
28
				</p>
29
				<p>
30
					<?php echo self::get_action_link( $button, __( 'Delete button permanently', 'podlove-subscribe-button' ), 'delete', 'button' ) ?>
0 ignored issues
show
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
31
					<?php echo self::get_action_link( $button, __( "Don't change anything", 'podlove-subscribe-button' ), 'keep', 'button-primary' ) ?>
0 ignored issues
show
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
32
				</p>
33
			</div>
34
			<?php
35
		}
36
		?>
37
		<div class="wrap">
38
			<h1><?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></h1>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$is_network'.
Loading history...
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
39
            <div id="poststuff">
40
                <div id="post-body" class="columns-2">
41
                    <div id="post-body-content">
42
	                    <?php
43
	                    switch ( $action ) {
44
		                    case 'new':   self::new_template(); break;
0 ignored issues
show
Coding Style introduced by
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...
Coding Style introduced by
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...
45
		                    case 'edit':  self::edit_template(); break;
0 ignored issues
show
Coding Style introduced by
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...
Coding Style introduced by
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...
46
		                    case 'index': self::view_template(); break;
0 ignored issues
show
Coding Style introduced by
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...
Coding Style introduced by
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...
47
		                    default:      self::view_template(); break;
0 ignored issues
show
Coding Style introduced by
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...
Coding Style introduced by
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...
48
	                    }
49
	                    ?>
50
                    </div>
51
                    <div id="postbox-container-1" class="postbox-container">
52
                        <?php self::sidebar(); ?>
53
                    </div>
54
                </div>
55
            </div>
56
		</div><!-- .wrap -->
57
		<?php
58
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
59
60
	public static function sidebar() { ?>
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function sidebar()
Loading history...
Coding Style introduced by
Closing PHP tag must be on a line by itself
Loading history...
61
        <div id="submitdiv" class="postbox">
62
            <h2 class="ui-sortable-handle"><span>Podlove Subscribe Button <code><?php echo \PodloveSubscribeButton::$version; ?></code></span></h2>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'PodloveSubscribeButton'.
Loading history...
63
            <div class="inside">
64
                <div id="minor-publishing" style="padding:0 10px;">
65
                    <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
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
66
                    <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
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
67
                    <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
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
68
                </div>
69
                <div id="major-publishing-actions">
70
                    <ul>
71
                        <li><a href="https://wordpress.org/plugins/podlove-subscribe-button/" target="_blank">WordPress.org</a></li>
72
                        <li>Podlove Project</li>
73
                        <li>Community</li>
74
                        <li>Donate</li>
75
                    </ul>
76
                </div>
77
            </div>
78
        </div>
79
        <?php
80
81
    }
82
83
	/**
84
	 * Process form: save/update a format
85
	 */
86
	public static function save() {
87
		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...
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
88
			return;
89
90
		$post = filter_input_array( INPUT_POST );
91
92
		$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' ) ) );
93
		$button->update_attributes( $post[ 'podlove_button' ] );
0 ignored issues
show
Bug introduced by
The method update_attributes() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

93
		$button->/** @scrutinizer ignore-call */ 
94
           update_attributes( $post[ 'podlove_button' ] );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
introduced by
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
94
95
		if ( isset( $post[ 'submit_and_stay' ] ) ) {
0 ignored issues
show
introduced by
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
96
			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
97
		} else {
98
			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
99
		}
100
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
101
	/**
102
	 * Process form: create a format
103
	 */
104
	public static function create() {
105
		global $wpdb;
106
107
		$post = filter_input_array( INPUT_POST );
108
109
		$button = ( filter_input( INPUT_GET, 'network' ) === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button );
0 ignored issues
show
introduced by
Parenthesis should always be used when instantiating a new object.
Loading history...
110
		$button->update_attributes( $post[ 'podlove_button' ] );
0 ignored issues
show
introduced by
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
111
112
		if ( isset( $post[ 'submit_and_stay' ] ) ) {
0 ignored issues
show
introduced by
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
113
			self::redirect( 'edit', $button->id, array( 'network' => filter_input( INPUT_GET, 'network' ) ), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
114
		} else {
115
			self::redirect( 'index', $button->id, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
116
		}
117
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
118
119
	/**
120
	 * Process form: delete a format
121
	 */
122
	public static function delete() {
123
		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...
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
124
			return;
125
126
		$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' ) ) );
127
		$button->delete();
128
129
		self::redirect( 'index', null, array(), ( filter_input( INPUT_GET, 'network' ) === '1' ? true : false ) );
130
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
131
132
	/**
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...
133
	 * Helper method: redirect to a certain page.
134
	 */
135
	public static function redirect( $action, $button_id = null, $params = array(), $network = false ) {
136
		$page    = ( $network ? '/network/settings' : 'options-general' ) . '.php?page=' . filter_input( INPUT_GET, 'page' );
0 ignored issues
show
Coding Style introduced by
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...
137
		$show    = ( $button_id ) ? '&button=' . $button_id : '';
0 ignored issues
show
Coding Style introduced by
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...
138
		$action  = '&action=' . $action;
0 ignored issues
show
Coding Style introduced by
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...
139
140
		array_walk( $params, function( &$value, $key ) { $value = "&$key=$value"; } );
0 ignored issues
show
Coding Style introduced by
Opening brace must be the last content on the line
Loading history...
Coding Style introduced by
Closing brace of nested function must be on a new line
Loading history...
Coding Style introduced by
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...
141
142
		wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) );
0 ignored issues
show
introduced by
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...
143
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
144
145
	public static function process_form() {
0 ignored issues
show
Coding Style introduced by
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...
146
		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...
147
			return;
148
149
		$action = ( null !== filter_input( INPUT_GET, 'action' ) ? filter_input( INPUT_GET, 'action' ) : null );
150
151
		if ( $action === 'save' ) {
0 ignored issues
show
introduced by
Use Yoda Condition checks, you must.
Loading history...
152
			self::save();
153
		} elseif ( $action === 'create' ) {
0 ignored issues
show
introduced by
Use Yoda Condition checks, you must.
Loading history...
154
			self::create();
155
		} elseif ( $action === 'delete' ) {
0 ignored issues
show
introduced by
Use Yoda Condition checks, you must.
Loading history...
156
			self::delete();
157
		}
158
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
159
160
	public static function new_template() {
0 ignored issues
show
Coding Style introduced by
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...
161
		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
0 ignored issues
show
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
162
			$button = new \PodloveSubscribeButton\Model\NetworkButton;
0 ignored issues
show
introduced by
Parenthesis should always be used when instantiating a new object.
Loading history...
163
		} else {
164
			$button = new \PodloveSubscribeButton\Model\Button;
0 ignored issues
show
introduced by
Parenthesis should always be used when instantiating a new object.
Loading history...
165
		}
166
167
		echo '<h2>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h2>' .
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
168
				__( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' );
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
169
		self::form_template( $button, 'create' );
170
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
171
172
	public static function edit_template() {
0 ignored issues
show
Coding Style introduced by
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...
173
		if ( filter_input( INPUT_GET, 'network' ) == '1' ) {
0 ignored issues
show
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
174
			$button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input( INPUT_GET, 'button' ) );
175
		} else {
176
			$button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input( INPUT_GET, 'button' ) );
177
		}
178
179
		echo '<h2>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), $button->title ) . '</h2>';
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '__'.
Loading history...
introduced by
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...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
180
		self::form_template( $button, 'save' );
181
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
182
183
	public static function view_template() {
0 ignored issues
show
Coding Style introduced by
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...
184
185
		$is_network = is_network_admin();
186
		$table = new \PodloveSubscribeButton\Button_List_Table;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 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...
introduced by
Parenthesis should always be used when instantiating a new object.
Loading history...
187
		$table->prepare_items();
188
		$table->display();
189
190
		// Get the global button settings (with fallback to default values)
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
191
		$settings = \PodloveSubscribeButton\Model\Button::get_global_setting_with_fallback();
192
193
		if ( ! $is_network ) :
194
		?>
195
		<h3><?php _e( 'Default Settings', 'podlove-subscribe-button' ); ?></h3>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
196
		<form method="post" action="options.php">
197
			<?php settings_fields( 'podlove-subscribe-button' ); ?>
198
			<?php do_settings_sections( 'podlove-subscribe-button' ); ?>
199
            <table class="form-table">
200
                <tr valign="top">
201
                    <th scope="row"><label for="podlove_subscribe_button_default_size"><?php _e( 'Size', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
202
                    <td>
203
                        <select name="podlove_subscribe_button_default_size" id="podlove_subscribe_button_default_size">
204
							<?php foreach ( \PodloveSubscribeButton\Defaults::button( 'size' ) as $value => $description ) : ?>
205
                                <option value="<?php echo $value; ?>" <?php selected( $settings['size'], $value ); ?>><?php echo $description; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
206
							<?php endforeach; ?>
207
                        </select>
208
                    </td>
209
                </tr>
210
                <tr valign="top">
211
                    <th scope="row"><label for="podlove_subscribe_button_default_autowidth"><?php _e( 'Autowidth', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
212
                    <td>
213
                        <input type="checkbox" name="podlove_subscribe_button_default_autowidth"
214
                               id="podlove_subscribe_button_default_autowidth" <?php checked( $settings['autowidth'], 'on' ); ?> />
0 ignored issues
show
introduced by
Found precision alignment of 3 spaces.
Loading history...
215
                    </td>
216
                </tr>
217
                <tr valign="top">
218
                    <th scope="row"><label for="podlove_subscribe_button_default_color"><?php _e( 'Color', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
219
                    <td>
220
                        <input id="podlove_subscribe_button_default_color" name="podlove_subscribe_button_default_color" class="podlove_subscribe_button_color"
221
                               value="<?php echo $settings['color'] ?>"/>
0 ignored issues
show
introduced by
Found precision alignment of 3 spaces.
Loading history...
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$settings'.
Loading history...
222
                    </td>
223
                </tr>
224
                <tr valign="top">
225
                    <th scope="row"><label for="podlove_subscribe_button_default_style"><?php _e( 'Style', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
226
                    <td>
227
                        <select name="podlove_subscribe_button_default_style" id="podlove_subscribe_button_default_style">
228
							<?php foreach ( \PodloveSubscribeButton\Defaults::button( 'style' ) as $value => $description ) : ?>
229
                                <option value="<?php echo $value; ?>" <?php selected( $settings['style'], $value ); ?>><?php echo $description; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
230
							<?php endforeach; ?>
231
                        </select>
232
                    </td>
233
                </tr>
234
                <tr valign="top">
235
                    <th scope="row"><label for="podlove_subscribe_button_default_format"><?php _e( 'Format', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
236
                    <td>
237
                        <select name="podlove_subscribe_button_default_format" id="podlove_subscribe_button_default_format">
238
							<?php foreach ( \PodloveSubscribeButton\Defaults::button( 'format' ) as $value => $description ) : ?>
239
                                <option value="<?php echo $value; ?>" <?php selected( $settings['format'], $value ); ?>><?php echo $description; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$description'.
Loading history...
240
							<?php endforeach; ?>
241
                        </select>
242
                    </td>
243
                </tr>
244
                <tr valign="top">
245
                    <th scope="row"><label for="podlove_subscribe_button_default_language"><?php _e( 'Language', 'podlove-subscribe-button' ); ?></label></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
246
                    <td>
247
                        <select name="podlove_subscribe_button_default_language" id="podlove_subscribe_button_default_language">
248
							<?php foreach ( \PodloveSubscribeButton\Defaults::button( 'language' ) as $value ) : ?>
249
                                <option value="<?php echo $value; ?>" <?php selected( $settings['language'], $value ); ?>><?php echo $value; ?></option>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$value'.
Loading history...
250
							<?php endforeach; ?>
251
                        </select>
252
                    </td>
253
                </tr>
254
            </table>
255
            <?php submit_button(); ?>
256
		</form>
257
		<?php
258
		endif;
259
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
260
261
	private static function form_template( $button, $action ) {
0 ignored issues
show
Coding Style introduced by
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...
262
		// Enqueue Scripts for Media Manager
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
263
		wp_enqueue_media();
264
		// Adjust if is_network
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
265
		$is_network = is_network_admin();
266
		?>
267
		<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
Coding Style introduced by
Inline PHP statement must end with a semicolon
Loading history...
introduced by
Use Yoda Condition checks, you must.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$action'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$is_network'.
Loading history...
268
			<input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
269
			<table class="form-table" border="0" cellspacing="0">
270
					<tbody>
271
					<tr>
272
						<th scope="row">
273
							<label for="podlove_button_name"><?php _e( 'Button ID', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
274
						</th>
275
						<td>
276
							<input type="text" class="regular-text" id="podlove_button_name" name="podlove_button[name]" value="<?php echo $button->name; ?>" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
277
                            <p class="description"><?php _e( 'The ID will be used as in internal identifier for shortcodes.', 'podlove-subscribe-button' ); ?></p>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
278
                        </td>
279
					</tr>
280
					<tr>
281
						<th scope="row">
282
							<label for="podlove_button_title"><?php _e( 'Podcast Title', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
283
						</th>
284
						<td>
285
							<input type="text" class="regular-text" id="podlove_button_title" name="podlove_button[title]" value="<?php echo $button->title; ?>" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
286
						</td>
287
					</tr>
288
					<tr>
289
						<th scope="row">
290
							<label for="podlove_button_subtitle"><?php _e( 'Podcast Subtitle', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
291
						</th>
292
						<td>
293
							<input type="text" class="regular-text" id="podlove_button_subtitle" name="podlove_button[subtitle]" value="<?php echo $button->subtitle; ?>" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
294
						</td>
295
					</tr>
296
					<tr>
297
						<th scope="row">
298
							<label for="podlove_button_description"><?php _e( 'Podcast Description', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
299
						</th>
300
						<td>
301
							<textarea class="autogrow" cols="40" rows="3" id="podlove_button_description" name="podlove_button[description]"><?php echo $button->description; ?></textarea>
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
302
						</td>
303
					</tr>
304
					<tr>
305
						<th scope="row">
306
							<label for="podlove-button-cover"><?php _e( 'Podcast Image URL', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
307
						</th>
308
						<td>
309
							<input type="text" class="regular-text" id="podlove-button-cover" name="podlove_button[cover]" value="<?php echo $button->cover; ?>" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
310
							<a id="Podlove_cover_image_select" class="button" href="#">Select</a>
311
							<br /><img src="<?php echo $button->cover; ?>" alt="" style="width: 200px" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$button'.
Loading history...
312
							<script type="text/javascript">
313
								(function($) {
314
									$("#podlove-button-cover").on( 'change', function() {
315
										url = $(this).val();
316
										$(this).parent().find("img").attr("src", url);
317
									} );
318
								})(jQuery);
319
							</script>
320
						</td>
321
					</tr>
322
					<tr>
323
						<th scope="row">
324
							<label for="feeds_table"><?php _e( 'Podcast Feeds', 'podlove-subscribe-button' ); ?></label>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
325
						</th>
326
						<td>
327
							<table id="feeds_table" class="podlove_alternating widefat striped">
328
								<thead>
329
									<tr>
330
										<th scope="col" id="url" class="manage-column column-primary"><?php _e( 'URL', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
331
										<th scope="col" id="itunes_id" class="manage-column"><?php _e( 'iTunes feed ID', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
332
										<th scope="col" id="format" class="manage-column"><?php _e( 'Media format', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
333
										<th scope="col" id="action" class="manage-column"><?php _e( 'Actions', 'podlove-subscribe-button' ); ?></th>
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
334
									</tr>
335
								</thead>
336
								<tbody id="feeds_table_body">
337
								</tbody>
338
							</table>
339
							<input type="button" class="button add_feed" value="+" />
340
							<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
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
341
						</td>
342
					</tr>
343
					</tbody>
344
				</table>
345
				<input name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'podlove-subscribe-button' ); ?>" type="submit" />
0 ignored issues
show
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
346
				<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
introduced by
All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'.
Loading history...
347
348
				<script type="text/template" id="feed_line_template">
349
					<tr>
350
						<td>
351
							<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][url]" value="{{url}}" />
352
						</td>
353
						<td>
354
						<input type="text" class="regular-text" name="podlove_button[feeds][{{id}}][itunesfeedid]" value="{{itunesfeedid}}" />
355
						</td>
356
						<td>
357
							<select class="regular-text podlove-media-format" name="podlove_button[feeds][{{id}}][format]">
358
								<?php
359
									foreach ( \PodloveSubscribeButton\Defaults::media_types() as $id => $audio ) {
360
										echo "<option value='" . $id . "'>" . $audio[ 'title' ] . "</option>\n";
0 ignored issues
show
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$id'.
Loading history...
introduced by
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$audio'.
Loading history...
introduced by
Array keys must NOT be surrounded by spaces if they only contain a string or an integer.
Loading history...
361
									}
362
								?>
363
							</select>
364
						</td>
365
						<td><span class="dashicons dashicons-trash clickable podlove-icon-remove"></span></td>
366
					</tr>
367
				</script>
368
				<script type="text/javascript">
369
					var feeds = <?php echo json_encode( $button->feeds ); ?>;
0 ignored issues
show
introduced by
json_encode() is discouraged. Use wp_json_encode() instead.
Loading history...
370
				</script>
371
		</form>
372
		<?php
373
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
374
375
	public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) {
0 ignored issues
show
Coding Style introduced by
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...
376
		return sprintf(
377
			'<a href="?page=%s&action=%s&button=%s&network=' . is_network_admin() . '"%s>' . $title . '</a>',
378
			filter_input( INPUT_GET, 'page' ),
379
			$action,
380
			$button->id,
381
			$type == 'button' ? ' class="button"' : ''
0 ignored issues
show
introduced by
Found: ==. Use strict comparisons (=== or !==).
Loading history...
introduced by
Use Yoda Condition checks, you must.
Loading history...
382
		);
383
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
384
385
} // END class
386