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: /**
  4:  * Smarty Internal Plugin Compile Modifier
  5:  * Compiles code for modifier execution
  6:  *
  7:  * @package    Smarty
  8:  * @subpackage Compiler
  9:  * @author     Uwe Tews
 10:  */
 11: 
 12: /**
 13:  * Smarty Internal Plugin Compile Modifier Class
 14:  *
 15:  * @package    Smarty
 16:  * @subpackage Compiler
 17:  */
 18: class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
 19: {
 20:     /**
 21:      * Compiles code for modifier execution
 22:      *
 23:      * @param  array  $args      array with attributes from parser
 24:      * @param  object $compiler  compiler object
 25:      * @param  array  $parameter array with compilation parameter
 26:      *
 27:      * @return string compiled code
 28:      */
 29:     public function compile($args, $compiler, $parameter)
 30:     {
 31:         // check and get attributes
 32:         $_attr = $this->getAttributes($compiler, $args);
 33:         $output = $parameter['value'];
 34:         // loop over list of modifiers
 35:         foreach ($parameter['modifierlist'] as $single_modifier) {
 36:             $modifier = $single_modifier[0];
 37:             $single_modifier[0] = $output;
 38:             $params = implode(',', $single_modifier);
 39:             // check if we know already the type of modifier
 40:             if (isset($compiler->known_modifier_type[$modifier])) {
 41:                 $modifier_types = array($compiler->known_modifier_type[$modifier]);
 42:             } else {
 43:                 $modifier_types = array(1, 2, 3, 4, 5, 6);
 44:             }
 45:             foreach ($modifier_types as $type) {
 46:                 switch ($type) {
 47:                     case 1:
 48:                         // registered modifier
 49:                         if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
 50:                             $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
 51:                             if (!is_array($function)) {
 52:                                 $output = "{$function}({$params})";
 53:                             } else {
 54:                                 if (is_object($function[0])) {
 55:                                     $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
 56:                                 } else {
 57:                                     $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
 58:                                 }
 59:                             }
 60:                             $compiler->known_modifier_type[$modifier] = $type;
 61:                             break 2;
 62:                         }
 63:                         break;
 64:                     case 2:
 65:                         // registered modifier compiler
 66:                         if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
 67:                             $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);
 68:                             $compiler->known_modifier_type[$modifier] = $type;
 69:                             break 2;
 70:                         }
 71:                         break;
 72:                     case 3:
 73:                         // modifiercompiler plugin
 74:                         if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
 75:                             // check if modifier allowed
 76:                             if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
 77:                                 $plugin = 'smarty_modifiercompiler_' . $modifier;
 78:                                 $output = $plugin($single_modifier, $compiler);
 79:                             }
 80:                             $compiler->known_modifier_type[$modifier] = $type;
 81:                             break 2;
 82:                         }
 83:                         break;
 84:                     case 4:
 85:                         // modifier plugin
 86:                         if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
 87:                             // check if modifier allowed
 88:                             if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
 89:                                 $output = "{$function}({$params})";
 90:                             }
 91:                             $compiler->known_modifier_type[$modifier] = $type;
 92:                             break 2;
 93:                         }
 94:                         break;
 95:                     case 5:
 96:                         // PHP function
 97:                         if (is_callable($modifier)) {
 98:                             // check if modifier allowed
 99:                             if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {
100:                                 $output = "{$modifier}({$params})";
101:                             }
102:                             $compiler->known_modifier_type[$modifier] = $type;
103:                             break 2;
104:                         }
105:                         break;
106:                     case 6:
107:                         // default plugin handler
108:                         if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))) {
109:                             $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
110:                             // check if modifier allowed
111:                             if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
112:                                 if (!is_array($function)) {
113:                                     $output = "{$function}({$params})";
114:                                 } else {
115:                                     if (is_object($function[0])) {
116:                                         $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
117:                                     } else {
118:                                         $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
119:                                     }
120:                                 }
121:                             }
122:                             if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) {
123:                                 // was a plugin
124:                                 $compiler->known_modifier_type[$modifier] = 4;
125:                             } else {
126:                                 $compiler->known_modifier_type[$modifier] = $type;
127:                             }
128:                             break 2;
129:                         }
130:                 }
131:             }
132:             if (!isset($compiler->known_modifier_type[$modifier])) {
133:                 $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
134:             }
135:         }
136: 
137:         return $output;
138:     }
139: }
140: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen