Determines which view file should be used.
@param string $view view name (either 'exception' or 'error')
@param integer $code HTTP status code
@return string view file path
162999
protected function getViewFile($view,$code)
	{
		$viewPaths=array(
			Yii::app()->getTheme()===null ? null :  Yii::app()->getTheme()->getSystemViewPath(),
			Yii::app() instanceof CWebApplication ? Yii::app()->getSystemViewPath() : null,
			YII_PATH.DIRECTORY_SEPARATOR.'views',
		);

		foreach($viewPaths as $i=>$viewPath)
		{
			if($viewPath!==null)
			{
				 $viewFile=$this->getViewFileInternal($viewPath,$view,$code,$i===2?'en_us':null);
				 if(is_file($viewFile))
				 	 return $viewFile;
			}
		}
	}
1173682
private function prepareFilePath(string $file, bool $fileCheck = true): string
    {
        $file = str_replace(["\0", "\r", "\n"], '', trim($file));
        if ($file == '') {
            throw new ViewException('No valid file given');
        }

        // custom
        if ($file[0] == '.') {
            $fileCheck = false;
            if (!file_exists($file)) {
                throw new ViewException("Custom view file '{$file}' not found");
            }
        } elseif ($file[0] == '@') {
            // custom in default view folder
            $file = sprintf('%s/app/service/_default/view/%s.php', APP_DIR, substr($file, 1));
            $fileCheck = false;
            if (!file_exists($file)) {
                throw new ViewException("Default view file '{$file}' not found");
            }
        } else {
            $file = sprintf('%s/app/service/%s/view/%s.php', APP_DIR, $this->service->getName(), $file);
        }

        if ($fileCheck && !file_exists($file)) {
            // look up default folder
            if ($this->service->isDefaultService()) {
                $file = sprintf('%s/app/service/_default/%s/view/%s', APP_DIR,
                    $this->service->getName(), basename($file));
            }

            if (!file_exists($file)) {
                throw new ViewException("View file '{$file}' not found");
            }
        }

        return $file;
    }
1137141
public static function get($view, $data = array()){

        if( $data ){
            self::$level = self::$level + 1;
            self::$data[ self::$level ] = (array) $data;
        }

        $file = SRC. "{$view}.php";

        // Parse view
        ob_start();

            self::process($file);

            if( $data ){

                unset(self::$data[ self::$level ]);
                self::$level = self::$level - 1;
                self::process(NULL);

            }

            $view = ob_get_contents();

        ob_end_clean();

        return $view;
    }
1317625
public function path(string $view): string
    {
        if (File::exists($view))
        {
            return $view;
        }

        list($bundle, $path) = explode(':', $view, 2);

        return $this->folder($bundle, $path);
    }
444192
private function getView(array $view)
    {
        $view['is_read_only'] = $view['is_writable'] ? 0 : 1;
        $view['is_writable_label'] = $view['is_writable'] ? 'reset' : 'read only';
        $view['line'] = $view['line'] ? "({$view['line']})" : 0;
        $view['error'] = $view['error'] ? '' : '';
        $view['save_url'] = $this->saveUrl;
        $view['message'] = $this->message ? "<span class=\"error\">{$this->message}</span>" : '';

        return require __DIR__ . '/Editor/view.php';
    }
621541
protected function _getView()
	{
		if ($viewInstance = Registry::get('view')) {
			return $viewInstance;
		}

		$request = Agl::getRequest();
		$module  = $request->getModule();
		$view    = $request->getView();

		$viewPath = APP_PATH
                    . Agl::APP_PHP_DIR
                    . ViewInterface::APP_PHP_DIR
                    . DS
                    . $module
                    . DS
                    . $view
                    . Agl::PHP_EXT;

        if (file_exists($viewPath)) {
            $className    = $module . ucfirst($view) . ViewInterface::APP_VIEW_SUFFIX;
            $viewInstance = Agl::getInstance($className);
        } else {
            $viewInstance = new View();
        }

        $viewInstance->setFile($module . DS . $view);

        Registry::set('view', $viewInstance);

        return $viewInstance;
	}
1013510
public static function setView($view)
    {
        if (count(self::$execContexts)) {
            self::$execContexts[count(self::$execContexts) - 1]['view'] = $view;
        }
    }
6060
public function message($view) : string
  {
    $view = $this->getPath($view);
    $path = self::$views . $view . self::$extension;

    if (file_exists($path)) {
      return '<!--%' .base64_encode($view). '%-->' . PHP_EOL . file_get_contents($path);
    }
    else {
      throw new PartialNotFoundException($path);
    }
  }
350535
protected function parseView($view)
	{
		if (is_string($view)) return [$view, null, null];

		// If the given view is an array with numeric keys, we will just assume that
		// both a "pretty" and "plain" view were provided, so we will return this
		// array as is, since must should contain both views with numeric keys.
		if (is_array($view) && isset($view[0]))
		{
			return [$view[0], $view[1], null];
		}

		// If the view is an array, but doesn't contain numeric keys, we will assume
		// the the views are being explicitly specified and will extract them via
		// named keys instead, allowing the developers to use one or the other.
		elseif (is_array($view))
		{
			return [
				array_get($view, 'html'),
				array_get($view, 'text'),
				array_get($view, 'raw'),
			];
		}

		throw new InvalidArgumentException("Invalid view.");
	}
788096
public function view($view, $data = [])
    {
        $viewPath = self::$instance->app->findView($view);
        echo self::$instance->renderView($viewPath, $data);
    }
740072
public function findView($viewPath)
    {
        // Remove file extension for correct array searching
        $viewPath = str_replace(array('.php', '.vphp'), '', $viewPath);

        // Try to find passed view_path in  resources views collection
        if (sizeof($view = preg_grep('/' . addcslashes($viewPath, '/\\') . '(\.php|\.vphp)/ui', $this->views))) {
            // Sort view paths to get the shortest path
            usort($view, array($this, 'sortStrings'));

            // Set current full view path as last found view
            return end($view);
        }

        return false;
    }
542230
function findControllerForView ($viewName)
  {
    /** @var DocumentContext $this */
    $path = $this->viewService->resolveTemplatePath ($viewName, $base);
//    inspect ($viewName, $base, $path);
    if (isset($this->controllers[$path]))
      return $this->controllers[$path];

    foreach ($this->controllerNamespaces as $nsPath => $ns) {
//      inspect ($nsPath, $ns);
      if (str_beginsWith ($path, $nsPath)) {
        $remaining = substr ($path, strlen ($nsPath) + 1);
        $a         = PS ($remaining)->split ('/');
        $file      = $a->pop ();
        $nsPrefix  = $a->map ('ucfirst', false)->join ('\\')->S;
        $class     = ($p = strpos ($file, '.')) !== false
          ? ucfirst (substr ($file, 0, $p))
          : ucfirst ($file);
        $FQN       = PA ([$ns, $nsPrefix, $class])->prune ()->join ('\\')->S;
//        inspect ("CLASS $FQN");
        if (class_exists ($FQN))
          return $FQN;
      }
    }
//    inspect ("CLASS NOT FOUND FOR VIEW $viewName");
    return null;
  }
1188900
protected static function parseView($view)
    {
        if (is_string($view)) {
            return array($view, null);
        }

        // If the given view is an array with numeric keys, we will just assume that
        // both a "pretty" and "plain" view were provided, so we will return this
        // array as is, since must should contain both views with numeric keys.
        if (is_array($view) && (isset($view[0]) || isset($view[1]))) {
            return array(
                isset($view[0]) ? $view[0] : null,
                isset($view[1]) ? $view[1] : null,
            );
        }

        // If the view is an array, but doesn't contain numeric keys, we will assume
        // the the views are being explicitly specified and will extract them via
        // named keys instead, allowing the developers to use one or the other.
        elseif (is_array($view)) {
            return array(
                isset($view['html']) ? $view['html'] : null,
                isset($view['text']) ? $view['text'] : null,
            );
        }

        throw new \RuntimeException("Invalid view.");
    }
556117
public function filterTemplateInclude( $view ) {
		/** @var $wp_query \WP_Query */
		global $wp_query;

		$response = $this->handle( $this->request, [$view] );

		if ( $response instanceof ResponseInterface ) {
			if ( $response->getStatusCode() === 404 ) {
				$wp_query->set_404();
			}

			return WPEMERGE_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'view.php';
		}

		return $view;
	}
718436
public function findView($view)
	{
		$view = $this->viewFolder.DIRECTORY_SEPARATOR.ltrim($view, DIRECTORY_SEPARATOR);

		return $this->finder->findFileReversed($view);
	}
638812
public function getRequestedView()
	{
		if($this->_viewPath===null)
		{
			if(!empty($_GET[$this->viewParam]) && is_string($_GET[$this->viewParam]))
				$this->_viewPath=$_GET[$this->viewParam];
			else
				$this->_viewPath=$this->defaultView;
		}
		return $this->_viewPath;
	}
1019761
private function getViewUrl(View $view)
    {
        if (!method_exists($view, 'getUrl')) {
            return $this->generateUrl('victoire_business_template_show', ['id' => $view->getId()]);
        }

        /** @var ViewReference $viewReference */
        $viewReference = $this->container->get('victoire_view_reference.repository')
            ->getOneReferenceByParameters(['viewId' => $view->getId()]);

        $view->setReference($viewReference);

        return $this->generateUrl('victoire_core_page_show', ['url' => $viewReference->getUrl()]);
    }