class vB_DataManager_StyleVarSize extends vB_DataManager_StyleVar

Traits

Properties

array $validfields Array of recognised and required fields for stylevar, and their types from vB_DataManager_StyleVar
protected array $bitfields Array of field names that are bitfields, together with the name of the variable in the registry with the definitions. from vB_DataManager_StyleVar
protected array $setfields Array to store the names of fields that have been sucessfully set from vB_DataManager
array $rawfields Array to store the names for fields that will be taking raw SQL from vB_DataManager
vB_Registry $registry The vBulletin registry object from vB_DataManager
vB_Database $dbobject The vBulletin database object from vB_DataManager
protected vB_dB_Assertor $assertor The vBulletin dB_Assertor object from vB_DataManager
protected vB_Session $session The vBulletin vB_Session object from vB_DataManager
protected array $userinfo The userinfo array from vB_Session object from vB_DataManager
protected array $options The options array from vB_Datastore object from vB_DataManager
protected vB_Datastore $datastore The vBulletin vB_Datastore object from vB_DataManager
array $errors Array to store any errors encountered while building data from vB_DataManager
string $error_handler The error handler for this object from vB_DataManager
array $existing Array to store existing data from vB_DataManager
array $info Array to store information from vB_DataManager
string $condition Condition to be used. Can be either array('keyfield' => 'value') or a valid assertor vB_dB_Query::CONDITIONS_KEY setting. from vB_DataManager
string $table The main table this class deals with from vB_DataManager_StyleVar
callback $failure_callback Callback to execute just before an error is logged. from vB_DataManager
null|bool $presave_called This variable prevents the pre_save() method from being called more than once. from vB_DataManager
protected $needRegistry flag for vb5 transition. A subclass can set this to false and we won't set up $vbulletin * from vB_DataManager_StyleVar
protected $keyField from vB_DataManager_StyleVar
protected string $primary_id The name of the primary ID column that is used to uniquely identify records retrieved. from vB_DataManager_StyleVar
protected array $local_storage Local storage, used to house data that we will be serializing into value from vB_DataManager_StyleVar
protected $childvals from vB_DataManager_StyleVar
$datatype
array $condition_construct Condition template for update query from vB_DataManager_StyleVar
protected $cleaner from vB_DataManager_StyleVar
$childfields

Methods

__sleep()

No description

__wakeup()

No description

__construct(vB_Registry $registry = NULL, integer $errtype = NULL)

Constructor - Checks for necessity of registry object

boolean
set_existing(array $existing)

Sets the existing data

set_condition($params = null)

Sets the condition to be used in WHERE clauses, based upon the $this->existing data and the $this->condition_constuct condition template.

is_field_set($field)

Determines if a fields is set

mixed
fetch_field($fieldname, $table = null)

Fetches info about the current data object - if a new value is set, it returns this, otherwise it will return the existing data

loadExisting($keyValue)

No description

boolean
set(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true, string $table = null)

Sets the supplied data to be part of the data to be saved. Use setr() if a reference to $value is to be passed

boolean
setr(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true)

Sets the supplied data to be part of the data to be saved

boolean
set_bitfield(string $fieldname, string $bitname, boolean $onoff)

Sets a bit in a bitfield

set_info(string $fieldname, mixed $value)

Rather like set(), but sets data into the $this->info array instead. Use setr_info if $value if a reference to value is to be passed

setr_info(string $fieldname, mixed $value)

Rather like set(), but sets reference to data into the $this->info array instead

boolean
verify(string $fieldname, mixed $value, boolean $doverify = true)

Verifies that the supplied data is one of the fields used by this object

do_unset(string $fieldname, string $table = null)

Unsets a values that has already been set

do_set(string $fieldname, mixed $value, string $table = null)

Takes valid data and sets it as part of the data to be saved

boolean
check_required()

Checks through the required fields for this object and ensures that all required fields have a value

array
fetchQueryInfo(string $tableName)

Returns an array with object info required for query methods as first argument

boolean
db_update(string $tableprefix, string $table, string $condition = null, boolean $doquery = true, mixed $delayed = false, boolean $affected_rows = false)

Creates and runs an UPDATE query to save the data from the object into the database

integer
db_insert(string $tableprefix, string $table, boolean $doquery = true, bool $replace = false)

Creates and runs an INSERT query to save the data from the object into the database

integer
db_delete(string $tableprefix, string $table, array $condition = '', boolean $doquery = true)

Generates the SQL to delete a record from a database table, then executes it

bool
has_errors(bool $die = true)

Check if the DM currently has errors. Will kill execution if it does and $die is true.

array
get_errors()

Returns the array of errors

get_exception()

No description

mixed
save(boolean $doquery = true, This $delayed = false, bool $affected_rows = false, bool $replace = false)

Saves the data from the object into the specified database tables

boolean
pre_save(boolean $doquery = true)

Any checks to run immediately before saving. If returning false, the save will not take place.

post_save_each(boolean $doquery = true)

Additional data to update after a save call (such as denormalized values in other tables).

post_save_once(boolean $doquery = true)

Additional data to update after a save call (such as denormalized values in other tables).

integer
delete($doquery = true)

Deletes the specified data item from the database

pre_delete(boolean $doquery = true)

Additional data to update before a delete call (such as denormalized values in other tables).

post_delete(boolean $doquery = true)

Additional data to update after a delete call (such as denormalized values in other tables).

boolean
setErrorHandler(string $errtype = vB_DataManager_Constants::ERRTYPE_STANDARD)

Sets the error handler for the object

error(string $errorphrase)

Shows an error message and halts execution - use this in the same way as print_stop_message();

set_failure_callback(callback $callback)

Sets the function to call on an error.

boolean
verify_userid(integer $userid)

Verifies that the specified user exists

boolean
verify_username(string $username)

Verifies that the provided username is valid, and attempts to correct it if it is not valid

boolean
verify_nonzero(integer $int)

Verifies that an integer is greater than zero

boolean
verify_nonzero_or_negone(integer $int)

Verifies that an integer is greater than zero or the special value -1 this rule matches a fair number of id columns

boolean
verify_nonempty(string $string)

Verifies that a string is not empty

boolean
verify_commalist(mixed $list)

Verifies that a variable is a comma-separated list of integers

boolean
verify_spacelist(mixed $list)

Verifies that a variable is a space-separated list of integers

boolean
verify_list(mixed $list, string $glue = ',', boolean $dropzero = false)

Creates a valid string of comma-separated integers

boolean
verify_serialized(mixed $data)

Verifies that input is a serialized array (or force an array to serialize)

boolean
verify_ipaddress(string $ipaddress)

Verifies an IP address - currently only works with IPv4

boolean
verify_md5(string $md5)

Verifies that a string is an MD5 string

boolean
verify_email(string $email)

Verifies that an email address is valid

boolean
verify_link(string $link, boolean $strict = false)

Verifies that a hyperlink is valid

boolean
verify_date_array(array $date)

Verifies a date array as a valid unix timestamp

boolean
forceItemInSet(mixed $data, array $validarray, mixed $default)

Checks that data is in the valid array. If it is not, set data to the $default.

string
fetchTableBase(string $tablename)

Fetches the base table name even if the parameter contains the package prefix.

deleteFile(string $file)

Check if a file exists, and then delete it if it does.

verify_styleid($data)

No description

boolean
build()

database build method that builds the data into our value field

boolean
set_child(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true, string $table = null)

Sets the supplied data to be part of the data to be build into value.

boolean
verify_child(string $fieldname, mixed $value, boolean $doverify = true)

Verifies that the supplied child data is one of the fields used by this object

do_set_child(string $fieldname, mixed $value, string $table = null)

Takes valid data and sets it as part of the child data to be saved

verify_stylevar($stylevarid)

Validation functions

verify_url($url)

No description

verify_color($color)

No description

verify_image($image)

No description

verify_repeat($repeat)

No description

verify_gradient_type($type)

No description

verify_gradient_direction($direction)

No description

verify_fontfamily($family)

No description

verify_fontweight($weight)

No description

verify_fontstyle($style)

No description

verify_fontvariant($variant)

No description

verify_size($variant)

No description

verify_font_size($size)

No description

verify_width($width)

No description

verify_height($height)

No description

verify_fontlist($fontlist)

No description

verify_texttransfrom($texttransform)

No description

verify_textalign($textalign)

No description

verify_units($unit)

No description

verify_margin($margin)

No description

verify_background_position($position)

No description

verify_value_stylevar($stylevar)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

__construct(vB_Registry $registry = NULL, integer $errtype = NULL)

Constructor - Checks for necessity of registry object

Note that this method will accept only the $errtype parameter (via some magic checking of the parameters) and this is the preferred way of calling the datamanager functions. The registry object is deprecated and will be created internally for those managers that still need it.

Parameters

vB_Registry $registry -- Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member.
integer $errtype --One of the ERRTYPE_x constants

in vB_DataManager at line 262
boolean set_existing(array $existing)

Sets the existing data

Parameters

array $existing Optional array of data describing the existing data we will be updating

Return Value

boolean Returns true if successful

in vB_DataManager at line 290
set_condition($params = null)

Sets the condition to be used in WHERE clauses, based upon the $this->existing data and the $this->condition_constuct condition template.

Parameters

$params

in vB_DataManager at line 342
is_field_set($field)

Determines if a fields is set

Parameters

$field

in vB_DataManager at line 354
mixed fetch_field($fieldname, $table = null)

Fetches info about the current data object - if a new value is set, it returns this, otherwise it will return the existing data

Parameters

$fieldname
$table

Return Value

mixed The requested data

in vB_DataManager at line 378
protected loadExisting($keyValue)

Parameters

$keyValue

in vB_DataManager at line 425
boolean set(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true, string $table = null)

Sets the supplied data to be part of the data to be saved. Use setr() if a reference to $value is to be passed

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
boolean $clean Clean data, or insert it RAW (used for non-arbitrary updates, like posts = posts + 1)
boolean $doverify Whether to verify the data with the appropriate function. Still cleans data if previous arg is true.
string $table Table name to force. Leave as null to use the default table

Return Value

boolean Returns false if the data is rejected for whatever reason

in vB_DataManager at line 469
boolean setr(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true)

Sets the supplied data to be part of the data to be saved

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data (reference) itself
boolean $clean Clean data, or insert it RAW (used for non-arbitrary updates, like posts = posts + 1)
boolean $doverify Whether to verify the data with the appropriate function. Still cleans data if previous arg is true.

Return Value

boolean Returns false if the data is rejected for whatever reason

in vB_DataManager at line 511
boolean set_bitfield(string $fieldname, string $bitname, boolean $onoff)

Sets a bit in a bitfield

Parameters

string $fieldname Name of the database bitfield (options, permissions etc.)
string $bitname Name of the bit within the bitfield (canview, canpost etc.)
boolean $onoff Whether the bit should be set or not

Return Value

boolean

in vB_DataManager at line 533
set_info(string $fieldname, mixed $value)

Rather like set(), but sets data into the $this->info array instead. Use setr_info if $value if a reference to value is to be passed

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself

in vB_DataManager at line 548
setr_info(string $fieldname, mixed $value)

Rather like set(), but sets reference to data into the $this->info array instead

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data (reference) itself

in vB_DataManager at line 569
boolean verify(string $fieldname, mixed $value, boolean $doverify = true)

Verifies that the supplied data is one of the fields used by this object

Also ensures that the data is of the correct type, and attempts to correct errors in the supplied data.

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
boolean $doverify Whether to verify the data with the appropriate function. Data is still cleaned though.

Return Value

boolean Returns true if the data is one of the fields used by this object, and is the correct type (or has been successfully corrected to be so)

in vB_DataManager at line 614
do_unset(string $fieldname, string $table = null)

Unsets a values that has already been set

Parameters

string $fieldname The name of the field that is to be unset
string $table Table name to force. Leave as null to use the default table

in vB_DataManager at line 636
do_set(string $fieldname, mixed $value, string $table = null)

Takes valid data and sets it as part of the data to be saved

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
string $table Table name to force. Leave as null to use the default table

in vB_DataManager at line 655
boolean check_required()

Checks through the required fields for this object and ensures that all required fields have a value

Return Value

boolean Returns true if all required fields have a valid value set

in vB_DataManager at line 674
protected array fetchQueryInfo(string $tableName)

Returns an array with object info required for query methods as first argument

Parameters

string $tableName

Return Value

array

in vB_DataManager at line 698
boolean db_update(string $tableprefix, string $table, string $condition = null, boolean $doquery = true, mixed $delayed = false, boolean $affected_rows = false)

Creates and runs an UPDATE query to save the data from the object into the database

Parameters

string $tableprefix The system's table prefix
string $table The name of the database table to be affected (do not include TABLE_PREFIX in your argument)
string $condition Specify the WHERE condition here. For example, 'userid > 10 AND posts < 50'
boolean $doquery Whether or not to actually run the query
mixed $delayed This is no longer used.
boolean $affected_rows Whether to return the number of affected rows

Return Value

boolean Returns true on success

in vB_DataManager at line 787
integer db_insert(string $tableprefix, string $table, boolean $doquery = true, bool $replace = false)

Creates and runs an INSERT query to save the data from the object into the database

Parameters

string $tableprefix The system's table prefix
string $table The name of the database table to be affected (do not include TABLE_PREFIX in your argument)
boolean $doquery Whether or not to actually run the query
bool $replace Perform REPLACE INTO instead of INSERT

Return Value

integer Returns the ID of the inserted record

in vB_DataManager at line 852
integer db_delete(string $tableprefix, string $table, array $condition = '', boolean $doquery = true)

Generates the SQL to delete a record from a database table, then executes it

Parameters

string $tableprefix The system's table prefix
string $table The name of the database table to be affected (do not include TABLE_PREFIX in your argument)
array $condition Specify the dbasserter condition for the DELETE here.
boolean $doquery Whether or not to actually run the query

Return Value

integer The number of records deleted

in vB_DataManager at line 884
bool has_errors(bool $die = true)

Check if the DM currently has errors. Will kill execution if it does and $die is true.

Parameters

bool $die Whether or not to end execution if errors are found; ignored if the error type is ERRTYPE_SILENT

Return Value

bool True if there are errors, false otherwise

in vB_DataManager at line 934
array get_errors()

Returns the array of errors

Return Value

array --

in vB_DataManager at line 939
get_exception()

in vB_DataManager at line 970
mixed save(boolean $doquery = true, This $delayed = false, bool $affected_rows = false, bool $replace = false)

Saves the data from the object into the specified database tables

Parameters

boolean $doquery Do the query?
This $delayed is no longer used.
bool $affected_rows Whether to return the number of affected rows.
bool $replace Perform REPLACE INTO instead of INSERT

Return Value

mixed If this was an INSERT query, the INSERT ID is returned

in vB_DataManager at line 1084
boolean pre_save(boolean $doquery = true)

Any checks to run immediately before saving. If returning false, the save will not take place.

Parameters

boolean $doquery Do the query?

Return Value

boolean True on success; false if an error occurred

in vB_DataManager at line 1104
post_save_each(boolean $doquery = true)

Additional data to update after a save call (such as denormalized values in other tables).

In batch updates, is executed for each record updated.

Parameters

boolean $doquery Do the query?

post_save_once(boolean $doquery = true)

Additional data to update after a save call (such as denormalized values in other tables).

In batch updates, is executed once after all records are updated.

Parameters

boolean $doquery Do the query?

in vB_DataManager at line 1131
integer delete($doquery = true)

Deletes the specified data item from the database

Parameters

$doquery

Return Value

integer The number of rows deleted

in vB_DataManager at line 1166
pre_delete(boolean $doquery = true)

Additional data to update before a delete call (such as denormalized values in other tables).

Parameters

boolean $doquery Do the query?

in vB_DataManager at line 1176
post_delete(boolean $doquery = true)

Additional data to update after a delete call (such as denormalized values in other tables).

Parameters

boolean $doquery Do the query?

in vB_DataManager at line 1191
boolean setErrorHandler(string $errtype = vB_DataManager_Constants::ERRTYPE_STANDARD)

Sets the error handler for the object

Parameters

string $errtype Error type

Return Value

boolean

in vB_DataManager at line 1214
error(string $errorphrase)

Shows an error message and halts execution - use this in the same way as print_stop_message();

Parameters

string $errorphrase Phrase name for error message

in vB_DataManager at line 1277
set_failure_callback(callback $callback)

Sets the function to call on an error.

Parameters

callback $callback A valid callback (either a function name, or specially formed array)

in vB_DataManager at line 1292
boolean verify_userid(integer $userid)

Verifies that the specified user exists

Parameters

integer $userid User ID

Return Value

boolean Returns true if user exists

in vB_DataManager at line 1318
boolean verify_username(string $username)

Verifies that the provided username is valid, and attempts to correct it if it is not valid

Parameters

string $username Username

Return Value

boolean Returns true if the username is valid, or has been corrected to be valid

in vB_DataManager at line 1398
protected boolean verify_nonzero(integer $int)

Verifies that an integer is greater than zero

Parameters

integer $int Value to check

Return Value

boolean

in vB_DataManager at line 1411
protected boolean verify_nonzero_or_negone(integer $int)

Verifies that an integer is greater than zero or the special value -1 this rule matches a fair number of id columns

Parameters

integer $int Value to check

Return Value

boolean

in vB_DataManager at line 1423
protected boolean verify_nonempty(string $string)

Verifies that a string is not empty

Parameters

string $string Text to check

Return Value

boolean

in vB_DataManager at line 1437
protected boolean verify_commalist(mixed $list)

Verifies that a variable is a comma-separated list of integers

Parameters

mixed $list List (can be string or array)

Return Value

boolean

in vB_DataManager at line 1449
protected boolean verify_spacelist(mixed $list)

Verifies that a variable is a space-separated list of integers

Parameters

mixed $list List (can be string or array)

Return Value

boolean

in vB_DataManager at line 1463
protected boolean verify_list(mixed $list, string $glue = ',', boolean $dropzero = false)

Creates a valid string of comma-separated integers

Parameters

mixed $list Either specify a string of integers separated by parameter 2, or an array of integers
string $glue The 'glue' for the string. Usually a comma or a space.
boolean $dropzero Whether or not to exclude zero from the list

Return Value

boolean

in vB_DataManager at line 1511
boolean verify_serialized(mixed $data)

Verifies that input is a serialized array (or force an array to serialize)

Parameters

mixed $data Either specify a serialized array, or an array to serialize, or an empty string

Return Value

boolean

in vB_DataManager at line 1542
boolean verify_ipaddress(string $ipaddress)

Verifies an IP address - currently only works with IPv4

Parameters

string $ipaddress IP address

Return Value

boolean

in vB_DataManager at line 1572
boolean verify_md5(string $md5)

Verifies that a string is an MD5 string

Parameters

string $md5 The MD5 string

Return Value

boolean

in vB_DataManager at line 1584
boolean verify_email(string $email)

Verifies that an email address is valid

Parameters

string $email Email address

Return Value

boolean

Verifies that a hyperlink is valid

Parameters

string $link Hyperlink URL
boolean $strict Strict link (only HTTP/HTTPS); default false

Return Value

boolean

in vB_DataManager at line 1627
boolean verify_date_array(array $date)

Verifies a date array as a valid unix timestamp

Parameters

array $date Date array containing day/month/year and optionally: hour/minute/second

Return Value

boolean

in vB_DataManager at line 1672
protected boolean forceItemInSet(mixed $data, array $validarray, mixed $default)

Checks that data is in the valid array. If it is not, set data to the $default.

This doesn't so much check if the data is valid as cleans the data to make it valid, which a number of validate functions do. This doesn't match the signature for verification functions because it's intended to build verification functions by passing the correct array and default.

Parameters

mixed $data -- scalar value
array $validarray -- array of valid values
mixed $default -- value to set data to if its not in the array this valid must be in the array.

Return Value

boolean -- should always return true as $data will be set to a valid value if used correctly. Will return false if $data and $default are not in $validarray

in vB_DataManager at line 1694
protected string fetchTableBase(string $tablename)

Fetches the base table name even if the parameter contains the package prefix.

Parameters

string $tablename Name of the table we are checking existing prefix.

Return Value

string The proper table name.

in vB_DataManager at line 1710
deleteFile(string $file)

Check if a file exists, and then delete it if it does.

Parameters

string $file filename

protected verify_styleid($data)

Parameters

$data

boolean build()

database build method that builds the data into our value field

Return Value

boolean True on success; false if an error occurred

boolean set_child(string $fieldname, mixed $value, boolean $clean = true, boolean $doverify = true, string $table = null)

Sets the supplied data to be part of the data to be build into value.

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
boolean $clean Clean data, or insert it RAW (used for non-arbitrary updates, like posts = posts + 1)
boolean $doverify Whether to verify the data with the appropriate function. Still cleans data if previous arg is true.
string $table Table name to force. Leave as null to use the default table

Return Value

boolean Returns false if the data is rejected for whatever reason

boolean verify_child(string $fieldname, mixed $value, boolean $doverify = true)

Verifies that the supplied child data is one of the fields used by this object

Also ensures that the data is of the correct type, and attempts to correct errors in the supplied data.

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
boolean $doverify Whether to verify the data with the appropriate function. Data is still cleaned though.

Return Value

boolean Returns true if the data is one of the fields used by this object, and is the correct type (or has been successfully corrected to be so)

do_set_child(string $fieldname, mixed $value, string $table = null)

Takes valid data and sets it as part of the child data to be saved

Parameters

string $fieldname The name of the field to which the supplied data should be applied
mixed $value The data itself
string $table Table name to force. Leave as null to use the default table

verify_stylevar($stylevarid)

Validation functions

Parameters

$stylevarid

verify_url($url)

Parameters

$url

verify_color($color)

Parameters

$color

verify_image($image)

Parameters

$image

verify_repeat($repeat)

Parameters

$repeat

verify_gradient_type($type)

Parameters

$type

verify_gradient_direction($direction)

Parameters

$direction

verify_fontfamily($family)

Parameters

$family

verify_fontweight($weight)

Parameters

$weight

verify_fontstyle($style)

Parameters

$style

verify_fontvariant($variant)

Parameters

$variant

verify_size($variant)

Parameters

$variant

verify_font_size($size)

Parameters

$size

verify_width($width)

Parameters

$width

verify_height($height)

Parameters

$height

verify_fontlist($fontlist)

Parameters

$fontlist

verify_texttransfrom($texttransform)

Parameters

$texttransform

verify_textalign($textalign)

Parameters

$textalign

verify_units($unit)

Parameters

$unit

verify_margin($margin)

Parameters

$margin

verify_background_position($position)

Parameters

$position

verify_value_stylevar($stylevar)

Parameters

$stylevar

verify_value_inherit_param_color($value)

Parameters

$value