You are here

function cmfcClassesCore::resetProperties in Calendar Systems 5

* fill all of object variables with their default values except $base_properties * $base_properties=array('local_language_name','db','event_system','configurations','table_name_prefix'); * @BENEFITS:increases object creation speed in loop, in fact there is no need to create class anymore, just create it at first time and then call this function for furture uses *

Parameters

$base_properties array:

File

calendar/lib/classesCore.class.inc.php, line 142

Class

cmfcClassesCore
all cmf classes inherit from this class

Code

function resetProperties($baseBroperties = null, $prefix = null) {
  $classVars = get_class_vars(cmfcPhp4::get_class($this));
  foreach ($classVars as $varName => $defaultValue) {
    if (!in_array($varName, $baseBroperties)) {
      if (is_integer($defaultValue) or is_float($defaultValue)) {
        $this->{$prefix . $varName} = $defaultValue;
      }
      else {
        $this->{$prefix . $varName} = $defaultValue;
      }
    }
  }
}