Get a theme variable

@param string $var
@param bool $default
@return string
6394
public function themeVarFunc($var, $default = null)
    {
        $header = $this->grav['page']->header();
        $header_classes = $header->{$var} ?? null;

        return $header_classes ?: $this->config->get('theme.' . $var, $default);
    }
1272177
public function configTheme($key = null, $default = null)
    {
        if (!isset($key)) {
            return $this->theme_settings;
        }

        $value = gplcart_array_get($this->theme_settings, $key);
        return isset($value) ? $value : $default;
    }
271928
public static function get($key, $default = null)
    {
        static $variables;

        if ($variables === null) {
            $variables = (new DotenvFactory([new EnvConstAdapter, new PutenvAdapter, new ServerConstAdapter]))->createImmutable();
        }

        return Option::fromValue($variables->get($key))
                     ->map(function ($value) {
                         switch (strtolower($value)) {
                             case 'true':
                             case '(true)':
                                 return true;
                             case 'false':
                             case '(false)':
                                 return false;
                             case 'empty':
                             case '(empty)':
                                 return '';
                             case 'null':
                             case '(null)':
                                 return;
                         }

                         if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) {
                             return $matches[2];
                         }

                         return $value;
                     })
                     ->getOrCall(function () use ($default) {
                         return value($default);
                     });
    }
1276902
public function getCookie($varname, $default = false)
    {
        if(isset($this->cookievars[$varname])) {
            return $this->cookievars[$varname]['value'];
        } else {
            return $default;
        }
    }
523578
public function render($template, $variables, $default = false)
    {
        if ($default) {
            $template = $this->homeService->defaultTemplate($template);
        }

        return new Response($this->templating->render($template, $variables));
    }
1027753
public function get($var)
    {
        $node = $this->mainNode->getByKey($var);
        if (empty($node)) return null;

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

        return $default
            ? $this->getName()
            : '';
    }
117892
private static function getPhpVariableAsText($var)
    {
        if (is_string($var)) {
            return('"'.str_replace(array("\x00", "\x0a", "\x0d", "\x1a", "\x09"), array('\0', '\n', '\r', '\Z', '\t'), $var).'"');
        } elseif (is_int($var) || is_float($var)) {
            return($var);
        } elseif (is_bool($var)) {
            if ($var) {
                return('true');
            } else {
                return('false');
            }
        } elseif (is_array($var)) {
            $result = 'array( ';
            $comma = '';
            foreach ($var as $key => $val) {
                $result .= $comma.self::getPhpVariableAsText($key).' => '.self::getPhpVariableAsText($val);
                $comma = ', ';
            }
            $result .= ' )';

            return($result);
        } elseif (is_object($var)) {
            return 'Object '.get_class($var);
        } elseif (is_resource($var)) {
            return 'Resource '.get_resource_type($var);
        }

        return 'Unknown type variable';
    }
50338
public function getState($var, $default = null)
	{
		$key = str_replace('\\', '.', $this->getModelNamespace()) . '.' . $this->getModelName() . ".{$var}";
		return \User::getState($key, $default);
	}
109259
protected function getDataCss($variable)
    {
        $css = [
            'padding'               => '7px',
            'background-color'      => $this->zebra ? '#D8D9DB' : '#FFF',
            'color'                 => '#405261',
        ];

        $type = gettype($variable);
        if ($type == 'NULL') {
            $css['color'] = '#999';
        }

        return $this->arrayToCss($css);
    }
328591
public function template($var = null)
    {
        if ($var !== null) {
            $this->template = $var;
        }
        if (empty($this->template)) {
            $this->template = ($this->modular() ? 'modular/' : '') . str_replace($this->extension(), '', $this->name());
        }

        return $this->template;
    }
37049
public function post($varname, $default = false)
	{
		if(isset($this->postvars[$varname])) {
			return $this->postvars[$varname];
		} else {
			return $default;
		}
	}
795276
public static function header(string $variable, $default=null) {
		return isset(self::$_headers[$variable])
			? self::$_headers[$variable]
			: $default;
	}
1133070
public function getSession($varname, $default = false)
    {
        if(isset($this->sessionvars[$varname])) {
            return $this->sessionvars[$varname];
        } else {
            return $default;
        }
    }
180797
public static function get( $var, $key, $default = null ) {

		if( $key === null )
			return $var;
		elseif( isset($var->$key) )
			return $var->$key;
		elseif( isset($var[$key]) )
			return $var[$key];
		else
			return $default;

	}
1372331
protected function getClassAttribute($var, $type = 'class')
    {
        $status = trim(( $type === 'class' ? $this->classAttribute : $this->styleAttribute) . $this->{$type}[$var]);

        return $this->createAttribute($status, $type);
    }
1067526
public function metadata($var = null)
    {
        if ($var !== null) {
            $this->metadata = (array)$var;
        }

        // if not metadata yet, process it.
        if (null === $this->metadata) {
            $header_tag_http_equivs = ['content-type', 'default-style', 'refresh', 'x-ua-compatible'];

            $this->metadata = [];

            $metadata = [];
            // Set the Generator tag
            $metadata['generator'] = 'GravCMS';

            // Get initial metadata for the page
            $metadata = array_merge($metadata, Grav::instance()['config']->get('site.metadata'));

            if (isset($this->header->metadata)) {
                // Merge any site.metadata settings in with page metadata
                $metadata = array_merge($metadata, $this->header->metadata);
            }

            // Build an array of meta objects..
            foreach ((array)$metadata as $key => $value) {
                // Lowercase the key
                $key = strtolower($key);
                // If this is a property type metadata: "og", "twitter", "facebook" etc
                // Backward compatibility for nested arrays in metas
                if (is_array($value)) {
                    foreach ($value as $property => $prop_value) {
                        $prop_key = $key . ':' . $property;
                        $this->metadata[$prop_key] = [
                            'name' => $prop_key,
                            'property' => $prop_key,
                            'content' => htmlspecialchars($prop_value, ENT_QUOTES, 'UTF-8')
                        ];
                    }
                } else {
                    // If it this is a standard meta data type
                    if ($value) {
                        if (\in_array($key, $header_tag_http_equivs, true)) {
                            $this->metadata[$key] = [
                                'http_equiv' => $key,
                                'content' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
                            ];
                        } elseif ($key === 'charset') {
                            $this->metadata[$key] = ['charset' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')];
                        } else {
                            // if it's a social metadata with separator, render as property
                            $separator = strpos($key, ':');
                            $hasSeparator = $separator && $separator < strlen($key) - 1;
                            $entry = [
                                'content' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
                            ];

                            if ($hasSeparator && !Utils::startsWith($key, 'twitter')) {
                                $entry['property'] = $key;
                            } else {
                                $entry['name'] = $key;
                            }

                            $this->metadata[$key] = $entry;
                        }
                    }
                }
            }
        }

        return $this->metadata;
    }