PluginProbe
FeedWordPress / 2022.0222
FeedWordPress v2022.0222
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
← All changes | diagnostics-page.php +59 -70 trunk2022.0222 View file →
@@ -74,9 +74,9 @@
74 74
75 75 public function what_requested () {
76 76 return FeedWordPress::post( 'feedwordpress_diagnostics_do' );
77 77 }
78 -
78 +
79 79 function accept_POST () {
80 80 if ( self::save_requested() || self::do_requested() ) :
81 81
82 82 update_option( 'feedwordpress_debug', FeedWordPress::post( 'feedwordpress_debug' ) );
@@ -125,49 +125,48 @@
125 125 </thead>
126 126
127 127 <tbody>
128 128 <tr>
129 - <th scope="row"><?php esc_html_e( 'Version:' ); ?></th>
130 - <td><?php esc_html_e( 'You are using FeedWordPress version' ); ?> <strong><?php print esc_html( FEEDWORDPRESS_VERSION ); ?></strong>.</td>
129 + <th scope="row">Version:</th>
130 + <td>You are using FeedWordPress version <strong><?php print FEEDWORDPRESS_VERSION; ?></strong>.</td>
131 131 </tr>
132 132
133 133 <tr>
134 - <th scope="row"><?php esc_html_e( 'Hosting Environment:' ); ?></th>
134 + <th scope="row">Hosting Environment:</th>
135 135 <td><ul style="margin-top: 0; padding-top: 0;">
136 - <li><em>WordPress:</em> <?php esc_html_e( 'version' ); ?> <?php print esc_html( $wp_version ); ?></li>
137 - <li><em>SimplePie:</em> <?php esc_html_e( 'version' ); ?> <?php print esc_html( SIMPLEPIE_VERSION ); ?></li>
136 + <li><em>WordPress:</em> version <?php print esc_html( $wp_version ); ?></li>
137 + <li><em>SimplePie:</em> version <?php print esc_html( SIMPLEPIE_VERSION ); ?></li>
138 138 <?php if ( function_exists( 'phpversion' ) ) : ?>
139 - <li><em><?php esc_html_e( 'PHP:' ); ?></em> <?php esc_html_e( 'version' ); ?> <?php print esc_html( phpversion() ); ?></li>
139 + <li><em>PHP:</em> version <?php print esc_html( phpversion() ); ?></li>
140 140 <?php endif; ?>
141 - <?php if ( function_exists( 'apache_get_version' ) ) : ?>
142 - <li><em><?php esc_html_e( 'Web Server:' ); ?></em> <?php print esc_html( apache_get_version() ); ?></li>
141 + <?php if (function_exists( 'apache_get_version' )) : ?>
142 + <li><sem>Web Server:</em> <?php print esc_html( apache_get_version() ); ?></li>
143 143 <?php endif; ?>
144 - <?php if ( ! empty( $_SERVER['SERVER_SIGNATURE'] ) ) : ?>
145 - <li><em><?php esc_html_e( 'Web Server signature:' ); ?></em> <?php print esc_html( $_SERVER['SERVER_SIGNATURE'] ); ?></li>
146 - <?php endif; ?>
147 - <li><em><?php esc_html_e( 'Hosted on:' ); ?></em> <?php print esc_html( php_uname( 'a' ) ); ?></li>
148 144 </ul>
149 145 </td>
150 146 </tr>
151 147
152 148 <tr>
153 - <th scope="row"><?php esc_html_e( 'Link Category:' ); ?></th>
154 - <td><?php if ( ! is_wp_error( $link_category_id ) ) :
155 - $term = get_term( $link_category_id, 'link_category' );
156 - ?><p><?php esc_html_e( 'Syndicated feeds are kept in link category' ); ?> #<?php print esc_html( $term->term_id ); ?>, <strong><?php print esc_html( $term->name ); ?></strong>.</p>
149 + <th scope="row">Link Category:</th>
150 + <td><?php if (!is_wp_error($link_category_id)) :
151 + $term = get_term($link_category_id, 'link_category');
152 + ?><p>Syndicated feeds are
153 + kept in link category #<?php print esc_html( $term->term_id ); ?>, <strong><?php print esc_html( $term->name ); ?></strong>.</p>
157 154 <?php else : ?>
158 - <p><strong><?php esc_html_e( 'FeedWordPress has been unable to set up a valid Link Category for syndicated feeds.' ); ?></strong> <?php esc_html_e( 'Attempting to set one up returned an' ); ?>
159 - <code><?php $link_category_id->get_error_code(); ?></code> <?php esc_html_e( 'error with this additional data:' ); ?></p>
155 + <p><strong>FeedWordPress has been unable to set up a valid Link Category
156 + for syndicated feeds.</strong> Attempting to set one up returned an
157 + <code><?php $link_category_id->get_error_code(); ?></code> error with this
158 + additional data:</p>
160 159 <table>
161 160 <tbody>
162 161 <tr>
163 - <th scope="row"><?php esc_html_e( 'Message:' ); ?></th>
162 + <th scope="row">Message:</th>
164 163 <td><?php print esc_html( $link_category_id->get_error_message() ); ?></td>
165 164 </tr>
166 - <?php $data = $link_category_id->get_error_data(); if ( ! empty( $data ) ) : ?>
165 + <?php $data = $link_category_id->get_error_data(); if (!empty($data)) : ?>
167 166 <tr>
168 - <th scope="row"><?php esc_html_e( 'Auxiliary Data:' ); ?></th>
169 - <td><pre><?php print esc_html( MyPHP::val( $link_category_id->get_error_data() ) ); ?></pre></td>
167 + <th scope="row">Auxiliary Data:</th>
168 + <td><pre><?php print esc_html(MyPHP::val($link_category_id->get_error_data())); ?></pre></td>
170 169 </tr>
171 170 <?php endif; ?>
172 171 </table>
173 172 <?php endif; ?></td>
@@ -173,11 +172,13 @@
173 172 <?php endif; ?></td>
174 173 </tr>
175 174
176 175 <tr>
177 - <th scope="row"><?php esc_html_e('Secret Key:'); ?></th>
178 - <td><input type="text" name="feedwordpress_secret_key" value="<?php print esc_attr( $feedwordpress->secret_key() ); ?>" />
179 - <p class="setting-description"><?php esc_html_e( 'This is used to control access to some diagnostic testing functions. You can change it to any string you want, but only tell it to people you trust to help you troubleshoot your FeedWordPress installation. Keep it secret&mdash;keep it safe.' ); ?></p></td>
176 + <th scope="row"><?php _e('Secret Key:'); ?></th>
177 + <td><input type="text" name="feedwordpress_secret_key" value="<?php print esc_attr($feedwordpress->secret_key()); ?>" />
178 + <p class="setting-description">This is used to control access to some diagnostic testing functions. You can change it to any string you want,
179 + but only tell it to people you trust to help you troubleshoot your
180 + FeedWordPress installation. Keep it secret&#8212;keep it safe.</p></td>
180 181 </tr>
181 182 </table>
182 183
183 184 <?php
@@ -182,22 +183,19 @@
182 183
183 184 <?php
184 185 } /* FeedWordPressDiagnosticsPage::info_box () */
185 186
186 - static function diagnostics_box( $page, $box = NULL ) {
187 + static function diagnostics_box ($page, $box = NULL) {
187 188 $settings = array();
188 - $settings['debug'] = ( get_option( 'feedwordpress_debug' ) == 'yes' );
189 + $settings['debug'] = (get_option('feedwordpress_debug')=='yes');
189 190
190 - $diagnostics_output = get_option( 'feedwordpress_diagnostics_output', array() );
191 - if ( ! is_array( $diagnostics_output ) ) {
192 - $diagnostics_output = array( $diagnostics_output );
193 - }
194 -
191 + $diagnostics_output = get_option('feedwordpress_diagnostics_output', array());
192 +
195 193 $users = fwp_author_list();
196 194
197 - $ded = get_option( 'feedwordpress_diagnostics_email_destination', 'admins' );
195 + $ded = get_option('feedwordpress_diagnostics_email_destination', 'admins');
198 196
199 - if (preg_match( '/^mailto:(.*)$/', $ded, $ref ) ) :
197 + if (preg_match('/^mailto:(.*)$/', $ded, $ref)) :
200 198 $ded_addy = $ref[1];
201 199 else :
202 200 $ded_addy = NULL;
203 201 endif;
@@ -205,18 +203,18 @@
205 203 // Hey ho, let's go...
206 204 ?>
207 205 <table class="edit-form">
208 206 <tr style="vertical-align: top">
209 -<th scope="row"><?php esc_html_e( 'Debugging mode:' ); ?></th>
207 +<th scope="row">Debugging mode:</th>
210 208 <td><select name="feedwordpress_debug" size="1">
211 -<option value="yes"<?php echo ( $settings['debug'] ? ' selected="selected"' : '' ); ?>><?php esc_html_e( 'on' ); ?></option>
212 -<option value="no"<?php echo ( $settings['debug'] ? '' : ' selected="selected"' ); ?>><?php esc_html_e( 'off' ); ?></option>
209 +<option value="yes"<?php echo ($settings['debug'] ? ' selected="selected"' : ''); ?>>on</option>
210 +<option value="no"<?php echo ($settings['debug'] ? '' : ' selected="selected"'); ?>>off</option>
213 211 </select>
214 212
215 -<p><?php esc_html_e( 'When debugging mode is <strong>ON</strong>, FeedWordPress displays many
213 +<p>When debugging mode is <strong>ON</strong>, FeedWordPress displays many
216 214 diagnostic error messages, warnings, and notices that are ordinarily suppressed,
217 215 and turns off all caching of feeds. Use with caution: this setting is useful for
218 -testing but absolutely inappropriate for a production server.' ); ?></p>
216 +testing but absolutely inappropriate for a production server.</p>
219 217
220 218 </td>
221 219 </tr>
222 220 <tr>
@@ -221,18 +219,18 @@
221 219 </tr>
222 220 <tr>
223 221 <th scope="row">Diagnostics output:</th>
224 222 <td><ul class="options">
225 -<li><input type="checkbox" name="diagnostics_output[]" value="error_log" <?php print ( in_array( 'error_log', $diagnostics_output ) ? ' checked="checked"' : ''); ?> /> Log in PHP error logs</label></li>
223 +<li><input type="checkbox" name="diagnostics_output[]" value="error_log" <?php print (in_array('error_log', $diagnostics_output) ? ' checked="checked"' : ''); ?> /> Log in PHP error logs</label></li>
226 224 <li><input type="checkbox" name="diagnostics_output[]" value="admin_footer" <?php print (in_array('admin_footer', $diagnostics_output) ? ' checked="checked"' : ''); ?> /> Display in WordPress admin footer</label></li>
227 225 <li><input type="checkbox" name="diagnostics_output[]" value="echo" <?php print (in_array('echo', $diagnostics_output) ? ' checked="checked"' : ''); ?> /> Echo in web browser as they are issued</label></li>
228 226 <li><input type="checkbox" name="diagnostics_output[]" value="echo_in_cronjob" <?php print (in_array('echo_in_cronjob', $diagnostics_output) ? ' checked="checked"' : ''); ?> /> Echo to output when they are issued during an update cron job</label></li>
229 227 <li><input type="checkbox" name="diagnostics_output[]" value="email" <?php print (in_array('email', $diagnostics_output) ? ' checked="checked"' : ''); ?> /> Send a daily email digest to:</label> <select name="diagnostics_email_destination" id="diagnostics-email-destination" size="1">
230 -<option value="admins"<?php if ( 'admins' == $ded ) : ?> selected="selected"<?php endif; ?>>the site administrators</option>
228 +<option value="admins"<?php if ('admins'==$ded) : ?> selected="selected"<?php endif; ?>>the site administrators</option>
231 229 <?php foreach ($users as $id => $name) : ?>
232 230 <option value="user:<?php print (int) $id; ?>"<?php if (sprintf('user:%d', (int) $id)==$ded) : ?> selected="selected"<?php endif; ?>><?php print esc_html($name); ?></option>
233 231 <?php endforeach; ?>
234 -<option value="mailto"<?php if ( !is_null($ded_addy)) : ?> selected="selected"<?php endif; ?>>another e-mail address...</option>
232 +<option value="mailto"<?php if (!is_null($ded_addy)) : ?> selected="selected"<?php endif; ?>>another e-mail address...</option>
235 233 </select>
236 234 <input type="email" id="diagnostics-email-destination-address" name="diagnostics_email_destination_address" value="<?php print esc_attr( $ded_addy ); ?>" placeholder="email address" /></li>
237 235 </ul></td>
238 236 </tr>
@@ -245,9 +243,9 @@
245 243 'diagnostics-email-destination-default',
246 244 'mailto',
247 245 'inline'
248 246 );
249 - jQuery( '#diagnostics-email-destination' ).change ( function () {
247 + jQuery('#diagnostics-email-destination').change ( function () {
250 248 contextual_appearance(
251 249 'diagnostics-email-destination',
252 250 'diagnostics-email-destination-address',
253 251 'diagnostics-email-destination-default',
@@ -258,19 +256,11 @@
258 256 </script>
259 257 <?php
260 258 } /* FeedWordPressDiagnosticsPage::diagnostics_box () */
261 259
262 - /**
263 - * Shows the box for the many possible update options.
264 - *
265 - * @param type $page description
266 - * @param type $box description
267 - *
268 - * @return void description
269 - */
270 260 static function updates_box ($page, $box = NULL) {
271 - $hours = get_option( 'feedwordpress_diagnostics_persistent_errors_hours', 2 );
272 - $fields = apply_filters( 'feedwordpress_diagnostics', array(
261 + $hours = get_option('feedwordpress_diagnostics_persistent_errors_hours', 2);
262 + $fields = apply_filters('feedwordpress_diagnostics', array(
273 263 'Update Diagnostics' => array(
274 264 'update_schedule:check' => 'whenever a FeedWordPress checks in on the update schedule',
275 265 'updated_feeds' => 'as each feed is checked for updates',
276 266 'syndicated_posts' => 'as each syndicated post is added to the database',
@@ -276,9 +266,8 @@
276 266 'syndicated_posts' => 'as each syndicated post is added to the database',
277 267 'feed_items' => 'as each syndicated item is considered on the feed',
278 268 'memory_usage' => 'indicating how much memory was used',
279 269 ),
280 - // Note: the embedded HTML gets filtered out, so this might require some refactoring. (gwyneth 20230917)
281 270 'Feed Retrieval' => array(
282 271 'updated_feeds:errors:persistent' => 'when attempts to update a feed have resulted in errors</label> <label>for at least <input type="number" min="1" max="360" step="1" name="diagnostics_persistent_error_hours" value="'.$hours.'" /> hours',
283 272 'updated_feeds:errors' => 'any time FeedWordPress encounters any errors while checking a feed for updates',
284 273 'updated_feeds:http' => "displaying the raw HTTP data passed to and from the feed being checked for updates",
@@ -295,18 +284,18 @@
295 284 'feed_items:freshness:sql' => 'when FeedWordPress issues the SQL query it uses to decide whether to treat items as new, updates, or duplicates',
296 285 'syndicated_posts:categories:test' => 'as FeedWordPress checks for the familiarity of feed categories and tags',
297 286 'syndicated_posts:static_meta_data' => 'providing meta-data about syndicated posts in the Edit Posts interface',
298 287 ),
299 - ), $page );
288 + ), $page);
300 289
301 - foreach ( $fields as $section => $items ) :
302 - foreach ( $items as $key => $label ) :
290 + foreach ($fields as $section => $items) :
291 + foreach ($items as $key => $label) :
303 292 $checked[$key] = '';
304 293 endforeach;
305 294 endforeach;
306 295
307 - $diagnostics_show = get_option( 'feedwordpress_diagnostics_show', array() );
308 - if ( is_array( $diagnostics_show ) ) : foreach ( $diagnostics_show as $thingy ) :
296 + $diagnostics_show = get_option('feedwordpress_diagnostics_show', array());
297 + if (is_array($diagnostics_show)) : foreach ($diagnostics_show as $thingy) :
309 298 $checked[$thingy] = ' checked="checked"';
310 299 endforeach; endif;
311 300
312 301 // Hey ho, let's go...
@@ -314,14 +303,14 @@
314 303 <table class="edit-form">
315 304 <?php foreach ($fields as $section => $ul) : ?>
316 305 <tr>
317 306 <th scope="row"><?php print esc_html($section); ?>:</th>
318 - <td><p><?php esc_html_e( 'Show a diagnostic message...' ); ?></p>
307 + <td><p>Show a diagnostic message...</p>
319 308 <ul class="options">
320 309 <?php foreach ($ul as $key => $label) : ?>
321 310 <li><label><input
322 311 type="checkbox" name="diagnostics_show[]"
323 - value="<?php print esc_html( $key ); ?>"
312 + value="<?php print esc_html($key); ?>"
324 313 <?php fwp_selected_flag( $checked, $key, "checked" ); ?> />
325 314 <?php print esc_html( $label ); ?></label></li>
326 315 <?php endforeach; ?>
327 316 </ul></td>
@@ -334,9 +323,9 @@
334 323 static function tests_box ($page, $box = NULL) {
335 324 $url = FeedWordPress::param( 'http_test_url' );
336 325 $method = FeedWordPress::param( 'http_test_method' );
337 326 $xpath = FeedWordPress::param( 'http_test_xpath' );
338 -
327 +
339 328 $aMethods = array(
340 329 'wp_remote_request',
341 330 'FeedWordPie_File',
342 331 'FeedWordPress::fetch',
@@ -367,9 +356,9 @@
367 356 if ($method==$sMethod) :
368 357 print ' selected="selected"';
369 358 endif;
370 359 ?>><?php
371 - print esc_html( $sMethod );
360 + print $sMethod;
372 361 ?></option>
373 362 <?php endforeach; ?>
374 363 </select></div>
375 364 <table>
@@ -375,15 +364,15 @@
375 364 <table>
376 365 <tr>
377 366 <td>
378 367 <div id="http-test-args">
379 - <div id="http-test-args-keyvalue-prototype" class="http-test-args-keyvalue"><label><?php esc_html_e( 'Args' ); ?>:
368 + <div id="http-test-args-keyvalue-prototype" class="http-test-args-keyvalue"><label>Args:
380 369 <input type="text" class='http_test_args_key' name="http_test_args_key[0]" value="" placeholder="key" /></label>
381 370 <label>= <input type="text" class='http_test_args_value' name="http_test_args_value[0]" value="" placeholder="value" /></label>
382 371 </div>
383 372 </div>
384 373 </td>
385 - <td><a href="#http-test-args" onclick="return clone_http_test_args_keyvalue_prototype();"><span class="dashicons dashicons-plus fwp-no-underline"></span> <?php esc_html_e( 'Add' ); ?></a></td>
374 + <td><a href="#http-test-args" onclick="return clone_http_test_args_keyvalue_prototype();">+ Add</a></td>
386 375 </tr>
387 376 </table>
388 377 </td>
389 378 </tr>
@@ -390,15 +379,15 @@
390 379
391 380 <tr>
392 381 <th>XPath:</th>
393 382 <td><div><input type="text" name="http_test_xpath" value="<?php print esc_attr($xpath); ?>" placeholder="xpath-like query" /></div>
394 - <div><p><?php esc_html_e( 'Leave blank to test HTTP, fill in to test a query.' ); ?></p></div>
383 + <div><p>Leave blank to test HTTP, fill in to test a query.</p></div>
395 384 </td>
396 385 </tr>
397 -
386 +
398 387 <?php if (isset($page->test_html['http_test'])) : ?>
399 388 <tr>
400 - <th scope="row"><?php esc_html_e( 'RESULTS:' ); ?></th>
389 + <th scope="row">RESULTS:</th>
401 390 <td>
402 391 <div>URL: <code><?php print esc_html($page->test_html['url']); ?></code></div>
403 392 <div style="position: relative">
404 393 <div style="width: 100%; overflow: scroll; background-color: #eed">
@@ -482,9 +471,9 @@
482 471 endif;
483 472 endif;
484 473 break;
485 474 endswitch;
486 -
475 +
487 476 $this->test_html['url'] = $url;
488 477 $this->test_html['http_test'] = esc_html( MyPHP::val($out) );
489 478 endif;
490 479 } /* FeedWordPressDiagnosticsPage::do_http_test () */