예제 #1
0
 public function execute($params)
 {
     $callback = array();
     $callback[] = $this;
     $callback[] = '_error';
     Artx_Data_Mappers::errorCallback($callback);
     $action = isset($params['action']) && is_string($params['action']) ? $params['action'] : '';
     if (0 == strlen($action) || !in_array($action, array('check', 'run', 'params'))) {
         return 'Invalid action.';
     }
     $this->_style = isset($params['id']) && is_string($params['id']) && ctype_digit($params['id']) ? intval($params['id'], 10) : -1;
     if (-1 === $this->_style) {
         return 'Invalid style id.';
     }
     switch ($action) {
         case 'check':
             echo 'result:' . ($this->_isInstalled() ? '1' : '0');
             break;
         case 'run':
             $this->_load();
             echo 'result:ok';
             break;
         case 'params':
             $parameters = array();
             foreach ($this->_data['parameter'] as $key => $parameterData) {
                 $parameters['jform_params_' . $parameterData['name']] = $parameterData['value'];
             }
             echo 'params:' . json_encode($parameters);
             break;
     }
 }
예제 #2
0
 public static function error($error, $code)
 {
     $null = null;
     $callback = Artx_Data_Mappers::errorCallback($null, true);
     if (isset($callback)) {
         call_user_func($callback, $error, $code);
     }
     return $error;
 }