Пример #1
0
 /**
  * Simple connection to the asset pipeline markdown module.
  *
  * @param array $file markdown file to be compiled
  * @param array $options containing path and other additionally desired options
  *
  * @return string the rendered html from markdown source (maybe cached)
  */
 public static function markdown($file, $options = array(), $content = false)
 {
     $url = LVC::get()->url('asset-pipeline::markdown', array_merge($options, array($file)));
     $response = false;
     if ($content === true) {
         $response = @file_get_contents($url);
     } else {
         $response = $url;
     }
     return $response;
 }
Пример #2
0
 public static function configure($assetRootDirectory)
 {
     assetpipes\CssPipe::register('css', ['min']);
     assetpipes\SassPipe::register('scss', ['min']);
     assetpipes\LessPipe::register('less', ['min']);
     assetpipes\JsPipe::register('js', ['min']);
     assetpipes\CoffeescriptPipe::register('coffee', ['min']);
     assetpipes\FontPipe::register('font', ['']);
     assetpipes\MarkdownPipe::register('markdown', ['']);
     assetpipes\ImagePipe::register('img', [LVC::get()->request->w, LVC::get()->request->h]);
     controllers\AssetPipeline::registerFlexOptions([LVC::get()->request->w => LVC::get()->request->w, LVC::get()->request->h => LVC::get()->request->h]);
     controllers\AssetPipeline::configure($assetRootDirectory);
 }
Пример #3
0
 /**
  * searches for the snippet in the registered directories
  *
  * @static
  * @param string $snippet the snippet to search for
  * @return string|bool either the snippet's full path or false
  */
 private static function searchSnippet($snippet)
 {
     $class = get_called_class();
     if (!isset(self::$snippetPath[$class])) {
         return false;
     }
     foreach (self::$snippetPath[$class] as $path) {
         $snippetPath = (substr($path, 0, 1) == '/' ? '' : LVC::get()->config->appPath) . $path . DIRECTORY_SEPARATOR . $snippet;
         if (file_exists($snippetPath)) {
             return $snippetPath;
         }
     }
     return false;
 }