From dd2b3b3f8855e8cdec3cf662960d70382e8c1273 Mon Sep 17 00:00:00 2001 From: Rad Geek Date: Sat, 21 Oct 2017 12:45:35 +0000 Subject: [PATCH] Minor code and docs cleanup. Remove code trying to cope with magic_quotes, which are no longer part of any minimally modern PHP. --- feedwordpress.php | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/feedwordpress.php b/feedwordpress.php index 3ed46e3..32849d0 100644 --- a/feedwordpress.php +++ b/feedwordpress.php @@ -21,16 +21,10 @@ # - Ultra-Liberal Feed Finder by Mark Pilgrim # - WordPress Blog Tool and Publishing Platform # according to the terms of the GNU General Public License. -# -# INSTALLATION: see readme.txt or -# -# USAGE: once FeedWordPress is installed, you manage just about everything from -# the WordPress Dashboard, under the Syndication menu. To keep fresh content -# coming in as it becomes available, you'll have to either check for updates -# manually, or set up one of the automatically-scheduled update methods. See -# for some details. -# -- Don't change these unless you know what you're doing... +#################################################################################### +## CONSTANTS & DEFAULTS ############################################################ +#################################################################################### define ('FEEDWORDPRESS_VERSION', '2017.1020'); define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://feedwordpress.radgeek.com/contact'); @@ -41,8 +35,6 @@ define('FEEDWORDPRESS_BLEG_BTC', '15EsQ9QMZtLytsaVYZUaUCmrkSMaxZBTso'); define('FEEDWORDPRESS_BLEG_PAYPAL', '22PAJZZCK5Z3W'); -define('FEEDWORDPRESS_BOILERPLATE_DEFAULT_HOOK_ORDER', 11000); // at the tail end of the filtering process - // Defaults define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors'); define ('DEFAULT_UPDATE_PERIOD', 60); // value in minutes @@ -66,6 +58,8 @@ define ('FEEDWORDPRESS_FRESHNESS_INTERVAL', 10*60); // Every ten minutes +define('FEEDWORDPRESS_BOILERPLATE_DEFAULT_HOOK_ORDER', 11000); // at the tail end of the filtering process + define ('FWP_SCHEMA_HAS_USERMETA', 2966); define ('FWP_SCHEMA_USES_ARGS_TAXONOMY', 12694); // Revision # for using $args['taxonomy'] to get link categories define ('FWP_SCHEMA_30', 12694); // Database schema # for WP 3.0 @@ -91,8 +85,9 @@ define('FEEDWORDPRESS_FETCH_TIMEOUT_DEFAULT', 20); endif; -// Use our the cache settings that we want. -add_filter('wp_feed_cache_transient_lifetime', array('FeedWordPress', 'cache_lifetime')); +#################################################################################### +## CORE DEPENDENCIES & PLUGIN MODULES ############################################## +#################################################################################### // Dependencies: modules packaged with WordPress core $wpCoreDependencies = array( @@ -146,12 +141,21 @@ require_once("${dir}/feedwordpresshttpauthenticator.class.php"); require_once("${dir}/feedwordpresslocalpost.class.php"); -// Magic quotes are just about the stupidest thing ever. +#################################################################################### +## GLOBAL PARAMETERS ############################################################### +#################################################################################### + +// $fwp_post used to be a global variable used to make it easier to cope +// with the frustrating sometime presence of "Magic Quotes" in earlier +// versions of PHP (). +// Magic quotes were DEPRECATED as of PHP 5.3.0, and REMOVED as of PHP +// 5.4.0, so for the time being $fwp_post just gets a copy of $_POST. +global $fwp_post; + if (is_array($_POST)) : $fwp_post = $_POST; - if (get_magic_quotes_gpc()) : - $fwp_post = stripslashes_deep($fwp_post); - endif; +else: + $fwp_post = null; endif; // Get the path relative to the plugins directory in which FWP is stored @@ -167,6 +171,10 @@ $fwp_path = 'feedwordpress'; endif; +#################################################################################### +## FEEDWORDPRSS: INITIALIZE OBJECT AND FILTERS ##################################### +#################################################################################### + $feedwordpress = new FeedWordPress; if (!$feedwordpress->needs_upgrade()) : // only work if the conditions are safe! @@ -281,6 +289,10 @@ add_action('plugins_loaded', array($feedwordpress, 'admin_api')); add_action('all_admin_notices', array($feedwordpress, 'all_admin_notices')); + // Use our the cache settings that we want. + add_filter('wp_feed_cache_transient_lifetime', array('FeedWordPress', 'cache_lifetime')); + + else : # Hook in the menus, which will just point to the upgrade interface add_action('admin_menu', 'fwp_add_pages');