abstract class vB

The vB core class.

Everything required at the core level should be accessible through this.

The core class performs initialisation for error handling, exception handling, application instatiation and optionally debug handling.

Properties

static protected $skipShutdown
static protected $autoloadInfo
static protected loggedWarnings $loggedWarnings We use warnings loosely here to be any of the myriad non fatal errors We only log warning that would ordinarily be reported per the error_reporting settings.

Methods

static 
init($relative_path = false)

Initializes the vB framework.

static 
silentWarnings()

No description

static 
normalWarnings()

No description

static 
getLoggedWarnings()

No description

contentHeadersSent(bool $sent = false)

Gets or sets whether content headers have been sent.

static 
autoload(string $classname, array $load_map = false, bool $check_file = true)

Autloads a class file when required.

static array
getAutoloadInfo()

Returns debug autoload info

static 
autoloadPreregister($add_callback)

Allows autoloaders to be registered before the vb autoloader.

static 
autoloadMap(array $load_map)

Allows entries to be added to the load map.

static 
skipShutdown(boolean $skip = true)

Notify the vB object not to do the normal shutdown

static 
shutdown()

Shutdown - primarily writing session information. May be some delayed queries.

static vB_Registry
get_registry($skipDatastoreOptions = false)

This is a temporary getter for retrieving the vbulletin object while we still needed TODO: remove this method

static 
getProducts()

No description

static 
getHooks()

No description

static array
getConfig()

Returns a by-reference the config object

static 
setConfigItem($section, $item, $value)

Allows setting a config item for unit test purposes only

static array
getSensitiveConfig()

Returns sensitive config options.

static 
sensitiveConfigOverride($override)

No description

static 
setConfigFile($config_file)

No description

static 
getConfigFile()

No description

static vB_dB_Assertor
getDbAssertor()

Returns a by-reference the assertor object

static vB_Datastore
getDatastore()

Returns a by-reference the config object

static bool
isUserContextSet( $userId = null)

Checks if usercontext is set

static vB_UserContext
getUserContext( $userId = null)

Returns a by-reference the usercontext object specified by $userId If no userId is specified, it uses the current session user

static 
setRequest(vB_Request $request)

No description

static vB_Request
getRequest()

No description

static 
setCurrentSession(vB_Session $session = null)

No description

static vB_Session
getCurrentSession()

No description

static vB_Cleaner
getCleaner()

No description

getString()

Get the string utility class

static vB_Utility_Url
getUrlLoader()

Get the utility url loader

static 
getVbClassName($tag, $base, $interface)

No description

static 
reset()

Intended for unit tests, this resets the portion of the test needed for testing to avoid cross contamination

static 
getLogger($name)

No description

static 
handleException($e)

No description

static 
handleError($errno, $errstr, $errfile, $errline)

No description

static 
handleErrorQuiet($errno, $errstr, $errfile, $errline)

No description

static 
handleErrorInternal($errno, $errstr, $errfile, $errline, $quiet)

handle vBulletin PHP error.

static 
get_db_assertor() deprecated

No description

static 
get_config() deprecated

No description

static 
get_cleaner() deprecated

No description

static 
get_datastore() deprecated

No description

Details

at line 146
static init($relative_path = false)

Initializes the vB framework.

All framework level objects and services are created so that they are available throughout the application. This is only done once per actual request.

Note: If the framework is used this way then there are several limitations. - If no vB_Bootstrap was created (ie, the admincp), then you cannot render any views created by the framework. - VB_ENTRY must be defined to a valid request script that runs the framework with vB::Main() - If you are rendering views, try to create all of the views that will be used before rendering any of them. This optimises template and phrase fetching.

Parameters

$relative_path

at line 292
static silentWarnings()

at line 297
static normalWarnings()

at line 302
static getLoggedWarnings()

at line 314
contentHeadersSent(bool $sent = false)

Gets or sets whether content headers have been sent.

Parameters

bool $sent
  • If true, the headers have been sent

at line 346
static autoload(string $classname, array $load_map = false, bool $check_file = true)

Autloads a class file when required.

Classnames are broken down into segments which are used to resolve the class directory and filename.

If the first segment matches 'vB' then it is in /vB else it is in /packages/segment/

An optional load map of classname => filename can be passed to skip the path resolution.

Parameters

string $classname
  • The name of the class to load
array $load_map
  • Assoc array of classname => filename for quick load
bool $check_file
  • Whether to check if the file exists and return false

at line 420
static array getAutoloadInfo()

Returns debug autoload info

Return Value

array Array of debug info containing 'classes' and 'count'

at line 430
static autoloadPreregister($add_callback)

Allows autoloaders to be registered before the vb autoloader.

Parameters

$add_callback

at line 454
static autoloadMap(array $load_map)

Allows entries to be added to the load map.

This is especially useful for calling during application initialization.

Parameters

array $load_map class => file $load_map

at line 464
static skipShutdown(boolean $skip = true)

Notify the vB object not to do the normal shutdown

Parameters

boolean $skip whether to skip the shutdown- yes means don't do it.

at line 473
static shutdown()

Shutdown - primarily writing session information. May be some delayed queries.

at line 519
static vB_Registry get_registry($skipDatastoreOptions = false)

This is a temporary getter for retrieving the vbulletin object while we still needed TODO: remove this method

Parameters

$skipDatastoreOptions

Return Value

vB_Registry

at line 570
static getProducts()

at line 608
static getHooks()

at line 650
static array getConfig()

Returns a by-reference the config object

Return Value

array

at line 663
static setConfigItem($section, $item, $value)

Allows setting a config item for unit test purposes only

Parameters

$section
$item
$value

at line 683
static protected array getSensitiveConfig()

Returns sensitive config options.

Return Value

array

at line 694
static sensitiveConfigOverride($override)

Parameters

$override

at line 701
static setConfigFile($config_file)

Parameters

$config_file

at line 706
static getConfigFile()

at line 838
static vB_dB_Assertor getDbAssertor()

Returns a by-reference the assertor object

Return Value

vB_dB_Assertor

at line 853
static vB_Datastore getDatastore()

Returns a by-reference the config object

Return Value

vB_Datastore

at line 870
static bool isUserContextSet( $userId = null)

Checks if usercontext is set

Parameters

$userId

Return Value

bool

at line 893
static vB_UserContext getUserContext( $userId = null)

Returns a by-reference the usercontext object specified by $userId If no userId is specified, it uses the current session user

Parameters

$userId

Return Value

vB_UserContext

at line 957
static setRequest(vB_Request $request)

Parameters

vB_Request $request

at line 966
static vB_Request getRequest()

Return Value

vB_Request

at line 978
static setCurrentSession(vB_Session $session = null)

Parameters

vB_Session $session

at line 1007
static vB_Session getCurrentSession()

Return Value

vB_Session

at line 1017
static vB_Cleaner getCleaner()

Return Value

vB_Cleaner

at line 1032
static vB_Utility_String getString()

Get the string utility class

Return Value

vB_Utility_String

at line 1052
static vB_Utility_Url getUrlLoader()

Get the utility url loader

Return Value

vB_Utility_Url

at line 1092
static getVbClassName($tag, $base, $interface)

Parameters

$tag
$base
$interface

at line 1132
static reset()

Intended for unit tests, this resets the portion of the test needed for testing to avoid cross contamination

at line 1140
static getLogger($name)

Parameters

$name

at line 1165
static handleException($e)

Parameters

$e

at line 1176
static handleError($errno, $errstr, $errfile, $errline)

Parameters

$errno
$errstr
$errfile
$errline

at line 1181
static handleErrorQuiet($errno, $errstr, $errfile, $errline)

Parameters

$errno
$errstr
$errfile
$errline

at line 1200
static handleErrorInternal($errno, $errstr, $errfile, $errline, $quiet)

handle vBulletin PHP error.

This does a bunch of error handling. Primarily it supressing path information for errors. It throws an exception for any fatal errors that actually get passed here (which is very few in 5 and 7 has switched to throwing not exceptions instead of fatal errors in most cases)

Parameters

$errno
$errstr
$errfile
$errline
$quiet

at line 1331
static get_db_assertor() deprecated

deprecated

at line 1339
static get_config() deprecated

deprecated

at line 1347
static get_cleaner() deprecated

deprecated

at line 1355
static get_datastore() deprecated

deprecated