Exemple #1
0
 public static function laravel_init()
 {
     // Load AutoLoad Aliases
     \Laravel\Autoloader::alias('\\Cloudmanic\\WarChest\\Libraries\\LaravelAuth', 'LaravelAuth');
     \Laravel\Autoloader::alias('\\Cloudmanic\\WarChest\\Libraries\\Me', 'Me');
     // Extend the Laravel Auth library to use our own custom driver.
     \Auth::extend('cloudmanic_auth', function () {
         return new LaravelAuth();
     });
     // Set Api auth filter.
     \Laravel\Routing\Route::filter('api_auth', function () {
         return CloudAuth::sessioninit();
     });
     // Build a micro for activating a class or not. We use this in a main navigation
     // to set the html class to active or not.
     \Laravel\HTML::macro('is_active', function ($name, $home = false, $class = 'active') {
         $base = \Laravel\URI::segment(1);
         // Is the the default route?
         if ($home && empty($base)) {
             return $class;
         }
         // Compare the segment.
         if ($base == $name) {
             return $class;
         }
         return '';
     });
 }
 /**
  * Generate an html link with a query string
  *
  * @param array $file
  * @return string
  */
 public static function link($file = array())
 {
     if (!is_array($file['location'])) {
         $querystring = array('location' => $file['location'], 'name' => $file['name'], 'translate' => \Laravel\Input::get('translate'));
         $text = $file['name'];
     } else {
         $querystring = array('location' => $file['location']['location'], 'name' => $file['name'], 'translate' => \Laravel\Input::get('translate'));
         $text = $file['location']['location'] . '/' . $file['name'];
     }
     $querystring = http_build_query($querystring);
     return \Laravel\HTML::link('language-builder/edit?' . $querystring, $text);
 }
 /**
  * Generate an image tag
  *
  * @param string $file The file relative to your public directory
  * @param string $alt The HTML alt attribute
  * @param string $params Additional HTML attributes
  *
  * @return string
  */
 public function image($file, $alt = '', $params = '')
 {
     $attrs = array();
     if (strlen(trim($params)) != 0) {
         parse_str($params, $attrs);
     }
     $attrs['alt'] = $alt;
     if (strtolower(substr($file, 0, 4)) == 'http') {
         $url = $file;
     } else {
         $url = asset($file);
     }
     return '<img src="' . HTML::entities($url) . '"' . HTML::attributes($attrs) . '>';
 }
Exemple #4
0
 /**
  * Create a HTML button element.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  array   $attributes
  * @return string
  */
 public static function button($value, $attributes = array())
 {
     return '<button' . HTML::attributes($attributes) . '>' . HTML::entities($value) . '</button>' . PHP_EOL;
 }
Exemple #5
0
 protected function minify_script($assets, $attributes, $files_to_compile, $output_file, $compile)
 {
     if ($compile) {
         $scripts_to_minify = array();
         foreach ($files_to_compile as $file) {
             $scripts_to_minify[] = '--js=' . path('public') . $file;
         }
         $scripts_to_minify = implode(' ', $scripts_to_minify);
         $java = 'java';
         // find java binary
         foreach ($this->config['java_binary_path_overrides'] as $java_bin_path) {
             if (file_exists($java_bin_path)) {
                 $java = $java_bin_path;
             }
         }
         // generate command line
         $jar = '-jar ' . __DIR__ . '/drivers/closure-compiler/compiler.jar';
         $out_script = '--js_output_file=' . $this->config['cache_dir_path'] . $output_file;
         // red team, go!
         exec("{$java} {$jar} {$scripts_to_minify} {$out_script}");
     }
     return HTML::script($this->config['cache_dir'] . $output_file . '?t=' . File::modified($this->config['cache_dir_path'] . $output_file), $attributes);
 }
 protected function link($page, $text, $class)
 {
     $query = '?page=' . $page . $this->appendage($this->appends);
     return '<li' . HTML::attributes(array('class' => $class)) . '>' . HTML::link(URI::current() . $query, $text, array(), Request::secure()) . '</li>';
 }