Get XML content.

@access protected
@author Aleh Hutnikau, <hutnikau@1pt.com>
@param boolean $refresh load content again.
@return string
13542
public function getContent($refresh = false)
    {
        if ($this->content === null || $refresh) {
            try{
                switch ($this->sourceType) {
                    case self::SOURCE_FILE:
                        //check file
                        if(!file_exists($this->source)){
                            throw new Exception("File {$this->source} not found.");
                        }
                        if(!is_readable($this->source)){
                            throw new Exception("Unable to read file {$this->source}.");
                        }
                        if(!preg_match("/\.{$this->fileExtension}$/", basename($this->source))){
                            throw new Exception("Wrong file extension in ".basename($this->source).", {$this->fileExtension} extension is expected");
                        }
                        if(!tao_helpers_File::securityCheck($this->source)){
                            throw new Exception("{$this->source} seems to contain some security issues");
                        }
                        $this->content = file_get_contents($this->source);
                        break;
                    case self::SOURCE_URL:
                        //only same domain
                        if(!preg_match("/^".preg_quote(BASE_URL, '/')."/", $this->source)){
                            throw new Exception("The given uri must be in the domain {$_SERVER['HTTP_HOST']}");
                        }
                        $this->content = tao_helpers_Request::load($this->source, true);
                        break;
                    case self::SOURCE_STRING:
                        $this->content = $this->source;
                        break;
                    case self::SOURCE_FLYFILE:
                        if (! $this->source->exists()) {
                            throw new Exception('Source file does not exists ("' . $this->source->getBasename() . '").');
                        }
                        if (! $this->content = $this->source->read()) {
                            throw new Exception('Unable to read file ("' . $this->source->getBasename() . '").');
                        }
                        break;
                }
            } catch(Exception $e) {
                $this->addError($e);
            }
        }
        
        return $this->content;
    }
13557
public function getRefreshToken($refresh_token)
	{
		// create refresh token
		$token = \Components\Developer\Models\Refreshtoken::oneByToken($refresh_token);

		// make sure we have a token
		if (!$token->get('id'))
		{
			return false;
		}

		// make sure its a published token
		if (!$token->isPublished())
		{
			return false;
		}

		// get the application's client id
		$application = \Components\Developer\Models\Application::oneOrFail($token->get('application_id'));
		$token->set('client_id', $application->get('client_id'));

		// format expires to unix timestamp
		$token->set('expires', with(new Date($token->get('expires')))->toUnix());

		// return token
		return $token->toArray();
	}
179790
function get_xml()
    {
        // send output
        $out = '<?xml version="1.0" encoding="'.RCUBE_CHARSET.'"?><spellresult charschecked="'.mb_strlen($this->content).'">';

        foreach ((array)$this->matches as $item) {
            $out .= '<c o="'.$item[1].'" l="'.$item[2].'">';
            $out .= is_array($item[4]) ? implode("\t", $item[4]) : $item[4];
            $out .= '</c>';
        }

        $out .= '</spellresult>';

        return $out;
    }
116867
protected function getProjectStructureXml($project, $ref = null)
    {
        if(!$project instanceof Project){
            $project = $this->codex->projects->get($project);
        }

        $ref = $ref === null ? $project->refs->getDefaultName() : $ref;

        $xmlPath = path_join($ref, $project->config('phpdoc.xml_path'));
        return $project->getFiles()->get($xmlPath);
    }
884444
public function getAccessToken($refresh = false)
    {
        if ($this->_auth) {
            return $this->_auth->getToken($refresh)->access_token;
        } else {
            return null;
        }
    }
588286
protected function getLayoutData($reload = false)
	{
		if ($reload || !isset($this->layoutData[__CLASS__]))
		{
			$this->layoutData[__CLASS__] = $this->loadLayoutData();
		}

		return $this->layoutData[__CLASS__];
	}
558662
public function getFieldName($refresh = false)
    {
        if (!$this->fieldName || $refresh) {
            // Prevent double '/'
            $names = array_values(array_filter(explode('/', (string) $this->getName(true)), 'strlen'));

            $control = array_values(array_filter(explode('/', (string) $this->getControl()), 'strlen'));

            $names = array_merge($control, $names);

            $control = array_shift($names);

            $names = array_map(
                function ($value) {
                    return '[' . $value . ']';
                },
                $names
            );

            $this->fieldName = $control . implode('', $names);
        }

        return $this->fieldName;
    }
942156
public function getBrowserVersion($refresh = false)
    {
        if (empty($this->detection['browser']) || $refresh) {
            $this->detectBrowser($this->userAgent);
        }

        return $this->browserVersion;
    }
1193613
public function getDescription($default = false)
    {
        if (($ob = $this->_headers['content-description']) &&
            strlen($ob->value)) {
            return $ob->value;
        }

        return $default
            ? $this->getName()
            : '';
    }
98979
public function getOauthRefreshToken($refresh_token)
    {
        $appid = $this->config->get('appid');
        $url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$appid}&grant_type=refresh_token&refresh_token={$refresh_token}";
        return $this->httpGetForJson($url);
    }
300159
private function fetchSerpContent($url)
    {
        $file = FileSystemHelper::getCachedEntry($url, $this->getCacheDir());
        // check if we have a cache entry
        if ($this->cacheHit($url)) {
            return file_get_contents($file);
        }
        // fetch content
        $content = file_get_contents($url, self::SHD_USE_INCLUDE_PATH,
                                     self::SHD_CONTEXT, self::SHD_OFFSET);
        // add cache signature
        $content .= '<!-- cached: ' . time() . ' -->';
        file_put_contents($file, $content);
        // encode the string properly
        return utf8_encode($content);
    }
802715
public function getContent() {
		if ($this->_content === null) {
			$this->_content = [];

			foreach ($this->_xml->children() as $element) {
				$this->_content[] = new static($element);
			}
		}
		
		return $this->_content;
	}
699103
public function getXml() : ?string 
    {
        if ( ! $this->hasXml()) {
            $this->setXml($this->getDefaultXml());
        }
        return $this->xml;
    }
298231
public function getNodeContent($xPath){
        if ($this->content->xpath($xPath) !== null){
            return (string)trim(end($this->content->xpath($xPath)));
        }
        return false;
    }
762714
protected function getActualColumns($refresh = false)
  {
    if (is_null($this->actual_columns) || $refresh) {
      $m = $this->getManager();

      $q = 'SHOW COLUMNS FROM `' . $m->getPrefix() . $this->getTable() . '`';

      $this->actual_columns = false;

      if ($res = $m->query($q)->fetchAll(\PDO::FETCH_ASSOC)) {
        foreach ($res as $row) {
          $this->actual_columns[] = $row['Field'];
        }
      }
    }

    return $this->actual_columns;
  }
808030
public function getXMLContent()
    {
        if ($this->xmlContent === null) {
            try {
                if (($content = $this->getContent()) === '') {
                    return $this->xmlContent = false;
                }
                $errors = libxml_use_internal_errors(true);
                $this->xmlContent = new \SimpleXMLElement($content);
                libxml_use_internal_errors($errors);
            } catch (\Exception $E) {
                return $this->xmlContent = false;
            }
        }

        return $this->xmlContent;
    }
329321
public function getData ($forceRefresh = false) {
        if ($forceRefresh || $this->_data === null) {
            $this->_data = $this->getConnection ()->getSlave ()->zrange ($this->name , 0 , -1 , true);
        }
        return $this->_data;
    }