HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: /home/mmickelson/theflexguy.com/wp-content/themes/vanilla/PHPTAL/Php/Attribute/I18N/Source.php
<?php

require_once PHPTAL_DIR.'PHPTAL/Php/Attribute.php';

// i18n:source
//
// The i18n:source attribute specifies the language of the text to be 
// translated. The default is "nothing", which means we don't provide 
// this information to the translation services.
//

/**
 * @package phptal.php.attribute.i18n
 */
class PHPTAL_Php_Attribute_I18N_Source extends PHPTAL_Php_Attribute
{
    public function start()
    {
        // ensure that a sources stack exists or create it
        $this->tag->generator->doIf('!isset($__i18n_sources)');
        $this->tag->generator->pushCode('$__i18n_sources = array()');
        $this->tag->generator->end();

        // push current source and use new one
        $code = '$__i18n_sources[] = $_translator->setSource(\'%s\')';
        $code = sprintf($code, $this->expression);
        $this->tag->generator->pushCode($code);
    }

    public function end()
    {
        // restore source
        $code = '$_translator->setSource(array_pop($__i18n_sources))';
        $this->tag->generator->pushCode($code);
    }
}

?>