Esempio n. 1
0
 protected function process()
 {
     $contents = $this->request['contents'];
     $contents = \Textmark_Parser::parse($contents);
     return \Icybee\Kses::sanitizeComment($contents);
 }
Esempio n. 2
0
 /**
  * Renders content using the Textmark engine.
  *
  * @see Icybee\Modules\Editor.Editor::render()
  */
 public function render($content)
 {
     return \Textmark_Parser::parse($content);
 }
Esempio n. 3
0
 function _doImages_reference_callback($matches)
 {
     // FIXME-20140921: Hook only support patron.markup, so we replaced a hack with another
     // waiting for a better solution.
     if (self::$images_reference_callback === null) {
         $hook = false;
         if (class_exists('Icybee\\Modules\\Images\\Hooks')) {
             $hook = 'Icybee\\Modules\\Images\\Hooks::textmark_images_reference';
         }
         self::$images_reference_callback = $hook;
     }
     if (self::$images_reference_callback !== false) {
         return $this->hashPart(call_user_func(self::$images_reference_callback, [], $this, $matches));
     }
     static $module;
     if (!$module) {
         $module = \ICanBoogie\app()->modules['images'];
     }
     //		echo l('<pre>in \1: \2</pre>', __FUNCTION__, $matches);
     $align = $matches[2];
     $alt = $matches[3];
     $id = $matches[4];
     # for shortcut links like ![this][].
     if (!$id) {
         $id = $alt;
     }
     $parts = explode(':', $id, 2);
     if (isset($parts[1])) {
         $entry = $module->model()->loadRange(0, 1, 'WHERE `' . $module->getConstant('TITLE') . '` = ? AND `' . $module->getConstant('ALBUM') . '` = ?', array($parts[1], $parts[0]))->fetchAndClose();
     } else {
         $entry = $module->model()->loadRange(0, 1, 'WHERE `slug` = ? OR `title` = ?', array($id, $id))->fetchAndClose();
     }
     if (!$entry) {
         $matches[2] = $matches[3];
         $matches[3] = $matches[4];
         return parent::_doImages_reference_callback($matches);
     }
     $params = array('src' => $entry->path, 'alt' => \ICanBoogie\escape($alt), 'width' => $entry->width, 'height' => $entry->height);
     if ($align) {
         switch ($align) {
             case '<':
                 $align = 'left';
                 break;
             case '=':
             case '|':
                 $align = 'middle';
                 break;
             case '>':
                 $align = 'right';
                 break;
         }
         $params['align'] = $align;
     }
     # the image has been found is the database
     return $this->hashPart($this->createElement('img', $params));
 }