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 Print Expression
  4:  * Compiles any tag which will output an expression or variable
  5:  *
  6:  * @package    Smarty
  7:  * @subpackage Compiler
  8:  * @author     Uwe Tews
  9:  */
 10: 
 11: /**
 12:  * Smarty Internal Plugin Compile Print Expression Class
 13:  *
 14:  * @package    Smarty
 15:  * @subpackage Compiler
 16:  */
 17: class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase
 18: {
 19:     /**
 20:      * Attribute definition: Overwrites base class.
 21:      *
 22:      * @var array
 23:      * @see Smarty_Internal_CompileBase
 24:      */
 25:     public $optional_attributes = array('assign');
 26:     /**
 27:      * Attribute definition: Overwrites base class.
 28:      *
 29:      * @var array
 30:      * @see Smarty_Internal_CompileBase
 31:      */
 32:     public $option_flags = array('nocache', 'nofilter');
 33: 
 34:     /**
 35:      * Compiles code for generating output from any expression
 36:      *
 37:      * @param array  $args      array with attributes from parser
 38:      * @param object $compiler  compiler object
 39:      * @param array  $parameter array with compilation parameter
 40:      *
 41:      * @throws SmartyException
 42:      * @return string compiled code
 43:      */
 44:     public function compile($args, $compiler, $parameter)
 45:     {
 46:         // check and get attributes
 47:         $_attr = $this->getAttributes($compiler, $args);
 48:         // nocache option
 49:         if ($_attr['nocache'] === true) {
 50:             $compiler->tag_nocache = true;
 51:         }
 52:         if (isset($_attr['assign'])) {
 53:             // assign output to variable
 54:             $output = "<?php \$_smarty_tpl->assign({$_attr['assign']},{$parameter['value']});?>";
 55:         } else {
 56:             // display value
 57:             $output = $parameter['value'];
 58:             // tag modifier
 59:             if (!empty($parameter['modifierlist'])) {
 60:                 $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], 'value' => $output));
 61:             }
 62:             if (!$_attr['nofilter']) {
 63:                 // default modifier
 64:                 if (!empty($compiler->smarty->default_modifiers)) {
 65:                     if (empty($compiler->default_modifier_list)) {
 66:                         $modifierlist = array();
 67:                         foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
 68:                             preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
 69:                             for ($i = 0, $count = count($mod_array[0]); $i < $count; $i ++) {
 70:                                 if ($mod_array[0][$i] != ':') {
 71:                                     $modifierlist[$key][] = $mod_array[0][$i];
 72:                                 }
 73:                             }
 74:                         }
 75:                         $compiler->default_modifier_list = $modifierlist;
 76:                     }
 77:                     $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output));
 78:                 }
 79:                 // autoescape html
 80:                 if ($compiler->template->smarty->escape_html) {
 81:                     $output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
 82:                 }
 83:                 // loop over registered filters
 84:                 if (!empty($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE])) {
 85:                     foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key => $function) {
 86:                         if (!is_array($function)) {
 87:                             $output = "{$function}({$output},\$_smarty_tpl)";
 88:                         } elseif (is_object($function[0])) {
 89:                             $output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
 90:                         } else {
 91:                             $output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
 92:                         }
 93:                     }
 94:                 }
 95:                 // auto loaded filters
 96:                 if (isset($compiler->smarty->autoload_filters[Smarty::FILTER_VARIABLE])) {
 97:                     foreach ((array) $compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name) {
 98:                         $result = $this->compile_output_filter($compiler, $name, $output);
 99:                         if ($result !== false) {
100:                             $output = $result;
101:                         } else {
102:                             // not found, throw exception
103:                             throw new SmartyException("Unable to load filter '{$name}'");
104:                         }
105:                     }
106:                 }
107:                 if (isset($compiler->template->variable_filters)) {
108:                     foreach ($compiler->template->variable_filters as $filter) {
109:                         if (count($filter) == 1 && ($result = $this->compile_output_filter($compiler, $filter[0], $output)) !== false) {
110:                             $output = $result;
111:                         } else {
112:                             $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => array($filter), 'value' => $output));
113:                         }
114:                     }
115:                 }
116:             }
117: 
118:             $compiler->has_output = true;
119:             $output = "<?php echo {$output};?>";
120:         }
121: 
122:         return $output;
123:     }
124: 
125:     /**
126:      * @param object $compiler compiler object
127:      * @param string $name     name of variable filter
128:      * @param string   $output   embedded output
129:      *
130:      * @return string
131:      */
132:     private function compile_output_filter($compiler, $name, $output)
133:     {
134:         $plugin_name = "smarty_variablefilter_{$name}";
135:         $path = $compiler->smarty->loadPlugin($plugin_name, false);
136:         if ($path) {
137:             if ($compiler->template->caching) {
138:                 $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;
139:                 $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;
140:             } else {
141:                 $compiler->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;
142:                 $compiler->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;
143:             }
144:         } else {
145:             // not found
146:             return false;
147:         }
148: 
149:         return "{$plugin_name}({$output},\$_smarty_tpl)";
150:     }
151: }
152: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen