Render file

@param string $file
@return string
@throws \RuntimeException
437249
public function renderFile($file)
    {
        if (!is_file($file)) {
            throw new \RuntimeException(sprintf('View cannot render file "%s" does not exist', $file));
        }

        ob_start();
        ob_implicit_flush(false);

        require $file;
        return ob_get_clean();
    }
643387
public function draw(string $file, array $data) : string
    {
        $this->file = $file;
        $this->data = $data;

        return $this->getOutputs();
    }
232968
protected function loadFile($file)
    {
        if (!class_exists('zxf\Symfony\Component\Yaml\Parser')) {
            throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
        }

        if (!stream_is_local($file)) {
            throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file));
        }

        if (!file_exists($file)) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file));
        }

        if (null === $this->yamlParser) {
            $this->yamlParser = new YamlParser();
        }

        $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) {
            $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message;

            return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
        });

        try {
            $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
        } catch (ParseException $e) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
        } finally {
            restore_error_handler();
        }

        return $this->validate($configuration, $file);
    }
85098
public function render($file, $data = [])
    {
        $filepath = $this->findTemplateFile($file);
        extract($data);
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
124862
public function render(string $view): string
	{
		if(empty($this->viewFactory))
		{
			throw new RuntimeException('A [ ViewFactory ] instance is required to render pagination views.');
		}

		return $this->viewFactory->create($view, $this->pagination())->render();
	}
1182859
public static function fromFile(string $file) : DOMDocument
    {
        if (!is_file($file)) {
            throw new InvalidArgumentException(sprintf('Path "%s" is not a file', $file));
        }

        if (!is_readable($file)) {
            throw new InvalidArgumentException(sprintf('File "%s" is not readable', $file));
        }

        // libxml_disable_entity_loader(true) disables \DOMDocument::load() method
        // so we need to read the content and use \DOMDocument::loadXML()
        $xml = file_get_contents($file);
        if ($xml === false) {
            throw new RuntimeException(sprintf(
                'Contents of readable file "%s" could not be gotten',
                $file
            ));
        }

        if (trim($xml) === '') {
            throw new RuntimeException(sprintf('File "%s" does not have content', $file));
        }

        return static::fromString($xml);
    }
734158
protected function getFile($file)
    {
        $mapping = [
            '%environment%' => $this->runtime->getEnvironment(),
        ];

        if ($this->runtime->getHostName() !== null) {
            $mapping['%host%'] = $this->runtime->getHostName();
        }

        if ($this->runtime->getReleaseId() !== null) {
            $mapping['%release%'] = $this->runtime->getReleaseId();
        }

        $options = $this->getOptions();
        return str_replace(
            array_keys($mapping),
            array_values($mapping),
            $options[$file]
        );
    }
1034292
public static function render_file($file, $params = array(), $sandbox=false){

        $obj = new self();

        return $obj->file($file, $params, $sandbox);
    }
662545
public function parseFile($file, array $tokens = [])
    {
        $this->filePath = $file;
        $template = accioPath('resources/scripts/' . str_replace('.', '/', $this->filePath) . '.sh');

        if ($this->filesystem->exists($template)) {
            $this->parseString($this->filesystem->get($template), $tokens);
            return $this;
        }

        throw new RuntimeException('Template ' . $template . ' does not exist');
    }
1248360
public function render( $file, $response = "" ) {
		ob_start();
		include $file;

		self::$FullRender = ob_get_clean();
		$config           = $this->config;

		self::$FullRender = preg_replace_callback(
			array(
				'/(\\\)?' . addslashes( $this->config->get( 'template.open_tag' ) ) . '=?' . '/',
				'/(\\\)?' . addslashes( $this->config->get( 'template.close_tag' ) ) . '/'
			),
			function ( $s ) use ( $config ) {

				if ( isset( $s[0] ) ) {

					if ( isset( $s[1] ) && $s[1] == '\\' ) {
						return substr( $s[0], 1 );
					} elseif ( $s[0] == $this->config->get( 'template.open_tag' ) ) {
						return '<?php ';
					} elseif ( $s[0] == $this->config->get( 'template.open_tag' ) . '=' ) {
						return '<?php echo ';
					} elseif ( $s[0] == $this->config->get( 'template.close_tag' ) ) {
						return '?>';
					}

				}
			},
			self::$FullRender
		);

		self::$FullRender = str_replace(
			array( '@js', '@css' ),
			array( $this->assets->js->render(), $this->assets->css->render() ),
			self::$FullRender
		);

		if ( ! empty( $response ) ) {

			self::$FullRender = str_replace(
				array( '@yield', '@response' ),
				array( $response, $response ),
				self::$FullRender
			);

		}
		//--- END Replace Tag

		ob_start();
		eval( '?>' . self::$FullRender );
		self::$FullRender = ob_get_clean();

		return self::$FullRender;
	}
135440
private function doRender($file, $data)
    {
        $this->view_data               = array_merge($this->view_data, $data);
        if (is_array($file)) {
            foreach($file as $key => $val) {
                $this->section->set($key, $val);
            }
        }
        elseif(!$this->view_file = $this->getPath($file)) {
            return null;
        }
        else {
            $this->setContent($this->renderViewFile());
        }
        if (!isset($this->layout_file)) {
            return $this->section->get('content');
        }
        $layout              = clone($this);
        $layout->layout_file = null;
        return $layout->doRender($this->layout_file, $this->view_data);
    }
1155164
protected function renderFileInfo(File $file)
    {
        return \sprintf(
            '%s <span class="tl_gray">(%s%s)</span>',
            $file->path,
            static::getReadableSize($file->size),
            (($file->isGdImage || $file->isSvgImage) ? ', ' . $file->width . 'x' . $file->height . ' px' : '')
        );
    }
703822
public function render($file, $data) {
        $contents = file_get_contents($this->findView($file));

        return $this->engine->render($contents, $data);
    }
929635
public function render($file, $data = [])
    {
        if ($data instanceof \Traversable) {
            $data = iterator_to_array($data);
        }

        if (is_object($data)) {
            $data = get_object_vars($data);
        }

        return $this->getEngine()->make($file, (array) $data)->render();
    }
1196591
public function render($file = '')
    {
        $viewManager = $this->config->get('view_manager');

        if ($viewManager['template_path_stack']) {
            $file = $viewManager['template_path_stack'] . '/' . $file;
        }

        $fileInfo = pathinfo($file);
        if (! isset($fileInfo['extension']) || $fileInfo['extension'] != 'phtml') {
            $file = $file . '.phtml';
        }

        if (is_file($file)) {
            if (! headers_sent()) {
                header('X-Generator: JiNexus Framework');
            }

            ob_start();
            include $file;
            ob_end_flush();
        } else {
            throw new Exception('View not found');
        }
    }
233821
public function render()
    {
        if (!is_readable($this->template) || !is_file($this->template)) {
            throw new \RuntimeException('Cannot read template ' . $this->template);
        }

        ob_start();
        include $this->template;
        return ob_get_clean();
    }
507722
protected function render_file(): string
    {
        return '<input type="file" '.$this->metaString().
            ' id="'.$this->escape->attr($this->id).
            '" name="'.$this->escape->attr($this->name).'" />';
    }