Ejemplo n.º 1
0
 protected function checkSize()
 {
     $allowedSize = $this->md->getOption('upload.max_size', null, "");
     if ($allowedSize == '') {
         $allowedSize = $this->modx->getOption('upload_maxsize', null, "2097152");
     }
     if ($allowedSize == '0') {
         return true;
     }
     $allowedSize = intval($allowedSize);
     if ($allowedSize < $_FILES['file']['size']) {
         return $this->modx->lexicon('markdowneditor.err.upload.too_big');
     }
     return true;
 }
Ejemplo n.º 2
-1
 public function init()
 {
     if (isset($this->sp['resource'])) {
         if (!$this->sp['resource']->richtext) {
             return false;
         }
     }
     $useEditor = $this->modx->getOption('use_editor', false);
     $whichEditor = $this->modx->getOption('which_editor', '');
     if ($useEditor && $whichEditor != 'MarkdownEditor') {
         $initCondition = $this->md->getOption('init.condition');
         if (empty($initCondition)) {
             $initCondition = '[]';
         }
         $initCondition = $this->modx->fromJSON($initCondition);
         if (!empty($initCondition)) {
             $c = $this->modx->newQuery('modResource');
             $c->where([['id' => $this->sp['resource']->id], $initCondition]);
             $check = $this->modx->getObject('modResource', $c);
             if ($check) {
                 $this->modx->setOption('which_editor', 'MarkdownEditor');
                 $whichEditor = 'MarkdownEditor';
             }
         }
     }
     if ($useEditor && $whichEditor == 'MarkdownEditor') {
         return true;
     }
     return false;
 }