Load the JSON extract tpl data into a PHP array.

@param string $tpl A valid stream or file location for the tpl.

@return array An array of the tpl data.
506706
protected function loadTpl($tpl)
    {
        $this->tplBase = $this->request->args('tplBase') ? $this->request->args('tplBase') : dirname($tpl);
        $content = file_get_contents($tpl);
        $this->prepareTpl($content);
        return json_decode($content, true);
    }
145539
public function display($tpl = null)
	{
		$result = $this->loadTemplate($tpl);

		if ($result instanceof Exception)
		{
			return $result;
		}

		echo $result;
	}
265786
public static function getFieldsWithAllData($tbl): array
    {
        if (isset(self::$_cached_tbl_fields[$tbl])) {
            return self::$_cached_tbl_fields[$tbl];
        }

        return self::$_cached_tbl_fields = self::q_assoc_id("SHOW FIELDS FROM `$tbl`");
    }
938932
public function load($file,$ttl)
	{
		$cache = \Cache::instance();
		$cacheHash = $this->getCacheHash($file);
		if ($this->f3->get('CACHE') && $ttl && ($cached = $cache->exists(
			$cacheHash, $content)) && $cached + $ttl > microtime(TRUE)
		) {
			$this->data = $content;
		} elseif ($this->fs->exists($metaFile = $this->getMetaFilePath($file))) {
			$this->data = json_decode($this->fs->read($metaFile), true);
			if ($this->f3->get('CACHE') && $ttl)
				$cache->set($cacheHash, $this->data, $ttl);
		}
		return $this->data;
	}
608604
private static function _load_file() {
		$t_array = file( __DIR__ . '/../../data/domains.txt' );
		$t_result_array = array();

		foreach ( $t_array as $t_line ) {
			$t_entry = trim( $t_line );
			if ( empty( $t_entry ) ) {
				continue;
			}

			# Exclude commented lines
			if ( strpos( $t_entry, '#' ) === 0 ) {
				continue;
			}

			$t_domain = strtolower( $t_entry );
			$t_result_array[$t_domain] = true;
		}

		return $t_result_array;
	}
463613
protected function loadFile($path)
    {
        $composerJson = $this->fileData($path);

        return (null === $composerJson) ? null : (array) \json_decode($composerJson, true);
    }
415197
public function parse($line)
    {
        if( !is_string($line) || strlen($line) === 0) {
            return array();
        }
        preg_match($this->pattern, $line, $data);
        if (!isset($data['date'])) {
            return array();
        }

        preg_match('/(.*)- Trace:(.*)/', $data['message'], $matches);
        if (is_array($matches) && isset($matches[1])) {
            $data['message'] = trim($matches[1]);
            $data['trace'] = trim($matches[2]);
        }

        return array(
            'date' => \DateTime::createFromFormat('Y-m-d H:i:s', $data['date']),
            'logger' => $data['logger'],
            'level' => $data['level'],
            'message' => $data['message'],
            'trace' => isset($data['trace']) ? $this->parseTrace($data['trace']) : null,
            'context' => json_decode($data['context'], true),
            'extra' => json_decode($data['extra'], true)
        );
    }
451366
public function fetch($tplFile, $data)
    {
        foreach ($data as $key => $value) {
            $this->_data[$key] = $value;
        }

        $Controller = $this->router['controller'] ?: 'Home';
        $Mothed = $this->router['mothed'] ?: "Index";

        $tplFile = $tplFile ? ucfirst($tplFile) : ucfirst($Mothed);
        $this->_viewPath = $this->_tplDir . ucfirst($Controller) . '/' . $tplFile . '.php';

        unset($tplFile);
        extract($this->_data);

        ob_start(); //开启缓冲区
        include $this->_viewPath;
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
193743
public function renderTemplate($tpl, array $render_vars) {
    $registry = new Registry();
    $loader = new \Twig_Loader_Filesystem($registry->templateDirs());
    $twig = new \Twig_Environment($loader, array(
      'cache' => sys_get_temp_dir() . '/drutiny/cache',
      'auto_reload' => TRUE,
    ));
    // $filter = new \Twig_SimpleFilter('filterXssAdmin', [$this, 'filterXssAdmin'], [
    //   'is_safe' => ['html'],
    // ]);
    // $twig->addFilter($filter);
    $template = $twig->load($tpl . '.html.twig');
    $contents = $template->render($render_vars);
    return $contents;
  }
813884
function jsonSerialize(): \stdClass {
    return (object) [
      'found' => $this->getFound(),
      'hit' => $this->getHit(),
      'data' => array_map(function(LineData $item) {
        return $item->jsonSerialize();
      }, $this->getData()->getArrayCopy())
    ];
  }
600740
private function parseJsonFile(string $file): array
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException("$file is not a file");
        }

        $json = json_decode(file_get_contents($file), true);

        if (null === $json) {
            throw new \RuntimeException("File $file cannot be decoded");
        }

        return $json;
    }
1287730
protected function _setTpl($tpl)
    {
        $this->_tpl = $tpl;

        if ($tpl === true) {
            $this->_tpl = self::TPL_WRAP;
        }

        if ($tpl === false) {
            $this->_tpl = self::TPL_DEFAULT;
        }
    }
853007
public function render($tpl, array $data = [], $status = null)
    {
        $vitex = Vitex::getInstance();
        $vitex->render($tpl, $data, $status);
    }
232127
public function fromJson(string $json): array
    {
        if (!$this->isEmptyValue($json)) {

            if ($decode = json_decode(trim($json), true) and json_last_error() == JSON_ERROR_NONE)
                $this->result = $decode;
            else
                $this->setError(json_last_error(), json_last_error_msg());
        }

        return $this->result;
    }
1290730
public function display($tpl = null)
	{
		$this->state         = $this->get('State');
		$this->items         = $this->get('Items');
		$this->pagination    = $this->get('Pagination');
		$this->assoc         = $this->get('Assoc');
		$this->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');

		// Check for errors.
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		// Preprocess the list of items to find ordering divisions.
		foreach ($this->items as &$item)
		{
			$this->ordering[$item->parent_id][] = $item->id;
		}

		// Levels filter - Used in Hathor.
		$this->f_levels = array(
			JHtml::_('select.option', '1', JText::_('J1')),
			JHtml::_('select.option', '2', JText::_('J2')),
			JHtml::_('select.option', '3', JText::_('J3')),
			JHtml::_('select.option', '4', JText::_('J4')),
			JHtml::_('select.option', '5', JText::_('J5')),
			JHtml::_('select.option', '6', JText::_('J6')),
			JHtml::_('select.option', '7', JText::_('J7')),
			JHtml::_('select.option', '8', JText::_('J8')),
			JHtml::_('select.option', '9', JText::_('J9')),
			JHtml::_('select.option', '10', JText::_('J10')),
		);

		// We don't need toolbar in the modal window.
		if ($this->getLayout() !== 'modal')
		{
			$this->addToolbar();
			$this->sidebar = JHtmlSidebar::render();
		}
		else
		{
			// In article associations modal we need to remove language filter if forcing a language.
			if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD'))
			{
				// If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
				$languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
				$this->filterForm->setField($languageXml, 'filter', true);

				// Also, unset the active language filter so the search tools is not open by default with this filter.
				unset($this->activeFilters['language']);
			}
		}

		return parent::display($tpl);
	}
1009295
protected function fetchReply($rpl)
  {
    foreach($rpl as $key => $val)
    {
      if($val->startsWith(TeamSpeak3::TS3_MOTD_PREFIX) || $val->startsWith(TeamSpeak3::TEA_MOTD_PREFIX) || (defined("CUSTOM_MOTD_PREFIX") && $val->startsWith(CUSTOM_MOTD_PREFIX)))
      {
        unset($rpl[$key]);
      }
      elseif($val->startsWith(TeamSpeak3::EVENT))
      {
        $this->evt[] = new TeamSpeak3_Adapter_ServerQuery_Event($rpl[$key], $this->con);
        unset($rpl[$key]);
      }
    }

    $this->rpl = new TeamSpeak3_Helper_String(implode(TeamSpeak3::SEPARATOR_LIST, $rpl));
  }
969804
private function loadIndexFile(string $indexFilepath): array
    {
        $this->status = IndexInterface::STATUS_LOADED;
        return \unserialize(\file_get_contents($indexFilepath));
    }