/*!
\static
Sets whether templates usage statistics enabled or not.
\return \c true if templates usage statistics was enabled, otherwise \c false.
420783
function setIsTemplatesUsageStatisticsEnabled( $enabled )
    {
        $wasEnabled = false;
        if( isset( $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'] ) )
            $wasEnabled = $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'];

        $GLOBALS['eZTemplateDebugTemplatesUsageStatisticsEnabled'] = $enabled;
        return $wasEnabled;
    }
1220702
public function setCreateAccountTemplate()
    {
        $templateId = $this->organization->getCreateAccountTemplate();
        if ($templateId) {
            $this->setTemplate($this->organization->getCreateAccountTemplate());
            return true;
        } elseif ($this->project->getEmailCreateAccount()) {
            $this->setTemplateByCode($this->project->getEmailCreateAccount());
            return true;
        } else {
            return false;
        }
    }
1092222
public static function template_viewed($templateorid) {
        static::require_enabled();
        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }

        // First we do a permissions check.
        if (!$template->can_read()) {
            throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview',
                'nopermissions', '');
        }

        // Trigger a template viewed event.
        \core\event\competency_template_viewed::create_from_template($template)->trigger();

        return true;
    }
1055342
public function isUsage()
    {
        $options = array('help', 'usage', 'option.h');
        foreach ($options as $option) {
            if ($this->request->get($option)) return true;
        }
        return false;
    }
1139107
public static function isEnabled()
      {
          $ini = eZINI::instance( 'squid.ini' );

          if ( $ini->hasSection( 'Squid' )
                && $ini->hasVariable( 'Squid', 'PurgeCacheOnPublish' )
                    && $ini->variable( 'Squid', 'PurgeCacheOnPublish' ) == 'enabled' )
          {
              return true;
          }
          else
          {
              return false;
          }
      }
1289154
protected function checkTemplateFile($canUseFlexforms = false)
    {
        if (TYPO3_MODE === 'BE') {
            return;
        }

        $this->checkForNonEmptyString(
            'templateFile',
            $canUseFlexforms,
            's_template_special',
            'This value specifies the HTML template which is essential when ' .
            'creating any output from this extension.'
        );

        if (($this->getFrontEndController() !== null)
            && $this->objectToCheck->hasConfValueString('templateFile', 's_template_special')
        ) {
            $rawFileName = $this->objectToCheck->getConfValueString(
                'templateFile',
                's_template_special',
                true
            );
            if (!is_file($this->getFrontEndController()->tmpl->getFileName($rawFileName))) {
                $message = 'The specified HTML template file <strong>'
                    . htmlspecialchars($rawFileName)
                    . '</strong> cannot be read. '
                    . 'The HTML template file is essential when creating any '
                    . 'output from this extension. '
                    . 'Please either create the file <strong>' . $rawFileName
                    . '</strong> or select an existing file using the TS setup '
                    . 'variable <strong>' . $this->getTSSetupPath()
                    . 'templateFile</strong>';
                if ($canUseFlexforms) {
                    $message .= ' or via FlexForms';
                }
                $message .= '.';
                $this->setErrorMessage($message);
            }
        }
    }
287007
public function enabled(string $for = ''): bool
    {
        global $wp_markdown_extra;
        $mde = $wp_markdown_extra;

        $for = $for === 'posts' || $for === 'comments' ? $for : 'posts';
        return $mde && $mde->s::getOption($for.'_enable');
    }
422965
public static function SetTemplates ($templates = []) {
		if (gettype(static::$templates) == 'array') {
			static::$templates = (array) $templates;
		} else {
			static::$templates = (object) $templates;
		}
		return static::$templates;
	}
592710
protected function _isPaginationEnabled()
    {
        if (!isset($this->controller->limits) ||
            !isset($this->controller->limits[$this->action]) ||
            !isset($this->controller->limits[$this->action]['default']) ||
            !isset($this->controller->limits[$this->action]['limits'])
        ) {
            return false;
        }

        return true;
    }
427578
def template_exists(template_name):
    '''
    
    '''
    try:
        template.loader.get_template(template_name)
        return True
    except template.TemplateDoesNotExist:
        return False
1127056
static function isXHTMLCodeIncluded()
    {
        if ( !isset( $GLOBALS['eZTemplateDebugXHTMLCodeEnabled'] ) )
        {
            $ini = eZINI::instance();
            $GLOBALS['eZTemplateDebugXHTMLCodeEnabled'] = $ini->variable( 'TemplateSettings', 'ShowXHTMLCode' ) == 'enabled';
        }
        return $GLOBALS['eZTemplateDebugXHTMLCodeEnabled'];
    }
1215944
function appendTemplateToStatistics( $templateName, $templateFileName )
    {
        $actualTemplateName = preg_replace( "#^[\w/]+templates/#", '', $templateFileName );
        $requestedTemplateName = preg_replace( "#^[\w/]+templates/#", '', $templateName );

        $tpl = eZTemplate::instance();
        $needToAppend = true;

        // don't add template info if it is a duplicate of previous.
        $statsSize = count( $tpl->TemplatesUsageStatistics );
        if ( $statsSize > 0 )
        {
            $lastTemplateInfo = $tpl->TemplatesUsageStatistics[$statsSize-1];
            if ( $lastTemplateInfo['actual-template-name'] === $actualTemplateName &&
                 $lastTemplateInfo['requested-template-name'] === $requestedTemplateName &&
                 $lastTemplateInfo['template-filename'] === $templateFileName )
            {
                $needToAppend = false;
            }
        }

        if ( $needToAppend )
        {
            $templateInfo = array( 'actual-template-name' => $actualTemplateName,
                                   'requested-template-name' => $requestedTemplateName,
                                   'template-filename' => $templateFileName );

            $tpl->TemplatesUsageStatistics[] = $templateInfo;
        }
    }
570943
public function onParseTemplate(Template $template): void
    {
        if (!$this->environment->isEnabled()) {
            return;
        }

        $this->initialize();
        if ($this->isAutoMappingDisabled($template->getName())) {
            return;
        }

        $templateName = $this->getMappedTemplateName($template->getName());
        if ($templateName) {
            $template->setName($templateName);
        }
    }
730079
void enableStatistics(boolean enabled) {
    requireNotClosed();

    synchronized (configuration) {
      if (enabled) {
        JmxRegistration.registerMXBean(this, statistics, MBeanType.Statistics);
      } else {
        JmxRegistration.unregisterMXBean(this, MBeanType.Statistics);
      }
      statistics.enable(enabled);
      configuration.setStatisticsEnabled(enabled);
    }
  }
388541
static function isCommentsEnabled()
    {
        if ( isset( $GLOBALS['eZTemplateCompilerSettings']['comments'] ) and
             $GLOBALS['eZTemplateCompilerSettings']['comments'] !== null )
        {
            return $GLOBALS['eZTemplateCompilerSettings']['comments'];
        }

        $ini = eZINI::instance();
        $commentsEnabled = $ini->variable( 'TemplateSettings', 'CompileComments' ) == 'enabled';
        return $commentsEnabled;
    }
1254881
public function isLoaded($name)
    {
        $name = $this->_formatName($name);
        if ($this->_useStaticRegistry) {
            return isset(self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name]);
        }

        return isset($this->_loadedPlugins[$name]);
    }
23370
public function isTrustedModifier($modifier_name, $compiler)
    {
        // check for internal always allowed modifier
        if (in_array($modifier_name, array('default'))) {
            return true;
        }
        // check security settings
        if (empty($this->allowed_modifiers)) {
            if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {
                return true;
            } else {
                $compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null, true);
            }
        } elseif (in_array($modifier_name, $this->allowed_modifiers) &&
            !in_array($modifier_name, $this->disabled_modifiers)
        ) {
            return true;
        } else {
            $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null, true);
        }

        return false; // should not, but who knows what happens to the compiler in the future?
    }