Skip to content

icms_core_Object

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_core_Object

Base class for all objects in the kernel (and beyond)

Constants

DTYPE_STRING

const DTYPE_STRING = 2

DTYPE_INTEGER

const DTYPE_INTEGER = 3

DTYPE_FLOAT

const DTYPE_FLOAT = 201

DTYPE_BOOLEAN

const DTYPE_BOOLEAN = 105

DTYPE_FILE

const DTYPE_FILE = 104

DTYPE_DATETIME

const DTYPE_DATETIME = 11

DTYPE_ARRAY

const DTYPE_ARRAY = 6

DTYPE_LIST

const DTYPE_LIST = 101

DTYPE_OBJECT

const DTYPE_OBJECT = 12

DTYPE_DEP_OTHER

const DTYPE_DEP_OTHER = 7

DTYPE_DEP_FILE

const DTYPE_DEP_FILE = 204

DTYPE_DEP_TXTBOX

const DTYPE_DEP_TXTBOX = 1

DTYPE_DEP_URL

const DTYPE_DEP_URL = 4

DTYPE_DEP_EMAIL

const DTYPE_DEP_EMAIL = 5

DTYPE_DEP_SOURCE

const DTYPE_DEP_SOURCE = 8

DTYPE_DEP_STIME

const DTYPE_DEP_STIME = 9

DTYPE_DEP_MTIME

const DTYPE_DEP_MTIME = 10

DTYPE_DEP_CURRENCY

const DTYPE_DEP_CURRENCY = 200

DTYPE_DEP_TIME_ONLY

const DTYPE_DEP_TIME_ONLY = 202

DTYPE_DEP_URLLINK

const DTYPE_DEP_URLLINK = 203

DTYPE_DEP_IMAGE

const DTYPE_DEP_IMAGE = 205

DTYPE_DEP_FORM_SECTION

const DTYPE_DEP_FORM_SECTION = 210

DTYPE_DEP_FORM_SECTION_CLOSE

const DTYPE_DEP_FORM_SECTION_CLOSE = 211

VARCFG_ALLOWED_MIMETYPES

const VARCFG_ALLOWED_MIMETYPES = allowedMimeTypes

VARCFG_MAX_FILESIZE

const VARCFG_MAX_FILESIZE = maxFileSize

VARCFG_MAX_WIDTH

const VARCFG_MAX_WIDTH = maxWidth

VARCFG_MAX_HEIGHT

const VARCFG_MAX_HEIGHT = maxHeight

VARCFG_PREFIX

const VARCFG_PREFIX = prefix

VARCFG_PATH

const VARCFG_PATH = path

VARCFG_FILENAME_FUNCTION

const VARCFG_FILENAME_FUNCTION = filenameGenerator

VARCFG_POSSIBLE_OPTIONS

const VARCFG_POSSIBLE_OPTIONS = possibleOptions

VARCFG_LOCKED

const VARCFG_LOCKED = locked

VARCFG_HIDE

const VARCFG_HIDE = hide

VARCFG_RENDER_TYPE

const VARCFG_RENDER_TYPE = renderType

VARCFG_SEPARATOR

const VARCFG_SEPARATOR = separator

VARCFG_MAX_LENGTH

const VARCFG_MAX_LENGTH = maxLength

VARCFG_VALIDATE_RULE

const VARCFG_VALIDATE_RULE = validateRule

VARCFG_SOURCE_FORMATING

const VARCFG_SOURCE_FORMATING = sourceFormating

VARCFG_FORMAT

const VARCFG_FORMAT = format

VARCFG_AF_DISABLED

const VARCFG_AF_DISABLED = autoFormatingDisabled

VARCFG_NOT_GPC

const VARCFG_NOT_GPC = not_gpc

VARCFG_CHANGED

const VARCFG_CHANGED = changed

VARCFG_VALUE

const VARCFG_VALUE = value

VARCFG_TYPE

const VARCFG_TYPE = data_type

VARCFG_REQUIRED

const VARCFG_REQUIRED = required

VARCFG_DATA_HANDLER

const VARCFG_DATA_HANDLER = data_handler

VARCFG_DEP_DATA_TYPE

const VARCFG_DEP_DATA_TYPE = depDataType

VARCFG_FORM_CAPTION

const VARCFG_FORM_CAPTION = form_caption

VARCFG_FORM_DESC

const VARCFG_FORM_DESC = form_dsc

VARCFG_DEFAULT_VALUE

const VARCFG_DEFAULT_VALUE = default_value

VARCFG_NOTLOADED

const VARCFG_NOTLOADED = not_loaded

VALIDATE_RULE_EMAIL

const VALIDATE_RULE_EMAIL = /^[a-z0-9]+([_\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\.[a-z]{2,}$/i

VALIDATE_RULE_LINKS

const VALIDATE_RULE_LINKS = #^http(s)?://[a-z0-9-_.]+\.[a-z]{2,4}#i

Properties

$_isNew

private bool $_isNew = \false

is it a newly created object?

  • Visibility: private

$_errors

private array $_errors = array()

errors

  • Visibility: private

$_filters

private mixed $_filters = array()

additional filters registered dynamically by a child class object

  • Visibility: private

$_vars

protected array $_vars = array()

Vars configuration

  • Visibility: protected

$_changed

protected int $_changed

Changed vars count

  • Visibility: protected

Methods

__construct

mixed icms_core_Object::__construct()

constructor

normally, this is called from child classes only

  • Visibility: public

unsetNew

mixed icms_core_Object::unsetNew()
  • Visibility: public

isNew

mixed icms_core_Object::isNew()
  • Visibility: public

initVar

mixed icms_properties_Handler::initVar(string key, int dataType, mixed defaultValue, bool required, mixed otherCfg)

Initialize var (property) for the object

Arguments

  • key string - <p>Var name</p>
  • dataType int - <p>Var data type (use constants DTYPE_* for specifing it!)</p>
  • defaultValue mixed - <p>Default value</p>
  • required bool - <p>Is Required?</p>
  • otherCfg mixed

setFormVars

mixed icms_core_Object::setFormVars(array var_arr, string pref, mixed not_gpc)

Assign values to multiple variables in a batch

Meant for a CGI context:

  • prefixed CGI args are considered safe
  • avoids polluting of namespace with CGI args
  • Visibility: public

Arguments

  • var_arr array - <p>associative array of values to assign</p>
  • pref string - <p>prefix (only keys starting with the prefix will be set)</p>
  • not_gpc mixed

registerFilter

mixed icms_core_Object::registerFilter(string filtername)

dynamically register additional filter for the object

  • Visibility: public

Arguments

  • filtername string - <p>name of the filter</p>

xoopsClone

object icms_core_Object::xoopsClone()

Clone current instance

  • Visibility: public

setDirty

mixed icms_core_Object::setDirty()

Sets object modified

  • Visibility: public

unsetDirty

mixed icms_core_Object::unsetDirty()

Sets object unmodified

  • Visibility: public

isDirty

mixed icms_core_Object::isDirty()

Is object modified?

  • Visibility: public

__clone

mixed icms_core_Object::__clone()

Create cloned copy of current object

  • Visibility: public

setNew

mixed icms_core_Object::setNew()
  • Visibility: public

getErrors

array icms_core_Object::getErrors()

return the errors for this object as an array

  • Visibility: public

setErrors

mixed icms_core_Object::setErrors(mixed err_str, mixed prefix)

add an error

  • Visibility: public

Arguments

  • err_str mixed
  • prefix mixed

getHtmlErrors

string icms_core_Object::getHtmlErrors()

return the errors for this object as html

  • Visibility: public

hasError

mixed icms_core_Object::hasError()
  • Visibility: public

_loadFilters

mixed icms_core_Object::_loadFilters()

load all additional filters that have been registered to the object

  • Visibility: private

assignVars

mixed icms_properties_Handler::assignVars(array values)

Assigns values from array to vars

Arguments

  • values array - <p>Assoc arary with keys and values to assign</p>

cleanVar

mixed icms_properties_Handler::cleanVar(string key, string type, string value)

Cleans value for var

Arguments

  • key string - <p>Var name</p>
  • type string - <p>Var type</p>
  • value string - <p>new value</p>

getFileMimeType

string icms_properties_Handler::getFileMimeType(string filename)

Gets mymetype from filename

Arguments

  • filename string - <p>Filename</p>

initCommonVar

mixed icms_properties_Handler::initCommonVar(string varname, bool displayOnForm, string default)

Inits common var

Arguments

  • varname string - <p>Var name</p>
  • displayOnForm bool - <p>Display on form</p>
  • default string - <p>Default value</p>

__isset

bool icms_properties_Handler::__isset(string name)

Checks if var exists

Arguments

  • name string - <p>Var name</p>

assignVar

mixed icms_properties_Handler::assignVar(string key, mixed value)

assign a value to a variable

Arguments

  • key string - <p>name of the variable to assign</p>
  • value mixed - <p>value to assign</p>

isChanged

bool icms_properties_Handler::isChanged()

If is object variables has been changed?

getChangedVars

array icms_properties_Handler::getChangedVars()

Gets changes vars

getProblematicVars

array icms_properties_Handler::getProblematicVars()

Gets an array with required but not specified vars

isVarSet

bool icms_properties_Handler::isVarSet(int type, string key)

Checks if var is set

Arguments

  • type int
  • key string

getDefaultVars

array icms_properties_Handler::getDefaultVars()

Gets default values for all vars

getVarInfo

mixed icms_properties_Handler::getVarInfo(string key, string info, mixed default)

Returns array of vars or only one var (if name specified) with selected info field

Arguments

  • key string - <p>Var name</p>
  • info string - <p>Var info to get</p>
  • default mixed - <p>Default response</p>

getVars

array icms_properties_Handler::getVars()

returns all variables for the object

setVars

mixed icms_properties_Handler::setVars(array var_arr, bool not_gpc)

Assign values to multiple variables in a batch

Arguments

  • var_arr array - <p>associative array of values to assign</p>
  • not_gpc bool

setVar

mixed icms_properties_Handler::setVar(string name, mixed value, array options)

Sets var value

Arguments

  • name string - <p>Var name</p>
  • value mixed - <p>New value</p>
  • options array - <p>Options to apply when settings values</p>

setVarInfo

mixed icms_properties_Handler::setVarInfo(string key, string info, mixed value)

Sets var info

Arguments

  • key string - <p>Var name</p>
  • info string - <p>Var option</p>
  • value mixed - <p>Options value</p>

getVarNames

array icms_properties_Handler::getVarNames()

Return array of properties names

setType

mixed icms_properties_Handler::setType(string key, int type)

Changes type for var

Arguments

  • key string - <p>Var name</p>
  • type int - <p>Type</p>

doSetFieldAsRequired

mixed icms_properties_Handler::doSetFieldAsRequired(string key, bool is_required)

Sets field as required

Arguments

  • key string - <p>Var name</p>
  • is_required bool - <p>Is required?</p>

cleanVars

array icms_properties_Handler::cleanVars()

Returns cleaned vars array

toArray

array icms_properties_Handler::toArray()

Returns properties as key-value array

serialize

string icms_properties_Handler::serialize()

Serialize instance to string

getValues

array icms_properties_Handler::getValues(mixed keys, string format, int maxDepth)

Returns the values of the specified variables

Arguments

  • keys mixed - <p>An array containing the names of the keys to retrieve, or null to get all of them</p>
  • format string - <p>Format to use (see getVar)</p>
  • maxDepth int - <p>Maximum level of recursion to use if some vars are objects themselves</p>

getVar

mixed icms_properties_Handler::getVar(mixed name, string format)

Returns a specific variable for the object in a proper format

Arguments

  • name mixed
  • format string - <p>format to use for the output</p>

getVarForDisplay

mixed icms_properties_Handler::getVarForDisplay(string name)

Gets var value for displaying

Arguments

  • name string

getVarForEdit

mixed icms_properties_Handler::getVarForEdit(string name)

Gets var value for editing

Arguments

  • name string

getVarForForm

mixed icms_properties_Handler::getVarForForm(string name)

Gets var value for form

Arguments

  • name string

__get

mixed icms_properties_Handler::__get(string name)

Magic function to get property value by accessing it by name

Arguments

  • name string

__set

mixed icms_properties_Handler::__set(string name, mixed value)

Magic function to work with properties as class variables (set them)

Arguments

  • name string - <p>Var name</p>
  • value mixed - <p>New value</p>

unserialize

mixed icms_properties_Handler::unserialize(mixed serialized)

Used when using with unserialize function call

Arguments

  • serialized mixed
Clone this wiki locally