You are here

function cmfcClassesCoreStandAlone::resetProperties in Calendar Systems 7

Same name and namespace in other branches
  1. 8 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()
  2. 8.2 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()
  3. 6.3 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()
  4. 6 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()
  5. 7.3 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()
  6. 7.2 calendar/lib/classesCore.class.inc.php \cmfcClassesCoreStandAlone::resetProperties()

* 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 226

Class

cmfcClassesCoreStandAlone
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;
      }
    }
  }
}