1 | <?php |
||||||
0 ignored issues
–
show
introduced
by
![]() |
|||||||
2 | |||||||
3 | namespace PodloveSubscribeButton\Settings; |
||||||
4 | |||||||
5 | class Buttons { |
||||||
0 ignored issues
–
show
|
|||||||
6 | |||||||
7 | public static function page() { |
||||||
0 ignored issues
–
show
|
|||||||
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. ![]() |
|||||||
10 | $is_network = is_network_admin(); |
||||||
11 | |||||||
12 | if ( $action == 'confirm_delete' && null !== filter_input(INPUT_GET, 'button') ) { |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
23 | <?php echo self::get_action_link( $button, __( "Don't change anything", 'podlove-subscribe-button' ), 'keep', 'button-primary' ) ?> |
||||||
0 ignored issues
–
show
|
|||||||
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'); ?>&action=new&network=<?php echo $is_network; ?>" class="add-new-h2"><?php _e( 'Add New', 'podlove-subscribe-button' ); ?></a></h2> |
||||||
0 ignored issues
–
show
|
|||||||
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. ![]() |
|||||||
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. ![]() |
|||||||
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. ![]() |
|||||||
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. ![]() |
|||||||
38 | } |
||||||
39 | ?> |
||||||
40 | </div> |
||||||
41 | <?php |
||||||
42 | } |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
49 | return; |
||||||
50 | |||||||
51 | if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
||||||
0 ignored issues
–
show
|
|||||||
52 | return; |
||||||
53 | } |
||||||
54 | |||||||
55 | $post = filter_input_array(INPUT_POST); |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
58 | $button->update_attributes( $post['podlove_button'] ); |
||||||
0 ignored issues
–
show
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
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. ![]() |
|||||||
59 | |||||||
60 | if ( isset($post['submit_and_stay']) ) { |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
62 | } else { |
||||||
63 | self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) ); |
||||||
0 ignored issues
–
show
|
|||||||
64 | } |
||||||
65 | } |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
73 | |||||||
74 | $button = ( filter_input(INPUT_GET, 'network') === '1' ? new \PodloveSubscribeButton\Model\NetworkButton : new \PodloveSubscribeButton\Model\Button ); |
||||||
0 ignored issues
–
show
|
|||||||
75 | $button->update_attributes( $post['podlove_button'] ); |
||||||
76 | |||||||
77 | if ( isset($post['submit_and_stay']) ) { |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
79 | } else { |
||||||
80 | self::redirect( 'index', $button->id, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) ); |
||||||
0 ignored issues
–
show
|
|||||||
81 | } |
||||||
82 | } |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
92 | $button->delete(); |
||||||
93 | |||||||
94 | self::redirect( 'index', null, array(), ( filter_input(INPUT_GET, 'network') === '1' ? true : false ) ); |
||||||
0 ignored issues
–
show
|
|||||||
95 | } |
||||||
0 ignored issues
–
show
|
|||||||
96 | |||||||
97 | /** |
||||||
0 ignored issues
–
show
|
|||||||
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. ![]() |
|||||||
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. ![]() |
|||||||
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. ![]() |
|||||||
104 | |||||||
105 | array_walk( $params, function(&$value, $key) { $value = "&$key=$value"; } ); |
||||||
0 ignored issues
–
show
|
|||||||
106 | |||||||
107 | wp_redirect( admin_url( $page . $show . $action . implode( '', $params ) ) ); |
||||||
0 ignored issues
–
show
|
|||||||
108 | } |
||||||
0 ignored issues
–
show
|
|||||||
109 | |||||||
110 | public static function process_form() { |
||||||
0 ignored issues
–
show
|
|||||||
111 | if ( null === filter_input(INPUT_GET, 'button') ) |
||||||
0 ignored issues
–
show
|
|||||||
112 | return; |
||||||
113 | |||||||
114 | $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null ); |
||||||
0 ignored issues
–
show
|
|||||||
115 | |||||||
116 | if (!in_array($action, ['save', 'create', 'delete'])) { |
||||||
0 ignored issues
–
show
|
|||||||
117 | return; |
||||||
118 | } |
||||||
119 | |||||||
120 | if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
||||||
0 ignored issues
–
show
|
|||||||
121 | return; |
||||||
122 | } |
||||||
123 | |||||||
124 | if ( $action === 'save' ) { |
||||||
0 ignored issues
–
show
|
|||||||
125 | self::save(); |
||||||
126 | } elseif ( $action === 'create' ) { |
||||||
0 ignored issues
–
show
|
|||||||
127 | self::create(); |
||||||
128 | } elseif ( $action === 'delete' ) { |
||||||
0 ignored issues
–
show
|
|||||||
129 | self::delete(); |
||||||
130 | } |
||||||
131 | } |
||||||
0 ignored issues
–
show
|
|||||||
132 | |||||||
133 | public static function new_template() { |
||||||
0 ignored issues
–
show
|
|||||||
134 | if ( filter_input(INPUT_GET, 'network') == '1' ) { |
||||||
0 ignored issues
–
show
|
|||||||
135 | $button = new \PodloveSubscribeButton\Model\NetworkButton; |
||||||
0 ignored issues
–
show
|
|||||||
136 | } else { |
||||||
137 | $button = new \PodloveSubscribeButton\Model\Button; |
||||||
0 ignored issues
–
show
|
|||||||
138 | } |
||||||
139 | |||||||
140 | echo '<h3>' . __( 'New Subscribe button', 'podlove-subscribe-button' ) . '</h3>'. |
||||||
0 ignored issues
–
show
|
|||||||
141 | __( 'Please fill in your Podcast metadata to create a Podlove Subscription button', 'podlove-subscribe-button' ); |
||||||
0 ignored issues
–
show
|
|||||||
142 | self::form_template( $button, 'create' ); |
||||||
143 | } |
||||||
0 ignored issues
–
show
|
|||||||
144 | |||||||
145 | public static function edit_template() { |
||||||
0 ignored issues
–
show
|
|||||||
146 | if ( filter_input(INPUT_GET, 'network') == '1' ) { |
||||||
0 ignored issues
–
show
|
|||||||
147 | $button = \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') ); |
||||||
0 ignored issues
–
show
|
|||||||
148 | } else { |
||||||
149 | $button = \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') ); |
||||||
0 ignored issues
–
show
|
|||||||
150 | } |
||||||
151 | |||||||
152 | echo '<h3>' . sprintf( __( 'Edit Subscribe button: %s', 'podlove-subscribe-button' ), sanitize_text_field($button->title) ) . '</h3>'; |
||||||
0 ignored issues
–
show
|
|||||||
153 | self::form_template( $button, 'save' ); |
||||||
154 | } |
||||||
0 ignored issues
–
show
|
|||||||
155 | |||||||
156 | public static function view_template() { |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
162 | <?php |
||||||
163 | $table = new \PodloveSubscribeButton\Button_List_Table; |
||||||
0 ignored issues
–
show
|
|||||||
164 | $table->prepare_items(); |
||||||
165 | $table->display(); |
||||||
166 | |||||||
167 | // Get the global button settings (with fallback to default values) |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
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) : ?> |
||||||
0 ignored issues
–
show
|
|||||||
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 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 ( 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: 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. ![]() |
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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) : ?> |
||||||
0 ignored issues
–
show
|
|||||||
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 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 ( 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: 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. ![]() |
|||||||
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
|
|||||||
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) : ?> |
||||||
0 ignored issues
–
show
|
|||||||
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 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 ( 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: 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. ![]() |
|||||||
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
|
|||||||
225 | |||||||
226 | private static function form_template( $button, $action ) { |
||||||
0 ignored issues
–
show
|
|||||||
227 | // Enqueue Scripts for Media Manager |
||||||
0 ignored issues
–
show
|
|||||||
228 | wp_enqueue_media(); |
||||||
229 | // Adjust if is_network |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
233 | <?php wp_nonce_field(-1, '_psb_nonce'); ?> |
||||||
0 ignored issues
–
show
|
|||||||
234 | <input type="hidden" value="<?php echo $button->id; ?>" name="podlove_button[id]" /> |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
297 | <th><?php _e('iTunes feed ID', 'podlove-subscribe-button' ); ?></th> |
||||||
0 ignored issues
–
show
|
|||||||
298 | <th><?php _e('Media format', 'podlove-subscribe-button' ); ?></th> |
||||||
0 ignored issues
–
show
|
|||||||
299 | <th><?php _e('Actions', 'podlove-subscribe-button' ); ?></th> |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
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
|
|||||||
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
|
|||||||
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) { |
||||||
0 ignored issues
–
show
|
|||||||
326 | echo "<option value='".$id."'>".$audio['title']."</option>\n"; |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
336 | </script> |
||||||
337 | </form> |
||||||
338 | <?php |
||||||
339 | } |
||||||
0 ignored issues
–
show
|
|||||||
340 | |||||||
341 | public static function get_action_link( $button, $title, $action = 'edit', $type = 'link' ) { |
||||||
0 ignored issues
–
show
|
|||||||
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
|
|||||||
344 | filter_input(INPUT_GET, 'page'), |
||||||
0 ignored issues
–
show
|
|||||||
345 | $action, |
||||||
346 | $button->id, |
||||||
347 | wp_create_nonce(), |
||||||
348 | $type == 'button' ? ' class="button"' : '' |
||||||
0 ignored issues
–
show
|
|||||||
349 | ); |
||||||
350 | } |
||||||
0 ignored issues
–
show
|
|||||||
351 | |||||||
352 | } |
||||||
353 |