MANAGER Class Reference

List of all members.

Public Member Functions

instance ()
 MANAGER ()
getItem ($itemid, $allowdraft, $allowfuture)
 loadClass ($name)
 existsItem ($id, $future, $draft)
 existsCategory ($id)
getBlog ($blogid)
 existsBlog ($name)
 existsBlogID ($id)
getTemplate ($templateName)
getKarma ($itemid)
getMember ($memberid)
 setParserProperty ($name, $value)
 getParserProperty ($name)
 _loadClass ($name, $filename)
 _loadPlugin ($name)
getPlugin ($name)
pluginLoaded ($name)
pidLoaded ($pid)
 pluginInstalled ($name)
 pidInstalled ($pid)
 getPidFromName ($name)
 clearCachedInfo ($what)
 _initCacheInfo ($what)
 notify ($eventName, $data)
 _loadSubscriptions ()
 addTicketToUrl ($url)
 addTicketHidden ()
 getNewTicket ()
 checkTicket ()
 _cleanUpExpiredTickets ()
 _generateTicket ()

Public Attributes

 $items
 $blogs
 $plugins
 $karma
 $templates
 $members
 $cachedInfo
 $subscriptions
 $currentRequestTicket = ''


Detailed Description

This class makes sure each item/weblog/comment object gets requested from the database only once, by keeping them in a cache. The class also acts as a dynamic classloader, loading classes _only_ when they are first needed, hoping to diminish execution time

The class is a singleton, meaning that there will be only one object of it active at all times. The object can be requested using MANAGER::instance()

http://nucleuscms.org/license.txt GNU General Public License Copyright (C) 2002-2007 The Nucleus Group

Version:
Id
MANAGER.php 1150 2007-05-19 23:26:02Z kaigreve
NucleusJP
MANAGER.php,v 1.8.2.1 2007/09/05 07:00:18 kimitake Exp

Definition at line 26 of file MANAGER.php.


Member Function Documentation

& MANAGER::instance (  ) 

Returns the only instance of this class. Creates the instance if it does not yet exists. Users should use this function as $manager =& MANAGER::instance(); to get a reference to the object instead of a copy

Definition at line 66 of file MANAGER.php.

References MANAGER().

MANAGER::MANAGER (  ) 

The constructor of this class initializes the object caches

Definition at line 77 of file MANAGER.php.

Referenced by instance().

& MANAGER::getItem ( itemid,
allowdraft,
allowfuture 
)

Returns the requested item object. If it is not in the cache, it will first be loaded and then placed in the cache. Intended use: $item =& $manager->getItem(1234)

Definition at line 91 of file MANAGER.php.

References $itemid, getBlog(), getBlogIDFromItemID(), ITEM::getitem(), and loadClass().

MANAGER::loadClass ( name  ) 

Loads a class if it has not yet been loaded

Definition at line 116 of file MANAGER.php.

References _loadClass().

Referenced by getItem().

MANAGER::existsItem ( id,
future,
draft 
)

Checks if an item exists

Definition at line 123 of file MANAGER.php.

References _loadClass(), and ITEM::exists().

MANAGER::existsCategory ( id  ) 

Checks if a category exists

Definition at line 131 of file MANAGER.php.

References quickQuery(), and sql_table().

& MANAGER::getBlog ( blogid  ) 

Definition at line 135 of file MANAGER.php.

References $blogid, and _loadClass().

Referenced by getItem().

MANAGER::existsBlog ( name  ) 

Definition at line 148 of file MANAGER.php.

References _loadClass(), and BLOG::exists().

MANAGER::existsBlogID ( id  ) 

Definition at line 153 of file MANAGER.php.

References _loadClass(), and BLOG::existsID().

& MANAGER::getTemplate ( templateName  ) 

Returns a previously read template

Definition at line 161 of file MANAGER.php.

References TEMPLATE::read().

& MANAGER::getKarma ( itemid  ) 

Returns a KARMA object (karma votes)

Definition at line 174 of file MANAGER.php.

References $itemid, $karma, and _loadClass().

& MANAGER::getMember ( memberid  ) 

Returns a MEMBER object

Definition at line 190 of file MANAGER.php.

References $memberid, _loadClass(), and MEMBER::createFromID().

MANAGER::setParserProperty ( name,
value 
)

Global parser preferences

Definition at line 206 of file MANAGER.php.

MANAGER::getParserProperty ( name  ) 

Definition at line 209 of file MANAGER.php.

MANAGER::_loadClass ( name,
filename 
)

A private helper class to load classes

Definition at line 216 of file MANAGER.php.

References $DIR_LIBS.

Referenced by existsBlog(), existsBlogID(), existsItem(), getBlog(), getKarma(), getMember(), and loadClass().

MANAGER::_loadPlugin ( name  ) 

Definition at line 223 of file MANAGER.php.

References $DIR_PLUGINS, $MYSQL_PREFIX, ACTIONLOG::add(), and getPidFromName().

Referenced by getPlugin(), and notify().

& MANAGER::getPlugin ( name  ) 

Definition at line 266 of file MANAGER.php.

References _loadPlugin().

& MANAGER::pluginLoaded ( name  ) 

checks if the given plugin IS loaded or not

Definition at line 280 of file MANAGER.php.

& MANAGER::pidLoaded ( pid  ) 

Definition at line 284 of file MANAGER.php.

MANAGER::pluginInstalled ( name  ) 

checks if the given plugin IS installed or not

Definition at line 298 of file MANAGER.php.

References _initCacheInfo(), and getPidFromName().

MANAGER::pidInstalled ( pid  ) 

Definition at line 302 of file MANAGER.php.

References _initCacheInfo().

MANAGER::getPidFromName ( name  ) 

Definition at line 306 of file MANAGER.php.

References _initCacheInfo().

Referenced by _loadPlugin(), and pluginInstalled().

MANAGER::clearCachedInfo ( what  ) 

Definition at line 315 of file MANAGER.php.

MANAGER::_initCacheInfo ( what  ) 

Loads some info on the first call only

Definition at line 322 of file MANAGER.php.

References mysql_fetch_object(), sql_query(), and sql_table().

Referenced by getPidFromName(), pidInstalled(), and pluginInstalled().

MANAGER::notify ( eventName,
data 
)

A function to notify plugins that something has happened. Only the plugins that are subscribed to the event will get notified. Upon the first call, the list of subscriptions will be fetched from the database. The plugins itsself will only get loaded when they are first needed

Parameters:
$eventName Name of the event (method to be called on plugins)
$data Can contain any type of data, depending on the event type. Usually this is an itemid, blogid, ... but it can also be an array containing multiple values

Definition at line 352 of file MANAGER.php.

References _loadPlugin(), and _loadSubscriptions().

MANAGER::_loadSubscriptions (  ) 

Loads plugin subscriptions

Definition at line 380 of file MANAGER.php.

References mysql_fetch_object(), sql_query(), and sql_table().

Referenced by notify().

MANAGER::addTicketToUrl ( url  ) 

GET requests: Adds ticket to URL (URL should NOT be html-encoded!, ticket is added at the end)

Definition at line 403 of file MANAGER.php.

References _generateTicket().

MANAGER::addTicketHidden (  ) 

POST requests: Adds ticket as hidden formvar

Definition at line 415 of file MANAGER.php.

References _generateTicket().

MANAGER::getNewTicket (  ) 

Get a new ticket (xmlHTTPRequest AutoSaveDraft uses this to refresh the ticket)

Definition at line 426 of file MANAGER.php.

References _generateTicket().

MANAGER::checkTicket (  ) 

Checks the ticket that was passed along with the current request

Definition at line 435 of file MANAGER.php.

References $member, $query, _cleanUpExpiredTickets(), quickQuery(), requestVar(), and sql_table().

MANAGER::_cleanUpExpiredTickets (  ) 

(internal method) Removes the expired tickets

Definition at line 476 of file MANAGER.php.

References $query, sql_query(), and sql_table().

Referenced by checkTicket().

MANAGER::_generateTicket (  ) 

(internal method) Generates/returns a ticket (one ticket per page request)

Definition at line 487 of file MANAGER.php.

References $member, $query, and sql_table().

Referenced by addTicketHidden(), addTicketToUrl(), and getNewTicket().


Member Data Documentation

MANAGER::$items

Cached ITEM, BLOG, PLUGIN, KARMA and MEMBER objects. When these objects are requested through the global $manager object (getItem, getBlog, ...), only the first call will create an object. Subsequent calls will return the same object.

The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used rather than an ID)

Definition at line 36 of file MANAGER.php.

MANAGER::$blogs

Definition at line 37 of file MANAGER.php.

MANAGER::$plugins

Definition at line 38 of file MANAGER.php.

MANAGER::$karma

Definition at line 39 of file MANAGER.php.

Referenced by getKarma().

MANAGER::$templates

Definition at line 40 of file MANAGER.php.

MANAGER::$members

Definition at line 41 of file MANAGER.php.

MANAGER::$cachedInfo

cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName) e.g. which plugins exists?

$cachedInfo['installedPlugins'] = array($pid -> $name)

Definition at line 49 of file MANAGER.php.

MANAGER::$subscriptions

The plugin subscriptionlist

The subcription array has the following structure $subscriptions[$EventName] = array containing names of plugin classes to be notified when that event happens

Definition at line 58 of file MANAGER.php.

MANAGER::$currentRequestTicket = ''

Definition at line 398 of file MANAGER.php.


The documentation for this class was generated from the following file:



Generated on Wed Jun 25 17:26:02 2008 by  doxygen 1.5.5