From b593ba3bfcc1d1608be29942176fca2953a2456f Mon Sep 17 00:00:00 2001 From: vitalif Date: Mon, 31 Dec 2012 10:24:42 +0000 Subject: [PATCH] Remove deprecated =&, make static method static, code style --- classes/fof-prefs.php | 11 ++++++----- fof-main.php | 8 ++++---- prefs.php | 2 +- set-prefs.php | 4 +--- update-quiet.php | 2 +- update.php | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/classes/fof-prefs.php b/classes/fof-prefs.php index 8e40ba3..f578f02 100644 --- a/classes/fof-prefs.php +++ b/classes/fof-prefs.php @@ -18,7 +18,7 @@ class FoF_Prefs var $prefs; var $admin_prefs; - function FoF_Prefs($user_id) + function __construct($user_id) { global $FOF_USER_TABLE; @@ -52,10 +52,13 @@ class FoF_Prefs } } - function &instance() + static function instance() { static $instance; - if(!isset($instance)) $instance = new FoF_Prefs(fof_current_user()); + if(!isset($instance)) + { + $instance = new FoF_Prefs(fof_current_user()); + } return $instance; } @@ -105,5 +108,3 @@ class FoF_Prefs fof_db_save_prefs($this->user_id, $this->prefs); } } - -?> diff --git a/fof-main.php b/fof-main.php index 87d2b0f..cec60dc 100644 --- a/fof-main.php +++ b/fof-main.php @@ -37,12 +37,12 @@ if(!$fof_installer) if(!$fof_no_login) { require_user(); - $fof_prefs_obj =& FoF_Prefs::instance(); + $fof_prefs_obj = FoF_Prefs::instance(); } else { $fof_user_id = 1; - $fof_prefs_obj =& FoF_Prefs::instance(); + $fof_prefs_obj = FoF_Prefs::instance(); } ob_start(); @@ -137,7 +137,7 @@ function fof_get_users() function fof_prefs() { - $p =& FoF_Prefs::instance(); + $p = FoF_Prefs::instance(); return $p->prefs; } @@ -890,7 +890,7 @@ function fof_update_feed($id, $as_user = NULL) // unread or starred, not currently in the feed or within sizeof(feed) items // of being in the feed, and are over 'purge' many days old - $p =& FoF_Prefs::instance(); + $p = FoF_Prefs::instance(); $admin_prefs = $p->admin_prefs; if($admin_prefs['purge'] != "") diff --git a/prefs.php b/prefs.php index 7162870..ef8636d 100644 --- a/prefs.php +++ b/prefs.php @@ -14,7 +14,7 @@ include_once("fof-main.php"); -$prefs =& FoF_Prefs::instance(); +$prefs = FoF_Prefs::instance(); if (fof_is_admin() && isset($_POST['adminprefs'])) { diff --git a/set-prefs.php b/set-prefs.php index 3ad5e42..1d930d1 100644 --- a/set-prefs.php +++ b/set-prefs.php @@ -14,7 +14,7 @@ include_once("fof-main.php"); -$prefs =& FoF_Prefs::instance(); +$prefs = FoF_Prefs::instance(); foreach($_POST as $k => $v) { @@ -22,5 +22,3 @@ foreach($_POST as $k => $v) } $prefs->save(); - -?> diff --git a/update-quiet.php b/update-quiet.php index 3d00e8e..e97863d 100644 --- a/update-quiet.php +++ b/update-quiet.php @@ -20,7 +20,7 @@ $fof_no_login = true; $fof_user_id = 1; include_once("fof-main.php"); -$p =& FoF_Prefs::instance(); +$p = FoF_Prefs::instance(); $fof_admin_prefs = $p->prefs; fof_log("=== update started, timeout = $fof_admin_prefs[autotimeout], purge = $fof_admin_prefs[purge] ===", "update"); diff --git a/update.php b/update.php index fe6f1b4..a58a623 100644 --- a/update.php +++ b/update.php @@ -19,7 +19,7 @@ print("
"); $feed = $_GET['feed']; $feeds = array(); -$p =& FoF_Prefs::instance(); +$p = FoF_Prefs::instance(); $admin_prefs = $p->admin_prefs; if($feed)