Beispiel #1
0
 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $text = $this->getParams()->has('text') ? $renderParams->getString('text') : null;
     $skipDropZone = $renderParams->getBoolean('skipDropZone', false);
     $viewResponse->set('text', $text);
     $viewResponse->set('skipDropZone', $skipDropZone);
 }
Beispiel #2
0
 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $viewResponse->set('class', $renderParams->has('class') ? $renderParams->getString('class') : null);
     $viewResponse->set('optionList', $this->_getOptionList());
     $viewResponse->set('translate', $renderParams->getBoolean('translate', $this->_translate) || $renderParams->has('translatePrefix'));
     $viewResponse->set('translatePrefix', $renderParams->has('translatePrefix') ? $renderParams->getString('translatePrefix') : null);
 }
Beispiel #3
0
 public function ajax_clearCache(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $cachesCleared = array();
     if ($params->getBoolean('CM_Cache_Storage_Memcache', false)) {
         $cache = new CM_Cache_Storage_Memcache();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_Memcache';
     }
     if ($params->getBoolean('CM_Cache_Storage_Apc', false)) {
         $cache = new CM_Cache_Storage_Apc();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_Apc';
     }
     if ($params->getBoolean('CM_Cache_Storage_File', false)) {
         $cache = new CM_Cache_Storage_File();
         $cache->flush();
         $cachesCleared[] = 'CM_Cache_Storage_File';
     }
     $handler->message('Cleared: ' . implode(', ', $cachesCleared));
 }
Beispiel #4
0
 public function ajax_error(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $status = $params->getInt('status', 200);
     $message = $params->has('text') ? $params->getString('text') : null;
     $messagePublic = $params->getBoolean('public', false) ? $message : null;
     if (in_array($status, array(500, 599), true)) {
         $response->addHeaderRaw('HTTP/1.1 ' . $status . ' Internal Server Error');
         $response->sendHeaders();
         exit($message);
     }
     $exception = $params->getString('exception');
     if (!in_array($exception, array('CM_Exception', 'CM_Exception_AuthRequired'), true)) {
         $exception = 'CM_Exception';
     }
     throw new $exception($message, $messagePublic);
 }