function &getPropertyEditorRegistrar() { if (!is_array($this->propertyEditorRegistrars)) { return $this->propertyEditorRegistrars; } return $this->propertyEditorRegistrars == null || empty($this->propertyEditorRegistrars) ? _null() : $this->propertyEditorRegistrars[0]; }
function &getProperty($name) { if (isset($this->properties[$name])) { return $this->properties[$name]; } return _null(); }
function &plugin($name) { if (pluginExists($name)) { return $this->plugins[$name]; } else { return _null(); } }
function &load_theme($name) { $tm =& AppContext::service('ThemeManager'); if ($tm != null) { return $tm->loadTheme($name); } else { return _null(); } }
function &_tag_get_attribute($tag, $name) { global $_tag_attributes; $id = _tag_get_id($tag); if (!isset($_tag_attributes[$tag][$id][$name])) { return _null(); } return $_tag_attributes[$tag][$id][$name]; }
function &createView($viewName, &$locale) { // If this resolver is not supposed to handle the given view, // return null to pass on to the next resolver in the chain. if (!$this->canHandle($viewName, $locale) || $this->viewClass == null) { return _null(); } // Check for special "redirect:" prefix. if (str_starts_with($viewName, REDIRECT_URL_PREFIX)) { $redirectUrl = substr($viewName, strlen(REDIRECT_URL_PREFIX)); $view =& AppContext::createAutowiredService('RedirectView'); $view->serviceName = $viewName; $view->url = $redirectUrl; return $view; } $view =& $this->buildView($viewName); return $view; }
function &_resolveViewName($viewName, &$locale, &$request) { foreach ($this->viewResolver as $vr) { $view =& $vr->resolveViewName($viewName, &$locale); if ($view != null) { return $view; } } return _null(); }
function &servicePoint($name) { global $appContext; if (!$appContext->serviceExists($name)) { return _null(); } return $appContext->servicePoints[$name]; }
function &instantiate() { if ($this->className == null) { return _null(); } if (!class_exists($this->className)) { if (!is_file($this->base . $this->filename) || !file_exists($this->base . $this->filename)) { show_error('Instantiator Error', "File not found for '{$this->className}': " . $this->base . $this->filename); } include $this->base . $this->filename; } $class = $this->className; if (!is_array($this->definition)) { $instance =& new $class(); } else { # parameters $parameters = false; if (isset($this->definition['parameters'])) { if (!is_array($parameters = $this->definition['parameters'])) { $parameters = array($parameters); } } # instantiate if (!$parameters) { $instance =& new $class(); } else { $instance =& $this->_create_obj_array($class, $parameters); } # autowire? if (isset($this->definition['autowire']) && $this->definition['autowire'] == true) { $vars = get_object_vars($instance); foreach ($vars as $name => $val) { $service =& AppContext::service($name); if ($service != null) { $instance->{$name} =& $service; } } } # properties if (isset($this->definition['properties'])) { $properties = array_map(array(&$this, '_get_typed_value'), $this->definition['properties']); foreach ($properties as $name => $value) { $instance->{$name} =& $properties[$name]; } } # invoke if (isset($this->definition['invoke'])) { foreach ($this->definition['invoke'] as $name => $value) { if (!is_array($value)) { $value = array($value); } call_user_func_array(array(&$instance, $name), $value); } } # initialize-method if (isset($this->definition['initialize-method'])) { call_user_func(array(&$instance, $this->definition['initialize-method'])); } } return $instance; }
function &getUploadedFile($name) { if (!isset($_FILES[$name])) { return _null(); } if (is_array($_FILES[$name]['name'])) { $result = array(); foreach ($_FILES[$name]['name'] as $key => $name) { $file = new UploadedFile($name, $_FILES[$name]['tmp_name'][$key], $_FILES[$name]['size'][$key], $_FILES[$name]['type'][$key], $_FILES[$name]['error'][$key]); $result[] =& $file; } return $result; } else { $file = new UploadedFile($_FILES[$name]['name'], $_FILES[$name]['tmp_name'], $_FILES[$name]['size'], $_FILES[$name]['type'], $_FILES[$name]['error']); return $file; } }
function &referenceData(&$request, $command, $bindingResult = null) { return _null(); }
function setPropertyValue(&$tokens, $newValue) { if (strtolower(get_class($tokens)) != 'propertytokenholder') { $nestedBw =& $this->_getBeanWrapperForPropertyPath($tokens); if ($nestedBw == null || strtolower(get_class($nestedBw)) != 'beanwrapper') { return new NotWriteablePropertyException($this->getRootClass(), $this->nestedPath . $tokens, 'Cannot find BeanWrapper for property path: ' . $tokens); } $tokens =& $this->_getPropertyNameTokens($this->_getFinalPath($nestedBw, $tokens)); return $nestedBw->setPropertyValue(&$tokens, $newValue); } $propertyName = $tokens->canonicalName; if ($tokens->keys != null) { // Apply indexes and map keys: fetch value for all keys but the last one. $getterTokens = new PropertyTokenHolder(); $getterTokens->canonicalName = $tokens->canonicalName; $getterTokens->actualName = $tokens->actualName; $getterTokens->keys = $tokens->keys; array_pop($getterTokens->keys); $propValue =& $this->getPropertyValue($getterTokens); // Set value for last key. $lastKey = count($tokens->keys) - 1; $key = $tokens->keys[$lastKey]; if (is_null($propValue)) { return new NullValueInNestedPathException($this->getRootClass(), $this->nestedPath . $propertyName, "Cannot access indexed value in property referenced " . "in indexed property path '" . $propertyName . "': returned null"); } else { if (is_array($propValue)) { $requiredType = get_array_component_type($propValue); $arrayIndex = $key; $oldValue = null; if (isset($propValue[$arrayIndex])) { $oldValue = $propValue[$arrayIndex]; } // if(!isset($propValue[$arrayIndex])) // return new InvalidPropertyException($this->getRootClass(), $this->nestedPath.$propertyName,"Invalid array index in property path '" . $propertyName . "'"); $convertedValue =& $this->convertIfNecessary($propertyName, $oldValue, $newValue, $requiredType, _null()); if (is_a($convertedValue, 'IllegalArgumentException')) { return new TypeMismatchException($this->object, $this->nestedPath . $propertyName, &$oldValue, &$newValue, $requiredType); } $propValue[$key] =& $convertedValue; } else { return new InvalidPropertyException($this->getRootClass(), $this->nestedPath . $propertyName, "Property referenced in indexed property path '" . $propertyName . "' is not an array; returned value was [" . var_export($propValue, true) . "]"); } } } else { $pd =& $this->_getPropertyDescriptorInternal($propertyName); if (is_null($pd)) { return new NotWriteablePropertyException($this->getRootClass(), $this->nestedPath . $propertyName, 'Cannot get PropertyDescriptor for property: ' . $this->nestedPath . $propertyName); } $propName =& $pd->getPropertyName(); $propType =& $pd->getPropertyType(); $readMethod = 'get' . $propName; $oldValue = null; if (method_exists($this->object, $readMethod)) { $oldValue =& $this->object->{$readMethod}(); } $convertedValue =& $this->convertIfNecessary(&$propertyName, &$oldValue, &$newValue, &$propType, &$pd); if (is_a($convertedValue, 'IllegalArgumentException')) { return new TypeMismatchException(&$this->object, $this->nestedPath . $propertyName, &$oldValue, &$newValue, &$propType); } // if (log_enabled(LOG_INFO)) { // log_message(LOG_INFO, microtime()." About to set property [" . $prop . "] on object of class [" . // get_class($this->object) . "]"); // } //TODO: is this necessary? // if(!array_key_exists($prop,get_object_vars($this->object))) // return new NotWriteablePropertyException($this->getRootClass(), $this->nestedPath.$propertyName,'Property does not exist on object: '.$this->nestedPath.$propertyName); $this->object->{$propName} =& $convertedValue; // if (log_enabled(LOG_INFO)) { // log_message(LOG_INFO, "Set property [" . $prop . "] with value of type [" . // $pd->getPropertyType() . "]"); // } } return true; }