/** * @param $defaultMethod string */ public function main(array $config, $defaultMethod) { foreach ($config as $key => $val) { if (strlen(trim($val)) === 0) { continue; } $method = $defaultMethod; if (strpos($val, '.')) { list($class, $method) = explode('.', $val); } else { $class = $val; } $thisConfig = array(); $iniFile = str_replace('_', '/', $class); $iniFile = str_replace('\\', '/', $iniFile); $cfg = $this->parser->parse($iniFile); if ($cfg === false) { $cfg = array(); } $ret = Component_Runner::run($class, $cfg, $method); if ($ret) { return $ret; } } }
public function run(array $config) { $actionName = $config['actionName']; $fileExists = false; $classPath = str_replace('_', '/', $actionName); $classPath = str_replace('\\', '/', $classPath); foreach (explode(PATH_SEPARATOR, ini_get('include_path')) as $path) { if (file_exists($path . "/{$classPath}.php")) { $fileExists = true; break; } } if (!$fileExists) { return; } $methodName = $config['methodName']; $config = Configure::get('laiz.action.Validator'); $handleByMethod = (bool) $config['handleByMethod']; if ($handleByMethod) { if (isset($this->validatorResult->_success)) { if ($this->validatorResult->_success) { $methodName = 'valid'; } else { $methodName = 'invalid'; } } } $ret = Component_Runner::run($actionName, $config, $methodName); if (isset($config['result']['*']) && !$ret) { $ret = 'action:' . $config['result']['*']; } return $ret; }