Example #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;
 }
Example #2
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;
 }
Example #3
0
 /**
  * checks which validator message is the one to be called
  *
  * @param string $validator validator name
  * @return array|null name and rule for validator method
  */
 private function getValidationInfo($validator)
 {
     $newValidator = $validator;
     $rule = array();
     while (!method_exists($this, LVC::camelCaseFrom($newValidator))) {
         $dashPos = strrpos($newValidator, '-');
         if ($dashPos > 0) {
             $rule[] = substr($newValidator, $dashPos + 1);
             $newValidator = substr($newValidator, 0, $dashPos);
         } else {
             error_log('LMVC -- Undefined validator in ' . get_class($this));
             return null;
         }
     }
     return array('method' => LVC::camelCaseFrom($newValidator), 'rule' => implode('-', array_reverse($rule)));
 }
Example #4
0
 /**
  * Registers the module controller namespace and the views directory
  */
 public function initialize()
 {
     LVC::registerControllerNamespace(new controllers\Security());
     LVC::registerViewDirectory(static::getPath() . '/views/');
     Snippets::registerSnippetDirectory(self::getPath() . '/snippets/');
 }
Example #5
0
 /**
  * Initialize the module
  */
 public function initialize()
 {
     LVC::registerControllerNamespace(new controllers\AssetPipeline());
 }
Example #6
0
 public function initialize()
 {
     LVC::registerControllerNamespace(new controllers\Upload());
 }
Example #7
0
 /**
  * Registers the module controller namespace and the views directory
  */
 public function initialize()
 {
     LVC::registerControllerNamespace(new controllers\Registration());
     LVC::registerViewDirectory(static::getPath() . '/views/');
 }