Ejemplo n.º 1
0
 /**
  * Overload the function to either return nothing (if image image rendering is disable) or return the
  * rendered image by calling the Parsedown function
  *
  * @param string $Excerpt The excerpt of text to be processed as an image
  *
  * @return array|null|void
  */
 protected function inlineImage($Excerpt)
 {
     if ($this->allowImages) {
         return parent::inlineImage($Excerpt);
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Resolve inline images relative URLs to the module's path
  *
  * @param $Excerpt
  * @return array|void
  */
 protected function inlineImage($Excerpt)
 {
     $image = parent::inlineImage($Excerpt);
     $path = new \Enrise\Uri($image['element']['attributes']['src']);
     if ($path->isRelative()) {
         $image['element']['attributes']['src'] = dol_buildpath('/mymodule/' . $path, 1);
     }
     return $image;
 }
Ejemplo n.º 3
0
 /**
  * Overload the function to either return nothing (if image image rendering is disable) or return the
  * rendered image by calling the Parsedown function
  *
  * @param string $Excerpt The excerpt of text to be processed as an image
  *
  * @return array|null|void
  */
 protected function inlineImage($Excerpt)
 {
     if ($this->allowImages) {
         $Image = parent::inlineImage($Excerpt);
         if ($this->camo['enabled']) {
             $parts = parse_url($Image['element']['attributes']['src']);
             if (!isset($parts['host']) || strlen($parts['host']) === 0) {
                 return null;
             }
             if (!in_array($parts['host'], $this->camo['whitelisted_domains'])) {
                 $Image['element']['attributes']['src'] = $this->camo['base_url'] . hash_hmac('sha1', $Image['element']['attributes']['src'], $this->camo['key']) . '/' . bin2hex($Image['element']['attributes']['src']);
             }
         }
         return $Image;
     }
     return null;
 }