Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 1: <?php
 2: /**
 3:  * Smarty Internal Plugin Compile Assign
 4:  * Compiles the {assign} tag
 5:  *
 6:  * @package    Smarty
 7:  * @subpackage Compiler
 8:  * @author     Uwe Tews
 9:  */
10: 
11: /**
12:  * Smarty Internal Plugin Compile Assign Class
13:  *
14:  * @package    Smarty
15:  * @subpackage Compiler
16:  */
17: class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
18: {
19:     /**
20:      * Compiles code for the {assign} tag
21:      *
22:      * @param  array  $args      array with attributes from parser
23:      * @param  object $compiler  compiler object
24:      * @param  array  $parameter array with compilation parameter
25:      *
26:      * @return string compiled code
27:      */
28:     public function compile($args, $compiler, $parameter)
29:     {
30:         // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
31:         $this->required_attributes = array('var', 'value');
32:         $this->shorttag_order = array('var', 'value');
33:         $this->optional_attributes = array('scope');
34:         $_nocache = 'null';
35:         $_scope = Smarty::SCOPE_LOCAL;
36:         // check and get attributes
37:         $_attr = $this->getAttributes($compiler, $args);
38:         // nocache ?
39:         if ($compiler->tag_nocache || $compiler->nocache) {
40:             $_nocache = 'true';
41:             // create nocache var to make it know for further compiling
42:             if (isset($compiler->template->tpl_vars[trim($_attr['var'], "'")])) {
43:                 $compiler->template->tpl_vars[trim($_attr['var'], "'")]->nocache = true;
44:             } else {
45:                 $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true);
46:             }
47:         }
48:         // scope setup
49:         if (isset($_attr['scope'])) {
50:             $_attr['scope'] = trim($_attr['scope'], "'\"");
51:             if ($_attr['scope'] == 'parent') {
52:                 $_scope = Smarty::SCOPE_PARENT;
53:             } elseif ($_attr['scope'] == 'root') {
54:                 $_scope = Smarty::SCOPE_ROOT;
55:             } elseif ($_attr['scope'] == 'global') {
56:                 $_scope = Smarty::SCOPE_GLOBAL;
57:             } else {
58:                 $compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno);
59:             }
60:         }
61:         // compiled output
62:         if (isset($parameter['smarty_internal_index'])) {
63:             $output = "<?php \$_smarty_tpl->createLocalArrayVariable($_attr[var], $_nocache, $_scope);\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value$parameter[smarty_internal_index] = $_attr[value];";
64:         } else {
65:             // implement Smarty2's behaviour of variables assigned by reference
66:             if ($compiler->template->smarty instanceof SmartyBC) {
67:                 $output = "<?php if (isset(\$_smarty_tpl->tpl_vars[$_attr[var]])) {\$_smarty_tpl->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
68:                 $output .= "\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value = $_attr[value]; \$_smarty_tpl->tpl_vars[$_attr[var]]->nocache = $_nocache; \$_smarty_tpl->tpl_vars[$_attr[var]]->scope = $_scope;";
69:                 $output .= "\n} else \$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);";
70:             } else {
71:                 $output = "<?php \$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);";
72:             }
73:         }
74:         if ($_scope == Smarty::SCOPE_PARENT) {
75:             $output .= "\nif (\$_smarty_tpl->parent != null) \$_smarty_tpl->parent->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
76:         } elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) {
77:             $output .= "\n\$_ptr = \$_smarty_tpl->parent; while (\$_ptr != null) {\$_ptr->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]]; \$_ptr = \$_ptr->parent; }";
78:         }
79:         if ($_scope == Smarty::SCOPE_GLOBAL) {
80:             $output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
81:         }
82:         $output .= '?>';
83: 
84:         return $output;
85:     }
86: }
87: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen