Example #1
0
 /**
  * Invoke filter
  * @param string code
  * @param WebLoader loader
  * @param string file
  * @return string
  */
 public function __invoke($code, WebLoader $loader, $file)
 {
     if (String::endsWith($file, ".less")) {
         return $this->getLessC()->parse($code);
     }
     return $code;
 }
Example #2
0
 /**
  * Convert date to RFC822
  * @param string|date $date
  * @return string
  */
 public static function prepareDate($date)
 {
     if ($date instanceof \DateTime) {
         $date = $date->getTimestamp();
     }
     if (is_string($date) && $date === (string) (int) $date) {
         $date = (int) $date;
     }
     if (is_string($date) && !String::endsWith($date, "GMT")) {
         $date = strtotime($date);
     }
     if (is_int($date)) {
         $date = gmdate('D, d M Y H:i:s', $date) . " GMT";
     }
     return $date;
 }
Example #3
0
 /**
  * Flash handler for images
  *
  * @example [* flash.swf 200x150 .(alternative content) *]
  *
  * @param TexyHandlerInvocation  handler invocation
  * @param TexyImage
  * @param TexyLink
  * @return TexyHtml|string|FALSE
  */
 public function flashHandler($invocation, $image, $link)
 {
     if (!String::endsWith($image->URL, ".swf")) {
         return $invocation->proceed();
     }
     $template = $this->createTemplate()->setFile(NEURON_DIR . "/templates/flash.phtml");
     $template->url = self::prependRoot($image->URL, $this->imageModule->root);
     $template->width = $image->width;
     $template->height = $image->height;
     if ($image->modifier->title) {
         $template->title = $image->modifier->title;
     }
     return $this->protect((string) $template, self::CONTENT_BLOCK);
 }