Exemplo n.º 1
0
 private function _configureEditor()
 {
     $extensions = Artx_Data_Mappers::get('extension');
     $tinyMce = $extensions->findOne(array('element' => 'tinymce'));
     if (is_string($tinyMce)) {
         return $this->_error($tinyMce, 1);
     }
     if (!is_null($tinyMce)) {
         $params = $this->_stringToParams($tinyMce->params);
         $elements = strlen($params['extended_elements']) ? explode(',', $params['extended_elements']) : array();
         $invalidElements = strlen($params['invalid_elements']) ? explode(',', $params['invalid_elements']) : array();
         if (in_array('script', $invalidElements)) {
             array_splice($invalidElements, array_search('script', $invalidElements), 1);
         }
         if (!in_array('style', $elements)) {
             $elements[] = 'style';
         }
         if (!in_array('script', $elements)) {
             $elements[] = 'script';
         }
         if (!in_array('div[*]', $elements)) {
             $elements[] = 'div[*]';
         }
         $params['extended_elements'] = implode(',', $elements);
         $params['invalid_elements'] = implode(',', $invalidElements);
         $tinyMce->params = $this->_paramsToString($params);
         $status = $extensions->save($tinyMce);
         if (is_string($status)) {
             return $this->_error($status, 1);
         }
     }
     return null;
 }
Exemplo n.º 2
0
 protected function _cascadeDelete($mapper, $filter)
 {
     $menuItems = Artx_Data_Mappers::get($mapper);
     $itemsList = $menuItems->find($filter);
     if (is_string($itemsList)) {
         return $this->_error($itemsList, 1);
     }
     foreach ($itemsList as $item) {
         $status = $menuItems->delete($item->id);
         if (is_string($status)) {
             return $this->_error($status, 1);
         }
     }
     return null;
 }