Example #1
0
 /**
  * @param \Eloquent $model
  * @param string $field
  * @param           $options
  * @param null $elementName
  * @return \Illuminate\View\View
  */
 public function field($model, $field, $options, $elementName = null)
 {
     $fieldProvider = $options['type'] . '_field';
     if (\App::bound($fieldProvider)) {
         return \App::make($fieldProvider, ['model' => $model, 'field' => $field, 'options' => $options, 'element_name' => $elementName]);
     } else {
         $this->model = $model;
         $this->field = $field;
         // Check for source model
         if (isset($options['sourceModel']) && is_a($options['sourceModel'], SourceModel::class, true)) {
             $this->sourceModel = app($options['sourceModel']);
         }
         if (!isset($options['class'])) {
             $options['class'] = '';
         }
         //Check if we don't have validation rules
         if (isset($options['validation'])) {
             foreach (explode('|', $options['validation']) as $rule) {
                 // For now we allow only rules without , check validation.js
                 if (strstr($rule, ',') === false) {
                     $options['class'] .= ' validate-' . $rule;
                 }
             }
         }
         $this->options = $options;
         $this->elementName = is_null($elementName) ? $field : $elementName;
         return $this->renderInput($this->options['type']);
     }
 }
Example #2
0
 /**
  * Decode Marker string text
  * 
  * @param  string $text Marker code
  * @return string 		Marker's decoded blade view
  */
 public function decode($text)
 {
     $tmp_text = trim($text);
     //con json
     preg_match_all('/\\[\\$([!?A-Z_]+)\\[([^$]+)?\\]\\]/i', $tmp_text, $matches);
     foreach ($matches[0] as $key => $value) {
         // Original marker string
         $marker_original = $matches[0][$key];
         // Method to execute
         $method = $matches[1][$key];
         // String found
         $found = $matches[2][$key];
         // Check if marker method is IoCed
         if (\App::bound($method)) {
             // Clean HTML
             $found = strip_tags($found);
             // Convert html entity chars
             $found = html_entity_decode($found);
             // Try to decode Json $found
             $result = json_decode($found, true);
             // Check if $found is Json otherwise format it and return
             $vars = !is_null($result) ? $result : $this->formatNotJson($found);
             if (!is_array($vars)) {
                 $vars = array();
             }
             $decoded = $this->{$method}($vars);
         }
         // If something has been found and decoded
         if (isset($decoded)) {
             $tmp_text = $this->replaceDecoded($marker_original, $decoded, $tmp_text);
         }
     }
     return $tmp_text;
 }
 /**
  * Set a few dependencies on the bridge instance.
  * 
  * @return void
  */
 protected function setBridgeDependencies()
 {
     //if you want to see if a class is bound to the container you can use BOUND method
     if ($this->app->bound('queue')) {
         $this->queue = $this->app['queue.connection'];
     }
 }
Example #4
0
 public function resolveService($resource)
 {
     $serviceName = isset($this->handlers[$resource]) ? $this->handlers[$resource] : false;
     if ($serviceName !== false && \App::bound($serviceName)) {
         return $service = \App::make($serviceName);
     } else {
         event(new PackageError($this, "Service not found."));
     }
 }
Example #5
0
 public function terminate($request, $response)
 {
     if (!\App::runningInConsole() && \App::bound('veer') && app('veer')->isBooted()) {
         $timeToLoad = empty(app('veer')->statistics['loading']) ? 0 : app('veer')->statistics['loading'];
         if ($timeToLoad > config('veer.loadingtime')) {
             \Log::alert('Slowness detected: ' . $timeToLoad . ': ', app('veer')->statistics());
             info('Queries: ', \DB::getQueryLog());
         }
         \Veer\Jobs\TrackingUser::run();
         (new \Veer\Commands\HttpQueueWorkerCommand(config('queue.default')))->handle();
     }
 }
    $route = parse_url($baseUrl);
    //add the view fields
    $view->config = $config;
    $view->editFields = $fieldFactory->getEditFields();
    $view->arrayFields = $fieldFactory->getEditFieldsArrays();
    $view->actions = $actionFactory->getActionsOptions();
    $view->baseUrl = $baseUrl;
    $view->assetUrl = URL::to('packages/frozennode/administrator/');
    $view->route = $route['path'] . '/';
});
//header view
View::composer(array('administrator::partials.header'), function ($view) {
    $view->menu = App::make('admin_menu')->getMenu();
    $view->settingsPrefix = App::make('admin_config_factory')->getSettingsPrefix();
    $view->pagePrefix = App::make('admin_config_factory')->getPagePrefix();
    $view->configType = App::bound('itemconfig') ? App::make('itemconfig')->getType() : false;
});
//the layout view
View::composer(array('administrator::layouts.default'), function ($view) {
    //set up the basic asset arrays
    $view->css = array();
    $view->js = array('jquery' => asset('packages/frozennode/administrator/js/jquery/jquery-1.8.2.min.js'), 'jquery-ui' => asset('packages/frozennode/administrator/js/jquery/jquery-ui-1.10.3.custom.min.js'), 'customscroll' => asset('packages/frozennode/administrator/js/jquery/customscroll/jquery.customscroll.js'));
    //add the non-custom-page css assets
    if (!$view->page && !$view->dashboard) {
        $view->css += array('jquery-ui' => asset('packages/frozennode/administrator/css/ui/jquery-ui-1.9.1.custom.min.css'), 'jquery-ui-timepicker' => asset('packages/frozennode/administrator/css/ui/jquery.ui.timepicker.css'), 'select2' => asset('packages/frozennode/administrator/js/jquery/select2/select2.css'), 'jquery-colorpicker' => asset('packages/frozennode/administrator/css/jquery.lw-colorpicker.css'));
    }
    //add the package-wide css assets
    $view->css += array('customscroll' => asset('packages/frozennode/administrator/js/jquery/customscroll/customscroll.css'), 'main' => asset('packages/frozennode/administrator/css/main.css'));
    //add the non-custom-page js assets
    if (!$view->page && !$view->dashboard) {
        $view->js += array('select2' => asset('packages/frozennode/administrator/js/jquery/select2/select2.js'), 'jquery-ui-timepicker' => asset('packages/frozennode/administrator/js/jquery/jquery-ui-timepicker-addon.js'), 'ckfinder' => asset('/ckfinder/ckfinder.js'), 'ckeditor' => asset('packages/frozennode/administrator/js/ckeditor/ckeditor.js'), 'ckeditor-jquery' => asset('packages/frozennode/administrator/js/ckeditor/adapters/jquery.js'), 'markdown' => asset('packages/frozennode/administrator/js/markdown.js'), 'plupload' => asset('packages/frozennode/administrator/js/plupload/js/plupload.full.js'));
Example #7
0
<?php

defined('LARAVEL_START') or die('No direct script access allowed');
set_meta('GIFTWISHES::SKIN', 'skin-blue');
if (!App::bound('orchestra.avatar') && class_exists('Orchestra\\Avatar\\AvatarServiceProvider')) {
    App::register('Orchestra\\Avatar\\AvatarServiceProvider');
}
Example #8
0
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
use Whoops\Handler\Handler;
// Use the Laravel IoC to get the Whoops\Run instance, if whoops
// is available (which will be the case, by default, in the dev
// environment)
if (method_exists($app['whoops.handler'], 'setResourcesPath')) {
    $app['whoops.handler']->setResourcesPath(app_path() . '/utils/exception/resources');
}
if (App::bound("whoops")) {
    ob_start(function ($content) {
        return str_replace("\\n", "\n", preg_replace('#^<!DOCTYPE\\shtml>.+<!DOCTYPE\\shtml>#', '<!DOCTYPE html>', str_replace("\n", "\\n", $content)));
    });
}
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
Example #9
0
 protected function write(array $record)
 {
     if (\App::bound('console-connector-logger')) {
         app('console-connector-logger')->writeln(sprintf("[%s] %d: %s", $record['datetime']->format('Y-m-d H:i:s'), $record['level'], $record['message']));
     }
 }