Craft\SeomaticController::actionRenderHumans PHP Method

actionRenderHumans() public method

* -------------------------------------------------------------------------------- Render the humans.txt template --------------------------------------------------------------------------------
public actionRenderHumans ( array $variables = [] )
$variables array
    public function actionRenderHumans(array $variables = array())
    {
        $templatePath = '';
        $locale = '';
        if (!$locale) {
            $locale = craft()->language;
        }
        $metaVars = craft()->seomatic->getGlobals('', $locale);
        /* -- Tell Twig not to escape at all for this text template */
        $twig = craft()->templates->getTwig();
        $escaper = $twig->getExtension('escaper');
        $escaper->setDefaultStrategy(false);
        if ($templatePath) {
            $htmlText = craft()->templates->render($templatePath);
        } else {
            $oldPath = method_exists(craft()->templates, 'getTemplatesPath') ? craft()->templates->getTemplatesPath() : craft()->path->getTemplatesPath();
            $newPath = craft()->path->getPluginsPath() . 'seomatic/templates';
            method_exists(craft()->templates, 'setTemplatesPath') ? craft()->templates->setTemplatesPath($newPath) : craft()->path->setTemplatesPath($newPath);
            /* -- Render the core template */
            $templateName = '_humans';
            $this->renderTemplate($templateName, $metaVars);
            method_exists(craft()->templates, 'setTemplatesPath') ? craft()->templates->setTemplatesPath($oldPath) : craft()->path->setTemplatesPath($oldPath);
        }
    }