Configures static views
432628
function setupStaticViews() {
  
  var self = this;
  
  var staticPath = this.mvcpath + 'views/' + this.paths.static;
  var staticConfig = app.config.staticViews;
  var staticViewExt = staticConfig && staticConfig.defaultExtension && ('.' + staticConfig.defaultExtension.replace(/^\./, ''));
  var setEncoding = staticConfig && staticConfig.setEncoding;
  
  // Note: supports hot code reloading out of the box, because the internal
  // static view state is reset each time this function is called.
  
  this.views.static = [];
  
  this.views.staticAssoc = {};
  this.views.staticRaw = {};
  this.views.staticMime = {};
  this.views.staticExtOverride = {};
  
  var staticExtRaw = /\[(.*)\]\.raw$/;
  var staticExt = /\[(.*)\]$/;
  var staticRaw = /\.raw$/;
  
  if (fs.existsSync(staticPath)) {
    
    fileModule.walkSync(staticPath, function(dirPath, dirs, files) {
      for (var path,file,i=0; i < files.length; i++) {
        file = files[i];
        path = (dirPath + '/' + file).replace(/\/+/g, '/');
        path = self.relPath(path, 'app/views/' + self.paths.static.slice(0, -1));
        if (self.regex.templateFile.test(path)) self.views.static.push(path);
      }
    });
    
    // Associate static paths with their respective templates
    // For reference, see [STATIC_VIEW_EXTENSIONS]
    for (var ext, file, url, matches, i=0; i < this.views.static.length; i++) {
      ext = null;
      file = this.views.static[i];
      url = '/' + file.replace(this.regex.templateFile, '');
      if (staticExtRaw.test(url)) {
        matches = url.match(staticExtRaw); ext = matches[1];
        url = url.replace(staticExtRaw, '');
        if (ext) { // Ext can be empty because of file[].hbs
          url += ('.' + ext); // Add extension override
          this.views.staticMime[url] = mime.lookup(ext); // Use changed url (also set custom mime due to override)
          this.views.staticExtOverride[url] = ext; // Set static extension override
          this.views.staticRaw[url] = true; // Set to raw because of both extension override and .raw extension suffix
        }
      } else if (staticExt.test(url)) {
        matches = url.match(staticExt); ext = matches[1];
        url = url.replace(staticExt, '');
        if (ext) { // Ext can be empty because of file[].hbs
          url += ('.' + ext); // Add extension override
          this.views.staticMime[url] = mime.lookup(ext); // Use changed url (also set custom mime due to override)
          this.views.staticExtOverride[url] = ext; // Set static extension override
          this.views.staticRaw[url] = true; // Set to raw because of extension override in filename
        }
      } else if (staticRaw.test(url)) { // View doesnt' have extension
        url = url.replace(staticRaw, '');
        if (staticViewExt) {
          url += staticViewExt; // View has no ext, staticViewExt applies
          this.views.staticMime[url] = mime.lookup(staticViewExt);
        }
        this.views.staticRaw[url] = true; // Set to raw because of filename
      } else if (staticViewExt) {
        // NOTE: View is not set to raw, it uses the default content type and raw settings in config
        url += staticViewExt; // View has no ext, staticViewExt applies
        this.views.staticMime[url] = mime.lookup(staticViewExt); // Use changed url
      }
      // If url is not modified at this stage, use default content type
      this.views.staticAssoc[url] = file;
    }
    
  }
  
  // Emit static views init event
  this.emit('static_views_loaded', this.views); // Emit regardless
  
}
164429
public static function setViewContext($context = null)
    {
        if ($context === null) {
            $context = self::get(self::get('app.views.context_param', 'format'), 
                                self::get('app.views.default_context', 'html'), 
                                self::get('request'));
        }
        
        self::set('app.view_context', $context);
        
        if (($viewContextParams = self::get("app.views.contexts.$context", false)) !== false) {
            if ($viewContextParams['layout'] !== true) {
                self::set('app.layout', $viewContextParams['layout']);
            }
            header('Content-type: ' . 
                self::get('content_type', 'text/html', $viewContextParams));
        }
    }
505434
function initViews () {
    // list of views - may be empty
    this.modelViews = []
    // if view is false no model views will be applied overriding any defaults
    if (this.args.view === false) {
        return
    }
    // get view from args or default
    var viewArg = defined(this.args.view) ? this.args.view : this.model.views.default
    // skip unless view arg is set from args or default
    if (!defined(viewArg)) {
        return
    }
    // list of views to apply to model
    var views
    // if view is string then convert to array
    if (typeof viewArg === 'string') {
        views = [viewArg]
    }
    // if view is array use it
    else if (Array.isArray(viewArg)) {
        views = viewArg
    }
    // invalid argument
    else {
        throw this.error('invalid view argument')
    }
    // iterate over views getting model view objects
    _.each(views, view => {
        var modelView = requireValidModelView(view, this.model.views, true)
        // if result is array then add all
        if (Array.isArray(modelView)) {
            _.each(modelView, modelView => this.modelViews.push(modelView))
        }
        // otherwise add object
        else {
            this.modelViews.push(modelView)
        }
    })
    // instantiate model view engine if there are views
    if (this.modelViews.length > 0) {
        this.modelViewEngine = new ImmutableCoreModelViewEngine({query: this})
    }
}
887623
protected function resetViewPaths()
    {
        $viewFinder = $this->app->make('view.finder');

        $paths = $viewFinder->getPaths();

        foreach ($this->getThemePaths() as $themePath) {
            ($paths[0] === $themePath) && array_shift($paths);
        }

        $viewFinder->setPaths($paths);
    }
1220442
protected function overrideViews()
    {
        $dir = Str::snake($this->controllerName());
        $path = base_path('resources/views/admin/').$dir;
        app('view')->prependNamespace('decoy', $path);
    }
482017
public function setView() {
        if (!is_string($this->action) || empty($this->action)) {
            $errMessage = 'The action value must be a string and not be empty';
            throw new \InvalidArgumentException($errMessage, GeneralErrors::VALUE_IS_NOT_OF_EXPECTED_TYPE);
        }
        if (\Puzzlout\Framework\Core\Request::Init($this->app)->IsPost()) {
            //No view needed for Ajax calls.
            return;
        }
        $this->view = \Puzzlout\Framework\Core\ViewLoader::Init($this)->GetView();
        $this->page->setContentFile($this->view);
    }
807772
function(viewConf, localRessource) {
        if (!viewConf) {
            self.throwError(500, 'No views configuration found. Did you try to add views before using Controller::render(...) ? Try to run: ./gina.sh -av '+options.conf.bundle)
        }

        var res     = '',
            tmpRes  = {},
            css     = {
                media   : "screen",
                rel     : "stylesheet",
                type    : "text/css",
                content : []
            },
            cssStr  = ' ',
            js      = {
                type    : "text/javascript",
                content : []
            },
            jsStr   = ' ',
            exclude  = null;

        //intercept errors in case of malformed config
        if ( typeof(viewConf) != "object" ) {
            cssStr  = viewConf;
            jsStr   = viewConf
        }


        //cascading merging
        if (localRessource !== 'default') {
            if ( typeof(viewConf[localRessource]) != 'undefined') {

                var noneDefaultJs   = (viewConf[localRessource]['javascripts']) ? JSON.parse(JSON.stringify(viewConf[localRessource]['javascripts'])) : [] ;
                var noneDefaultCss  = (viewConf[localRessource]['stylesheets']) ? JSON.parse(JSON.stringify(viewConf[localRessource]['stylesheets'])) : [] ;

                viewConf[localRessource] = merge(viewConf.default, viewConf[localRessource]);

                if ( viewConf[localRessource]["javascriptsExclude"] ) {

                    if ( Array.isArray(viewConf[localRessource]["javascriptsExclude"]) && !/(all|\*)/.test(viewConf[localRessource]["javascriptsExclude"][0]) || typeof(viewConf[localRessource]["javascriptsExclude"]) == 'string' && !/(all|\*)/.test(viewConf[localRessource]["javascriptsExclude"]) ) {

                        for (var i = 0, len = viewConf.default['javascripts'].length; i<len; ++i) {
                            if ( viewConf.default['javascripts'] && viewConf[localRessource]['javascripts'].indexOf(viewConf.default['javascripts'][i]) ) {
                                viewConf[localRessource]['javascripts'].splice(viewConf[localRessource]['javascripts'].indexOf(viewConf.default['javascripts'][i]), 1)
                            }
                        }
                    } else {// else means that we exclude all default
                        viewConf[localRessource]['javascripts'] = noneDefaultJs;
                    }
                }

                if ( viewConf[localRessource]["stylesheetsExclude"] ) {

                    if ( Array.isArray(viewConf[localRessource]["stylesheetsExclude"]) && !/(all|\*)/.test(viewConf[localRessource]["stylesheetsExclude"][0]) || typeof(viewConf[localRessource]["stylesheetsExclude"]) == 'string' && !/(all|\*)/.test(viewConf[localRessource]["stylesheetsExclude"]) ) {

                        for (var i = 0, len = viewConf.default['stylesheets'].length; i<len; ++i) {
                            if ( viewConf.default['stylesheets'] && viewConf[localRessource]['javascripts'].indexOf(viewConf.default['javascripts'][i]) ) {
                                viewConf[localRessource]['stylesheets'].splice(viewConf[localRessource]['javascripts'].indexOf(viewConf.default['javascripts'][i]), 1)
                            }
                        }
                    } else {// else means that we exclude all default
                        viewConf[localRessource]['stylesheets'] = noneDefaultJs;
                    }
                }


            } else {
                viewConf[localRessource] = viewConf.default
            }
        }

        //Get css
        if( viewConf[localRessource]["stylesheets"] ) {
            tmpRes  = getNodeRes('css', cssStr, viewConf[localRessource]["stylesheets"], css);

            cssStr  = tmpRes.cssStr;
            css     = tmpRes.css;
            tmpRes  = null
        }
        //Get js
        if( viewConf[localRessource]["javascripts"] ) {
            tmpRes  = getNodeRes('js', jsStr, viewConf[localRessource]["javascripts"], js);

            jsStr   = tmpRes.jsStr;
            js      = tmpRes.js;
            tmpRes  = null
        }

        set('page.stylesheets', cssStr);
        set('page.scripts', jsStr)
    }
712878
public function setViewLayout($view)
    {
        $this->layout         = $this->viewLayout->change($view);
        $this->layout->layout = $this->viewPath->setUp($this->layout->layout, null);
    }
1250573
private function generateViews()
    {
        $viewInstance = View::instance($this);
        $viewInstance->setLayoutType($this->viewType);
        $viewTemplateDir = dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Views'.DS;
        $viewInstance->setTableColumns($this->columns);
        $viewInstance->setViewTemplatePath($viewTemplateDir);

        // generate twig template layout if type has set via user
        if ($this->viewType == 'php') {
            // Type not set then we will generate php layout
            $viewInstance->generateLayout('layouts');
        } else {
            $viewInstance->generateLayout('layouts.main');
        }

        $viewInstance->generateViews();

        $this->info(
            'Views Generated In '.str_replace('Controller', '', $this->controller).' Directory..'
        );
    }
815219
protected function _configure() {

			// Create my settings object
			$this->config = new Core\Configuration();
			
			// Define some paths
			define("CHICKENWIRE_PATH", dirname(__FILE__));
			define("APP_PATH", APP_ROOT . "/Application");
			define("CONFIG_PATH", APP_PATH . "/Config");
			define("CONTROLLER_PATH", APP_PATH . "/Controllers");
			define("LAYOUT_PATH", APP_PATH . "/Layouts");
			define("MODEL_PATH", APP_PATH . "/Models");
			define("VIEW_PATH", APP_PATH . "/Views");
			define("PUBLIC_PATH", APP_PATH . "/Public");
			define("MODULE_PATH", APP_ROOT . "/Modules");

			define("MODEL_NS", $this->config->applicationNamespace . "\\Models");

			// Include all php files in the config directory
			$dh = opendir(CONFIG_PATH);
			$configFiles = scandir(CONFIG_PATH, SCANDIR_SORT_ASCENDING);
			foreach ($configFiles as $file) {

				// PHP?
				if (preg_match("/\.php$/", $file)) {

					// Load it
					$this->config->load(CONFIG_PATH . '/' . $file);
					
				}

			}

			// Initalize database configuration
			$dbConnections = $this->config->allFor("database");
			$environment = $this->config->environment;
			\ActiveRecord\Config::initialize(function($config) use ($dbConnections, $environment) {

				// Set model path
				$config->setModelDirectory(MODEL_PATH);

				// Apply connections
				$config->setConnections($dbConnections);

				// Set default to my environment
				$config->setDefaultConnection($environment);

			});

			// Set the timezone
			if ($this->config->timezone == '') {
				throw new \Exception("You need to specify the timezone in the Application configuration.", 1);				
			}
			date_default_timezone_set($this->config->timezone);

			// Set self closing slash
			\HtmlObject\Traits\Tag::$useSelfClosingSlash = $this->config->htmlSelfClosingSlash;

			// Set the webPath
			$this->config->webPath = rtrim($this->config->webPath, ' /');

		}
370480
function configure() {
        server.use(config.assets ? config.assets : '/assets', express.static(`${app.root}/views/assets`))

        server.use(bodyparser.json({ limit: config.body_parser_limit }))
        server.use(bodyparser.urlencoded({
            parameterLimit: 10000,
            limit: config.body_parser_limit,
            extended: true
        }))

        if (config.session) {
            server.use(session({
                secret: config.session_secret,
                store: new redisStore({
                    host: config.session_redis_host || 'localhost',
                    port: config.session_redis_port || 6379,
                    client: redis.createClient()
                }),
                resave: false,
                saveUninitialized: true
            }))
        }

        server.set('views', `${app.root}/views`)
        server.set('view engine', 'twig')

    }
237759
protected function setupLayout()
    {
        if (isset($this->layout) && !is_null($this->layout)) {
            $data = array();

            // Enter here data that have to be accessible everywhere
            $this->layout = View::make($this->layout, $data);
        }
    }
355883
static function Init()
	{
		require_once 'verysimple/Phreeze/Controller.php';
		require_once 'verysimple/HTTP/RequestUtil.php';

		if (!self::$IS_INITIALIZED)
		{
			RequestUtil::NormalizeUrlRewrite();

			Controller::$SmartyViewPrefix = '';
			Controller::$DefaultRedirectMode = 'header';

			self::$IS_INITIALIZED = true;
		}

	}
740602
public static function requireView() : void
  {
    $medusa = new Medusa(self::$viewsEngine);

    $medusa->setCacheDirectory(self::$viewsCache);
    $medusa->setViewsDirectory(self::$viewsDirectory);
    $medusa->setViewsExtension(self::$viewsExtension);

    $medusa->register(Partial::class);
    $medusa->register(Using::class);
    $medusa->register(Csrf::class);
    $medusa->register(ConfigToJsonString::class);

    if (class_exists(DirectivesResolver::class)) {
      (new DirectivesResolver)->start([
        'view' => $medusa
      ]);
    }

    self::$viewComponent = $medusa;
  }
414871
protected function setupLayout()
    {
        if ( ! is_null($this->layout))
        {
            $this->layout = View::make($this->layout);
        }
    }
1072892
private static function view()
    {
        $files = ['View'];
        $folder = static::$root.'MVC/View'.'/';

        self::call($files, $folder);

        $files = ['Template', 'Views'];
        $folder = static::$root.'MVC/View/Libs'.'/';

        self::call($files, $folder);

        $files = ['ViewNotFoundException'];
        $folder = static::$root.'MVC/View/Exceptions'.'/';

        self::call($files, $folder);
    }
872443
private void setupStyles() {
        TypedArray styledAttributes = obtainStyledAttributes(R.style.PinLock, R.styleable.PinLock);

        final int layoutBackground = styledAttributes.getColor(R.styleable.PinLock_backgroundColor, Color.WHITE);
        View layout = findViewById(R.id.pinLockLayout);
        layout.setBackgroundColor(layoutBackground);

        final int cancelForgotTextSize = styledAttributes.getInt(R.styleable.PinLock_cancelForgotTextSize, 20);
        cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
        forgetButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);


        final int cancelForgotTextColor = styledAttributes.getColor(R.styleable.PinLock_cancelForgotTextColor, Color.BLACK);
        cancelButton.setTextColor(cancelForgotTextColor);
        if(forgetButton.isEnabled()) {
            forgetButton.setTextColor(cancelForgotTextColor);
        } else {
            forgetButton.setTextColor(Color.parseColor("#a9abac"));
        }

        final int infoTextSize = styledAttributes.getInt(R.styleable.PinLock_infoTextSize, 20);
        final int infoTextColor = styledAttributes.getColor(R.styleable.PinLock_infoTextColor, Color.BLACK);
        label.setTextSize(TypedValue.COMPLEX_UNIT_SP, infoTextSize);
        label.setTextColor(infoTextColor);
    }