| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -define( 'FWP_BOLD_PREFIX_REGEX', '/^[*][*] ([^*]+) [*][*] \s+ (\S.*)$/x' ); | |
| 3 | - | |
| 4 | 2 | /** |
| 5 | 3 | * class FeedWordPressAdminPage |
| 6 | 4 | * |
| 7 | 5 | * Handles a lot of the interface-code related jots and tittles for putting together |
| @@ -9,24 +7,25 @@ | ||
| 9 | 7 | * Syndication > Feeds & Updates, etc., whether for setting global defaults, or for |
| 10 | 8 | * settings on particular feeds. |
| 11 | 9 | * |
| 12 | 10 | */ |
| 11 | + | |
| 12 | +define( 'FWP_BOLD_PREFIX_REGEX', '/^[*][*] ([^*]+) [*][*] \s+ (\S.*)$/x'); | |
| 13 | + | |
| 13 | 14 | class FeedWordPressAdminPage { |
| 14 | 15 | protected $context; |
| 15 | 16 | protected $updated = false; |
| 16 | 17 | protected $mesg = NULL; |
| 17 | 18 | |
| 18 | - /** @var SyndicatedLink|null An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings. */ | |
| 19 | 19 | var $link = NULL; |
| 20 | 20 | var $dispatch = NULL; |
| 21 | 21 | var $filename = NULL; |
| 22 | 22 | var $pagenames = array(); |
| 23 | - var $boxes_by_methods = array(); // did I delete this by mistake? (gwyneth 20230920) | |
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * Construct the admin page object. |
| 27 | 26 | * |
| 28 | - * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings. | |
| 27 | + * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings | |
| 29 | 28 | */ |
| 30 | 29 | public function __construct( $page = 'feedwordpressadmin', $link = NULL ) { |
| 31 | 30 | $this->link = $link; |
| 32 | 31 | |
| @@ -31,9 +30,9 @@ | ||
| 31 | 30 | $this->link = $link; |
| 32 | 31 | |
| 33 | 32 | // Set meta-box context name |
| 34 | 33 | $this->context = $page; |
| 35 | - if ( $this->for_feed_settings() ) : | |
| 34 | + if ($this->for_feed_settings()) : | |
| 36 | 35 | $this->context .= 'forfeed'; |
| 37 | 36 | endif; |
| 38 | 37 | } /* FeedWordPressAdminPage constructor */ |
| 39 | 38 | |
| @@ -48,9 +47,9 @@ | ||
| 48 | 47 | endif; |
| 49 | 48 | |
| 50 | 49 | if (isset($this->pagenames[$context])) : |
| 51 | 50 | $name = $this->pagenames[$context]; |
| 52 | - elseif (isset($this->pagenames['default'])) : | |
| 51 | + elseif (isset($tis->pagenames['default'])) : | |
| 53 | 52 | $name = $this->pagenames['default']; |
| 54 | 53 | else : |
| 55 | 54 | $name = $this->pageslug(); |
| 56 | 55 | endif; |
| @@ -65,10 +64,9 @@ | ||
| 65 | 64 | endif; |
| 66 | 65 | do_action($this->dispatch.'_post', null, $this); |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | - | |
| 70 | - public function update_feed() { | |
| 68 | + public function update_feed () { | |
| 71 | 69 | global $feedwordpress; |
| 72 | 70 | |
| 73 | 71 | add_action('feedwordpress_check_feed', 'update_feeds_mention'); |
| 74 | 72 | add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); |
| @@ -73,9 +71,9 @@ | ||
| 73 | 71 | add_action('feedwordpress_check_feed', 'update_feeds_mention'); |
| 74 | 72 | add_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); |
| 75 | 73 | |
| 76 | 74 | $link = $this->link; |
| 77 | - | |
| 75 | + | |
| 78 | 76 | print '<div class="updated">'; |
| 79 | 77 | print "<ul>"; |
| 80 | 78 | $uri = $this->link->uri(); |
| 81 | 79 | $displayUrl = $uri; |
| @@ -86,14 +84,14 @@ | ||
| 86 | 84 | |
| 87 | 85 | $delta = $feedwordpress->update($uri); |
| 88 | 86 | print "</ul>"; |
| 89 | 87 | |
| 90 | - if ( !is_null($delta)) : | |
| 91 | - echo "<p><strong>Update complete.</strong>".esc_html( fwp_update_set_results_message($delta) )."</p>"; | |
| 88 | + if (!is_null($delta)) : | |
| 89 | + echo "<p><strong>Update complete.</strong>".fwp_update_set_results_message($delta)."</p>"; | |
| 92 | 90 | echo "\n"; flush(); |
| 93 | 91 | else : |
| 94 | 92 | $effectiveUrl = esc_html($effectiveUrl); |
| 95 | - echo '<p><strong>Error:</strong> There was a problem updating <a href="' . esc_url( $effectiveUrl ) . '">' . esc_html( $displayUrl ) . '</a></p>' . "\n"; | |
| 93 | + echo "<p><strong>Error:</strong> There was a problem updating <a href=\"$effectiveUrl\">$displayUrl</a></p>\n"; | |
| 96 | 94 | endif; |
| 97 | 95 | print "</div>\n"; |
| 98 | 96 | remove_action('feedwordpress_check_feed', 'update_feeds_mention'); |
| 99 | 97 | remove_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); |
| @@ -115,93 +113,62 @@ | ||
| 115 | 113 | $this->updated = true; |
| 116 | 114 | endif; |
| 117 | 115 | } /* FeedWordPressAdminPage::save_settings () */ |
| 118 | 116 | |
| 117 | + public function for_feed_settings () { return (is_object($this->link) and method_exists($this->link, 'found') and $this->link->found()); } | |
| 118 | + public function for_default_settings () { return !$this->for_feed_settings(); } | |
| 119 | 119 | |
| 120 | - public function for_feed_settings() { | |
| 121 | - return ( is_object( $this->link ) and method_exists( $this->link, 'found' ) and $this->link->found() ); | |
| 122 | - } /* FeedWordPressAdminPage */ | |
| 123 | - | |
| 124 | - public function for_default_settings () { | |
| 125 | - return ! $this->for_feed_settings(); | |
| 126 | - } /* FeedWordPressAdminPage */ | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * Attempts to retrieve a setting for a feed. | |
| 130 | - * | |
| 131 | - * @param string|array $names Either a string with the name of the feed, | |
| 132 | - * or an associative array where the 'feed' parameter | |
| 133 | - * indicates the feed. | |
| 134 | - * @param string|null $fallback_value Fallback option value, if everything fails. | |
| 135 | - * @param Array $params List of attributes. | |
| 136 | - * | |
| 137 | - * @return mixed Retrieved option from settings. | |
| 138 | - */ | |
| 139 | - public function setting( $names, $fallback_value = NULL, $params = array() ) { | |
| 140 | - if ( ! is_array( $params ) ) : | |
| 141 | - $params = array( 'default' => $params ); | |
| 120 | + public function setting ($names, $fallback_value = NULL, $params = array()) { | |
| 121 | + if (!is_array($params)) : | |
| 122 | + $params = array('default' => $params); | |
| 142 | 123 | endif; |
| 143 | - $params = shortcode_atts( array( | |
| 144 | - 'default' => 'default', | |
| 145 | - 'fallback' => true, | |
| 146 | - ), | |
| 147 | - $params ); | |
| 124 | + $params = shortcode_atts(array( | |
| 125 | + 'default' => 'default', | |
| 126 | + 'fallback' => true, | |
| 127 | + ), $params); | |
| 148 | 128 | |
| 149 | - if ( is_string( $names ) ) : | |
| 150 | - $feed_name = $names; | |
| 151 | - $global_name = 'feedwordpress_' . preg_replace( '![\s/]+!', '_', $names ); | |
| 129 | + if (is_string($names)) : | |
| 130 | + $feed_name = $names; | |
| 131 | + $global_name = 'feedwordpress_'.preg_replace('![\s/]+!', '_', $names); | |
| 152 | 132 | else : |
| 153 | - $feed_name = $names['feed']; | |
| 154 | - $global_name = 'feedwordpress_' . $names['global']; | |
| 133 | + $feed_name = $names['feed']; | |
| 134 | + $global_name = 'feedwordpress_'.$names['global']; | |
| 155 | 135 | endif; |
| 156 | 136 | |
| 157 | - if ( $this->for_feed_settings() ) : // Check feed-specific setting first; fall back to global | |
| 158 | - if ( ! $params['fallback'] ) : | |
| 159 | - $global_name = NULL; | |
| 160 | - endif; | |
| 161 | - $ret = $this->link->setting( $feed_name, $global_name, $fallback_value, $params['default'] ); | |
| 137 | + if ($this->for_feed_settings()) : // Check feed-specific setting first; fall back to global | |
| 138 | + if (!$params['fallback']) : $global_name = NULL; endif; | |
| 139 | + $ret = $this->link->setting($feed_name, $global_name, $fallback_value, $params['default']); | |
| 162 | 140 | else : // Check global setting |
| 163 | - $ret = get_option( $global_name, $fallback_value ); | |
| 141 | + $ret = get_option($global_name, $fallback_value); | |
| 164 | 142 | endif; |
| 165 | 143 | return $ret; |
| 166 | - } /* FeedWordPressAdminPage::setting() */ | |
| 144 | + } | |
| 167 | 145 | |
| 168 | - /** | |
| 169 | - * Updates feed settings. | |
| 170 | - * | |
| 171 | - * @see setting() | |
| 172 | - * | |
| 173 | - * @param string|array $names Either a string with the name of the feed, | |
| 174 | - * or an associative array where the 'global' parameter | |
| 175 | - * indicates the feed. | |
| 176 | - * @param string|null $value Setting value to update. | |
| 177 | - * @param string $default Setting default option (defaults to 'default'). | |
| 178 | - */ | |
| 179 | - public function update_setting( $names, $value, $default = 'default' ) { | |
| 180 | - if ( is_string( $names ) ) : | |
| 181 | - $feed_name = $names; | |
| 182 | - $global_name = 'feedwordpress_' . preg_replace( '![\s/]+!', '_', $names ); | |
| 146 | + public function update_setting ($names, $value, $default = 'default') { | |
| 147 | + if (is_string($names)) : | |
| 148 | + $feed_name = $names; | |
| 149 | + $global_name = 'feedwordpress_'.preg_replace('![\s/]+!', '_', $names); | |
| 183 | 150 | else : |
| 184 | - $feed_name = $names['feed']; | |
| 185 | - $global_name = 'feedwordpress_' . $names['global']; | |
| 151 | + $feed_name = $names['feed']; | |
| 152 | + $global_name = 'feedwordpress_'.$names['global']; | |
| 186 | 153 | endif; |
| 187 | 154 | |
| 188 | - if ( $this->for_feed_settings() ) : // Update feed-specific setting | |
| 189 | - $this->link->update_setting( $feed_name, $value, $default ); | |
| 155 | + if ($this->for_feed_settings()) : // Update feed-specific setting | |
| 156 | + $this->link->update_setting($feed_name, $value, $default); | |
| 190 | 157 | else : // Update global setting |
| 191 | - update_option( $global_name, $value ); | |
| 158 | + update_option($global_name, $value); | |
| 192 | 159 | endif; |
| 193 | - } /* FeedWordPressAdminPage::update_setting() */ | |
| 160 | + } /* FeedWordPressAdminPage::update_setting () */ | |
| 194 | 161 | |
| 195 | - public function save_requested() { | |
| 162 | + public function save_requested () { | |
| 196 | 163 | return ! ( is_null( MyPHP::post('save') ) && is_null( MyPHP::post('submit') ) ); |
| 197 | 164 | } |
| 198 | - | |
| 199 | - public function update_requested() { | |
| 165 | + public function update_requested () { | |
| 200 | 166 | return ( strlen( MyPHP::post('update', '') ) > 0 ); |
| 201 | 167 | } |
| 202 | 168 | |
| 203 | - public function submitted_link_id() { | |
| 169 | + public function submitted_link_id () { | |
| 170 | + | |
| 204 | 171 | // Presume global unless we get a specific link ID |
| 205 | 172 | $link_id = NULL; |
| 206 | 173 | |
| 207 | 174 | $submit_buttons = array( |
| @@ -235,24 +202,17 @@ | ||
| 235 | 202 | |
| 236 | 203 | public function stamp_link_id ($field = null) { |
| 237 | 204 | if (is_null($field)) : $field = 'save_link_id'; endif; |
| 238 | 205 | ?> |
| 239 | - <input type="hidden" name="<?php print esc_attr($field); ?>" value="<?php print esc_attr( ($this->for_feed_settings() ? $this->link->id : '*') ); ?>" /> | |
| 206 | + <input type="hidden" name="<?php print esc_attr($field); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" /> | |
| 240 | 207 | <?php |
| 241 | 208 | } /* FeedWordPressAdminPage::stamp_link_id () */ |
| 242 | 209 | |
| 243 | - /** | |
| 244 | - * Returns a short explanation of what posts we have here, | |
| 245 | - * either posts from this feed or syndicated posts. | |
| 246 | - * | |
| 247 | - * @return string True corresponds to posts from this feed, | |
| 248 | - * false to syndicated posts. | |
| 249 | - */ | |
| 250 | - public function these_posts_phrase() { | |
| 251 | - if ( $this->for_feed_settings() ) : | |
| 252 | - $phrase = __( 'posts from this feed' ); | |
| 210 | + public function these_posts_phrase () { | |
| 211 | + if ($this->for_feed_settings()) : | |
| 212 | + $phrase = __('posts from this feed'); | |
| 253 | 213 | else : |
| 254 | - $phrase = __( 'syndicated posts' ); | |
| 214 | + $phrase = __('syndicated posts'); | |
| 255 | 215 | endif; |
| 256 | 216 | return $phrase; |
| 257 | 217 | } /* FeedWordPressAdminPage::these_posts_phrase() */ |
| 258 | 218 | |
| @@ -264,9 +224,9 @@ | ||
| 264 | 224 | * |
| 265 | 225 | * @see add_meta_box() |
| 266 | 226 | * @see do_meta_boxes() |
| 267 | 227 | */ |
| 268 | - public function meta_box_context() { | |
| 228 | + public function meta_box_context () { | |
| 269 | 229 | return $this->context; |
| 270 | 230 | } /* FeedWordPressAdminPage::meta_box_context () */ |
| 271 | 231 | |
| 272 | 232 | /** |
| @@ -284,9 +244,9 @@ | ||
| 284 | 244 | if (typeof(visibleStyle)=='undefined') visibleStyle = 'block'; |
| 285 | 245 | |
| 286 | 246 | var rollup=document.getElementById(item); |
| 287 | 247 | if (rollup) { |
| 288 | - if ((checkbox && rollup.checked) || ( !checkbox && value==rollup.value)) { | |
| 248 | + if ((checkbox && rollup.checked) || (!checkbox && value==rollup.value)) { | |
| 289 | 249 | jQuery('#'+disappear).hide(); |
| 290 | 250 | jQuery('#'+appear).show(600); |
| 291 | 251 | } else { |
| 292 | 252 | jQuery('#'+appear).hide(); |
| @@ -303,9 +263,9 @@ | ||
| 303 | 263 | // Merge in the page's filename |
| 304 | 264 | $params = array_merge($params, array('page' => $fwp_path.'/'.$page)); |
| 305 | 265 | |
| 306 | 266 | // If there is a link ID provided, then merge that in too. |
| 307 | - if ( !is_null($link)) : | |
| 267 | + if (!is_null($link)) : | |
| 308 | 268 | $link_id = NULL; |
| 309 | 269 | if (is_object($link)) : |
| 310 | 270 | if (method_exists($link, 'found')) : |
| 311 | 271 | // Is this a SyndicatedLink object? |
| @@ -320,9 +280,9 @@ | ||
| 320 | 280 | // Is this just a numeric ID? |
| 321 | 281 | $link_id = $link; |
| 322 | 282 | endif; |
| 323 | 283 | |
| 324 | - if ( !is_null($link_id)) : | |
| 284 | + if (!is_null($link_id)) : | |
| 325 | 285 | $params = array_merge($params, array('link_id' => $link_id)); |
| 326 | 286 | endif; |
| 327 | 287 | endif; |
| 328 | 288 | |
| @@ -329,8 +289,10 @@ | ||
| 329 | 289 | return MyPHP::url(admin_url('admin.php'), $params); |
| 330 | 290 | } /* FeedWordPressAdminPage::admin_page_href () */ |
| 331 | 291 | |
| 332 | 292 | public function display_feed_settings_page_links ($params = array()) { |
| 293 | + global $fwp_path; | |
| 294 | + | |
| 333 | 295 | $params = wp_parse_args($params, array( |
| 334 | 296 | 'before' => '', |
| 335 | 297 | 'between' => ' | ', |
| 336 | 298 | 'after' => '', |
| @@ -356,11 +318,11 @@ | ||
| 356 | 318 | $link_id = $sub->link_id; |
| 357 | 319 | endif; |
| 358 | 320 | endif; |
| 359 | 321 | |
| 360 | - $out_html = $params['before']; $first = true; | |
| 322 | + print $params['before']; $first = true; | |
| 361 | 323 | foreach ($links as $label => $link) : |
| 362 | - if ( ! $first) : $out_html .= $params['between']; endif; | |
| 324 | + if (!$first) : print $params['between']; endif; | |
| 363 | 325 | |
| 364 | 326 | if (isset($link['url'])) : MyPHP::url($link['url'], array("link_id" => $link_id)); |
| 365 | 327 | else : $url = $this->admin_page_href($link['page'], array(), $sub); |
| 366 | 328 | endif; |
| @@ -366,28 +328,26 @@ | ||
| 366 | 328 | endif; |
| 367 | 329 | $url = esc_html($url); |
| 368 | 330 | |
| 369 | 331 | if ($link['page']==basename($this->filename)) : |
| 370 | - $out_html .= "<strong>"; | |
| 332 | + print "<strong>"; | |
| 371 | 333 | else : |
| 372 | - $out_html .= sprintf( '<a href="%s">', esc_url( $url ) ); | |
| 334 | + print "<a href=\"${url}\">"; | |
| 373 | 335 | endif; |
| 374 | 336 | |
| 375 | - if ($params['long']) : $out_html .= esc_html(__($link['long'])); | |
| 376 | - else : $out_html .= esc_html(__($label)); | |
| 337 | + if ($params['long']) : print esc_html(__($link['long'])); | |
| 338 | + else : print esc_html(__($label)); | |
| 377 | 339 | endif; |
| 378 | 340 | |
| 379 | 341 | if ($link['page']==basename($this->filename)) : |
| 380 | - $out_html .= "</strong>"; | |
| 342 | + print "</strong>"; | |
| 381 | 343 | else : |
| 382 | - $out_html .= "</a>"; | |
| 344 | + print "</a>"; | |
| 383 | 345 | endif; |
| 384 | 346 | |
| 385 | 347 | $first = false; |
| 386 | 348 | endforeach; |
| 387 | - $out_html .= $params['after']; | |
| 388 | - | |
| 389 | - print wp_kses( $out_html, 'post' ); | |
| 349 | + print $params['after']; | |
| 390 | 350 | } /* FeedWordPressAdminPage::display_feed_settings_page_links */ |
| 391 | 351 | |
| 392 | 352 | public function display_feed_select_dropdown() { |
| 393 | 353 | $links = FeedWordPress::syndicated_links(); |
| @@ -396,12 +356,12 @@ | ||
| 396 | 356 | <div id="fwpfs-container"><ul class="subsubsub"> |
| 397 | 357 | <li><select name="link_id" class="fwpfs" style="max-width: 20.0em;"> |
| 398 | 358 | <option value="*"<?php if ($this->for_default_settings()) : ?> selected="selected"<?php endif; ?>>- defaults for all feeds -</option> |
| 399 | 359 | <?php if ($links) : foreach ($links as $ddlink) : ?> |
| 400 | - <option value="<?php print (int) $ddlink->link_id; ?>"<?php if ( !is_null($this->link) and ($this->link->id==$ddlink->link_id)) : ?> selected="selected"<?php endif; ?>><?php print esc_html($ddlink->link_name); ?></option> | |
| 360 | + <option value="<?php print (int) $ddlink->link_id; ?>"<?php if (!is_null($this->link) and ($this->link->id==$ddlink->link_id)) : ?> selected="selected"<?php endif; ?>><?php print esc_html($ddlink->link_name); ?></option> | |
| 401 | 361 | <?php endforeach; endif; ?> |
| 402 | 362 | </select> |
| 403 | - <input id="fwpfs-button" class="button" type="submit" name="go" value="<?php esc_attr_e('Go') ?> »" /></li> | |
| 363 | + <input id="fwpfs-button" class="button" type="submit" name="go" value="<?php _e('Go') ?> »" /></li> | |
| 404 | 364 | |
| 405 | 365 | <?php |
| 406 | 366 | $this->display_feed_settings_page_links(array( |
| 407 | 367 | 'before' => '<li>', |
| @@ -420,26 +380,17 @@ | ||
| 420 | 380 | </div> |
| 421 | 381 | <?php |
| 422 | 382 | } /* FeedWordPressAdminPage::display_feed_select_dropdown() */ |
| 423 | 383 | |
| 424 | - /** | |
| 425 | - * Displays a header section throughout the FWP dashboard. | |
| 426 | - * | |
| 427 | - * @param string $pagename Page name for which this header is. | |
| 428 | - * @param bool $all False if it displays just the settings; true if it displays all. | |
| 429 | - */ | |
| 430 | - public function display_sheet_header( $pagename = 'Syndication', $all = false ) { | |
| 431 | - /* changed to use a SVG instead, while keeping the correct size. | |
| 432 | - Note that these icons have been deprecated in 2013 or so: | |
| 433 | - @see https://core.trac.wordpress.org/ticket/26119 */ | |
| 384 | + public function display_sheet_header ($pagename = 'Syndication', $all = false) { | |
| 434 | 385 | ?> |
| 435 | - <div class="icon32"><img src="<?php print esc_attr( plugins_url( 'assets/images/icon.svg', __FILE__ ) ); ?>" alt="FeedWordPress Logo" /></div> | |
| 436 | - <h2><?php print esc_html( __( $pagename . ( $all ? '' : ' Settings' ) ) ); ?><?php if ( $this->for_feed_settings() ) : ?>: <?php echo esc_html( $this->link->name( /*from feed=*/ false ) ); ?><?php endif; ?></h2> | |
| 386 | + <div class="icon32"><img src="<?php print esc_attr( plugins_url( 'feedwordpress.png', __FILE__ ) ); ?>" alt="" /></div> | |
| 387 | + <h2><?php print esc_html(__($pagename.($all ? '' : ' Settings'))); ?><?php if ($this->for_feed_settings()) : ?>: <?php echo esc_html($this->link->name(/*from feed=*/ false)); ?><?php endif; ?></h2> | |
| 437 | 388 | <?php |
| 438 | - } /* FeedWordPressAdminPage::display_sheet_header() */ | |
| 389 | + } | |
| 439 | 390 | |
| 440 | - public function display_update_notice_if_updated( $pagename = 'Syndication', $mesg = NULL ) { | |
| 441 | - if ( ! is_null( $mesg ) ) : | |
| 391 | + public function display_update_notice_if_updated ($pagename = 'Syndication', $mesg = NULL) { | |
| 392 | + if (!is_null($mesg)) : | |
| 442 | 393 | $this->mesg = $mesg; |
| 443 | 394 | endif; |
| 444 | 395 | |
| 445 | 396 | if ($this->updated) : |
| @@ -449,9 +400,9 @@ | ||
| 449 | 400 | $this->mesg = $this->updated; |
| 450 | 401 | endif; |
| 451 | 402 | endif; |
| 452 | 403 | |
| 453 | - if ( !is_null($this->mesg)) : | |
| 404 | + if (!is_null($this->mesg)) : | |
| 454 | 405 | ?> |
| 455 | 406 | <div class="updated"> |
| 456 | 407 | <p><?php print esc_html($this->mesg); ?></p> |
| 457 | 408 | </div> |
| @@ -529,10 +480,10 @@ | ||
| 529 | 480 | add_meta_box( |
| 530 | 481 | /*id=*/ $id, |
| 531 | 482 | /*title=*/ $title, |
| 532 | 483 | /*callback=*/ array($this, $method), |
| 533 | - /*screen=*/ $this->meta_box_context(), | |
| 534 | - /*context=*/ $this->meta_box_context(), | |
| 484 | + /*page=*/ $this->meta_box_context(), | |
| 485 | + /*context=*/ $this->meta_box_context() | |
| 535 | 486 | ); |
| 536 | 487 | endforeach; |
| 537 | 488 | do_action($this->dispatch.'_meta_boxes', $this); |
| 538 | 489 | ?> |
| @@ -537,9 +488,9 @@ | ||
| 537 | 488 | do_action($this->dispatch.'_meta_boxes', $this); |
| 538 | 489 | ?> |
| 539 | 490 | <div class="metabox-holder"> |
| 540 | 491 | <?php |
| 541 | - do_meta_boxes( $this->meta_box_context(), $this->meta_box_context(), $this ); | |
| 492 | + do_meta_boxes($this->meta_box_context(), $this->meta_box_context(), $this); | |
| 542 | 493 | ?> |
| 543 | 494 | </div> <!-- class="metabox-holder" --> |
| 544 | 495 | </div> <!-- id="post-body" --> |
| 545 | 496 | <?php $this->close_sheet(); ?> |
| @@ -565,9 +516,9 @@ | ||
| 565 | 516 | |
| 566 | 517 | ?> |
| 567 | 518 | <div class="wrap feedwordpress-admin" id="feedwordpress-admin-<?php print esc_attr( $this->pageslug() ); ?>"> |
| 568 | 519 | <?php |
| 569 | - if ( !is_null($header)) : | |
| 520 | + if (!is_null($header)) : | |
| 570 | 521 | $this->display_sheet_header($header); |
| 571 | 522 | endif; |
| 572 | 523 | |
| 573 | 524 | if ( !is_null( $this->dispatch ) ) : |
| @@ -584,9 +535,9 @@ | ||
| 584 | 535 | $this->display_settings_scope_message(); |
| 585 | 536 | endif; |
| 586 | 537 | |
| 587 | 538 | ?><div class="tablenav"><?php |
| 588 | - if ( !is_null($this->dispatch)) : | |
| 539 | + if (!is_null($this->dispatch)) : | |
| 589 | 540 | ?><div class="alignright"><?php |
| 590 | 541 | $this->save_button(); |
| 591 | 542 | ?></div><?php |
| 592 | 543 | endif; |
| @@ -605,9 +556,9 @@ | ||
| 605 | 556 | ?> |
| 606 | 557 | |
| 607 | 558 | </div> <!-- id="poststuff" --> |
| 608 | 559 | <?php |
| 609 | - if ( !is_null($this->dispatch)) : | |
| 560 | + if (!is_null($this->dispatch)) : | |
| 610 | 561 | $this->save_button(); |
| 611 | 562 | print "</form>\n"; |
| 612 | 563 | endif; |
| 613 | 564 | ?> |
| @@ -616,8 +567,10 @@ | ||
| 616 | 567 | <?php |
| 617 | 568 | } /* FeedWordPressAdminPage::close_sheet () */ |
| 618 | 569 | |
| 619 | 570 | public function setting_radio_control ($localName, $globalName, $options, $params = array()) { |
| 571 | + global $fwp_path; | |
| 572 | + | |
| 620 | 573 | $params = wp_parse_args( |
| 621 | 574 | $params, |
| 622 | 575 | array( |
| 623 | 576 | 'filename' => basename($this->filename), |
| @@ -667,9 +620,9 @@ | ||
| 667 | 620 | else : $defaultInputId = NULL; |
| 668 | 621 | endif; |
| 669 | 622 | |
| 670 | 623 | if (isset($params['default-input-id-no'])) : $defaultInputIdNo = $params['default-input-id-no']; |
| 671 | - elseif ( !is_null($defaultInputId)) : $defaultInputIdNo = $defaultInputId.'-no'; | |
| 624 | + elseif (!is_null($defaultInputId)) : $defaultInputIdNo = $defaultInputId.'-no'; | |
| 672 | 625 | else : $defaultInputIdNo = NULL; |
| 673 | 626 | endif; |
| 674 | 627 | |
| 675 | 628 | // This allows us to either include the site-default setting as |
| @@ -691,9 +644,9 @@ | ||
| 691 | 644 | endif; |
| 692 | 645 | |
| 693 | 646 | $settingDefaulted = (is_null($setting) or ($settingDefault === $setting)); |
| 694 | 647 | |
| 695 | - if ( !is_callable($options)) : | |
| 648 | + if (!is_callable($options)) : | |
| 696 | 649 | $checked = array(); |
| 697 | 650 | if ($settingDefaulted) : |
| 698 | 651 | $checked[$defaultInputValue] = ' checked="checked"'; |
| 699 | 652 | endif; |
| @@ -728,16 +681,16 @@ | ||
| 728 | 681 | <ul class="options"> |
| 729 | 682 | <li><label><input type="radio" |
| 730 | 683 | name="<?php print esc_attr( $defaultInputName ); ?>" |
| 731 | 684 | value="<?php print esc_attr( $defaultInputValue ); ?>" |
| 732 | - <?php if ( !is_null($defaultInputId)) : ?>id="<?php print esc_attr( $defaultInputId ); ?>" <?php endif; ?> | |
| 685 | + <?php if (!is_null($defaultInputId)) : ?>id="<?php print esc_attr( $defaultInputId ); ?>" <?php endif; ?> | |
| 733 | 686 | <?php fwp_checked_flag($defaulted, 'yes'); ?> /> |
| 734 | 687 | Use the site-wide setting</label> |
| 735 | 688 | <span class="current-setting">Currently: |
| 736 | 689 | <strong><?php if (is_callable($labels)) : |
| 737 | - print wp_kses( call_user_func( $labels, $globalSetting, $defaulted, $params ), 'post' ); | |
| 690 | + print call_user_func($labels, $globalSetting, $defaulted, $params); | |
| 738 | 691 | elseif (is_null($labels)) : |
| 739 | - print esc_html( $globalSetting ); | |
| 692 | + print $globalSetting; | |
| 740 | 693 | else : |
| 741 | 694 | $label = $labels[ $globalSetting ]; |
| 742 | 695 | if ( preg_match( FWP_BOLD_PREFIX_REGEX, $label, $ref ) ) : |
| 743 | 696 | $label = $ref[1] . ' ' . $ref[2]; |
| @@ -752,11 +705,11 @@ | ||
| 752 | 705 | <ul class="options"> |
| 753 | 706 | <li><label><input type="radio" |
| 754 | 707 | name="<?php print esc_attr( $defaultInputName ); ?>" |
| 755 | 708 | value="no" |
| 756 | - <?php if ( !is_null($defaultInputIdNo)) : ?>id="<?php print esc_attr( $defaultInputIdNo ); ?>" <?php endif; ?> | |
| 709 | + <?php if (!is_null($defaultInputIdNo)) : ?>id="<?php print esc_attr( $defaultInputIdNo ); ?>" <?php endif; ?> | |
| 757 | 710 | <?php fwp_checked_flag($defaulted, 'no'); ?> /> |
| 758 | - <?php esc_html_e('Do something different with this feed.'); ?></label> | |
| 711 | + <?php _e('Do something different with this feed.'); ?></label> | |
| 759 | 712 | <?php endif; |
| 760 | 713 | endif; |
| 761 | 714 | |
| 762 | 715 | // Let's spit out the controls here. |
| @@ -776,9 +729,9 @@ | ||
| 776 | 729 | endif; |
| 777 | 730 | ?> |
| 778 | 731 | <li><label><input type="radio" name="<?php print esc_attr( $inputName ); ?>" |
| 779 | 732 | value="<?php print esc_attr( $value ); ?>" |
| 780 | - <?php fwp_checked_flag($checked, $value); ?> /> | |
| 733 | + <?php print fwp_checked_flag($checked, $value); ?> /> | |
| 781 | 734 | <?php |
| 782 | 735 | if ( !is_null($prefix) ) : |
| 783 | 736 | printf( '<strong>%s</strong> ', esc_html( $prefix ) ); |
| 784 | 737 | endif; |