Remove deprecated =&, make static method static, code style

master
vitalif 2012-12-31 10:24:42 +00:00
parent 055bd05953
commit b593ba3bfc
6 changed files with 14 additions and 15 deletions

View File

@ -18,7 +18,7 @@ class FoF_Prefs
var $prefs; var $prefs;
var $admin_prefs; var $admin_prefs;
function FoF_Prefs($user_id) function __construct($user_id)
{ {
global $FOF_USER_TABLE; global $FOF_USER_TABLE;
@ -52,10 +52,13 @@ class FoF_Prefs
} }
} }
function &instance() static function instance()
{ {
static $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; return $instance;
} }
@ -105,5 +108,3 @@ class FoF_Prefs
fof_db_save_prefs($this->user_id, $this->prefs); fof_db_save_prefs($this->user_id, $this->prefs);
} }
} }
?>

View File

@ -37,12 +37,12 @@ if(!$fof_installer)
if(!$fof_no_login) if(!$fof_no_login)
{ {
require_user(); require_user();
$fof_prefs_obj =& FoF_Prefs::instance(); $fof_prefs_obj = FoF_Prefs::instance();
} }
else else
{ {
$fof_user_id = 1; $fof_user_id = 1;
$fof_prefs_obj =& FoF_Prefs::instance(); $fof_prefs_obj = FoF_Prefs::instance();
} }
ob_start(); ob_start();
@ -137,7 +137,7 @@ function fof_get_users()
function fof_prefs() function fof_prefs()
{ {
$p =& FoF_Prefs::instance(); $p = FoF_Prefs::instance();
return $p->prefs; 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 // 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 // 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; $admin_prefs = $p->admin_prefs;
if($admin_prefs['purge'] != "") if($admin_prefs['purge'] != "")

View File

@ -14,7 +14,7 @@
include_once("fof-main.php"); include_once("fof-main.php");
$prefs =& FoF_Prefs::instance(); $prefs = FoF_Prefs::instance();
if (fof_is_admin() && isset($_POST['adminprefs'])) if (fof_is_admin() && isset($_POST['adminprefs']))
{ {

View File

@ -14,7 +14,7 @@
include_once("fof-main.php"); include_once("fof-main.php");
$prefs =& FoF_Prefs::instance(); $prefs = FoF_Prefs::instance();
foreach($_POST as $k => $v) foreach($_POST as $k => $v)
{ {
@ -22,5 +22,3 @@ foreach($_POST as $k => $v)
} }
$prefs->save(); $prefs->save();
?>

View File

@ -20,7 +20,7 @@ $fof_no_login = true;
$fof_user_id = 1; $fof_user_id = 1;
include_once("fof-main.php"); include_once("fof-main.php");
$p =& FoF_Prefs::instance(); $p = FoF_Prefs::instance();
$fof_admin_prefs = $p->prefs; $fof_admin_prefs = $p->prefs;
fof_log("=== update started, timeout = $fof_admin_prefs[autotimeout], purge = $fof_admin_prefs[purge] ===", "update"); fof_log("=== update started, timeout = $fof_admin_prefs[autotimeout], purge = $fof_admin_prefs[purge] ===", "update");

View File

@ -19,7 +19,7 @@ print("<br>");
$feed = $_GET['feed']; $feed = $_GET['feed'];
$feeds = array(); $feeds = array();
$p =& FoF_Prefs::instance(); $p = FoF_Prefs::instance();
$admin_prefs = $p->admin_prefs; $admin_prefs = $p->admin_prefs;
if($feed) if($feed)