diff --git a/wp-content/plugins/feedwordpress/admin-ui.php b/wp-content/plugins/feedwordpress/admin-ui.php index bc3029fa6d3a881026070fb51ab4e15e874627b9..5cea1d2300b639d78c72286598ee510422e7ced4 100644 --- a/wp-content/plugins/feedwordpress/admin-ui.php +++ b/wp-content/plugins/feedwordpress/admin-ui.php @@ -1,8 +1,8 @@ <?php class FeedWordPressAdminPage { - var $context; - var $updated = false; - var $mesg = NULL; + protected $context; + protected $updated = false; + protected $mesg = NULL; var $link = NULL; var $dispatch = NULL; @@ -14,7 +14,7 @@ class FeedWordPressAdminPage { * * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings */ - function FeedWordPressAdminPage ($page = 'feedwordpressadmin', $link = NULL) { + public function __construct( $page = 'feedwordpressadmin', $link = NULL ) { $this->link = $link; // Set meta-box context name @@ -24,12 +24,12 @@ class FeedWordPressAdminPage { endif; } /* FeedWordPressAdminPage constructor */ - function pageslug () { + public function pageslug () { $slug = preg_replace('/FeedWordPress(.*)Page/', '$1', get_class($this)); return strtolower($slug); } - function pagename ($context = NULL) { + public function pagename ($context = NULL) { if (is_null($context)) : $context = 'default'; endif; @@ -44,7 +44,7 @@ class FeedWordPressAdminPage { return __($name); } /* FeedWordPressAdminPage::pagename () */ - function accept_POST ($post) { + public function accept_POST ($post) { if ($this->for_feed_settings() and $this->update_requested_in($post)) : $this->update_feed(); elseif ($this->save_requested_in($post)) : // User mashed Save Changes @@ -53,7 +53,7 @@ class FeedWordPressAdminPage { do_action($this->dispatch.'_post', $post, $this); } - function update_feed () { + public function update_feed () { global $feedwordpress; add_action('feedwordpress_check_feed', 'update_feeds_mention'); @@ -85,7 +85,7 @@ class FeedWordPressAdminPage { remove_action('feedwordpress_check_feed_complete', 'update_feeds_finish', 10, 3); } - function save_settings ($post) { + public function save_settings ($post) { do_action($this->dispatch.'_save', $post, $this); if ($this->for_feed_settings()) : @@ -102,10 +102,10 @@ class FeedWordPressAdminPage { endif; } /* FeedWordPressAdminPage::save_settings () */ - function for_feed_settings () { return (is_object($this->link) and method_exists($this->link, 'found') and $this->link->found()); } - function for_default_settings () { return !$this->for_feed_settings(); } + public function for_feed_settings () { return (is_object($this->link) and method_exists($this->link, 'found') and $this->link->found()); } + public function for_default_settings () { return !$this->for_feed_settings(); } - function setting ($names, $fallback_value = NULL, $params = array()) { + public function setting ($names, $fallback_value = NULL, $params = array()) { if (!is_array($params)) : $params = array('default' => $params); endif; @@ -131,7 +131,7 @@ class FeedWordPressAdminPage { return $ret; } - function update_setting ($names, $value, $default = 'default') { + public function update_setting ($names, $value, $default = 'default') { if (is_string($names)) : $feed_name = $names; $global_name = 'feedwordpress_'.preg_replace('![\s/]+!', '_', $names); @@ -147,14 +147,14 @@ class FeedWordPressAdminPage { endif; } /* FeedWordPressAdminPage::update_setting () */ - function save_requested_in ($post) { + public function save_requested_in ($post) { return (isset($post['save']) or isset($post['submit'])); } - function update_requested_in ($post) { + public function update_requested_in ($post) { return (isset($post['update']) and (strlen($post['update']) > 0)); } - /*static*/ function submitted_link_id () { + public function submitted_link_id () { global $fwp_post; // Presume global unless we get a specific link ID @@ -179,8 +179,8 @@ class FeedWordPressAdminPage { return $link_id; } /* FeedWordPressAdminPage::submitted_link_id() */ - /*static*/ function submitted_link () { - $link_id = FeedWordPressAdminPage::submitted_link_id(); + public function submitted_link () { + $link_id = $this->submitted_link_id(); if (is_numeric($link_id) and $link_id) : $link = new SyndicatedLink($link_id); else : @@ -189,14 +189,14 @@ class FeedWordPressAdminPage { return $link; } /* FeedWordPressAdminPage::submitted_link () */ - function stamp_link_id ($field = null) { + public function stamp_link_id ($field = null) { if (is_null($field)) : $field = 'save_link_id'; endif; ?> <input type="hidden" name="<?php print esc_attr($field); ?>" value="<?php print ($this->for_feed_settings() ? $this->link->id : '*'); ?>" /> <?php } /* FeedWordPressAdminPage::stamp_link_id () */ - function these_posts_phrase () { + public function these_posts_phrase () { if ($this->for_feed_settings()) : $phrase = __('posts from this feed'); else : @@ -214,7 +214,7 @@ class FeedWordPressAdminPage { * @see add_meta_box() * @see do_meta_boxes() */ - function meta_box_context () { + public function meta_box_context () { return $this->context; } /* FeedWordPressAdminPage::meta_box_context () */ @@ -223,11 +223,11 @@ class FeedWordPressAdminPage { * * @uses FeedWordPressAdminPage::meta_box_context() */ - function fix_toggles () { + public function fix_toggles () { FeedWordPressSettingsUI::fix_toggles_js($this->meta_box_context()); } /* FeedWordPressAdminPage::fix_toggles() */ - function ajax_interface_js () { + public function ajax_interface_js () { ?> function contextual_appearance (item, appear, disappear, value, visibleStyle, checkbox) { if (typeof(visibleStyle)=='undefined') visibleStyle = 'block'; @@ -246,7 +246,7 @@ class FeedWordPressAdminPage { <?php } /* FeedWordPressAdminPage::ajax_interface_js () */ - function admin_page_href ($page, $params = array(), $link = NULL) { + public function admin_page_href ($page, $params = array(), $link = NULL) { global $fwp_path; // Merge in the page's filename @@ -278,7 +278,7 @@ class FeedWordPressAdminPage { return MyPHP::url(admin_url('admin.php'), $params); } /* FeedWordPressAdminPage::admin_page_href () */ - function display_feed_settings_page_links ($params = array()) { + public function display_feed_settings_page_links ($params = array()) { global $fwp_path; $params = wp_parse_args($params, array( @@ -338,7 +338,7 @@ class FeedWordPressAdminPage { print $params['after']; } /* FeedWordPressAdminPage::display_feed_settings_page_links */ - function display_feed_select_dropdown() { + public function display_feed_select_dropdown() { $links = FeedWordPress::syndicated_links(); ?> @@ -370,15 +370,15 @@ class FeedWordPressAdminPage { <?php } /* FeedWordPressAdminPage::display_feed_select_dropdown() */ - function display_sheet_header ($pagename = 'Syndication', $all = false) { + public function display_sheet_header ($pagename = 'Syndication', $all = false) { global $fwp_path; ?> - <div class="icon32"><img src="<?php print esc_html(WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress.png'); ?>" alt="" /></div> + <div class="icon32"><img src="<?php print esc_html( plugins_url( '/'.$fwp_path.'/feedwordpress.png') ); ?>" alt="" /></div> <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> <?php } - function display_update_notice_if_updated ($pagename = 'Syndication', $mesg = NULL) { + public function display_update_notice_if_updated ($pagename = 'Syndication', $mesg = NULL) { if (!is_null($mesg)) : $this->mesg = $mesg; endif; @@ -400,7 +400,7 @@ class FeedWordPressAdminPage { endif; } /* FeedWordPressAdminPage::display_update_notice_if_updated() */ - function display_settings_scope_message () { + public function display_settings_scope_message () { if ($this->for_feed_settings()) : ?> <p>These settings only affect posts syndicated from @@ -416,7 +416,7 @@ class FeedWordPressAdminPage { /*static*/ function has_link () { return true; } - function form_action ($filename = NULL) { + public function form_action ($filename = NULL) { global $fwp_path; if (is_null($filename)) : @@ -425,11 +425,11 @@ class FeedWordPressAdminPage { return $this->admin_page_href($filename); } /* FeedWordPressAdminPage::form_action () */ - function update_message () { + public function update_message () { return $this->mesg; } - function display () { + public function display () { global $fwp_post; if (FeedWordPress::needs_upgrade()) : @@ -490,7 +490,7 @@ class FeedWordPressAdminPage { <?php } - function open_sheet ($header) { + public function open_sheet ($header) { // Set up prepatory AJAX stuff ?> <script type="text/javascript"> @@ -545,7 +545,7 @@ class FeedWordPressAdminPage { <?php } /* FeedWordPressAdminPage::open_sheet () */ - function close_sheet () { + public function close_sheet () { ?> </div> <!-- id="poststuff" --> @@ -560,7 +560,7 @@ class FeedWordPressAdminPage { <?php } /* FeedWordPressAdminPage::close_sheet () */ - function setting_radio_control ($localName, $globalName, $options, $params = array()) { + public function setting_radio_control ($localName, $globalName, $options, $params = array()) { global $fwp_path; if (isset($params['filename'])) : $filename = $params['filename']; @@ -727,7 +727,7 @@ class FeedWordPressAdminPage { endif; } /* FeedWordPressAdminPage::setting_radio_control () */ - function save_button ($caption = NULL) { + public function save_button ($caption = NULL) { if (is_null($caption)) : $caption = __('Save Changes'); endif; ?> <p class="submit"> @@ -793,8 +793,11 @@ function fwp_tags_box ($tags, $object, $params = array()) { if (!is_array($tags)) : $tags = array(); endif; $tax_name = $params['taxonomy']; - $taxonomy = get_taxonomy($params['taxonomy']); - $disabled = (!current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''); + + $oTax = get_taxonomy($params['taxonomy']); + $oTaxLabels = get_taxonomy_labels($oTax); + + $disabled = (!current_user_can($oTax->cap->assign_terms) ? 'disabled="disabled"' : ''); $desc = "<p style=\"font-size:smaller;font-style:bold;margin:0\">Tag $object as...</p>"; @@ -822,24 +825,24 @@ function fwp_tags_box ($tags, $object, $params = array()) { <div class="tagsdiv" id="<?php echo $params['id']; ?>"> <div class="jaxtag"> <div class="nojs-tags hide-if-js"> - <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p> + <p><?php echo $oTaxLabels->add_or_remove_items; ?></p> <textarea name="<?php echo $params['textarea_name']; ?>" class="the-tags" id="<?php echo $params['textarea_id']; ?>"><?php echo esc_attr(implode(",", $tags)); ?></textarea></div> - <?php if ( current_user_can($taxonomy->cap->assign_terms) ) :?> + <?php if ( current_user_can($oTax->cap->assign_terms) ) :?> <div class="ajaxtag hide-if-no-js"> <label class="screen-reader-text" for="<?php echo $params['input_id']; ?>"><?php echo $params['box_title']; ?></label> - <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div> + <div class="taghint"><?php echo $oTaxLabels->add_new_item; ?></div> <p><input type="text" id="<?php print $params['input_id']; ?>" name="<?php print $params['input_name']; ?>" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /></p> </div> - <p class="howto"><?php echo esc_attr( $taxonomy->labels->separate_items_with_commas ); ?></p> + <p class="howto"><?php echo esc_attr( $oTaxLabels->separate_items_with_commas ); ?></p> <?php endif; ?> </div> <div class="tagchecklist"></div> </div> -<?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> -<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p> +<?php if ( current_user_can($oTax->cap->assign_terms) ) : ?> +<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $oTaxLabels->choose_from_most_used; ?></a></p> <?php endif; } @@ -854,7 +857,9 @@ function fwp_category_box ($checked, $object, $tags = array(), $params = array() $prefix = (isset($params['prefix']) ? $params['prefix'] : ''); $taxonomy = (isset($params['taxonomy']) ? $params['taxonomy'] : 'category'); endif; - $tax = get_taxonomy($taxonomy); + + $oTax = get_taxonomy($taxonomy); + $oTaxLabels = get_taxonomy_labels($oTax); if (strlen($prefix) > 0) : $idPrefix = $prefix.'-'; @@ -870,7 +875,7 @@ function fwp_category_box ($checked, $object, $tags = array(), $params = array() <div id="<?php print $idPrefix; ?>taxonomy-<?php print $taxonomy; ?>" class="feedwordpress-category-div"> <ul id="<?php print $idPrefix; ?><?php print $taxonomy; ?>-tabs" class="category-tabs"> <li class="ui-tabs-selected tabs"><a href="#<?php print $idPrefix; ?><?php print $taxonomy; ?>-all" tabindex="3"><?php _e( 'All posts' ); ?></a> - <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these <?php print $tax->labels->name; ?></p> + <p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these <?php print $oTaxLabels->name; ?></p> </li> </ul> @@ -976,7 +981,7 @@ class FeedWordPressSettingsUI { wp_enqueue_script('post'); // for magic tag and category boxes wp_enqueue_script('admin-forms'); // for checkbox selection - wp_register_script('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.js'); + wp_register_script('feedwordpress-elements', plugins_url('/' . $fwp_path . '/feedwordpress-elements.js') ); wp_enqueue_script('feedwordpress-elements'); } diff --git a/wp-content/plugins/feedwordpress/authors-page.php b/wp-content/plugins/feedwordpress/authors-page.php index d2438e88592c19c605b00b6066be39f3ccd30010..242719441fe7c6ba88d4c773a0d5040352b54f15 100644 --- a/wp-content/plugins/feedwordpress/authors-page.php +++ b/wp-content/plugins/feedwordpress/authors-page.php @@ -5,12 +5,12 @@ class FeedWordPressAuthorsPage extends FeedWordPressAdminPage { var $authorlist = NULL; var $rule_count = 0; - function FeedWordPressAuthorsPage ($link = -1) { + public function __construct( $link = -1 ) { if (is_numeric($link) and -1 == $link) : - $link = FeedWordPressAdminPage::submitted_link(); + $link = $this->submitted_link(); endif; - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressauthors', $link); + parent::__construct('feedwordpressauthors', $link); $this->refresh_author_list(); $this->dispatch = 'feedwordpress_author_settings'; $this->filename = __FILE__; diff --git a/wp-content/plugins/feedwordpress/categories-page.php b/wp-content/plugins/feedwordpress/categories-page.php index a24c680b9d6f449d3eb8000fe04fa02e49bae8ef..fe1810e95f09535e345fe8dc75ae775c5f91fc0a 100644 --- a/wp-content/plugins/feedwordpress/categories-page.php +++ b/wp-content/plugins/feedwordpress/categories-page.php @@ -2,12 +2,12 @@ require_once(dirname(__FILE__) . '/admin-ui.php'); class FeedWordPressCategoriesPage extends FeedWordPressAdminPage { - function FeedWordPressCategoriesPage ($link = -1) { + public function __construct( $link = -1 ) { if (is_numeric($link) and -1 == $link) : $link = $this->submitted_link(); endif; - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresscategories', $link); + parent::__construct('feedwordpresscategories', $link); $this->dispatch = 'feedwordpress_admin_page_categories'; $this->pagenames = array( 'default' => 'Categories & Tags', diff --git a/wp-content/plugins/feedwordpress/diagnostics-page.php b/wp-content/plugins/feedwordpress/diagnostics-page.php index 66f0dc2979032db1bc4dbdb2e09789be582130f2..97b1595c3e688199dee747376ea6a11e04b2fdca 100644 --- a/wp-content/plugins/feedwordpress/diagnostics-page.php +++ b/wp-content/plugins/feedwordpress/diagnostics-page.php @@ -2,9 +2,9 @@ require_once(dirname(__FILE__) . '/admin-ui.php'); class FeedWordPressDiagnosticsPage extends FeedWordPressAdminPage { - function FeedWordPressDiagnosticsPage () { + public function __construct() { // Set meta-box context name - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressdiagnosticspage'); + parent::__construct('feedwordpressdiagnosticspage'); $this->dispatch = 'feedwordpress_diagnostics'; $this->filename = __FILE__; diff --git a/wp-content/plugins/feedwordpress/feedfinder.class.php b/wp-content/plugins/feedwordpress/feedfinder.class.php index 5837f3e6de08b5211eb4735a3ad12ccc79920d39..ee9083191bdf27567b15bc5dd31fb9d5090af6e1 100644 --- a/wp-content/plugins/feedwordpress/feedfinder.class.php +++ b/wp-content/plugins/feedwordpress/feedfinder.class.php @@ -37,7 +37,7 @@ class FeedFinder { var $_obvious_feed_url = array('[./]rss', '[./]rdf', '[./]atom', '[./]feed', '\.xml'); var $_maybe_feed_url = array ('rss', 'rdf', 'atom', 'feed', 'xml'); - function FeedFinder ($uri = NULL, $params = array(), $fallbacks = 3) { + function __construct( $uri = NULL, $params = array(), $fallbacks = 3 ) { if (is_bool($params)) : $params = array("verify" => $params); endif; @@ -59,6 +59,10 @@ class FeedFinder { $this->fallbacks = $fallbacks; } /* FeedFinder::FeedFinder () */ + function FeedFinder( $uri = NULL, $params = array(), $fallbacks = 3 ) { + self::__construct( $uri, $params, $fallbacks ); + } + function find ($uri = NULL, $params = array()) { $params = wp_parse_args($params, array( // Defaults "authentication" => -1, diff --git a/wp-content/plugins/feedwordpress/feeds-page.php b/wp-content/plugins/feedwordpress/feeds-page.php index c1e755d941216a2af92f89a1548dae6fd57725b1..011d92e832fd096510d534697abcc1adadb20249 100644 --- a/wp-content/plugins/feedwordpress/feeds-page.php +++ b/wp-content/plugins/feedwordpress/feeds-page.php @@ -83,12 +83,12 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage { * * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings */ - function FeedWordPressFeedsPage ($link = -1) { + public function __construct( $link = -1 ) { if (is_numeric($link) and -1 == $link) : - $link = FeedWordPressAdminPage::submitted_link(); + $link = $this->submitted_link(); endif; - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressfeeds', $link); + parent::__construct('feedwordpressfeeds', $link); $this->dispatch = 'feedwordpress_admin_page_feeds'; $this->pagenames = array( @@ -139,7 +139,7 @@ class FeedWordPressFeedsPage extends FeedWordPressAdminPage { } /* FeedWordPressFeedsPage::display() */ function ajax_interface_js () { - FeedWordPressAdminPage::ajax_interface_js(); + parent::ajax_interface_js(); ?> jQuery(document).ready( function () { diff --git a/wp-content/plugins/feedwordpress/feedtime.class.php b/wp-content/plugins/feedwordpress/feedtime.class.php index 067c584300ec8339b4695e1f7ec8578a098c5b46..355863dc3edaf4e60a202fb6613e10820b92c2d5 100644 --- a/wp-content/plugins/feedwordpress/feedtime.class.php +++ b/wp-content/plugins/feedwordpress/feedtime.class.php @@ -24,10 +24,14 @@ class FeedTime { var $rep; var $ts; - function FeedTime ($time) { + function __construct( $time ) { $this->set($time); } /* FeedTime constructor */ + function FeedTime( $time ) { + self::__construct( $time ); + } + function set ($time, $recurse = false) { $this->rep = $time; $this->ts = NULL; diff --git a/wp-content/plugins/feedwordpress/feedwordpress-content-type-sniffer.class.php b/wp-content/plugins/feedwordpress/feedwordpress-content-type-sniffer.class.php index 15bab37423c7df2d9dc6071fb26acab4a54c80f8..894bd5c517866824dea174fbdc529d1487603912 100644 --- a/wp-content/plugins/feedwordpress/feedwordpress-content-type-sniffer.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpress-content-type-sniffer.class.php @@ -1,5 +1,7 @@ <?php -require_once(ABSPATH . WPINC . '/class-feed.php'); +if (!class_exists('SimplePie_Content_Type_Sniffer')) : + require_once(ABSPATH . WPINC . '/class-simplepie.php'); +endif; class FeedWordPress_Content_Type_Sniffer extends SimplePie_Content_Type_Sniffer { /** diff --git a/wp-content/plugins/feedwordpress/feedwordpress-walker-category-checklist.class.php b/wp-content/plugins/feedwordpress/feedwordpress-walker-category-checklist.class.php index ea7e39e4a49b0015bd3f65950974efddff63c380..74e01932b74dcf8826a45dde08c10963a647f4b5 100644 --- a/wp-content/plugins/feedwordpress/feedwordpress-walker-category-checklist.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpress-walker-category-checklist.class.php @@ -13,13 +13,13 @@ require_once(ABSPATH.'/wp-admin/includes/template.php'); class FeedWordPress_Walker_Category_Checklist extends Walker_Category_Checklist { var $prefix = ''; var $taxonomy = 'category'; var $checkbox_name = NULL; - function FeedWordPress_Walker_Category_Checklist ($params = array()) { + public function __construct ($params = array()) { $this->set_taxonomy('category'); if (isset($params['checkbox_name'])) : $this->checkbox_name = $params['checkbox_name']; endif; - } + } /* FeedWordPress_Walker_Category_Checklist::__construct () */ function set_prefix ($prefix) { $this->prefix = $prefix; @@ -28,7 +28,7 @@ class FeedWordPress_Walker_Category_Checklist extends Walker_Category_Checklist $this->taxonomy = $taxonomy; } - function start_el( &$output, $category, $depth = 0, $args = array(), $current_object_id = 0 ) { + function start_el (&$output, $category, $depth = 0, $args = array(), $id = 0) { extract($args); if ( empty($taxonomy) ) : $taxonomy = 'category'; diff --git a/wp-content/plugins/feedwordpress/feedwordpress.php b/wp-content/plugins/feedwordpress/feedwordpress.php index 753ca5eee9893a6307d380e195166f01ac46473d..6526acbd570bbd406e94a65ad2e9fcac7a97b1ca 100644 --- a/wp-content/plugins/feedwordpress/feedwordpress.php +++ b/wp-content/plugins/feedwordpress/feedwordpress.php @@ -3,7 +3,7 @@ Plugin Name: FeedWordPress Plugin URI: http://feedwordpress.radgeek.com/ Description: simple and flexible Atom/RSS syndication for WordPress -Version: 2016.0420 +Version: 2016.1213 Author: Charles Johnson Author URI: http://radgeek.com/ License: GPL @@ -11,7 +11,7 @@ License: GPL /** * @package FeedWordPress - * @version 2016.0420 + * @version 2016.1213 */ # This uses code derived from: @@ -32,7 +32,7 @@ License: GPL # -- Don't change these unless you know what you're doing... -define ('FEEDWORDPRESS_VERSION', '2016.0420'); +define ('FEEDWORDPRESS_VERSION', '2016.1213'); define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact'); if (!defined('FEEDWORDPRESS_BLEG')) : @@ -91,17 +91,39 @@ endif; // Use our the cache settings that we want. add_filter('wp_feed_cache_transient_lifetime', array('FeedWordPress', 'cache_lifetime')); -// Ensure that we have SimplePie loaded up and ready to go. -// We no longer need a MagpieRSS upgrade module. Hallelujah! -if (!class_exists('SimplePie')) : - require_once(ABSPATH . WPINC . '/class-simplepie.php'); -endif; -require_once(ABSPATH . WPINC . '/class-feed.php'); +// Dependencies: modules packaged with WordPress core +$wpCoreDependencies = array( +"class:SimplePie" => "class-simplepie", +"class:WP_Feed_Cache" => "class-wp-feed-cache", +"class:WP_Feed_Cache_Transient" => "class-wp-feed-cache-transient", +"class:WP_SimplePie_File" => "class-wp-simplepie-file", +"class:WP_SimplePie_Sanitize_KSES" => "class-wp-simplepie-sanitize-kses", +"function:wp_insert_user" => "registration", +); -if (!function_exists('wp_insert_user')) : - require_once (ABSPATH . WPINC . '/registration.php'); // for wp_insert_user +// Ensure that we have SimplePie loaded up and ready to go +// along with the WordPress auxiliary classes. +$unmetCoreDependencies = array(); +foreach ($wpCoreDependencies as $unit => $fileSlug) : + list($unitType, $unitName) = explode(":", $unit, 2); + + $dependencyMet = (('class'==$unitType) ? class_exists($unitName) : function_exists($unitName)); + if (!$dependencyMet) : + $phpFileName = ABSPATH . WPINC . "/${fileSlug}.php"; + if (file_exists($phpFileName)) : + require_once($phpFileName); + else : + $unmetCoreDependencies[] = $unitName; + endif; + endif; +endforeach; + +// Fallback garbage-pail module used in WP < 4.7 which may meet our dependencies +if (count($unmetCoreDependencies) > 0) : + require_once(ABSPATH . WPINC . "/class-feed.php"); endif; +// Dependences: modules packaged with FeedWordPress plugin $dir = dirname(__FILE__); require_once("${dir}/externals/myphp/myphp.class.php"); require_once("${dir}/admin-ui.php"); @@ -216,6 +238,8 @@ if (!$feedwordpress->needs_upgrade()) : // only work if the conditions are safe! endif; add_action('init', array($feedwordpress, 'init')); + add_action('wp_loaded', array($feedwordpress, 'wp_loaded')); + add_action('shutdown', array($feedwordpress, 'email_diagnostic_log')); add_action('shutdown', array($feedwordpress, 'feedwordpress_cleanup')); add_action('wp_dashboard_setup', array($feedwordpress, 'dashboard_setup')); @@ -237,7 +261,7 @@ endif; // if (!FeedWordPress::needs_upgrade()) ################################################################################ class FeedWordPressDiagnostic { - function feed_error ($error, $old, $link) { + public static function feed_error ($error, $old, $link) { $wpError = $error['object']; $url = $link->uri(); @@ -671,7 +695,7 @@ function fwp_add_pages () { $menu_cap, $syndicationMenu, NULL, - WP_PLUGIN_URL.'/'.FeedWordPress::path('feedwordpress-tiny.png') + plugins_url( '/'.FeedWordPress::path('feedwordpress-tiny.png') ) ); do_action('feedwordpress_admin_menu_pre_feeds', $menu_cap, $settings_cap); @@ -1204,7 +1228,11 @@ class FeedWordPress { $exact = $hook; // Before munging if (!!$hook) : - if ($hook != 'init') : // Constrain values. + if ($hook == 'init' or $hook == 'wp_loaded') : // Re-map init to wp_loaded + $hook = ($params['setting only'] ? 'init' : 'wp_loaded'); + + // Constrain possible values. If it's not an init or wp_loaded, it's a shutdown + else : $hook = 'shutdown'; endif; endif; @@ -1465,7 +1493,7 @@ class FeedWordPress { // If this is a FeedWordPress admin page, queue up scripts for AJAX // functions that FWP uses. If it is a display page or a non-FWP admin // page, don't. - wp_register_style('feedwordpress-elements', WP_PLUGIN_URL.'/'.$fwp_path.'/feedwordpress-elements.css'); + wp_register_style('feedwordpress-elements', plugins_url( '/'.$fwp_path.'/feedwordpress-elements.css') ); if (FeedWordPressSettingsUI::is_admin()) : // For JavaScript that needs to be generated dynamically add_action('admin_print_scripts', array('FeedWordPressSettingsUI', 'admin_scripts')); @@ -1512,10 +1540,21 @@ class FeedWordPress { add_action('wp_ajax_fwp_feedcontents', array($this, 'fwp_feedcontents')); add_action('wp_ajax_fwp_xpathtest', array($this, 'fwp_xpathtest')); - $this->clear_cache_magic_url(); - $this->update_magic_url(); } /* FeedWordPress::init() */ + /** + * FeedWordPress::wp_loaded (): Once all plugin and theme modules have been + * loaded and initialized (by actions on the init hook, etc.), check the HTTP + * request to see if we need to perform any special FeedWordPress-related + * actions. + * + * @since 2016.0614 + */ + public function wp_loaded () { + $this->clear_cache_magic_url(); + $this->update_magic_url(); + } /* FeedWordPress::wp_loaded () */ + public function fwp_feeds () { $feeds = array(); $feed_ids = $this->feeds; @@ -1769,11 +1808,22 @@ class FeedWordPress { } /* FeedWordPress::user_can_richedit () */ + public function clear_cache_magic_url () { + if ($this->clear_cache_requested()) : + $this->clear_cache(); + endif; + } /* FeedWordPress::clear_cache_magic_url() */ + + public function clear_cache_requested () { + return MyPHP::request('clear_cache'); + } /* FeedWordPress::clear_cache_requested() */ + public function update_magic_url () { global $wpdb; // Explicit update request in the HTTP request (e.g. from a cron job) - if ($this->update_requested()) : + if (self::update_requested()) : + $this->update_hooked = "Initiating a CRON JOB CHECK-IN ON UPDATE SCHEDULE due to URL parameter = ".trim($this->val($_REQUEST['update_feedwordpress'])); $this->update($this->update_requested_url()); @@ -1803,27 +1853,17 @@ class FeedWordPress { // when successful. exit; endif; - } /* FeedWordPress::magic_update_url () */ - - public function clear_cache_magic_url () { - if ($this->clear_cache_requested()) : - $this->clear_cache(); - endif; - } /* FeedWordPress::clear_cache_magic_url() */ - - public function clear_cache_requested () { - return MyPHP::request('clear_cache'); - } /* FeedWordPress::clear_cache_requested() */ + } /* FeedWordPress::update_magic_url () */ - public function update_requested () { + public static function update_requested () { return MyPHP::request('update_feedwordpress'); } /* FeedWordPress::update_requested() */ - + public function update_requested_url () { $ret = null; if (($_REQUEST['update_feedwordpress']=='*') - or (preg_match('|^http://.*|i', $_REQUEST['update_feedwordpress']))) : + or (preg_match('|^[a-z]+://.*|i', $_REQUEST['update_feedwordpress']))) : $ret = $_REQUEST['update_feedwordpress']; endif; @@ -2288,24 +2328,24 @@ class FeedWordPress { $diagnostic_nesting = count(explode(":", $level)); - if (FeedWordPress::diagnostic_on($level)) : + if (self::diagnostic_on($level)) : foreach ($output as $method) : switch ($method) : case 'echo' : - if (!FeedWordPress::update_requested()) : + if (!self::update_requested()) : echo "<div><pre><strong>Diag".str_repeat('====', $diagnostic_nesting-1).'|</strong> '.$out."</pre></div>\n"; endif; break; case 'echo_in_cronjob' : - if (FeedWordPress::update_requested()) : - echo FeedWordPress::log_prefix()." ".$out."\n"; + if (self::update_requested()) : + echo self::log_prefix()." ".$out."\n"; endif; break; case 'admin_footer' : $feedwordpress_admin_footer[] = $out; break; case 'error_log' : - error_log(FeedWordPress::log_prefix().' '.$out); + error_log(self::log_prefix().' '.$out); break; case 'email' : diff --git a/wp-content/plugins/feedwordpress/feedwordpress_file.class.php b/wp-content/plugins/feedwordpress/feedwordpress_file.class.php index e3eadccba5b1feba9e41c6f0f8752216376afd03..8bdf337d6c680c5da3d2fcccbdfc4890ef7e5ca4 100644 --- a/wp-content/plugins/feedwordpress/feedwordpress_file.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpress_file.class.php @@ -4,7 +4,7 @@ global $fwp_credentials; $fwp_credentials = NULL; class FeedWordPress_File extends WP_SimplePie_File { - function FeedWordPress_File ($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { + public function __construct ($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { global $feedwordpress; global $wp_version; diff --git a/wp-content/plugins/feedwordpress/feedwordpresshttpauthenticator.class.php b/wp-content/plugins/feedwordpress/feedwordpresshttpauthenticator.class.php index 0a1bb42dbdcf8ebf8b19530627b3f66098d88b57..5fa541b3aae8c76d93fc5d4a1a86c6db014cc221 100644 --- a/wp-content/plugins/feedwordpress/feedwordpresshttpauthenticator.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpresshttpauthenticator.class.php @@ -9,7 +9,7 @@ class FeedWordPressHTTPAuthenticator { endforeach; add_filter('pre_http_request', array($this, 'pre_http_request'), 10, 3); - add_action('http_api_curl', array($this, 'set_auth_options'), 1000, 1); + add_action('http_api_curl', array($this, 'set_auth_options'), 1000, 3); } /* FeedWordPressHTTPAuthenticator::__construct () */ function methods_available () { @@ -150,7 +150,7 @@ class FeedWordPressHTTPAuthenticator { return $use; } /* FeedWordPressHTTPAuthenticator::if_curl () */ - function set_auth_options (&$handle) { + function set_auth_options ($handle, $r, $url) { if ('digest'==$this->args['authentication']) : curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); endif; diff --git a/wp-content/plugins/feedwordpress/feedwordpressrpc.class.php b/wp-content/plugins/feedwordpress/feedwordpressrpc.class.php index 9a58854c4bc26180120c6a0dcad41ca24e842ea4..c673afca8ed19392838742482b17c616ab431a09 100644 --- a/wp-content/plugins/feedwordpress/feedwordpressrpc.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpressrpc.class.php @@ -4,7 +4,7 @@ ################################################################################ class FeedWordPressRPC { - function FeedWordPressRPC () { + public function __construct () { add_filter('xmlrpc_methods', array($this, 'xmlrpc_methods')); } diff --git a/wp-content/plugins/feedwordpress/feedwordpresssyndicationpage.class.php b/wp-content/plugins/feedwordpress/feedwordpresssyndicationpage.class.php index 70409e2638a6576eff217de9adeb566e2d098d11..cd1b71299bf6ffcc67136c0fa9803a29328d7a3b 100644 --- a/wp-content/plugins/feedwordpress/feedwordpresssyndicationpage.class.php +++ b/wp-content/plugins/feedwordpress/feedwordpresssyndicationpage.class.php @@ -16,8 +16,8 @@ define('FWP_CANCEL_BUTTON', '× Cancel'); define('FWP_CHECK_FOR_UPDATES', 'Update'); class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { - function FeedWordPressSyndicationPage ($filename = NULL) { - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL); + public function __construct ($filename = NULL) { + parent::__construct('feedwordpresssyndication', /*link=*/ NULL); // No over-arching form element $this->dispatch = NULL; @@ -477,7 +477,7 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { // Hey ho, let's go... ?> - <div style="float: left; background: #F5F5F5; padding-top: 5px; padding-right: 5px;"><a href="<?php print $this->form_action(); ?>"><img src="<?php print esc_html(WP_PLUGIN_URL."/${fwp_path}/feedwordpress.png"); ?>" alt="" /></a></div> + <div style="float: left; background: #F5F5F5; padding-top: 5px; padding-right: 5px;"><a href="<?php print $this->form_action(); ?>"><img src="<?php print esc_html(plugins_url( "/${fwp_path}/feedwordpress.png") ); ?>" alt="" /></a></div> <p class="info" style="margin-bottom: 0px; border-bottom: 1px dotted black;">Managed by <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> <?php print FEEDWORDPRESS_VERSION; ?>.</p> @@ -536,7 +536,7 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { <?php FeedWordPressSettingsUI::magic_input_tip_js('add-uri'); ?> <input type="hidden" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /> - <input style="vertical-align: middle;" type="image" src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/plus.png" alt="<?php print FWP_SYNDICATE_NEW; ?>" /></div> + <input style="vertical-align: middle;" type="image" src="<?php print plugins_url('/'.$fwp_path .'/plus.png' ); ?>" alt="<?php print FWP_SYNDICATE_NEW; ?>" /></div> </form> </div> <!-- id="add-single-uri" --> @@ -602,9 +602,9 @@ class FeedWordPressSyndicationPage extends FeedWordPressAdminPage { <input type="hidden" name="action" value="feedfinder" /> <input type="submit" class="button-secondary" name="action" value="<?php print FWP_SYNDICATE_NEW; ?>" /> - <div style="text-align: right; margin-right: 2.0em"><a id="turn-on-multiple-sources" href="#add-multiple-uri"><img style="vertical-align: middle" src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/down.png" alt="" /> add multiple</a> + <div style="text-align: right; margin-right: 2.0em"><a id="turn-on-multiple-sources" href="#add-multiple-uri"><img style="vertical-align: middle" src="<?php print plugins_url('/' . $fwp_path . '/down.png'); ?>" alt="" /> add multiple</a> <span class="screen-reader-text"> or </span> - <a id="turn-on-opml-upload" href="#upload-opml"><img src="<?php print WP_PLUGIN_URL.'/'.$fwp_path; ?>/plus.png" alt="" style="vertical-align: middle" /> import source list</a></div> + <a id="turn-on-opml-upload" href="#upload-opml"><img src="<?php print plugins_url('/' . $fwp_path . '/plus.png'); ?>" alt="" style="vertical-align: middle" /> import source list</a></div> </li> </ul> </form> @@ -730,12 +730,12 @@ support, and documentation.</p> </div> <!-- style="display: inline-block" --> <div class="hovered-component" style="display: inline-block; vertical-align: bottom"> -<a href="bitcoin:<?php print esc_attr(FEEDWORDPRESS_BLEG_BTC); ?>"><img src="<?php print esc_url(WP_PLUGIN_URL.'/'.FeedWordPress::path('btc-qr-64px.png')); ?>" alt="Donate" /></a> +<a href="bitcoin:<?php print esc_attr(FEEDWORDPRESS_BLEG_BTC); ?>"><img src="<?php print esc_url( plugins_url('/'.FeedWordPress::path('btc-qr-64px.png') ) ); ?>" alt="Donate" /></a> <div><a href="bitcoin:<?php print esc_attr(FEEDWORDPRESS_BLEG_BTC); ?>">via bitcoin<span class="hover-on pop-over" style="background-color: #ddffdd; padding: 5px; color: black; border-radius: 5px;">bitcoin:<?php print esc_html(FEEDWORDPRESS_BLEG_BTC); ?></span></a></div> </div> <div style="display: inline-block; vertical-align: bottom"> -<input type="image" name="submit" src="<?php print esc_url(WP_PLUGIN_URL.'/'.FeedWordPress::path('paypal-donation-64px.png')); ?>" alt="Donate through PayPal" /> +<input type="image" name="submit" src="<?php print esc_url(plugins_url('/' . FeedWordPress::path('paypal-donation-64px.png' ) ) ); ?>" alt="Donate through PayPal" /> <input type="hidden" name="business" value="distro.to.feedback@radgeek.com" /> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="item_name" value="FeedWordPress donation" /> diff --git a/wp-content/plugins/feedwordpress/inspectpostmeta.class.php b/wp-content/plugins/feedwordpress/inspectpostmeta.class.php index e43081c78e2dfe4012decb98d6ef7a97d0101b4b..4c3de5f74d6c7ecc1035a4ee5f5ee0618abb7bcd 100644 --- a/wp-content/plugins/feedwordpress/inspectpostmeta.class.php +++ b/wp-content/plugins/feedwordpress/inspectpostmeta.class.php @@ -8,9 +8,9 @@ */ class InspectPostMeta { - function InspectPostMeta ($in_hook = true) { + public function __construct ($in_hook = true) { add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 10, 2); - } + } /* InspectPostMeta::__construct () */ function add_meta_boxes ($post_type, $post) { add_meta_box( diff --git a/wp-content/plugins/feedwordpress/magpiefromsimplepie.class.php b/wp-content/plugins/feedwordpress/magpiefromsimplepie.class.php index 0cebcf08e2450f9831785414253ecbafa6edb056..a40416a735e00c68614b431ca6b9ad0b0fccce8c 100644 --- a/wp-content/plugins/feedwordpress/magpiefromsimplepie.class.php +++ b/wp-content/plugins/feedwordpress/magpiefromsimplepie.class.php @@ -66,7 +66,7 @@ class MagpieFromSimplePie { * @uses MagpieFromSimplePie::normalize * @uses MagpieFromSimplePie::is_atom */ - function MagpieFromSimplePie ($pie, $item = true) { + function __construct( $pie, $item = true ) { $this->pie = $pie; // item in {NULL, true} = process channel data @@ -95,6 +95,10 @@ class MagpieFromSimplePie { $this->feed_version = $this->feed_version(); $this->encoding = $pie->get_encoding(); } /* MagpieFromSimplePie constructor */ + + function MagpieFromSimplePie( $pie, $item = true ) { + self::__construct( $pie, $item ); + } /** * MagpieFromSimplePie::get_items: returns an array of MagpieRSS format arrays diff --git a/wp-content/plugins/feedwordpress/magpiemocklink.class.php b/wp-content/plugins/feedwordpress/magpiemocklink.class.php index b666812559ad66b11ea53202e637f9145cfe25a1..92e0c223e88e32baa28a2283e85c7546584b5c4a 100644 --- a/wp-content/plugins/feedwordpress/magpiemocklink.class.php +++ b/wp-content/plugins/feedwordpress/magpiemocklink.class.php @@ -4,7 +4,7 @@ require_once(dirname(__FILE__) . '/syndicatedlink.class.php'); class MagpieMockLink extends SyndicatedLink { var $url; - function MagpieMockLink ($rss, $url) { + function __construct( $rss, $url ) { $this->link = $rss; if (is_array($rss) and isset($rss['simplepie']) and isset($rss['magpie'])) : @@ -22,6 +22,10 @@ class MagpieMockLink extends SyndicatedLink { ); } /* function MagpieMockLink::MagpieMockLink () */ + function MagpieMockLink( $rss, $url ) { + self::__construct( $rss, $url ); + } + function poll ($crash_ts = NULL) { // Do nothing but update copy of feed $this->simplepie = FeedWordPress::fetch($this->url); diff --git a/wp-content/plugins/feedwordpress/performance-page.php b/wp-content/plugins/feedwordpress/performance-page.php index 24e608bcd4e67908cca62ec3890a45df487c324d..dd3f684a88e0086bfbc5e6baf060c60dca533445 100644 --- a/wp-content/plugins/feedwordpress/performance-page.php +++ b/wp-content/plugins/feedwordpress/performance-page.php @@ -2,14 +2,14 @@ require_once(dirname(__FILE__) . '/admin-ui.php'); class FeedWordPressPerformancePage extends FeedWordPressAdminPage { - function FeedWordPressPerformancePage () { + public function __construct() { // Set meta-box context name - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressperformancepage'); + parent::__construct('feedwordpressperformancepage'); $this->dispatch = 'feedwordpress_performance'; $this->filename = __FILE__; } - function has_link () { return false; } + public function has_link () { return false; } function display () { global $wpdb, $wp_db_version, $fwp_path; diff --git a/wp-content/plugins/feedwordpress/posts-page.php b/wp-content/plugins/feedwordpress/posts-page.php index c7e09ccfd208119db2f58de7063e43cfa867f3b0..69997a2fb6ef1b79b7f813fedfcfcad67c337259 100644 --- a/wp-content/plugins/feedwordpress/posts-page.php +++ b/wp-content/plugins/feedwordpress/posts-page.php @@ -11,12 +11,12 @@ class FeedWordPressPostsPage extends FeedWordPressAdminPage { * * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings */ - function FeedWordPressPostsPage ($link = -1) { + public function __construct( $link = -1 ) { if (is_numeric($link) and -1 == $link) : - $link = FeedWordPressAdminPage::submitted_link(); + $link = $this->submitted_link(); endif; - FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresspostspage', $link); + parent::__construct('feedwordpresspostspage', $link); $this->dispatch = 'feedwordpress_admin_page_posts'; $this->filename = __FILE__; $this->updatedPosts = new UpdatedPostsControl($this); diff --git a/wp-content/plugins/feedwordpress/readme.txt b/wp-content/plugins/feedwordpress/readme.txt index fe6342b57ee5e2ec2286982da70c7b5fe0d10226..bae4f062072cb8d3a295c2702dea0a90255569f1 100644 --- a/wp-content/plugins/feedwordpress/readme.txt +++ b/wp-content/plugins/feedwordpress/readme.txt @@ -2,9 +2,9 @@ Contributors: Charles Johnson Donate link: http://feedwordpress.radgeek.com/ Tags: syndication, aggregation, feed, atom, rss -Requires at least: 3.0 -Tested up to: 4.5.2 -Stable tag: 2016.0420 +Requires at least: 4.5 +Tested up to: 4.7 +Stable tag: 2016.1213 FeedWordPress syndicates content from feeds you choose into your WordPress weblog. @@ -23,7 +23,6 @@ developed, originally, because I needed a more flexible replacement for [Planet][] to use at Feminist Blogs, an aggregator site that I used to administer. [Planet]: http://www.planetplanet.org/ -[Feminist Blogs]: http://feministblogs.org/ FeedWordPress is designed with flexibility, ease of use, and ease of configuration in mind. You'll need a working installation of WordPress (version @@ -94,6 +93,56 @@ outs, see the documentation at the [FeedWordPress project homepage][]. == Changelog == += 2016.1213 = + +* WORDPRSS BACKWARD COMPATIBILITY FOR VERSIONS [4.5, 4.7]: This change fixes + a fatal PHP error (on some web server configurations you'd see the message + "Fatal error: require_once(): Failed opening required '[...]/wp-includes/class-wp-feed-cache.php'" + on others, you might just see an HTTP 500 Internal Server Error or a blank + page) when using FeedWordPress with versions of WordPress before 4.7. A + change that I introduced to avoid a code module that had been deprecated in + version 4.7 ended up relying on code modules that were only introduced as + of version 4.7; so now, instead, FeedWordPress attempts to detect which + modules the current version of the WordPress core makes available, and load + the right modules depending on your WordPress version. + + In theory, up to this point, FeedWordPress supported any version of + WordPress from version 3.0 onward. In practice, version 3.0 was released + over 6 years ago, and I can realistically commit only to testing out new + releases of FeedWordPress with a few prior versions of WordPress; so I've + updated the "Requires at least" field to version 4.5, the first major + release issued in 2016. If you've really got to use FeedWordPress with + older versions of WordPress, it will probably still work with any moderately + modern release of WordPress, but I won't promise to keep it working with + releases of WordPress that are more than about a year old. + += 2016.1211 = + +* WORDPRESS COMPATIBILITY: Tested with new versions of WordPress up to 4.7. + +* PHP WARNINGS UNDER WP 4.7: Eliminated cause of a PHP warning under WP 4.7 + "Parameter 1 to FeedWordPressHTTPAuthenticator::set_auth_options expected to be reference" + Warnings were due to a change in how http_api_curl hook is sometimes called + in WP 4.7; so I changed the signature of the event handling method to avoid + the notice. Props to @cogdog, @froomkin, @gwynethllewelyn et al. for flagging + the issue and @garymarkfuller for suggesting a preliminary fix to the issue + that was fairly similar to the solution I ended up adopting. + +* PHP 7 and PHP Strict Standards compatibility changes: @alexiskulash @daidais + and @zoul0813 all sent pull requests through Github to fix some issues from + a very old code base that has made its way from PHP 3.x through 5.x to the + roll-out of PHP 7. Class methods should now fare better under modern versions + of PHP and generate fewer "Deprecated" notices. + +* IMPROVEMENTS TO SCHEDULED AND AUTOMATIC UPDATES: use wp_loaded hook to check + for magic URL parameters and to execute updates, to do pageload-based automatic + updates, etc. Ensures that anything plugins or themes need to do in init to set + up custom post types, taxonomies, etc. will be done before the update_feedwordpress + updates are attempted. If you saw posts not getting put into the correct custom + post type or custom taxonomies or similar problems when performing scheduled updates, + but the problem seemed to go away when you manually performed updates through the + wp-admin interface, then you might be able to solve those problems with this update. + = 2016.0420 = * WORDPRESS COMPATIBILITY: Tested with new versions of WordPress up to 4.5. diff --git a/wp-content/plugins/feedwordpress/syndicatedlink.class.php b/wp-content/plugins/feedwordpress/syndicatedlink.class.php index f1d35a9ec168af38957bf459617b9c1b2e02d585..e2f5b677118bea681747521751d4a740286fea13 100644 --- a/wp-content/plugins/feedwordpress/syndicatedlink.class.php +++ b/wp-content/plugins/feedwordpress/syndicatedlink.class.php @@ -43,7 +43,7 @@ class SyndicatedLink { public $simplepie = null; var $magpie = null; - function SyndicatedLink ($link) { + public function __construct( $link ) { global $wpdb; if (is_object($link)) : @@ -54,22 +54,24 @@ class SyndicatedLink { $this->link = get_bookmark($link); endif; - if (strlen($this->link->link_rss) > 0) : - $this->get_settings_from_notes(); + if (is_object($this->link)) : + if (strlen($this->link->link_rss) > 0) : + $this->get_settings_from_notes(); + endif; endif; add_filter('feedwordpress_update_complete', array($this, 'process_retirements'), 1000, 1); - } /* SyndicatedLink::SyndicatedLink () */ + } /* SyndicatedLink::__construct () */ - function found () { + public function found () { return is_object($this->link) and !is_wp_error($this->link); } /* SyndicatedLink::found () */ - function id () { + public function id () { return (is_object($this->link) ? $this->link->link_id : NULL); } - function stale () { + public function stale () { global $feedwordpress; $stale = true; @@ -92,7 +94,7 @@ class SyndicatedLink { return $stale; } /* SyndicatedLink::stale () */ - function fetch () { + public function fetch () { $timeout = $this->setting('fetch timeout', 'feedwordpress_fetch_timeout', FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT); $this->simplepie = apply_filters( @@ -107,8 +109,9 @@ class SyndicatedLink { else : $this->magpie = new MagpieFromSimplePie($this->simplepie, NULL); endif; - } - function live_posts () { + } /* SyndicatedLink::fetch () */ + + public function live_posts () { if (!is_object($this->simplepie)) : $this->fetch(); endif; @@ -123,9 +126,9 @@ class SyndicatedLink { $ret = $this->simplepie; endif; return $ret; - } + } /* SyndicatedLink::live_posts () */ - function poll ($crash_ts = NULL) { + public function poll ($crash_ts = NULL) { global $wpdb; $url = $this->uri(array('add_params' => true, 'fetch' => true)); @@ -361,7 +364,7 @@ class SyndicatedLink { return $new_count; } /* SyndicatedLink::poll() */ - function process_retirements ($delta) { + public function process_retirements ($delta) { global $post; $q = new WP_Query(array( @@ -382,7 +385,7 @@ class SyndicatedLink { endif; return $delta; - } + } /* SyndicatedLink::process_retirements () */ /** * Updates the URL for the feed syndicated by this link. @@ -390,7 +393,7 @@ class SyndicatedLink { * @param string $url The new feed URL to use for this source. * @return bool TRUE on success, FALSE on failure. */ - function set_uri ($url) { + public function set_uri ($url) { global $wpdb; if ($this->found()) : @@ -409,7 +412,7 @@ class SyndicatedLink { return $ret; } /* SyndicatedLink::set_uri () */ - function deactivate () { + public function deactivate () { global $wpdb; $wpdb->query($wpdb->prepare(" @@ -417,7 +420,18 @@ class SyndicatedLink { ", (int) $this->id)); } /* SyndicatedLink::deactivate () */ - function delete () { + /** + * SyndicatedLink::delete() deletes a subscription from the WordPress links + * table. Any posts that were syndicated through that subscription will still + * be present in the wp_posts table; but postmeta fields that refer to the + * syndication feed's numeric id (which will no longer be valid) will be + * deleted. For most purposes, the posts remaining will be treated as if they + * were locally authored posts rather than syndicated posts. + * + * @global $wpdb + * @uses wpdb::query + */ + public function delete () { global $wpdb; $wpdb->query($wpdb->prepare(" @@ -432,7 +446,16 @@ class SyndicatedLink { $this->id = NULL; } /* SyndicatedLink::delete () */ - function nuke () { + /** + * SyndicatedLink::nuke() deletes a subscription AND all of the + * posts syndicated through that subscription. + * + * @global $wpdb + * @uses wpdb::get_col + * @uses wp_delete_post + * @uses SyndicatedLink::delete + */ + public function nuke () { global $wpdb; // Make a list of the items syndicated from this feed... @@ -457,7 +480,7 @@ class SyndicatedLink { $this->delete(); } /* SyndicatedLink::nuke () */ - function map_name_to_new_user ($name, $newuser_name) { + public function map_name_to_new_user ($name, $newuser_name) { global $wpdb; if (strlen($newuser_name) > 0) : @@ -478,11 +501,11 @@ class SyndicatedLink { endif; } /* SyndicatedLink::map_name_to_new_user () */ - function imploded_settings () { + protected function imploded_settings () { return array('cats', 'tags', 'match/cats', 'match/tags', 'match/filter'); - } + } /* SyndicatedLink::imploded_settings () */ - function get_settings_from_notes () { + protected function get_settings_from_notes () { // Read off feed settings from link_notes $notes = explode("\n", $this->link->link_notes); foreach ($notes as $note): @@ -583,7 +606,7 @@ class SyndicatedLink { } /* SyndicatedLink::get_settings_from_notes () */ - function settings_to_notes () { + protected function settings_to_notes () { $to_notes = $this->settings; unset($to_notes['link/id']); // Magic setting; don't save @@ -629,7 +652,7 @@ class SyndicatedLink { return $notes; } /* SyndicatedLink::settings_to_notes () */ - function save_settings ($reload = false) { + public function save_settings ($reload = false) { global $wpdb; // Save channel-level meta-data @@ -666,7 +689,7 @@ class SyndicatedLink { * @param mixed $fallback_value If the link setting and the global setting are nonexistent or marked as a use-default value, fall back to this constant value. * @return bool TRUE on success, FALSE on failure. */ - function setting ($name, $fallback_global = NULL, $fallback_value = NULL, $default = 'default') { + public function setting ($name, $fallback_global = NULL, $fallback_value = NULL, $default = 'default') { $ret = NULL; if (isset($this->settings[$name])) : $ret = $this->settings[$name]; @@ -700,12 +723,12 @@ class SyndicatedLink { return $ret; } /* SyndicatedLink::setting () */ - function merge_settings ($data, $prefix, $separator = '/') { + public function merge_settings ($data, $prefix, $separator = '/') { $dd = $this->flatten_array($data, $prefix, $separator); $this->settings = array_merge($this->settings, $dd); } /* SyndicatedLink::merge_settings () */ - function update_setting ($name, $value, $default = 'default') { + public function update_setting ($name, $value, $default = 'default') { if (!is_null($value) and $value != $default) : $this->settings[$name] = $value; else : // Zap it. @@ -713,11 +736,11 @@ class SyndicatedLink { endif; } /* SyndicatedLink::update_setting () */ - function is_non_incremental () { + public function is_non_incremental () { return ('complete'==$this->setting('update_incremental', 'update_incremental', 'incremental')); } /* SyndicatedLink::is_non_incremental () */ - function uri ($params = array()) { + public function uri ($params = array()) { $params = wp_parse_args($params, array( 'add_params' => false, 'fetch' => false, @@ -759,15 +782,15 @@ class SyndicatedLink { return $uri; } /* SyndicatedLink::uri () */ - function username () { + public function username () { return $this->setting('http username', 'http_username', NULL); } /* SyndicatedLink::username () */ - function password () { + public function password () { return $this->setting('http password', 'http_password', NULL); } /* SyndicatedLink::password () */ - function authentication_method () { + public function authentication_method () { $auth = $this->setting('http auth method', NULL); if (('-' == $auth) or (strlen($auth)==0)) : $auth = NULL; @@ -776,7 +799,7 @@ class SyndicatedLink { } /* SyndicatedLink::authentication_method () */ var $postmeta = array(); - function postmeta ($params = array()) { + public function postmeta ($params = array()) { $params = wp_parse_args($params, /*defaults=*/ array( "field" => NULL, "parsed" => false, @@ -820,7 +843,7 @@ class SyndicatedLink { return $ret; } /* SyndicatedLink::postmeta () */ - function property_cascade ($fromFeed, $link_field, $setting, $method) { + public function property_cascade ($fromFeed, $link_field, $setting, $method) { $value = NULL; if ($fromFeed) : $value = $this->setting($setting, NULL, NULL, NULL); @@ -836,15 +859,15 @@ class SyndicatedLink { return $value; } /* SyndicatedLink::property_cascade () */ - function homepage ($fromFeed = true) { + public function homepage ($fromFeed = true) { return $this->property_cascade($fromFeed, 'link_url', 'feed/link', 'get_link'); } /* SyndicatedLink::homepage () */ - function name ($fromFeed = true) { + public function name ($fromFeed = true) { return $this->property_cascade($fromFeed, 'link_name', 'feed/title', 'get_title'); } /* SyndicatedLink::name () */ - function guid () { + public function guid () { $ret = $this->setting('feed/id', NULL, $this->uri()); // If we can get it live from the feed, do so. @@ -871,7 +894,7 @@ class SyndicatedLink { return $ret; } - function links ($params = array()) { + public function links ($params = array()) { $params = wp_parse_args($params, array( "rel" => NULL, )); @@ -925,7 +948,7 @@ class SyndicatedLink { return $ret; } - function ttl ($return_element = false) { + public function ttl ($return_element = false) { if (is_object($this->magpie)) : $channel = $this->magpie->channel; else : @@ -982,7 +1005,7 @@ class SyndicatedLink { return ($return_element ? array($ret, $xml) : $ret); } /* SyndicatedLink::ttl() */ - function automatic_ttl () { + public function automatic_ttl () { // spread out over a time interval for staggered updates $updateWindow = $this->setting('update/window', 'update_window', DEFAULT_UPDATE_PERIOD); if (!is_numeric($updateWindow) or ($updateWindow < 1)) : @@ -995,16 +1018,23 @@ class SyndicatedLink { return apply_filters('syndicated_feed_automatic_ttl', $fudgedInterval, $this); } /* SyndicatedLink::automatic_ttl () */ - // SyndicatedLink::flatten_array (): flatten an array. Useful for - // hierarchical and namespaced elements. - // - // Given an array which may contain array or object elements in it, - // return a "flattened" array: a one-dimensional array of scalars - // containing each of the scalar elements contained within the array - // structure. Thus, for example, if $a['b']['c']['d'] == 'e', then the - // returned array for FeedWordPress::flatten_array($a) will contain a key - // $a['feed/b/c/d'] with value 'e'. - function flatten_array ($arr, $prefix = 'feed/', $separator = '/') { + /** + * SyndicatedLink::flatten_array (): flatten an array. Useful for + * hierarchical and namespaced elements. + * + * Given an array which may contain array or object elements in it, + * return a "flattened" array: a one-dimensional array of scalars + * containing each of the scalar elements contained within the array + * structure. Thus, for example, if $a['b']['c']['d'] == 'e', then the + * returned array for FeedWordPress::flatten_array($a) will contain a key + * $a['feed/b/c/d'] with value 'e'. + * + * @param array $arr + * @param string $prefix + * @param string $separator + * @return array + */ + public function flatten_array ($arr, $prefix = 'feed/', $separator = '/') { $ret = array (); if (is_array($arr)) : foreach ($arr as $key => $value) : @@ -1018,7 +1048,7 @@ class SyndicatedLink { return $ret; } /* SyndicatedLink::flatten_array () */ - function hardcode ($what) { + public function hardcode ($what) { $ret = $this->setting('hardcode '.$what, 'hardcode_'.$what, NULL); @@ -1030,7 +1060,7 @@ class SyndicatedLink { return $ret; } /* SyndicatedLink::hardcode () */ - function syndicated_status ($what, $default, $fallback = true) { + public function syndicated_status ($what, $default, $fallback = true) { global $wpdb; $g_set = ($fallback ? 'syndicated_' . $what . '_status' : NULL); @@ -1039,7 +1069,7 @@ class SyndicatedLink { return esc_sql(trim(strtolower($ret))); } /* SyndicatedLink:syndicated_status () */ - function taxonomies () { + public function taxonomies () { $post_type = $this->setting('syndicated post type', 'syndicated_post_type', 'post'); return get_object_taxonomies(array('object_type' => $post_type), 'names'); } /* SyndicatedLink::taxonomies () */ @@ -1053,7 +1083,7 @@ class SyndicatedLink { * @param array|null $taxonomies * @return array */ - function category_ids ($post, $cats, $unfamiliar_category = 'create', $taxonomies = NULL, $params = array()) { + public function category_ids ($post, $cats, $unfamiliar_category = 'create', $taxonomies = NULL, $params = array()) { $singleton = (isset($params['singleton']) ? $params['singleton'] : true); $allowFilters = (isset($params['filters']) ? $params['filters'] : false); @@ -1150,5 +1180,5 @@ class SyndicatedLink { ); return $terms; } /* SyndicatedLink::category_ids () */ -} // class SyndicatedLink +} /* class SyndicatedLink */ diff --git a/wp-content/plugins/feedwordpress/syndicatedpost.class.php b/wp-content/plugins/feedwordpress/syndicatedpost.class.php index eb3bdbed0e6dfbe1a45a304940a0ed13ad696ce2..8d1b1f4db362382d89721305c48f835eb014d9f1 100644 --- a/wp-content/plugins/feedwordpress/syndicatedpost.class.php +++ b/wp-content/plugins/feedwordpress/syndicatedpost.class.php @@ -2240,6 +2240,10 @@ EOM; // Add a random disambiguator $userdata['user_login'] .= substr(md5(uniqid(microtime())), 0, 6); break; + case 'user_nicename_too_long' : + // Add a limited 50 caracters user_nicename based on user_login + $userdata['user_nicename'] = mb_substr( $userdata['user_login'], 0, 50 ); + break; case 'existing_user_email' : // No disassemble! $parts = explode('@', $userdata['user_email'], 2); diff --git a/wp-content/plugins/feedwordpress/syndicationdataqueries.class.php b/wp-content/plugins/feedwordpress/syndicationdataqueries.class.php index d61784bdc95564085e136575733d4fffb7c685e9..2588fbdd4053131598f923ff9218580deea03afa 100644 --- a/wp-content/plugins/feedwordpress/syndicationdataqueries.class.php +++ b/wp-content/plugins/feedwordpress/syndicationdataqueries.class.php @@ -1,7 +1,7 @@ <?php class SyndicationDataQueries { - function SyndicationDataQueries () { + public function __construct () { add_action('init', array($this, 'init')); add_action('parse_query', array($this, 'parse_query'), 10, 1); add_filter('posts_search', array($this, 'posts_search'), 10, 2); diff --git a/wp-content/plugins/feedwordpress/updatedpostscontrol.class.php b/wp-content/plugins/feedwordpress/updatedpostscontrol.class.php index d505268fea0a489cd8f500cc5556c4db52914850..e371d8bd24c544fb56ed1e7d961d31bdc95abb33 100644 --- a/wp-content/plugins/feedwordpress/updatedpostscontrol.class.php +++ b/wp-content/plugins/feedwordpress/updatedpostscontrol.class.php @@ -1,10 +1,14 @@ <?php class UpdatedPostsControl { var $page; - function UpdatedPostsControl (&$page) { + function __construct( &$page ) { $this->page =& $page; } /* UpdatedPostsControl constructor */ + function UpdatedPostsControl( &$page ) { + self::__construct( $page ); + } + function display () { $settings = array( // This is all bass-ackwards because the actual yes/no