PluginProbe
FeedWordPress / 2022.0204
FeedWordPress v2022.0204
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 | feeds-page.php +467 -666 trunk2022.0204 View file →
@@ -1,34 +1,12 @@
1 1 <?php
2 -require_once dirname(__FILE__) . '/admin-ui.php';
3 -require_once dirname(__FILE__) . '/magpiemocklink.class.php';
4 -require_once dirname(__FILE__) . '/feedfinder.class.php';
5 -require_once dirname(__FILE__) . '/updatedpostscontrol.class.php';
2 +require_once(dirname(__FILE__) . '/admin-ui.php');
3 +require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
4 +require_once(dirname(__FILE__) . '/feedfinder.class.php');
5 +require_once(dirname(__FILE__) . '/updatedpostscontrol.class.php');
6 6
7 -/**
8 - * List of feeds for FWP
9 - *
10 - * @extends FeedWordPressAdminPage
11 - * @global $post_source
12 - */
13 7 class FeedWordPressFeedsPage extends FeedWordPressAdminPage {
14 - /**
15 - * List of possible HTTP status messages.
16 - *
17 - * @var array
18 - *
19 - * @note Added a few more, renamed a few to stick to contemporary standard. (gwyneth 20230918)
20 - */
21 - var $HTTPStatusMessages = array(
22 - 100 => 'Continue',
23 - 101 => 'Switching Protocols',
24 - 102 => 'Processing', // WebDAV; RFC 2518
25 - 103 => 'Early Hints', // RFC 8297
26 - 110 => 'Response is Stale', // Obsoleted in 2022 by RFC 9111 (caching-related)
27 - 111 => 'Revalidation Failed', // Obsoleted in 2022 by RFC 9111 (caching-related)
28 - 112 => 'Disconnected Operation', // Obsoleted in 2022 by RFC 9111 (caching-related)
29 - 113 => 'Heuristic Expiration', // Obsoleted in 2022 by RFC 9111 (caching-related)
30 - 199 => 'Miscellaneous Warning', // Obsoleted in 2022 by RFC 9111 (caching-related)
8 + var $HTTPStatusMessages = array (
31 9 200 => 'OK. FeedWordPress had no problems retrieving the content at this URL but the content does not seem to be a feed, and does not seem to include links to any feeds.',
32 10 201 => 'Created',
33 11 202 => 'Accepted',
34 12 203 => 'Non-Authoritative information',
@@ -34,23 +12,15 @@
34 12 203 => 'Non-Authoritative information',
35 13 204 => 'No Content',
36 14 205 => 'Reset Content',
37 15 206 => 'Partial Content',
38 - 207 => 'Multi-Status', // WebDAV; RFC 4918
39 - 208 => 'Already Reported', // WebDAV; RFC 5842
40 - 214 => 'Transformation Applied', // Obsoleted in 2022 by RFC 9111 (caching-related)
41 - 218 => 'This is fine', // Non-standard; used by the Apache HTTP Serve)
42 - 226 => 'IM Used', // RFC 3229
43 - 299 => 'Miscellaneous Persistent Warning', // Obsoleted in 2022 by RFC 9111 (caching-related)
44 16 300 => 'Multiple Choices',
45 17 301 => 'Moved Permanently',
46 - 302 => 'Found', // Previously known as 'Moved temporarily'
18 + 302 => 'Found',
47 19 303 => 'See Other',
48 20 304 => 'Not Modified',
49 21 305 => 'Use Proxy',
50 - 306 => 'Switch Proxy',
51 22 307 => 'Temporary Redirect',
52 - 308 => 'Permanent Redirect',
53 23 400 => 'Bad Request',
54 24 401 => 'Unauthorized. This URL probably needs a username and password for you to access it.',
55 25 402 => 'Payment Required',
56 26 403 => 'Forbidden. The URL is not made available for the machine that FeedWordPress is running on.',
@@ -62,38 +32,13 @@
62 32 409 => 'Conflict',
63 33 410 => 'Gone. This URL is no longer available on this server and no forwarding address is known.',
64 34 411 => 'Length Required',
65 35 412 => 'Precondition Failed',
66 - 413 => 'Payload Too Large', // Previously known as 'Request Entity Too Large'
67 - 414 => 'URI Too Long', // Previously known as 'Request URI Too Long'
36 + 413 => 'Request Entity Too Large',
37 + 414 => 'Request URI Too Long',
68 38 415 => 'Unsupported Media Type',
69 - 416 => 'Range Not Satisfiable', // Previously known as 'Requested Range Not Satisfiable'
39 + 416 => 'Requested Range Not Satisfiable',
70 40 417 => 'Expectation Failed',
71 - 418 => 'I\'m a teapot', // RFC 2324, RFC 7168
72 - 419 => 'Page Expired', // Non-standard; used by the Laravel Framework
73 - 420 => 'Enhance Your Calm', // Non-standard; used by version 1.0 of the Twitter API
74 - 421 => 'Misdirected Request',
75 - 422 => 'Unprocessable Entity',
76 - 423 => 'Locked', // WebDAV; RFC 4918
77 - 424 => 'Failed Dependency', // WebDAV; RFC 4918
78 - 425 => 'Too Early', // RFC 8470
79 - 426 => 'Upgrade Required',
80 - 428 => 'Precondition Required', // RFC 6585
81 - 429 => 'Too Many Requests', // RFC 6585
82 - 431 => 'Request Header Fields Too Large', // RFC 6585
83 - 440 => 'Login Time-out', // Non-standard; used by Microsoft on IIS
84 - 444 => 'No Response', // Non-standard; used internally by the nginx web server
85 - 449 => 'Retry With', // Non-standard; used by Microsoft on IIS
86 - 450 => 'Blocked by Windows Parental Controls', // Non-standard; used by Microsoft
87 - 451 => 'Unavailable For Legal Reasons', // RFC 7725; also: used by Microsoft IIS for a redirect
88 - 460 => 'Too Soon', // Non-standard; used by Amazon on AWS
89 - 463 => 'Too Many IP Addresses', // Non-standard; used by Amazon on AWS
90 - 464 => 'Incompatible Protocol Version', // Non-standard; used by Amazon on AWS
91 - 494 => 'Request Header Too Large', // Non-standard; used by the nginx web server
92 - 495 => 'SSL Certificate Error', // Non-standard; used by the nginx web server
93 - 496 => 'SSL Certificate Required', // Non-standard; used by the nginx web server
94 - 498 => 'Invalid Token', // Non-standard; used by Esri on their ArcGIS for Server product
95 - 499 => 'Token Required', // Non-standard; used by Esri on their ArcGIS for Server product; also used as 'Client Closed Request' by the nginx web server
96 41 500 => 'Internal Server Error. Something unexpected went wrong with the configuration of the server that hosts this URL. You might try again later to see if this issue has been resolved.',
97 42 501 => 'Not Implemented',
98 43 502 => 'Bad Gateway',
99 44 503 => 'Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server that hosts this URL. This is probably a temporary condition and you should try again later to see if the issue has been resolved.',
@@ -98,44 +43,12 @@
98 43 502 => 'Bad Gateway',
99 44 503 => 'Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server that hosts this URL. This is probably a temporary condition and you should try again later to see if the issue has been resolved.',
100 45 504 => 'Gateway Timeout',
101 46 505 => 'HTTP Version Not Supported',
102 - 506 => 'Variant Also Negotiates', // RFC 2295
103 - 507 => 'Insufficient Storage', // WebDAV; RFC 4918
104 - 508 => 'Loop Detected', // WebDAV; RFC 5842
105 - 509 => 'Bandwidth Limit Exceeded', // Non-standard; used by the Apache Web Server as well as cPanel
106 - 510 => 'Not Extended', // RFC 2774
107 - 511 => 'Network Authentication Required', // RFC 6585
108 - 520 => 'Web Server Returned an Unknown Error', // Non-Standard; used by Cloudflare
109 - 521 => 'Web Server Is Down', // Non-Standard; used by Cloudflare
110 - 522 => 'Connection Timed Out', // Non-Standard; used by Cloudflare
111 - 523 => 'Origin Is Unreachable', // Non-Standard; used by Cloudflare
112 - 524 => 'A Timeout Occurred', // Non-Standard; used by Cloudflare
113 - 525 => 'SSL Handshake Failed', // Non-Standard; used by Cloudflare
114 - 526 => 'Invalid SSL Certificate', // Non-Standard; used by Cloudflare
115 - 527 => 'Railgun Error', // Non-Standard; used by Cloudflare
116 - 529 => 'Site is overloaded', // Non-standard; used by Qualys on its SSLLabs server testing API
117 - 530 => 'Site is frozen', // Non-standard; used by the Pantheon Systems web platform
118 - 561 => 'Unauthorized', // Non-standard; used by Amazon on AWS
119 - 598 => 'Network Read Timeout Error', // Non-standard; informal convention used by some HTTP procoes
120 - 599 => 'Network Connect Timeout Error', // Non-standard; informal convention used by some HTTP procoes
121 47 );
122 -
123 - /**
124 - * List of updated posts.
125 - *
126 - * @var mixed
127 - */
128 48 var $updatedPosts = NULL;
129 49
130 - /**
131 - * List of special settings.
132 - *
133 - * Regular expression syntax is OK here.
134 - *
135 - * @var Array
136 - */
137 - var $special_settings = array(
50 + var $special_settings = array ( /* Regular expression syntax is OK here */
138 51 'cats',
139 52 'cat_split',
140 53 'fetch timeout',
141 54 'freeze updates',
@@ -168,16 +81,15 @@
168 81 /**
169 82 * Constructs the Feeds page object
170 83 *
171 84 * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings
172 - * @uses UpdatedPostsControl
173 85 */
174 86 public function __construct( $link = -1 ) {
175 - if ( is_numeric( $link ) and -1 == $link ) :
87 + if (is_numeric($link) and -1 == $link) :
176 88 $link = $this->submitted_link();
177 89 endif;
178 90
179 - parent::__construct( 'feedwordpressfeeds', $link );
91 + parent::__construct('feedwordpressfeeds', $link);
180 92
181 93 $this->dispatch = 'feedwordpress_admin_page_feeds';
182 94 $this->pagenames = array(
183 95 'default' => 'Feeds',
@@ -184,45 +96,39 @@
184 96 'settings-update' => 'Syndicated feed',
185 97 'open-sheet' => 'Feed and Update',
186 98 );
187 99 $this->filename = __FILE__;
188 - $this->updatedPosts = new UpdatedPostsControl( $this );
189 -
190 - $this->special_settings = apply_filters( 'syndicated_feed_special_settings', $this->special_settings, $this );
100 + $this->updatedPosts = new UpdatedPostsControl($this);
101 +
102 + $this->special_settings = apply_filters('syndicated_feed_special_settings', $this->special_settings, $this);
191 103 } /* FeedWordPressFeedsPage constructor */
192 104
193 - /**
194 - * Prints out the feeds page.
195 - *
196 - * @return bool TRUE to continue printing out, FALSE to stop.
197 - * @uses FeedWordPress::param()
198 - */
199 - function display() {
105 + function display () {
106 + global $fwp_post;
200 107 global $post_source;
201 108
202 109 $this->boxes_by_methods = array(
203 - 'feed_information_box' => __( 'Feed Information' ),
204 - 'global_feeds_box' => __( 'Update Scheduling' ),
205 - 'updated_posts_box' => __( 'Updated Posts' ),
206 - 'custom_settings_box' => __( 'Custom Feed Settings (for use in templates)' ),
207 - 'advanced_settings_box' => __( 'Advanced Settings' ),
110 + 'feed_information_box' => __('Feed Information'),
111 + 'global_feeds_box' => __('Update Scheduling'),
112 + 'updated_posts_box' => __('Updated Posts'),
113 + 'custom_settings_box' => __('Custom Feed Settings (for use in templates)'),
114 + 'advanced_settings_box' => __('Advanced Settings'),
208 115 );
209 116 if ($this->for_default_settings()) :
210 - unset( $this->boxes_by_methods['custom_settings_box'] );
211 - endif;
212 -
117 + unset($this->boxes_by_methods['custom_settings_box']);
118 + endif;
119 +
213 120 // Allow overriding of normal source for FeedFinder, which may
214 121 // be called from multiple points.
215 - if ( isset( $post_source ) and ! is_null( $post_source ) ) :
122 + if (isset($post_source) and !is_null($post_source)) :
216 123 $source = $post_source;
217 124 else :
218 125 $source = $this->dispatch;
219 126 endif;
220 127
221 - $feedfinder = FeedWordPress::param( 'feedfinder' );
222 - $action = FeedWordPress::param( 'action' );
223 - if ( $feedfinder || in_array( $action, array( 'feedfinder', FWP_SYNDICATE_NEW ) ) ) :
224 -
128 + if (isset($_REQUEST['feedfinder'])
129 + or (isset($_REQUEST['action']) and $_REQUEST['action']=='feedfinder')
130 + or (isset($_REQUEST['action']) and $_REQUEST['action']==FWP_SYNDICATE_NEW)) :
225 131 // If this is a POST, validate source and user credentials
226 132 FeedWordPressCompatibility::validate_http_request(/*action=*/ $source, /*capability=*/ 'manage_links');
227 133
228 134 return $this->display_feedfinder(); // re-route to Feed Finder page
@@ -231,55 +137,48 @@
231 137 parent::display();
232 138 return false; // Don't continue
233 139 } /* FeedWordPressFeedsPage::display() */
234 140
235 - /**
236 - * Interface with JavaScript calls.
237 - *
238 - */
239 - function ajax_interface_js() {
141 + function ajax_interface_js () {
240 142 parent::ajax_interface_js();
241 143 ?>
242 - jQuery( document ).ready( function () {
243 - contextual_appearance( 'automatic-updates-selector', 'cron-job-explanation', null, 'no' );
244 - contextual_appearance( 'time-limit', 'time-limit-box', null, 'yes' );
245 - contextual_appearance( 'use-default-update-window-no', 'update-scheduling-note', null, null, 'block', true );
246 - jQuery( '#use-default-update-window-yes, #use-default-update-window-no' ).click( function () {
247 - contextual_appearance( 'use-default-update-window-no', 'update-scheduling-note', null, null, 'block', true );
144 +
145 + jQuery(document).ready( function () {
146 + contextual_appearance('automatic-updates-selector', 'cron-job-explanation', null, 'no');
147 + contextual_appearance('time-limit', 'time-limit-box', null, 'yes');
148 + contextual_appearance('use-default-update-window-no', 'update-scheduling-note', null, null, 'block', true);
149 + jQuery('#use-default-update-window-yes, #use-default-update-window-no').click( function () {
150 + contextual_appearance('use-default-update-window-no', 'update-scheduling-note', null, null, 'block', true);
248 151 } );
249 152
250 - var els = [ 'name', 'description', 'url' ];
251 - for ( var i = 0; i < els.length; i++ ) {
153 + var els = ['name', 'description', 'url'];
154 + for (var i = 0; i < els.length; i++) {
252 155 contextual_appearance(
253 - /*item=*/ 'basics-hardcode-' + els[i],
254 - /*appear=*/ 'basics-' + els[i] + '-view',
255 - /*disappear=*/ 'basics-' + els[i] + '-edit',
256 - /*value=*/ 'no',
156 + /*item=*/ 'basics-hardcode-'+els[i],
157 + /*appear=*/ 'basics-'+els[i]+'-view',
158 + /*disappear=*/ 'basics-'+els[i]+'-edit',
159 + /*value=*/ 'no',
257 160 /*visibleStyle=*/ 'block',
258 - /*checkbox=*/ true
161 + /*checkbox=*/ true
259 162 );
260 163 } /* for */
261 -
164 +
262 165 // Let's make the interface for the PAUSE/RESUME a bit better
263 - jQuery( '<tr id="reveal-pause-resume"><th></th><td><button id="pause-resume-reveal-button">&mdash; PAUSE or RESUME UPDATES &mdash;</button></td></tr>' ).insertBefore( '#pause-resume' );
264 - jQuery( '#pause-resume' ).hide();
265 - jQuery( '#pause-resume-reveal-button' ).click( function( ev ) {
166 + jQuery('<tr id="reveal-pause-resume"><th></th><td><button id="pause-resume-reveal-button">&#8212; PAUSE or RESUME UPDATES &#8212;</button></td></tr>').insertBefore('#pause-resume');
167 + jQuery('#pause-resume').hide();
168 + jQuery('#pause-resume-reveal-button').click(function(ev) {
266 169 ev.preventDefault();
267 170
268 - jQuery( '#pause-resume' ).toggle();
171 + jQuery('#pause-resume').toggle();
269 172 return false;
270 173 });
174 +
271 175 } );
176 +
272 177 <?php
273 - } /* FeedWordPressFeedsPage::ajax_interface_js() */
274 -
275 - /**
276 - * Displays updated feeds.
277 - *
278 - * @param object $page Current page object (?).
279 - * @param mixed|null $box A box inside this object.
280 - */
281 - /*static*/ function updated_posts_box( $page, $box = NULL ) {
178 + }
179 +
180 + /*static*/ function updated_posts_box ($page, $box = NULL) {
282 181 ?>
283 182 <table class="edit-form">
284 183 <?php $page->updatedPosts->display(); ?>
285 184 </table>
@@ -285,148 +184,136 @@
285 184 </table>
286 185 <?php
287 186 } /* FeedWordPressFeedsPage::updated_posts_box() */
288 187
289 - /**
290 - * Displays form to deal with global feeds.
291 - *
292 - * @param object $page Current page object (?).
293 - * @param mixed|null $box A box inside this object.
294 - *
295 - * @uses FeedWordPress::automatic_update_hook()
296 - */
297 - /*static*/ function global_feeds_box( $page, $box = NULL ) {
188 + /*static*/ function global_feeds_box ($page, $box = NULL) {
298 189 global $feedwordpress;
299 - $automatic_updates = $feedwordpress->automatic_update_hook( array( 'setting only' => true ) );
300 - $update_time_limit = (int) get_option( 'feedwordpress_update_time_limit' );
190 + $automatic_updates = $feedwordpress->automatic_update_hook(array('setting only' => true));
191 + $update_time_limit = (int) get_option('feedwordpress_update_time_limit');
301 192
302 193 // Hey, ho, let's go...
303 194 ?>
304 195
305 - <table class="edit-form"
306 - <?php if ( $page->for_default_settings() ) : ?>
196 + <table class="edit-form">
197 + <?php if ($page->for_default_settings()) : ?>
307 198
308 199 <tr>
309 - <th scope="row"><?php esc_html_e( 'Update Method:' ); ?></th>
200 + <th scope="row">Update Method:</th>
310 201 <td><select id="automatic-updates-selector" name="automatic_updates" size="1" onchange="contextual_appearance('automatic-updates-selector', 'cron-job-explanation', null, 'no');">
311 - <option value="shutdown"<?php fwp_selected_flag( 'shutdown' == $automatic_updates ); ?>><?php esc_html_e( 'automatically check for updates after pages load' ); ?></option>
312 - <option value="init"<?php fwp_selected_flag( 'init' == $automatic_updates ); ?>><?php esc_html_e( 'automatically check for updates before pages load' ); ?></option>
313 - <option value="no"<?php fwp_selected_flag( ! $automatic_updates ); ?>><?php esc_html_e( 'cron job or manual updates' ); ?></option>
202 + <option value="shutdown"<?php fwp_selected_flag( $automatic_updates=='shutdown' ); ?>>automatically check for updates after pages load</option>
203 + <option value="init"<?php fwp_selected_flag( $automatic_updates=='init' ); ?>>automatically check for updates before pages load</option>
204 + <option value="no"<?php fwp_selected_flag( !$automatic_updates ); ?>>cron job or manual updates</option>
314 205 </select>
315 206 <div id="cron-job-explanation" class="setting-description">
316 207 <p><?php
317 - /* Do we have shell_exec() available from here, or is it disabled for security reasons?
318 - * If it's available, use it to execute `which` to try to get a realistic path to curl,
319 - * or to wget. If everything fails or shell_exec() isn't available, then just make
320 - * up something for the sake of example.
321 - */
322 - /** var string|null Path to either cURL or wget executables. */
208 + // Do we have shell_exec() available from here, or is it disabled for security reasons?
209 + // If it's available, use it to execute `which` to try to get a realistic path to curl,
210 + // or to wget. If everything fails or shell_exec() isn't available, then just make
211 + // up something for the sake of example.
323 212 $curlOrWgetPath = NULL;
324 213
325 - /** var bool True if this WP installation can call shell commands. */
326 - $shellExecAvailable = ( is_callable( 'shell_exec' ) && false === stripos( ini_get( 'disable_functions' ), 'shell_exec') );
214 + $shellExecAvailable = (is_callable('shell_exec') && false === stripos(ini_get('disable_functions'), 'shell_exec'));
327 215
328 - if ( $shellExecAvailable ) :
216 + if ($shellExecAvailable) :
329 217 $curlOrWgetPath = `which curl`; $opts = '--silent %s';
330 218 endif;
331 219
332 - if ( $shellExecAvailable and ( is_null( $curlOrWgetPath ) or strlen( trim( $curlOrWgetPath ) ) == 0 ) ) :
220 + if ($shellExecAvailable and (is_null($curlOrWgetPath) or strlen(trim($curlOrWgetPath))==0)) :
333 221 $curlOrWgetPath = `which wget`; $opts = '-q -O - %s';
334 222 endif;
335 223
336 - if ( is_null( $curlOrWgetPath ) or strlen( trim( $curlOrWgetPath ) ) == 0 ) :
224 + if (is_null($curlOrWgetPath) or strlen(trim($curlOrWgetPath))==0) :
337 225 $curlOrWgetPath = '/usr/bin/curl'; $opts = '--silent %s';
338 226 endif;
339 227
340 - $curlOrWgetPath = preg_replace( '/\n+$/', '', $curlOrWgetPath );
341 -
342 - /** var string Constructed shell command line to call cURL/wget for updating FeedWordPress feeds. */
343 - $cmdline = $curlOrWgetPath . ' ' . sprintf( $opts, get_bloginfo( 'url' ) . '?update_feedwordpress=1' );
344 -
345 - ?><?php esc_html_e( 'If you want to use a cron job, you can perform scheduled updates by sending regularly-scheduled requests to ' ); ?><a href="<?php bloginfo('url'); ?>?update_feedwordpress=1"><code><?php bloginfo('url'); ?>?update_feedwordpress=1</code></a>
346 - <?php esc_html_e( 'For example, inserting the following line in your crontab:' ); ?></p>
228 + $curlOrWgetPath = preg_replace('/\n+$/', '', $curlOrWgetPath);
229 +
230 + $cmdline = $curlOrWgetPath . ' ' . sprintf($opts, get_bloginfo('url').'?update_feedwordpress=1');
231 +
232 + ?>If you want to use a cron job,
233 + you can perform scheduled updates by sending regularly-scheduled
234 + requests to <a href="<?php bloginfo('url'); ?>?update_feedwordpress=1"><code><?php bloginfo('url'); ?>?update_feedwordpress=1</code></a>
235 + For example, inserting the following line in your crontab:</p>
347 236 <pre style="font-size: 0.80em"><code>*/10 * * * * <?php print esc_html($cmdline); ?></code></pre>
348 - <p class="setting-description"><?php esc_html_e( 'will check in every 10 minutes and check for updates on any feeds that are ready to be polled for updates.' ); ?></p>
237 + <p class="setting-description">will check in every 10 minutes
238 + and check for updates on any feeds that are ready to be polled for updates.</p>
349 239 </div>
350 240 </td>
351 241 </tr>
352 -
242 +
353 243 <?php else : /* Feed-specific settings */ ?>
354 244
355 245 <tr>
356 - <th scope="row"><?php esc_html_e( 'Last update' ) ?>:</th>
246 + <th scope="row"><?php _e('Last update') ?>:</th>
357 247 <td><?php
358 - if ( isset( $page->link->settings['update/last'] ) ) :
359 - echo esc_html( fwp_time_elapsed( $page->link->settings['update/last'] ) . " " );
248 + if (isset($page->link->settings['update/last'])) :
249 + echo fwp_time_elapsed($page->link->settings['update/last'])." ";
360 250 else :
361 - esc_html_e( " none yet" );
251 + echo " none yet";
362 252 endif;
363 253 ?></td></tr>
364 254
365 - <tr><th><?php esc_html_e( 'Next update' ) ?>:</th>
255 + <tr><th><?php _e('Next update') ?>:</th>
366 256 <td><?php
367 - $holdem = ( isset( $page->link->settings['update/hold'] ) ? $page->link->settings['update/hold'] : 'scheduled' );
257 + $holdem = (isset($page->link->settings['update/hold']) ? $page->link->settings['update/hold'] : 'scheduled');
368 258 ?>
369 259 <select name="update_schedule">
370 - <option value="scheduled"<?php echo ( 'scheduled' == $holdem ) ? ' selected="selected"' : ''; ?>><?php esc_html_e( 'update on schedule' ); ?> <?php
260 + <option value="scheduled"<?php echo ($holdem=='scheduled')?' selected="selected"':''; ?>>update on schedule <?php
371 261 echo " (";
372 - if ( isset( $page->link->settings['update/ttl'] ) and is_numeric( $page->link->settings['update/ttl'] ) ) :
373 - if ( isset( $page->link->settings['update/timed'] ) and 'automatically' == $page->link->settings['update/timed'] ) :
374 - esc_html_e( 'next: ');
375 - $next = $page->link->settings['update/last'] + ( (int) $page->link->settings['update/ttl'] * 60 );
376 - // Note: strftime() is deprecated; use date() instead. (gwyneth 20230918)
377 - if ( strftime( '%x', time() ) != strftime( '%x', $next) ) :
378 - echo esc_html( strftime( '%x', $next ) . ' ' );
262 + if (isset($page->link->settings['update/ttl']) and is_numeric($page->link->settings['update/ttl'])) :
263 + if (isset($page->link->settings['update/timed']) and $page->link->settings['update/timed']=='automatically') :
264 + echo 'next: ';
265 + $next = $page->link->settings['update/last'] + ((int) $page->link->settings['update/ttl'] * 60);
266 + if (strftime('%x', time()) != strftime('%x', $next)) :
267 + echo strftime('%x', $next)." ";
379 268 endif;
380 - echo esc_html( strftime( '%X', $page->link->settings['update/last'] + ( (int) $page->link->settings['update/ttl'] * 60 ) ) );
269 + echo strftime('%X', $page->link->settings['update/last']+((int) $page->link->settings['update/ttl']*60));
381 270 else :
382 - echo esc_html__( "every " ) . esc_html( $page->link->settings['update/ttl'] ) . esc_html__( " minute" )
383 - . ( ( 1 != $page->link->settings['update/ttl'] ) ? esc_html__( "s" ) : "" );
271 + echo "every ".$page->link->settings['update/ttl']." minute".(($page->link->settings['update/ttl']!=1)?"s":"");
384 272 endif;
385 273 else:
386 - esc_html_e( "next scheduled update" );
274 + echo "next scheduled update";
387 275 endif;
388 276 echo ")";
389 277 ?></option>
390 - <option value="next"<?php echo ( 'next' == $holdem ) ? ' selected="selected"' : ''; ?>><?php esc_html_e( 'update ASAP' ); ?></option>
391 - <option value="ping"<?php echo ( 'ping' == $holdem ) ? ' selected="selected"' : ''; ?>><?php esc_html_e( 'update only when pinged' ); ?></option>
278 + <option value="next"<?php echo ($holdem=='next')?' selected="selected"':''; ?>>update ASAP</option>
279 + <option value="ping"<?php echo ($holdem=='ping')?' selected="selected"':''; ?>>update only when pinged</option>
392 280 </select></td></tr>
393 -
281 +
394 282 <?php endif; ?>
395 283
396 284 <tr id="pause-resume">
397 - <th scope="row"><?php esc_html_e( 'Pause/Resume:'); ?></th>
285 + <th scope="row"><?php print __('Pause/Resume:'); ?></th>
398 286 <td><?php
399 287 $this->setting_radio_control(
400 - 'update/pause',
401 - 'update_pause',
288 + 'update/pause', 'update_pause',
402 289 /*options=*/ array(
403 - 'no' => __( '<strong>UPDATE:</strong> import new posts as normal' ),
404 - 'yes' => __( '<strong>PAUSE:</strong> do not import new posts until I unpause updates' ),
290 + 'no' => '<strong>UPDATE:</strong> import new posts as normal',
291 + 'yes' => '<strong>PAUSE:</strong> do not import new posts until I unpause updates',
405 292 ),
406 293 /*params=*/ array(
407 294 'setting-default' => NULL,
408 295 'global-setting-default' => 'no',
409 296 'default-input-value' => 'default',
410 - ),
297 + )
411 298 );
412 299 ?></td>
413 300 </tr>
414 301
415 302 <tr>
416 - <th scope="row"><?php esc_html_e( 'Update scheduling:') ?></th>
417 - <td><p style="margin-top:0px"><?php esc_html_e( 'How long should FeedWordPress wait between updates before it considers this feed ready to be polled for updates again?' ); ?></p>
303 + <th scope="row"><?php print __('Update scheduling:') ?></th>
304 + <td><p style="margin-top:0px">How long should FeedWordPress wait between updates before it considers this feed ready to be polled for updates again?</p>
418 305 <?php
306 +
419 307 $this->setting_radio_control(
420 - 'update/window',
421 - 'update_window',
422 - array( $this, 'update_window_edit_box' ),
308 + 'update/window', 'update_window',
309 + array($this, 'update_window_edit_box'),
423 310 array(
424 311 'global-setting-default' => DEFAULT_UPDATE_PERIOD,
425 - 'default-input-name' => 'use_default_update_window',
426 - 'default-input-id' => 'use-default-update-window-yes',
427 - 'default-input-id-no' => 'use-default-update-window-no',
428 - 'labels' => array($this, 'update_window_currently' ),
312 + 'default-input-name' => 'use_default_update_window',
313 + 'default-input-id' => 'use-default-update-window-yes',
314 + 'default-input-id-no' => 'use-default-update-window-no',
315 + 'labels' => array($this, 'update_window_currently'),
429 316 )
430 317 );
431 318 ?></td>
432 319 </tr>
@@ -431,20 +318,20 @@
431 318 ?></td>
432 319 </tr>
433 320
434 321 <tr>
435 - <th scope="row"><?php esc_html_e( 'Minimum Interval:'); ?></th>
436 - <td><p style="margin-top:0px"><?php esc_html_e( 'Some feeds include standard elements that
322 + <th scope="row"><?php print __('Minimum Interval:'); ?></th>
323 + <td><p style="margin-top:0px">Some feeds include standard elements that
437 324 request a specific update schedule. If the interval requested by the
438 - feed provider is <em>longer</em> than FeedWordPress&rsquo;s normal scheduling,
325 + feed provider is <em>longer</em> than FeedWordPress's normal scheduling,
439 326 FeedWordPress will always respect their request to slow down. But what
440 - should it do if the update interval is <em>shorter</em> than the schedule set above?' ); ?></p>
327 + should it do if the update interval is <em>shorter</em> than the schedule set above?</p>
441 328 <?php
442 329 $this->setting_radio_control(
443 330 'update/minimum', 'update_minimum',
444 331 /*options=*/ array(
445 - 'no' => __( 'Speed up and accept the interval from the feed provider' ),
446 - 'yes' => __( 'Keep pace and use the longer scheduling from FeedWordPress' ),
332 + 'no' => 'Speed up and accept the interval from the feed provider',
333 + 'yes' => 'Keep pace and use the longer scheduling from FeedWordPress',
447 334 ),
448 335 /*params=*/ array(
449 336 'setting-default' => NULL,
450 337 'global-setting-default' => 'no',
@@ -453,114 +340,76 @@
453 340 );
454 341 ?>
455 342 </td>
456 343 </tr>
457 -
344 +
458 345 <?php if ($this->for_default_settings()) : ?>
459 -
346 +
460 347 <tr>
461 - <th scope="row"><?php esc_html_e( 'Time limit on updates' ); ?>:</th>
462 - <td><select id="time-limit" name="update_time_limit" size="1" onchange="contextual_appearance( 'time-limit', 'time-limit-box', null, 'yes' );">
463 - <option value="no"<?php fwp_selected_flag( $update_time_limit <= 0 ); ?>><?php esc_html_e( 'no time limit on updates' ); ?></option>
464 - <option value="yes"<?php fwp_selected_flag( $update_time_limit > 0 ); ?>><?php esc_html_e( 'limit updates to no more than...' ); ?></option>
348 + <th scope="row"><?php print __('Time limit on updates'); ?>:</th>
349 + <td><select id="time-limit" name="update_time_limit" size="1" onchange="contextual_appearance('time-limit', 'time-limit-box', null, 'yes');">
350 + <option value="no"<?php fwp_selected_flag($update_time_limit<=0); ?>>no time limit on updates</option>
351 + <option value="yes"<?php fwp_selected_flag($update_time_limit>0); ?>>limit updates to no more than...</option>
465 352 </select>
466 - <span id="time-limit-box"><label><input type="text" name="time_limit_seconds" value="<?php print esc_attr( $update_time_limit ); ?>" size="5" /> <?php esc_html_e( 'seconds' ); ?></label></span>
353 + <span id="time-limit-box"><label><input type="text" name="time_limit_seconds" value="<?php print esc_attr($update_time_limit); ?>" size="5" /> seconds</label></span>
467 354 </tr>
468 355
469 356 <?php endif; ?>
470 -
357 +
471 358 </table>
472 -
359 +
473 360 <?php
474 361 } /* FeedWordPressFeedsPage::global_feeds_box() */
475 362
476 - /**
477 - * Updates the window edit box.
478 - *
479 - * @param int $updateWindow Minutes between polling.
480 - * @param bool $defaulted Unused.
481 - * @param array $params Unused.
482 - */
483 - function update_window_edit_box( $updateWindow, $defaulted, $params ) {
484 - if ( ! is_numeric( $updateWindow) ) :
363 + function update_window_edit_box ($updateWindow, $defaulted, $params) {
364 + if (!is_numeric($updateWindow)) :
485 365 $updateWindow = DEFAULT_UPDATE_PERIOD;
486 366 endif;
487 367 ?>
488 - <p><?php esc_html_e( 'Wait' ); ?> <input type="text" name="update_window" value="<?php print esc_attr( $updateWindow ); ?>" size="4" /> <?php esc_html_e( 'minutes between polling.' ); ?></p>
368 + <p>Wait <input type="text" name="update_window" value="<?php print esc_attr($updateWindow); ?>" size="4" /> minutes between polling.</p>
489 369 <div class="setting-description" id="update-scheduling-note">
490 - <p<?php if ( $updateWindow < 50 ) : ?> style="color: white; background-color: #703030; padding: 1.0em;"<?php endif; ?>><?php esc_html_e( '<strong>Recommendation.</strong> Unless you are positive that you have the webmaster&rsquo;s permission, you generally should not set FeedWordPress to poll feeds more frequently than once every 60 minutes. Many webmasters consider more frequent automated polling to be abusive, and may complain to your web host, or ban your IP address, as retaliation for hammering their servers too hard.' ); ?></p>
491 - <p><?php esc_html_e( '<strong>Note.</strong> This is a default setting that FeedWordPress uses to schedule updates when the feed does not provide any scheduling requests. If this feed does provide update scheduling information (through elements such as <code>&lt;rss:ttl&gt;</code> or <code>&lt;sy:updateFrequency&gt;</code>), FeedWordPress will respect the feed&rsquo;s request.' ); ?></p>
370 + <p<?php if ($updateWindow<50) : ?> style="color: white; background-color: #703030; padding: 1.0em;"<?php endif; ?>><strong>Recommendation.</strong> Unless you are positive that you have the webmaster's permission, you generally should not set FeedWordPress to poll feeds more frequently than once every 60 minutes. Many webmasters consider more frequent automated polling to be abusive, and may complain to your web host, or ban your IP address, as retaliation for hammering their servers too hard.</p>
371 + <p><strong>Note.</strong> This is a default setting that FeedWordPress uses to schedule updates when the feed does not provide any scheduling requests. If this feed does provide update scheduling information (through elements such as <code>&lt;rss:ttl&gt;</code> or <code>&lt;sy:updateFrequency&gt;</code>), FeedWordPress will respect the feed's request.</p>
492 372 </div>
493 373 <?php
494 - } /* FeedWordPressFeedsPage::update_window_edit_box() */
495 -
496 - /**
497 - * Auxiliary function to update the window with current polling waiting period.
498 - *
499 - * @param int $updateWindow Minutes between polling.
500 - * @param bool $defaulted Unused.
501 - * @param array $params Unused.
502 - */
503 - function update_window_currently( $updateWindow, $defaulted, $params ) {
374 + } /* FeedWordPressFeedsPage::update_window_edit_box () */
375 +
376 + function update_window_currently ($updateWindow, $defaulted, $params) {
504 377 $updateWindow = (int) $updateWindow;
505 - if ( 1 == $updateWindow ) :
506 - $caption = __( 'wait %d minute between polling' );
378 + if (1==$updateWindow) :
379 + $caption = 'wait %d minute between polling';
507 380 else :
508 - $caption = __( 'wait %d minutes between polling' );
381 + $caption = 'wait %d minutes between polling';
509 382 endif;
510 - return sprintf( $caption, $updateWindow );
511 - } /* FeedWordPressFeedsPage::update_window_currently() */
383 + return sprintf(__($caption), $updateWindow);
384 + } /* FeedWordPressFeedsPage::update_window_currently () */
385 +
386 + function fetch_timeout_setting ($setting, $defaulted, $params) {
387 + $timeout = intval($this->setting('fetch timeout', FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT));
512 388
513 - /**
514 - * Fetches the timeout setting.
515 - *
516 - * Nothing is returned, this just emits the HTML.
517 - *
518 - * @param int $setting Unused.
519 - * @param bool $defaulted Unused.
520 - * @param array $params Unused.
521 - */
522 - function fetch_timeout_setting( $setting, $defaulted, $params ) {
523 - /** var int Fetch feed timeout in seconds. */
524 - $timeout = intval( $this->setting( 'fetch timeout', FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT ) );
525 -
526 - if ( $this->for_feed_settings() ) :
527 - $article = __( 'this' );
389 + if ($this->for_feed_settings()) :
390 + $article = 'this';
528 391 else :
529 - $article = __( 'a' );
392 + $article = 'a';
530 393 endif;
531 394 ?>
532 - <p><?php esc_html_e( 'Wait no more than' ); ?> <input name="fetch_timeout" type="number" min="0" size="3" value="<?php print esc_attr( $timeout ); ?>" />
533 - <?php esc_html_e( 'second(s) when trying to fetch '); print esc_html( $article ); esc_html_e(' feed to check for updates. '); ?></p>
534 - <p><?php esc_html_e( 'If ' ); print esc_html( $article ); esc_html_e(' source&rsquo;s web server does not respond before time runs
535 - out, FeedWordPress will skip over the source and try again during the next update cycle.' ); ?></p>
395 + <p>Wait no more than
396 + than <input name="fetch_timeout" type="number" min="0" size="3" value="<?php print esc_attr($timeout); ?>" />
397 + second(s) when trying to fetch <?php print esc_html($article); ?> feed to check for updates.</p>
398 + <p>If <?php print esc_html($article); ?> source's web server does not respond before time runs
399 + out, FeedWordPress will skip over the source and try again during
400 + the next update cycle.</p>
536 401 <?php
537 - } /* FeedWordPressFeedsPage::fetch_timeout_setting() */
538 -
539 - /**
540 - * Properly formats the feed timeout setting, with plurals if required.
541 - *
542 - * Nothing is returned, this just emits the HTML.
543 - *
544 - * @param int $setting Value for the feed timeout, in seconds.
545 - * @param bool $defaulted Unused.
546 - * @param array $params Unused.
547 - */
548 - function fetch_timeout_setting_value( $setting, $defaulted, $params ) {
549 - print number_format( intval( $setting) ) . " " . ( ( 1 == $setting ) ? "second" : "seconds" );
550 402 }
551 -
552 - /**
553 - * Displays the advanced settings box on the FWP dashboard page.
554 - *
555 - * @param FeedWordPressFeedsPage $page A page object, unused.
556 - * @param mixed|null $box A box inside this object, unused.
557 - */
558 - function advanced_settings_box( $page, $box = NULL ) {
403 + function fetch_timeout_setting_value ($setting, $defaulted, $params) {
404 + print number_format(intval($setting)) . " " . (($setting==1) ? "second" : "seconds");
405 + }
406 +
407 + function advanced_settings_box ($page, $box = NULL) {
559 408 ?>
560 409 <table class="edit-form">
561 410 <tr>
562 - <th><?php esc_html_e( 'Fetch Timeout:' ); ?></th>
411 + <th>Fetch Timeout:</th>
563 412 <td>
564 413 <?php
565 414 $this->setting_radio_control(
566 415 'fetch timeout', 'fetch_timeout',
@@ -575,31 +424,29 @@
575 424 ?>
576 425 </td>
577 426 </tr>
578 427 <tr>
579 - <th><?php esc_html_e( 'Feed Update Type:' ); ?></th>
428 + <th>Feed Update Type:</th>
580 429 <td><?php
581 - $this->setting_radio_control( 'update_incremental', 'update_incremental',
430 + $this->setting_radio_control('update_incremental', 'update_incremental',
582 431 /*options=*/ array(
583 - 'incremental' => __( '**Incremental.** When items no longer appear on the feed, keep them in the WordPress posts table.' ),
584 - 'complete' => __( '**Complete.** When items no longer appear on the feed, they are obsolete; retire them from the WordPress posts table.' ),
432 + 'incremental' => '<strong>Incremental.</strong> When items no longer appear on the feed, keep them in the WordPress posts table.',
433 + 'complete' => '<strong>Complete.</strong> When items no longer appear on the feed, they are obsolete; retire them from the WordPress posts table.',
585 434 ),
586 435 /*params=*/ array(
587 436 'setting-default' => NULL,
588 437 'global-setting-default' => 'incremental',
589 - 'default-input-value' => 'default',
438 + 'default-input-value' => 'default',
590 439 )
591 440 ); ?></td>
592 441 </tr>
593 442 <tr>
594 - <th><?php esc_html_e( 'Allow Feeds to Delete Posts:' ); ?></th>
443 + <th>Allow Feeds to Delete Posts:</th>
595 444 <td><?php
596 - $this->setting_radio_control(
597 - 'tombstones',
598 - 'tombstones',
445 + $this->setting_radio_control('tombstones', 'tombstones',
599 446 /*options=*/ array(
600 - 'yes' => __( 'Yes. If a feed indicates that one of its posts has been deleted, delete the local copy syndicated to this website.' ),
601 - 'no' => __( 'No. Even if a feed indicates that one of its posts has been deleted, retain the local copy on this website.' ),
447 + 'yes' => 'Yes. If a feed indicates that one of its posts has been deleted, delete the local copy syndicated to this website.',
448 + 'no' => 'No. Even if a feed indicates that one of its posts has been deleted, retain the local copy on this website.',
602 449 ),
603 450 /*params=*/ array(
604 451 'setting-default' => NULL,
605 452 'global-setting-default' => 'yes',
@@ -608,61 +455,52 @@
608 455 ); ?></td>
609 456 </tr>
610 457 </table>
611 458 <?php
612 - } /* FeedWordPressFeedsPage::advanced_settings_box() */
613 -
614 - /**
615 - * Shows a box for authentication credentials for a feed.
616 - *
617 - * @param array $params Array of parameters to parse.
618 - */
619 - function display_authentication_credentials_box( $params = array() ) {
459 + } /* FeedWordPressFeedsPage::advanced_settings_box () */
460 +
461 + function display_authentication_credentials_box ($params = array()) {
620 462 static $count = 0;
621 463
622 - $params = wp_parse_args(
623 - $params,
624 - array(
625 - 'username' => NULL,
626 - 'password' => NULL,
627 - 'method' => '-',
628 - ),
629 - );
630 -
464 + $params = wp_parse_args($params, array(
465 + 'username' => NULL,
466 + 'password' => NULL,
467 + 'method' => '-',
468 + ));
469 +
631 470 // Equivalents
632 - if ( is_null( $params['method'] ) ) : $params['method'] = '-'; endif;
633 -
471 + if (is_null($params['method'])) : $params['method'] = '-'; endif;
472 +
634 473 $count++;
635 - /** var string Constructed slug for each feed credential. */
636 - $slug = ( $count > 1 ? '-' . $count : '' );
637 -
474 + $slug = ($count > 1 ? '-'.$count : '');
475 +
638 476 global $feedwordpress;
639 477 $authMethods = apply_filters(
640 478 'feedwordpress_http_auth_methods',
641 - $feedwordpress->httpauth->methods_available(),
479 + $feedwordpress->httpauth->methods_available()
642 480 );
643 -
644 - $linkRssAuthId = sanitize_html_class( 'link-rss-authentication' . $slug );
645 - $linkRssCredentialsId = sanitize_html_class( 'link-rss-authentication-credentials' . $slug );
646 - $linkRssAuthMethodId = sanitize_html_class( 'link-rss-authentication-method' . $slug );
647 -
648 - if ( count( $authMethods ) > 1 ) : /* More than '-' */
481 +
482 + $linkRssAuthId = sanitize_html_class('link-rss-authentication' . $slug);
483 + $linkRssCredentialsId = sanitize_html_class('link-rss-authentication-credentials' . $slug);
484 + $linkRssAuthMethodId = sanitize_html_class('link-rss-authentication-method' . $slug );
485 +
486 + if (count($authMethods) > 1) : /* More than '-' */
649 487 ?>
650 - <div class="link-rss-authentication" id="<?php print esc_attr( $linkRssAuthId ); ?>">
488 + <div class="link-rss-authentication" id="<?php print esc_attr($linkRssAuthId); ?>">
651 489 <table>
652 490 <tbody>
653 - <tr class="link-rss-authentication-credentials" id="<?php print esc_attr( $linkRssCredentialsId ); ?>">
654 - <td><label><?php esc_html_e( 'user:' ); ?> <input type="text" name="link_rss_username"
655 - value="<?php print esc_attr( $params['username'] ); ?>" size="16"
491 + <tr class="link-rss-authentication-credentials" id="<?php print esc_attr($linkRssCredentialsId); ?>">
492 + <td><label>user: <input type="text" name="link_rss_username"
493 + value="<?php print esc_attr($params['username']); ?>" size="16"
656 494 placeholder="username to access this feed" /></label></td>
657 - <td><label><?php esc_html_e( 'pass:' ); ?> <input type="text" name="link_rss_password"
658 - value="<?php print esc_attr( $params['password'] ); ?>" size="16"
659 - placeholder=<?php esc_html_e( 'password to access this feed' ); ?> /></label></td>
660 - <td class="link-rss-authentication-method" id="<?php print esc_attr( $linkRssAuthMethodId ); ?>"><label><?php esc_html_e( 'method' ); ?>: <select class="link-rss-auth-method" id="link-rss-auth-method" name="link_rss_auth_method" size="1">
661 -<?php foreach ( $authMethods as $value => $label ) : ?>
662 - <option value="<?php print esc_attr( $value ); ?>"<?php
663 - fwp_selected_flag( $value == $params['method'] );
664 - ?>><?php print esc_html( $label ); ?></option>
495 + <td><label>pass: <input type="text" name="link_rss_password"
496 + value="<?php print esc_attr($params['password']); ?>" size="16"
497 + placeholder="password to access this feed" /></label></td>
498 + <td class="link-rss-authentication-method" id="<?php print esc_attr($linkRssAuthMethodId); ?>"><label>method: <select class="link-rss-auth-method" id="link-rss-auth-method" name="link_rss_auth_method" size="1">
499 +<?php foreach ($authMethods as $value => $label) : ?>
500 + <option value="<?php print esc_attr($value); ?>"<?php
501 + fwp_selected_flag($value == $params['method']);
502 + ?>><?php print esc_html($label); ?></option>
665 503 <?php endforeach; ?>
666 504 </select></label></td>
667 505 </tr>
668 506 </tbody>
@@ -667,136 +505,124 @@
667 505 </tr>
668 506 </tbody>
669 507 </table>
670 508 </div>
671 -
509 +
672 510 <script type="text/javascript">
673 - jQuery('<td><a class="add-remove remove-it" id="link-rss-userpass-remove<?php print esc_attr( $slug ); ?>" href="#"><span class="x">(X)</span> <?php esc_html_e( 'Remove' ); ?></a></td>')
674 - .appendTo('#<?php print esc_attr( $linkRssCredentialsId ); ?>' )
511 + jQuery('<td><a class="add-remove remove-it" id="link-rss-userpass-remove<?php print esc_attr($slug); ?>" href="#"><span class="x">(X)</span> Remove</a></td>')
512 + .appendTo('#<?php print esc_attr($linkRssCredentialsId); ?>')
675 513 .click( feedAuthenticationMethodUnPress );
676 - jQuery( '#link-rss-auth-method<?php print esc_attr( $slug ); ?>' ).change( feedAuthenticationMethod );
677 - feedAuthenticationMethod( {
678 - init: true,
679 - node: jQuery( '#<?php print esc_attr( $linkRssAuthId ); ?>' )
680 - } );
514 + jQuery('#link-rss-auth-method<?php print esc_attr($slug); ?>').change( feedAuthenticationMethod );
515 + feedAuthenticationMethod({
516 + init: true,
517 + node: jQuery('#<?php print esc_attr($linkRssAuthId); ?>') });
681 518 </script>
682 -
519 +
683 520 <?php
684 521 endif;
685 - } /* FeedWordPressFeedsPage::display_authentication_credentials_box() */
686 -
687 - /**
688 - * Displays a box with information about a feed.
689 - *
690 - * @param object $page Current page object (?).
691 - * @param mixed|null $box A box inside this object.
692 - *
693 - * @uses get_categories()
694 - * @uses get_category()
695 - * @uses get_option()
696 - * @uses maybe_unserialize()
697 - * @uses FeedWordPress::link_category_id()
698 - */
699 - function feed_information_box( $page, $box = NULL ) {
700 - $link_rss_params = maybe_unserialize( $page->setting( 'query parameters', '' ) );
701 - if ( ! is_array( $link_rss_params ) ) :
522 + }
523 +
524 + function feed_information_box ($page, $box = NULL) {
525 + global $wpdb;
526 + $link_rss_params = maybe_unserialize($page->setting('query parameters', ''));
527 + if (!is_array($link_rss_params)) :
702 528 $link_rss_params = array();
703 529 endif;
704 -
705 - if ( $page->for_feed_settings() ) :
706 - $info['name'] = esc_html( $page->link->link->link_name );
707 - $info['description'] = esc_html( $page->link->link->link_description );
708 - $info['url'] = esc_html( $page->link->link->link_url );
530 +
531 + if ($page->for_feed_settings()) :
532 + $info['name'] = esc_html($page->link->link->link_name);
533 + $info['description'] = esc_html($page->link->link->link_description);
534 + $info['url'] = esc_html($page->link->link->link_url);
709 535 $rss_url = $page->link->link->link_rss;
710 536
711 - $hardcode['name'] = $page->link->hardcode( 'name' );
712 - $hardcode['description'] = $page->link->hardcode( 'description' );
713 - $hardcode['url'] = $page->link->hardcode( 'url' );
537 + $hardcode['name'] = $page->link->hardcode('name');
538 + $hardcode['description'] = $page->link->hardcode('description');
539 + $hardcode['url'] = $page->link->hardcode('url');
714 540 else :
715 541 $cat_id = FeedWordPress::link_category_id();
716 542
717 543 $params = array();
718 - $params['taxonomy'] = 'link_category';
544 + $params['taxonomy'] = 'link_category';
719 545 $params['hide_empty'] = false;
720 - $results = get_categories( $params );
721 -
722 - /** var bool Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty. */
546 + $results = get_categories($params);
547 +
548 + // Guarantee that the Contributors category will be in the drop-down chooser, even if it is empty.
723 549 $found_link_category_id = false;
724 - foreach ( $results as $row ) :
550 + foreach ($results as $row) :
725 551 // Normalize case
726 - if ( ! isset( $row->cat_id ) ) : $row->cat_id = $row->cat_ID; endif;
552 + if (!isset($row->cat_id)) : $row->cat_id = $row->cat_ID; endif;
727 553
728 - if ( $row->cat_id == $cat_id) : $found_link_category_id = true; endif;
554 + if ($row->cat_id == $cat_id) : $found_link_category_id = true; endif;
729 555 endforeach;
730 -
731 - if ( ! $found_link_category_id ) :
732 - $results[] = get_category( $cat_id );
556 +
557 + if (!$found_link_category_id) :
558 + $results[] = get_category($cat_id);
733 559 endif;
734 -
560 +
735 561 $info = array();
736 562 $rss_url = null;
737 563
738 - $hardcode['name'] = get_option( 'feedwordpress_hardcode_name' );
739 - $hardcode['description'] = get_option( 'feedwordpress_hardcode_description' );
740 - $hardcode['url'] = get_option( 'feedwordpress_hardcode_url' );
564 + $hardcode['name'] = get_option('feedwordpress_hardcode_name');
565 + $hardcode['description'] = get_option('feedwordpress_hardcode_description');
566 + $hardcode['url'] = get_option('feedwordpress_hardcode_url');
741 567 endif;
742 568
743 - /** @var bool Hide authentication (unused). */
744 569 $hideAuth = false;
745 570
746 - $username = $this->setting( 'http username', NULL );
571 + $username = $this->setting('http username', NULL);
747 572
748 - if ( is_null( $username ) ) :
573 + if (is_null($username)) :
749 574 $username = '';
750 575 $hideAuth = true;
751 576 endif;
752 -
753 - $password = $this->setting( 'http password', NULL );
754 - if ( is_null( $password ) ) :
577 +
578 + $password = $this->setting('http password', NULL);
579 + if (is_null($password)) :
755 580 $password = '';
756 581 endif;
582 +
583 + $auth = $this->setting('http auth method', NULL);
757 584
758 - $auth = $this->setting( 'http auth method', NULL );
585 + global $feedwordpress;
759 586
760 - if ( is_null( $auth ) or ( strlen( $auth ) == 0 ) ) :
587 + if (is_null($auth) or (strlen($auth)==0)) :
761 588 $auth = '-';
762 589 $hideAuth = true;
763 590 endif;
764 591
765 592 // Hey ho, let's go
766 -
593 +
767 594 ?>
768 595 <table class="edit-form">
769 596
770 - <?php if ( $page->for_feed_settings() ) : ?>
597 + <?php if ($page->for_feed_settings()) : ?>
771 598
772 599 <tr>
773 - <th scope="row"><?php esc_html_e( 'Feed URL:' ) ?></th>
774 - <td><a href="<?php echo esc_html( $rss_url ); ?>"><?php echo esc_html( $rss_url ); ?></a>
775 - (<a href="<?php echo esc_url( FEEDVALIDATOR_URI ); ?>?url=<?php echo urlencode( $rss_url ); ?>"
776 - title="<?php esc_html_e( 'Check feed' ); ?> &lt;<?php echo esc_html( $rss_url ); ?>&gt; <?php esc_html_e( 'for validity' ); ?>">validate</a>)
600 + <th scope="row"><?php _e('Feed URL:') ?></th>
601 + <td><a href="<?php echo esc_html($rss_url); ?>"><?php echo esc_html($rss_url); ?></a>
602 + (<a href="<?php echo FEEDVALIDATOR_URI; ?>?url=<?php echo urlencode($rss_url); ?>"
603 + title="Check feed &lt;<?php echo esc_html($rss_url); ?>&gt; for validity">validate</a>)
777 604 <input type="submit" name="feedfinder" value="switch &rarr;" style="font-size:smaller" />
778 -
779 - <?php $this->display_authentication_credentials_box( array(
780 - 'username' => $username,
781 - 'password' => $password,
782 - 'method' => $auth,
783 - )
784 - );
785 - ?>
605 +
606 + <?php $this->display_authentication_credentials_box(array(
607 + 'username' => $username,
608 + 'password' => $password,
609 + 'method' => $auth,
610 + )); ?>
611 +
786 612 <table id="link-rss-params">
787 613 <tbody>
788 614 <?php
789 - $link_rss_params['new'] = array( '', '' );
615 + $link_rss_params['new'] = array('', '');
790 616 $i = 0;
791 - foreach ( $link_rss_params as $index => $pair ) :
617 + foreach ($link_rss_params as $index => $pair) :
792 618 ?>
793 619 <tr class="link-rss-params-row" id="link-rss-params-<?php print esc_attr($index); ?>">
794 - <td><label><?php esc_html_e( 'Parameter' ); ?>: <input type="text" class="link_params_key"
795 - name="link_rss_params_key[<?php print esc_attr( $index ); ?>]" value="<?php print esc_html( $pair[0] ); ?>"
620 + <td><label>Parameter: <input type="text" class="link_params_key"
621 + name="link_rss_params_key[<?php print esc_attr($index); ?>]" value="<?php print esc_html($pair[0]); ?>"
796 622 size="5" style="width: 5em" placeholder="name" /></label></td>
797 623 <td class="link-rss-params-value-cell"><label class="link_params_value_label">= <input type="text" class="link_params_value"
798 - name="link_rss_params_value[<?php print esc_attr( $index ); ?>]" value="<?php print esc_html( $pair[1] ); ?>"
624 + name="link_rss_params_value[<?php print esc_attr($index); ?>]" value="<?php print esc_html($pair[1]); ?>"
799 625 size="8" placeholder="value" /></label></td>
800 626 </tr>
801 627 <?php
802 628 $i++;
@@ -803,49 +629,44 @@
803 629 endforeach;
804 630 ?>
805 631 </tbody>
806 632 </table>
807 -
633 +
808 634 <div><input type="hidden" id="link-rss-params-num" name="link_rss_params_num" value="<?php print esc_attr($i); ?>" /></div>
809 -
810 - <script>
811 - function linkParamsRowRemove( element ) {
812 - jQuery( element ).closest( 'tr' ).fadeOut(
813 - 'slow',
814 - function () {
815 - jQuery( this ).remove();
816 - }
817 - );
635 +
636 + <script type="text/javascript">
637 + function linkParamsRowRemove (element) {
638 + jQuery(element).closest('tr').fadeOut('slow', function () {
639 + jQuery(this).remove();
640 + } );
818 641 }
819 642
820 - jQuery('<td><a href="#" class="add-remove link-rss-params-remove"><span class="x">(X)</span> <?php esc_html_e( 'Remove' ); ?></a></td>' ).insertAfter( '.link-rss-params-value-cell' );
643 + jQuery('<td><a href="#" class="add-remove link-rss-params-remove"><span class="x">(X)</span> Remove</a></td>').insertAfter('.link-rss-params-value-cell');
821 644
822 - jQuery( '#link-rss-params-new' ).hide();
823 - jQuery( '<a class="add-remove" id="link-rss-params-add" href="#"><span class="dashicons dashicons-plus fwp-no-underline"></span> <?php esc_html_e( 'Add a query parameter' ); ?></a>').insertAfter( '#link-rss-params' );
824 - jQuery( '#link-rss-params-add' ).click( function () {
825 - var next = jQuery( '#link-rss-params-num' ).val();
826 - var newRow = jQuery( '#link-rss-params-new' ).clone().attr( 'id', 'link-rss-params-' + next );
827 - newRow.find( '.link_params_key' ).attr( 'name', 'link_rss_params_key[' + next + ']' );
828 - newRow.find( '.link_params_value' ).attr( 'name', 'link_rss_params_value[' + next + ']' );
645 + jQuery('#link-rss-params-new').hide();
646 + jQuery('<a class="add-remove" id="link-rss-params-add" href="#">+ Add a query parameter</a>').insertAfter('#link-rss-params');
647 + jQuery('#link-rss-params-add').click( function () {
648 + var next = jQuery('#link-rss-params-num').val();
649 + var newRow = jQuery('#link-rss-params-new').clone().attr('id', 'link-rss-params-'+next);
650 + newRow.find('.link_params_key').attr('name', 'link_rss_params_key['+next+']');
651 + newRow.find('.link_params_value').attr('name', 'link_rss_params_value['+next+']');
652 +
653 + newRow.find('.link-rss-params-remove').click( function () {
654 + linkParamsRowRemove(this);
655 + return false;
656 + } );
829 657
830 - newRow.find( '.link-rss-params-remove' ).click(
831 - function () {
832 - linkParamsRowRemove( this );
833 - return false;
834 - }
835 - );
836 -
837 - newRow.appendTo( '#link-rss-params' );
658 + newRow.appendTo('#link-rss-params');
838 659 newRow.show();
839 -
660 +
840 661 // Update counter for next row.
841 662 next++;
842 - jQuery( '#link-rss-params-num' ).val( next );
663 + jQuery('#link-rss-params-num').val(next);
843 664
844 665 return false;
845 666 } );
846 - jQuery( '.link-rss-params-remove' ).click( function () {
847 - linkParamsRowRemove( this );
667 + jQuery('.link-rss-params-remove').click( function () {
668 + linkParamsRowRemove(this);
848 669 return false;
849 670 } );
850 671 </script>
851 672 </td>
@@ -852,15 +673,15 @@
852 673 </tr>
853 674
854 675 <?php
855 676 $rows = array(
856 - "name" => __('Link Name'),
677 + "name" => __('Link Name'),
857 678 "description" => __('Short Description'),
858 - "url" => __('Homepage'),
679 + "url" => __('Homepage'),
859 680 );
860 - foreach ( $rows as $what => $label ) :
861 - $hardcode_name = sanitize_html_class( sprintf( 'hardcode_%s', $what ) );
862 - $hardcode_id = sanitize_html_class( sprintf( 'basics-hardcode-%s', $what ) );
681 + foreach ($rows as $what => $label) :
682 + $hardcode_name = sanitize_html_class( sprintf( 'hardcode_%s', $what ) );
683 + $hardcode_id = sanitize_html_class( sprintf( 'basics-hardcode-%s', $what ) );
863 684 $hardcode_view_id = sanitize_html_class( sprintf( 'basics-%s-view', $what ) );
864 685 $hardcode_edit_id = sanitize_html_class( sprintf( 'basics-%s-edit', $what ) );
865 686 ?>
866 687 <tr>
@@ -865,25 +686,25 @@
865 686 ?>
866 687 <tr>
867 688 <th scope="row"><?php print esc_html( $label ); ?></th>
868 689 <td>
869 - <div id="<?php print esc_attr( $hardcode_edit_id ); ?>"><input type="text" name="link<?php print esc_attr( $what ); ?>"
870 - value="<?php echo esc_attr( $info[$what] ); ?>" style="width: 95%" /></div>
690 + <div id="<?php print esc_attr( $hardcode_edit_id ); ?>"><input type="text" name="link<?php print esc_attr($what); ?>"
691 + value="<?php echo esc_attr($info[$what]); ?>" style="width: 95%" /></div>
871 692 <div id="<?php print esc_attr( $hardcode_view_id ); ?>">
872 - <?php if ( 'url' == $what ) : ?><a href="<?php print esc_url( $info[$what] ); ?>"><?php else : ?><strong><?php endif; ?>
873 - <?php print ( strlen( trim( $info[$what] ) ) > 0 ) ? esc_attr( $info[$what] ) : esc_attr__( '(none provided)' ); ?>
874 - <?php if ( 'url' == $what ) : ?></a><?php else : ?></strong><?php endif; ?></div>
875 -
693 + <?php if ($what=='url') : ?><a href="<?php print esc_url( $info[$what] ); ?>"><?php else : ?><strong><?php endif; ?>
694 + <?php print ( strlen( trim( $info[$what] ) ) > 0 ) ? esc_attr( $info[$what] ) : '(none provided)'; ?>
695 + <?php if ($what=='url') : ?></a><?php else : ?></strong><?php endif; ?></div>
696 +
876 697 <div>
877 - <label><input id="<?php print esc_attr( $hardcode_id ); ?>"
878 - type="radio" name="<?php print esc_attr( $hardcode_name ); ?>" value="no"
879 - <?php echo ( ('yes' == $hardcode[$what] ) ? '' : ' checked="checked"');?>
880 - onchange="contextual_appearance( 'basics-hardcode-<?php print esc_attr( $what ); ?>', '<?php print esc_attr( $hardcode_view_id ); ?>', '<?php print esc_attr( $hardcode_edit_id ); ?>', 'no', 'block', /*checkbox=*/ true )"
881 - /> <?php esc_html_e( 'Update automatically from feed' ); ?></label>
882 - <label><input type="radio" name="<?php print esc_attr( $hardcode_name ); ?>" value="yes"
883 - <?php echo ( ( 'yes' != $hardcode[$what] ) ? '' : ' checked="checked"' );?>
884 - onchange="contextual_appearance('<?php print esc_attr( $hardcode_id ); ?>', '<?php print esc_attr( $hardcode_view_id ); ?>', '<?php print esc_attr( $hardcode_edit_id ); ?>', 'no', 'block', /*checkbox=*/ true)"
885 - /> <?php esc_html_e( 'Edit manually' ); ?></label>
698 + <label><input id="<?php print esc_attr($hardcode_id); ?>"
699 + type="radio" name="<?php print esc_attr($hardcode_name); ?>" value="no"
700 + <?php echo (($hardcode[$what]=='yes')?'':' checked="checked"');?>
701 + onchange="contextual_appearance('basics-hardcode-<?php print esc_attr($what); ?>', '<?php print esc_attr($hardcode_view_id ); ?>', '<?php print esc_attr( $hardcode_edit_id ); ?>', 'no', 'block', /*checkbox=*/ true)"
702 + /> Update automatically from feed</label>
703 + <label><input type="radio" name="<?php print esc_attr($hardcode_name); ?>" value="yes"
704 + <?php echo (($hardcode[$what]!='yes')?'':' checked="checked"');?>
705 + onchange="contextual_appearance('<?php print esc_attr($hardcode_id); ?>', '<?php print esc_attr($hardcode_view_id); ?>', '<?php print esc_attr($hardcode_edit_id); ?>', 'no', 'block', /*checkbox=*/ true)"
706 + /> Edit manually</label>
886 707 </div>
887 708 </td>
888 709 </tr>
889 710 <?php
@@ -892,41 +713,41 @@
892 713
893 714 <?php else : ?>
894 715
895 716 <tr>
896 - <th scope="row"><?php esc_html_e( 'Syndicated Link category:' ); ?></th>
717 + <th scope="row">Syndicated Link category:</th>
897 718 <td><p><select name="syndication_category" size="1">
898 719 <?php
899 - foreach ( $results as $row ) :
720 + foreach ($results as $row) :
900 721 // Normalize case
901 - if ( ! isset( $row->cat_id ) ) : $row->cat_id = $row->cat_ID; endif;
722 + if (!isset($row->cat_id)) : $row->cat_id = $row->cat_ID; endif;
902 723
903 - echo "\n\t" . '<option value="' . esc_attr( $row->cat_id ) . '"';
904 - if ( $row->cat_id == $cat_id) :
905 - echo ' selected="selected"';
724 + echo "\n\t<option value=\"$row->cat_id\"";
725 + if ($row->cat_id == $cat_id) :
726 + echo " selected='selected'";
906 727 endif;
907 - echo '>' . esc_attr( $row->cat_id ) . ': ' . esc_html( $row->cat_name );
908 - echo '</option>' . "\n";
728 + echo ">$row->cat_id: ".esc_html($row->cat_name);
729 + echo "</option>\n";
909 730 endforeach;
910 731 ?></select></p>
911 - <p class="setting-description"><?php esc_html_e( 'FeedWordPress will syndicate the
912 - links placed under this link category.' ); ?></p>
732 + <p class="setting-description">FeedWordPress will syndicate the
733 + links placed under this link category.</p>
913 734 </td>
914 735 </tr>
915 -
736 +
916 737 <tr>
917 - <th scope="row"><?php esc_html_e( 'Link Names:' ); ?></th>
918 - <td><label><input type="checkbox" name="hardcode_name" value="no"<?php echo ( ( 'yes' == $hardcode['name'] )? '' : ' checked="checked"' );?>/> <?php esc_html_e( 'Update contributor titles automatically when the feed title changes' ); ?></label></td>
738 + <th scope="row">Link Names:</th>
739 + <td><label><input type="checkbox" name="hardcode_name" value="no"<?php echo (($hardcode['name']=='yes')?'':' checked="checked"');?>/> Update contributor titles automatically when the feed title changes</label></td>
919 740 </tr>
920 -
741 +
921 742 <tr>
922 - <th scope="row"><?php esc_html_e( 'Short descriptions:' ); ?></th>
923 - <td><label><input type="checkbox" name="hardcode_description" value="no"<?php echo ( ( 'yes' == $hardcode['description'] ) ? '' : ' checked="checked"' );?>/> <?php esc_html_e( 'Update contributor descriptions automatically when the feed tagline changes' ); ?></label></td>
743 + <th scope="row">Short descriptions:</th>
744 + <td><label><input type="checkbox" name="hardcode_description" value="no"<?php echo (($hardcode['description']=='yes')?'':' checked="checked"');?>/> Update contributor descriptions automatically when the feed tagline changes</label></td>
924 745 </tr>
925 -
746 +
926 747 <tr>
927 - <th scope="row"><?php esc_html_e( 'Homepages:' ); ?></th>
928 - <td><label><input type="checkbox" name="hardcode_url" value="no"<?php echo ( ( 'yes' == $hardcode['url'] ) ? '' : ' checked="checked"' );?>/> <?php esc_html_e( 'Update contributor homepages automatically when the feed link changes' ); ?></label></td>
748 + <th scope="row">Homepages:</th>
749 + <td><label><input type="checkbox" name="hardcode_url" value="no"<?php echo (($hardcode['url']=='yes')?'':' checked="checked"');?>/> Update contributor homepages automatically when the feed link changes</label></td>
929 750 </tr>
930 751
931 752 <?php endif; ?>
932 753
@@ -933,10 +754,9 @@
933 754 </table>
934 755 <?php
935 756 } /* FeedWordPressFeedsPage::feed_information_box() */
936 757
937 -
938 - function custom_settings_box( $page, $box = NULL ) {
758 + function custom_settings_box ($page, $box = NULL) {
939 759 $postsSettings = $this->admin_page_href('posts-page.php', array(), $page->link);
940 760 ?>
941 761 <p class="setting-description">These custom settings are special fields for the <strong>feed</strong> you are
942 762 syndicating, to be retrieved in templates using the <code>get_feed_meta()</code> function. They do not create
@@ -941,8 +761,9 @@
941 761 <p class="setting-description">These custom settings are special fields for the <strong>feed</strong> you are
942 762 syndicating, to be retrieved in templates using the <code>get_feed_meta()</code> function. They do not create
943 763 custom fields on syndicated <strong>posts</strong>. If you want to create custom fields that are applied to each
944 764 individual post from this feed, set up the settings in <a href="<?php print esc_url($postsSettings); ?>">Syndicated Posts</a>.</p>
765 +
945 766 <div id="postcustomstuff">
946 767 <table id="meta-list" cellpadding="3">
947 768 <tr>
948 769 <th>Key</th>
@@ -948,13 +769,13 @@
948 769 <th>Key</th>
949 770 <th>Value</th>
950 771 <th>Action</th>
951 772 </tr>
952 -
773 +
953 774 <?php
954 775 $i = 0;
955 776 foreach ($page->link->settings as $key => $value) :
956 - if ( !preg_match("\007^((".implode(')|(', $page->special_settings)."))$\007i", $key)) :
777 + if (!preg_match("\007^((".implode(')|(', $page->special_settings)."))$\007i", $key)) :
957 778 ?>
958 779 <tr style="vertical-align:top">
959 780 <th width="30%" scope="row"><input type="hidden" name="notes[<?php echo esc_attr($i); ?>][key0]" value="<?php echo esc_html($key); ?>" />
960 781 <input id="notes-<?php echo esc_attr($i); ?>-key" name="notes[<?php echo esc_attr($i); ?>][key1]" value="<?php echo esc_html($key); ?>" /></th>
@@ -983,9 +804,9 @@
983 804 $ret = NULL;
984 805 if (is_wp_error($err)) :
985 806 if ($err->get_error_code()=='http_request_failed') :
986 807 $data = $err->get_error_data('http_request_failed');
987 -
808 +
988 809 if (is_array($data) and isset($data['status'])) :
989 810 if (401==$data['status']) :
990 811 $ret = $data['uri'];
991 812 endif;
@@ -993,15 +814,17 @@
993 814 endif;
994 815 endif;
995 816 return $ret;
996 817 }
997 -
818 +
998 819 function display_feedfinder () {
999 - $lookup = FeedWordPress::param( 'lookup' );
1000 -
1001 - $auth = FeedWordPress::param( 'link_rss_auth_method' );
1002 - $username = FeedWordPress::param( 'link_rss_username' );
1003 - $password = FeedWordPress::param( 'link_rss_password' );
820 + global $wpdb;
821 +
822 + $lookup = (isset($_REQUEST['lookup']) ? $_REQUEST['lookup'] : NULL);
823 +
824 + $auth = MyPHP::request('link_rss_auth_method');
825 + $username = MyPHP::request('link_rss_username');
826 + $password = MyPHP::request('link_rss_password');
1004 827 $credentials = array(
1005 828 "authentication" => $auth,
1006 829 "username" => $username,
1007 830 "password" => $password,
@@ -1018,9 +841,9 @@
1018 841 $lookup = $this->link->link->link_url;
1019 842 $auth = $this->link->setting('http auth method');
1020 843 $username = $this->link->setting('http username');
1021 844 $password = $this->link->setting('http password');
1022 -
845 +
1023 846 // Guarantee that you at least have the option to
1024 847 // stick with what works.
1025 848 $current = $this->link->link->link_rss;
1026 849 $feeds[] = $current;
@@ -1038,23 +861,23 @@
1038 861 $this->display_alt_feed_box($lookup);
1039 862 endif;
1040 863
1041 864 $finder = array();
1042 - if ( !is_null($current)) :
865 + if (!is_null($current)) :
1043 866 $finder[$current] = new FeedFinder($current);
1044 867 endif;
1045 868 $finder[$lookup] = new FeedFinder($lookup);
1046 -
869 +
1047 870 foreach ($finder as $url => $ff) :
1048 871 $feeds = array_merge($feeds, $ff->find(
1049 872 /*url=*/ NULL,
1050 873 /*params=*/ $credentials));
1051 874 endforeach;
1052 -
875 +
1053 876 $feeds = array_values( // Renumber from 0..(N-1)
1054 877 $feeds
1055 878 );
1056 -
879 +
1057 880 // Allow for some simple FeedFinder results filtering
1058 881 $feeds = apply_filters(
1059 882 'feedwordpress_feedfinder_results',
1060 883 $feeds,
@@ -1066,9 +889,9 @@
1066 889 "finder" => $finder,
1067 890 ),
1068 891 $this
1069 892 );
1070 -
893 +
1071 894 if (count($feeds) > 0):
1072 895 if ($feedSwitch) :
1073 896 ?>
1074 897 <h3>Feeds Found</h3>
@@ -1088,15 +911,15 @@
1088 911 $form_class = '';
1089 912 endif;
1090 913
1091 914 global $fwp_credentials;
1092 -
915 +
1093 916 foreach ($feeds as $key => $f):
1094 917 $ofc = $fwp_credentials;
1095 918 $fwp_credentials = $credentials; // Set
1096 919 $pie = FeedWordPress::fetch($f, array("cache" => false));
1097 920 $fwp_credentials = $ofc; // Re-Set
1098 -
921 +
1099 922 $rss = (is_wp_error($pie) ? $pie : new MagpieFromSimplePie($pie));
1100 923
1101 924 if ($this->url_for_401($pie)) :
1102 925 $this->display_alt_feed_box($lookup, array(
@@ -1106,9 +929,9 @@
1106 929 "password" => $password
1107 930 ));
1108 931 continue;
1109 932 endif;
1110 -
933 +
1111 934 if ($rss and !is_wp_error($rss)):
1112 935 $feed_link = (isset($rss->channel['link'])?$rss->channel['link']:'');
1113 936 $feed_title = (isset($rss->channel['title'])?$rss->channel['title']:$feed_link);
1114 937 $feed_type = ($rss->feed_type ? $rss->feed_type : 'Unknown');
@@ -1122,14 +945,14 @@
1122 945 $feed_version_template = '';
1123 946 $feed_version = '';
1124 947 endif;
1125 948 ?>
1126 - <form <?php fwp_form_class_attr($form_class); ?> action="<?php print esc_url( $this->form_action( 'syndication.php' ) ); ?>" method="post">
949 + <form<?php print fwp_form_class_attr($form_class); ?> action="<?php print esc_url( $this->form_action( 'syndication.php' ) ); ?>" method="post">
1127 950 <div class="inside"><?php FeedWordPressCompatibility::stamp_nonce('feedwordpress_switchfeed'); ?>
1128 951
1129 952 <?php
1130 953 $classes = array('feed-found'); $currentFeed = '';
1131 - if ( !is_null($current) and $current==$f) :
954 + if (!is_null($current) and $current==$f) :
1132 955 $classes[] = 'current';
1133 956 $currentFeed = ' (currently subscribed)';
1134 957 endif;
1135 958 if ($key%2) :
@@ -1135,9 +958,9 @@
1135 958 if ($key%2) :
1136 959 $classes[] = 'alt';
1137 960 endif;
1138 961 ?>
1139 - <fieldset class="<?php print esc_attr( implode(" ", $classes) ); ?>">
962 + <fieldset class="<?php print implode(" ", $classes); ?>">
1140 963 <legend><?php print esc_html( sprintf( $option_template, ( $key + 1 ) ) ); print esc_html($feed_type) . " "; print esc_html( sprintf( $feed_version_template, $feed_version ) ); ?> feed<?php print esc_html( $currentFeed ); ?></legend>
1141 964
1142 965 <?php
1143 966 $this->stamp_link_id();
@@ -1144,9 +967,9 @@
1144 967
1145 968 // No feed specified = add new feed; we
1146 969 // need to pass along a starting title
1147 970 // and homepage URL for the new Link.
1148 - if ( ! $this->for_feed_settings()):
971 + if (!$this->for_feed_settings()):
1149 972 ?>
1150 973 <input type="hidden" name="feed_title" value="<?php echo esc_html($feed_title); ?>" />
1151 974 <input type="hidden" name="feed_link" value="<?php echo esc_html($feed_link); ?>" />
1152 975 <?php
@@ -1160,9 +983,9 @@
1160 983 <div class="feed-sample">
1161 984 <?php
1162 985 $link = null;
1163 986 $post = null;
1164 - if ( !is_wp_error($rss) && !empty($rss->items) && is_array($rss->items) ):
987 + if (!is_wp_error($rss) and count($rss->items) > 0):
1165 988 // Prepare to display Sample Item
1166 989 $link = new MagpieMockLink(array('simplepie' => $pie, 'magpie' => $rss), $f);
1167 990 $post = new SyndicatedPost(array('simplepie' => $rss->originals[0], 'magpie' => $rss->items[0]), $link);
1168 991 ?>
@@ -1168,12 +991,12 @@
1168 991 ?>
1169 992 <h3>Sample Item</h3>
1170 993 <ul>
1171 994 <li><strong>Title:</strong> <a href="<?php echo esc_url( $post->post['meta']['syndication_permalink'] ); ?>"><?php echo esc_html( $post->post['post_title'] ); ?></a></li>
1172 - <li><strong>Date:</strong> <?php print esc_html( date('d-M-y g:i:s a', $post->published() ) ); ?></li>
995 + <li><strong>Date:</strong> <?php print date('d-M-y g:i:s a', $post->published()); ?></li>
1173 996 </ul>
1174 997 <div class="entry">
1175 - <?php print wp_kses( $post->post['post_content'], 'post' ); ?>
998 + <?php print wp_kses( $post->post['post_content'] ); ?>
1176 999 </div>
1177 1000 <?php
1178 1001 do_action('feedwordpress_feed_finder_sample_item', $f, $post, $link);
1179 1002 else:
@@ -1181,9 +1004,9 @@
1181 1004 print '<div class="feed-problem">';
1182 1005 print "<h3>Problem:</h3>\n";
1183 1006 print "<p>FeedWordPress encountered the following error
1184 1007 when trying to retrieve this feed:</p>";
1185 - print '<p style="margin: 1.0em 3.0em"><code>' . esc_html( $rss->get_error_message() ) . '</code></p>';
1008 + print '<p style="margin: 1.0em 3.0em"><code>'.$rss->get_error_message().'</code></p>';
1186 1009 print "<p>If you think this is a temporary problem, you can still force FeedWordPress to add the subscription. FeedWordPress will not be able to find any syndicated posts until this problem is resolved.</p>";
1187 1010 print "</div>";
1188 1011 endif;
1189 1012 ?>
@@ -1192,13 +1015,13 @@
1192 1015 <?php
1193 1016 endif;
1194 1017 ?>
1195 1018 </div>
1196 -
1019 +
1197 1020 <div>
1198 1021 <h3>Feed Information</h3>
1199 1022 <ul>
1200 - <li><strong>Homepage:</strong> <a href="<?php echo esc_url( $feed_link ); ?>"><?php echo is_null( $feed_title )?'<em>Unknown</em>': esc_html( $feed_title ); ?></a></li>
1023 + <li><strong>Homepage:</strong> <a href="<?php echo esc_url( $feed_link ); ?>"><?php echo is_null($feed_title)?'<em>Unknown</em>': esc_html( $feed_title ); ?></a></li>
1201 1024 <li><strong>Feed URL:</strong> <a title="<?php echo esc_html( $f ); ?>" href="<?php echo esc_url( $f ); ?>"><?php echo esc_html( feedwordpress_display_url($f, 40, 10) ); ?></a> (<a title="Check feed &lt;<?php echo esc_html( $f ); ?>&gt; for validity" href="http://feedvalidator.org/check.cgi?url=<?php echo urlencode( $f ); ?>">validate</a>)</li>
1202 1025 <li><strong>Encoding:</strong> <?php echo isset($rss->encoding) ? esc_html($rss->encoding) : "<em>Unknown</em>"; ?></li>
1203 1026 <li><strong>Description:</strong> <?php echo isset($rss->channel['description']) ? esc_html($rss->channel['description']) : "<em>Unknown</em>"; ?></li>
1204 1027 </ul>
@@ -1220,58 +1043,53 @@
1220 1043 unset($post);
1221 1044 endforeach;
1222 1045 else:
1223 1046 foreach ($finder as $url => $ff) :
1224 - print '<h3>Searched for feeds at '. esc_html( $url ) . '</h3>' . "\n";
1225 - print '<p><strong>' . esc_html__( 'Error' ) . ':</strong> ' . esc_html__( 'FeedWordPress couldn\'t find any feeds at' ).' <code><a href="' . esc_url( $lookup ) . '">' . esc_html( $lookup ) . '</a></code>';
1226 - print '. ' . esc_html__( 'Try another URL' ) . '.</p>';
1227 -
1047 + $url = esc_html($url);
1048 + print "<h3>Searched for feeds at ${url}</h3>\n";
1049 + print "<p><strong>".__('Error').":</strong> ".__("FeedWordPress couldn't find any feeds at").' <code><a href="'.htmlspecialchars($lookup).'">'.htmlspecialchars($lookup).'</a></code>';
1050 + print ". ".__('Try another URL').".</p>";
1051 +
1228 1052 // Diagnostics
1229 1053 print "<div class=\"updated\" style=\"margin-left: 3.0em; margin-right: 3.0em;\">\n";
1230 - print '<h3>' . esc_html__( 'Diagnostic information' ) . '</h3>' . "\n";
1231 - if ( !is_null($ff->error()) and strlen($ff->error()) > 0) :
1232 - print '<h4>'. esc_html__( 'HTTP request failure' ) . '</h4>' . "\n";
1233 - print '<p>' . esc_html( $ff->error() ) ."</p>\n";
1054 + print "<h3>".__('Diagnostic information')."</h3>\n";
1055 + if (!is_null($ff->error()) and strlen($ff->error()) > 0) :
1056 + print "<h4>".__('HTTP request failure')."</h4>\n";
1057 + print "<p>".$ff->error()."</p>\n";
1234 1058 else :
1235 - print '<h4>' . esc_html__( 'HTTP request completed' ) . '</h4>' . "\n";
1236 - print '<p><strong>Status ' . esc_html( $ff->status() ) . ':</strong> '. esc_html( $this->HTTPStatusMessages[ (int) $ff->status() ] ) ."</p>\n";
1059 + print "<h4>".__('HTTP request completed')."</h4>\n";
1060 + print "<p><strong>Status ".$ff->status().":</strong> ".$this->HTTPStatusMessages[(int) $ff->status()]."</p>\n";
1237 1061 endif;
1238 1062
1239 1063 // Do some more diagnostics if the API for it is available.
1240 - // Note to @radgeek: consider using a hook instead: https://developer.wordpress.org/reference/hooks/http_api_transports/ (gwyneth 20230920)
1241 - if ( function_exists( '_wp_http_get_object' ) ) :
1064 + if (function_exists('_wp_http_get_object')) :
1242 1065 $httpObject = _wp_http_get_object();
1243 -
1244 - /*
1245 - // _getTransport() was totally deprecated (gwyneth 20230920)
1066 +
1246 1067 if (is_callable(array($httpObject, '_getTransport'))) :
1247 -
1248 1068 $transports = $httpObject->_getTransport();
1249 -
1069 +
1250 1070 print "<h4>".__('HTTP Transports available').":</h4>\n";
1251 1071 print "<ol>\n";
1252 1072 print "<li>".implode("</li>\n<li>", array_map('get_class', $transports))."</li>\n";
1253 1073 print "</ol>\n";
1254 - else
1255 - */
1256 - if ( is_callable( array( $httpObject, '_get_first_available_transport' ) ) ) :
1074 + elseif (is_callable(array($httpObject, '_get_first_available_transport'))) :
1257 1075 $transport = $httpObject->_get_first_available_transport(
1258 1076 array(),
1259 1077 $url
1260 1078 );
1261 -
1262 - print "<h4>" . esc_html__("HTTP Transport") . ":</h4>\n";
1079 +
1080 + print "<h4>".__("HTTP Transport").":</h4>\n";
1263 1081 print "<ol>\n";
1264 - print "<li>" . esc_html( MyPHP::val($transport) ) . "</li>\n";
1082 + print "<li>".MyPHP::val($transport)."</li>\n";
1265 1083 print "</ol>\n";
1266 1084 endif;
1267 -
1085 +
1268 1086 print "</div>\n";
1269 1087 endif;
1270 1088 endforeach;
1271 1089 endif;
1272 -
1273 - if ( ! $feedSwitch) :
1090 +
1091 + if (!$feedSwitch) :
1274 1092 $this->display_alt_feed_box($lookup, /*alt=*/ true);
1275 1093 endif;
1276 1094 ?>
1277 1095 </div> <!-- class="wrap" -->
@@ -1278,14 +1096,15 @@
1278 1096 <?php
1279 1097 return false; // Don't continue
1280 1098 } /* FeedWordPressFeedsPage::display_feedfinder() */
1281 1099
1282 - function display_alt_feed_box ($lookup, $params = false)
1283 - {
1100 + function display_alt_feed_box ($lookup, $params = false) {
1101 + global $fwp_post;
1102 +
1284 1103 if (is_bool($params)) :
1285 1104 $params = array("alt" => $params);
1286 1105 endif;
1287 -
1106 +
1288 1107 $params = wp_parse_args($params, array( // Defaults
1289 1108 "alt" => false,
1290 1109 "err" => NULL,
1291 1110 "auth" => NULL,
@@ -1292,9 +1111,9 @@
1292 1111 "password" => NULL,
1293 1112 "username" => NULL,
1294 1113 ));
1295 1114 $alt = $params['alt'];
1296 -
1115 +
1297 1116 ?>
1298 1117 <form action="<?php print esc_url( $this->form_action('syndication.php') ); ?>" method="post">
1299 1118 <div class="inside"><?php
1300 1119 FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds');
@@ -1299,9 +1118,9 @@
1299 1118 <div class="inside"><?php
1300 1119 FeedWordPressCompatibility::stamp_nonce('feedwordpress_feeds');
1301 1120 ?>
1302 1121 <fieldset class="alt"
1303 - <?php if ( ! $alt): ?>style="margin: 1.0em 3.0em; font-size: smaller;"<?php endif; ?>>
1122 + <?php if (!$alt): ?>style="margin: 1.0em 3.0em; font-size: smaller;"<?php endif; ?>>
1304 1123 <legend><?php if ($alt) : ?>Alternative feeds<?php else: ?>Find feeds<?php endif; ?></legend>
1305 1124 <?php if ($alt) : ?><h3>Use a different feed</h3><?php endif; ?>
1306 1125 <?php if (is_wp_error($params['err'])) :
1307 1126 ?>
@@ -1338,39 +1157,32 @@
1338 1157 will try to automatically detect any feeds associated with a
1339 1158 website.</p>
1340 1159 </div> <!-- class="inside" -->
1341 1160 </fieldset></form>
1342 -
1161 +
1343 1162 <?php
1344 1163 } /* FeedWordPressFeedsPage::display_alt_feed_box() */
1345 -
1346 - function save_settings () {
1164 +
1165 + function save_settings ($post) {
1347 1166 if ($this->for_feed_settings()) :
1348 - $params_key = FeedWordPress::post( 'link_rss_params_key', array() );
1349 -
1350 - if ( is_array( $params_key ) && count($params_key) > 0 ) :
1351 - $params_values = FeedWordPress::post( 'link_rss_params_value', array() );
1167 +
1168 + if (isset($post['link_rss_params_key'])) :
1352 1169 $qp = array();
1353 - foreach ( $params_key as $index => $key ) :
1170 + foreach ($post['link_rss_params_key'] as $index => $key) :
1354 1171 if (strlen($key) > 0) :
1355 -
1356 - if ( isset( $params_values[ $index ] ) ) :
1357 -
1358 - $params_value = $params_values[ $index ];
1359 - if ( strlen($params_value) > 0 ) :
1360 - $qp[] = array( $key, $params_value );
1361 - endif;
1172 + if (isset($post['link_rss_params_value'][$index])
1173 + and strlen($post['link_rss_params_value'][$index])) :
1174 + $value = $post['link_rss_params_value'][$index];
1175 + $qp[] = array($key, $value);
1362 1176 endif;
1363 1177 endif;
1364 1178 endforeach;
1365 1179 $this->update_setting('query parameters', serialize($qp));
1366 -
1367 1180 endif;
1368 -
1181 +
1369 1182 // custom feed settings first
1370 - $param_notes = FeedWordPress::post( 'notes', array() );
1371 - foreach ( $param_notes as $mn ) :
1372 - $mn['key0'] = ( isset($mn['key0']) ? trim($mn['key0']) : null );
1183 + foreach ($post['notes'] as $mn) :
1184 + $mn['key0'] = (isset($mn['key0']) ? trim($mn['key0']) : NULL);
1373 1185 $mn['key1'] = trim($mn['key1']);
1374 1186 if (preg_match("\007^(("
1375 1187 .implode(')|(',$this->special_settings)
1376 1188 ."))$\007i",
@@ -1380,138 +1192,127 @@
1380 1192
1381 1193 if (strlen($mn['key0']) > 0) :
1382 1194 unset($this->link->settings[$mn['key0']]); // out with the old
1383 1195 endif;
1384 -
1196 +
1385 1197 if (($mn['action']=='update') and (strlen($mn['key1']) > 0)) :
1386 1198 $this->link->settings[$mn['key1']] = $mn['value']; // in with the new
1387 1199 endif;
1388 1200 endforeach;
1389 -
1201 +
1390 1202 // now stuff through the web form
1391 1203 // hardcoded feed info
1392 -
1204 +
1393 1205 foreach (array('name', 'description', 'url') as $what) :
1394 1206 // We have a checkbox for "No," so if it's unchecked, mark as "Yes."
1395 - $this->link->settings["hardcode {$what}"] = FeedWordPress::post( "hardcode_{$what}", 'yes' );
1207 + $this->link->settings["hardcode {$what}"] = (isset($post["hardcode_{$what}"]) ? $post["hardcode_{$what}"] : 'yes');
1396 1208 if (FeedWordPress::affirmative($this->link->settings, "hardcode {$what}")) :
1397 - $this->link->link->{'link_'.$what} = FeedWordPress::post( 'link' . $what );
1209 + $this->link->link->{'link_'.$what} = $post['link'.$what];
1398 1210 endif;
1399 1211 endforeach;
1400 -
1212 +
1401 1213 // Update scheduling
1402 - $update_schedule = FeedWordPress::post( 'update_schedule' );
1403 - if ( ! is_null( $update_schedule ) ) :
1404 - $this->link->settings['update/hold'] = $update_schedule;
1214 + if (isset($post['update_schedule'])) :
1215 + $this->link->settings['update/hold'] = $post['update_schedule'];
1405 1216 endif;
1406 1217
1407 - $use_default_update_window = FeedWordPress::post( 'use_default_update_window' );
1408 - $update_window = FeedWordPress::post( 'update_window' );
1409 - if ( FeedWordPress::affirmative( $use_default_update_window ) ) :
1218 + if (isset($post['use_default_update_window']) and strtolower($post['use_default_update_window'])=='yes') :
1410 1219 unset($this->link->settings['update/window']);
1411 - elseif ( ! is_null( $update_window ) ) :
1412 - $update_window = intval( $update_window );
1413 - if ( $update_window > 0 ) :
1414 - $this->link->settings['update/window'] = $update_window;
1220 + elseif (isset($post['update_window'])):
1221 + if ((int) $post['update_window'] > 0) :
1222 + $this->link->settings['update/window'] = (int) $post['update_window'];
1415 1223 endif;
1416 1224 endif;
1417 -
1225 +
1418 1226 else :
1419 1227 // Global
1420 - update_option('feedwordpress_cat_id', FeedWordPress::post( 'syndication_category' ) );
1421 -
1422 - $automatic_updates = FeedWordPress::post( 'automatic_updates' );
1423 - if ( ! in_array( $automatic_updates, array( 'init', 'shutdown' ) ) ) :
1424 - $automatic_updates = null;
1228 + update_option('feedwordpress_cat_id', $post['syndication_category']);
1229 +
1230 + if (!isset($post['automatic_updates']) or !in_array($post['automatic_updates'], array('init', 'shutdown'))) :
1231 + $automatic_updates = NULL;
1232 + else :
1233 + $automatic_updates = $post['automatic_updates'];
1425 1234 endif;
1426 1235 update_option('feedwordpress_automatic_updates', $automatic_updates);
1427 1236
1428 - $update_window = FeedWordPress::post( 'update_window' );
1429 - if ( ! is_null( $update_window ) ) :
1430 - $update_window = intval( $update_window );
1431 - if ( $update_window > 0 ) :
1432 - update_option( 'feedwordpress_update_window', $update_window );
1237 + if (isset($post['update_window'])):
1238 + if ((int) $post['update_window'] > 0) :
1239 + update_option('feedwordpress_update_window', (int) $post['update_window']);
1433 1240 endif;
1434 1241 endif;
1435 1242
1436 - $update_time_limit = FeedWordPress::post( 'update_time_limit' );
1437 - $time_limit_seconds = 0;
1438 - if ( FeedWordPress::affirmative( $update_time_limit ) ) :
1439 - $time_limit_seconds = intval( FeedWordPress::post( 'time_limit_seconds' ) );
1440 - endif;
1441 - update_option( 'feedwordpress_update_time_limit', $time_limit_seconds );
1243 + update_option('feedwordpress_update_time_limit', ($post['update_time_limit']=='yes')?(int) $post['time_limit_seconds']:0);
1442 1244
1443 1245 foreach (array('name', 'description', 'url') as $what) :
1444 1246 // We have a checkbox for "No," so if it's unchecked, mark as "Yes."
1445 - $hardcode = FeedWordPress::post( "hardcode_{$what}", 'yes' );
1446 - update_option( "feedwordpress_hardcode_{$what}", $hardcode );
1247 + $hardcode = (isset($post["hardcode_{$what}"]) ? $post["hardcode_{$what}"] : 'yes');
1248 + update_option("feedwordpress_hardcode_{$what}", $hardcode);
1447 1249 endforeach;
1448 -
1250 +
1449 1251 endif;
1450 -
1451 - $update_pause = FeedWordPress::post( 'update_pause' );
1452 - if ( ! is_null( $update_pause ) ) :
1453 - $this->update_setting( 'update/pause', $update_pause );
1252 +
1253 + if (isset($post['update_pause'])) :
1254 + $this->update_setting('update/pause', $post['update_pause']);
1454 1255 endif;
1455 1256
1456 - $fetch_timeout = FeedWordPress::post( 'fetch_timeout' );
1457 - if ( ! is_null( $fetch_timeout ) ) :
1458 - $fetch_timeout_default = FeedWordPress::post( 'fetch_timeout_default' );
1459 - if ( FeedWordPress::affirmative( $fetch_timeout_default ) ) :
1460 - $fetch_timeout = null;
1257 + if (isset($post['fetch_timeout'])) :
1258 + if (isset($post['fetch_timeout_default']) and $post['fetch_timeout_default']=='yes') :
1259 + $timeout = NULL;
1260 + else :
1261 + $timeout = $post['fetch_timeout'];
1461 1262 endif;
1462 1263
1463 - if ( is_int( $fetch_timeout ) ) :
1464 - $fetch_timeout = intval( $fetch_timeout );
1264 + if (is_int($timeout)) :
1265 + $timeout = intval($timeout);
1465 1266 endif;
1466 - $this->update_setting( 'fetch timeout', $fetch_timeout );
1267 + $this->update_setting('fetch timeout', $timeout);
1467 1268 endif;
1468 -
1469 - $update_incremental = FeedWordPress::post( 'update_incremental' );
1470 - if ( ! is_null( $update_incremental ) ) :
1471 - $this->update_setting( 'update_incremental', $update_incremental );
1269 +
1270 + if (isset($post['update_incremental'])) :
1271 + $this->update_setting('update_incremental', $post['update_incremental']);
1472 1272 endif;
1473 1273
1474 - $tombstones = FeedWordPress::post( 'tombstones' );
1475 - if ( ! is_null( $tombstones ) ) :
1476 - $this->update_setting('tombstones', $tombstones );
1274 + if (isset($post['tombstones'])) :
1275 + $this->update_setting('tombstones', $post['tombstones']);
1477 1276 endif;
1478 1277
1479 - $update_minimum = FeedWordPress::post( 'update_minimum' );
1480 - if ( ! is_null( $update_minimum ) ) :
1481 - $this->update_setting( 'update/minimum', $update_minimum );
1278 + if (isset($post['update_minimum'])) :
1279 + $this->update_setting('update/minimum', $post['update_minimum']);
1482 1280 endif;
1483 1281
1484 - $link_rss_auth_method = FeedWordPress::post( 'link_rss_auth_method' );
1485 1282 if (
1486 - ! $link_rss_auth_method
1487 - || '-' == $link_rss_auth_method
1283 + isset($post['link_rss_auth_method'])
1284 + and $post['link_rss_auth_method']
1285 + and ('-' != $post['link_rss_auth_method'])
1488 1286 ) :
1489 - $link_rss_auth_method = null;
1287 + $this->update_setting('http auth method', $post['link_rss_auth_method']);
1288 + else :
1289 + $this->update_setting('http auth method', NULL);
1490 1290 endif;
1491 - $this->update_setting( 'http auth method', $link_rss_auth_method );
1492 -
1493 - $link_rss_username = FeedWordPress::post( 'link_rss_username' );
1291 +
1494 1292 if (
1495 - ! $link_rss_username
1496 - || is_null( $link_rss_auth_method )
1293 + isset($post['link_rss_username'])
1294 + and (strlen($post['link_rss_username']) > 0)
1295 + and ('-' != $post['link_rss_auth_method'])
1497 1296 ) :
1498 - $link_rss_username = null;
1297 + $this->update_setting('http username', $post['link_rss_username']);
1298 + else :
1299 + $this->update_setting('http username', NULL);
1499 1300 endif;
1500 - $this->update_setting( 'http username', $link_rss_username );
1501 1301
1502 - $link_rss_password = FeedWordPress::post( 'link_rss_password' );
1503 1302 if (
1504 - strlen( $link_rss_password ) == 0
1505 - || is_null( $link_rss_auth_method )
1303 + isset($post['link_rss_password'])
1304 + and (strlen($post['link_rss_password']) > 0)
1305 + and ('-' != $post['link_rss_auth_method'])
1506 1306 ) :
1507 - $link_rss_password = null;
1307 + $this->update_setting('http password', $post['link_rss_password']);
1308 + else :
1309 + $this->update_setting('http password', NULL);
1508 1310 endif;
1509 - $this->update_setting( 'http password', $link_rss_password );
1311 +
1312 + $this->updatedPosts->accept_POST($post);
1510 1313
1511 - $this->updatedPosts->accept_POST();
1512 -
1513 - parent::save_settings();
1314 + parent::save_settings($post);
1514 1315 } /* FeedWordPressFeedsPage::save_settings() */
1515 1316
1516 1317 } /* class FeedWordPressFeedsPage */
1517 1318