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 Include PHP
  4:  * Compiles the {include_php} tag
  5:  *
  6:  * @package    Smarty
  7:  * @subpackage Compiler
  8:  * @author     Uwe Tews
  9:  */
 10: 
 11: /**
 12:  * Smarty Internal Plugin Compile Insert Class
 13:  *
 14:  * @package    Smarty
 15:  * @subpackage Compiler
 16:  */
 17: class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
 18: {
 19:     /**
 20:      * Attribute definition: Overwrites base class.
 21:      *
 22:      * @var array
 23:      * @see Smarty_Internal_CompileBase
 24:      */
 25:     public $required_attributes = array('file');
 26:     /**
 27:      * Attribute definition: Overwrites base class.
 28:      *
 29:      * @var array
 30:      * @see Smarty_Internal_CompileBase
 31:      */
 32:     public $shorttag_order = array('file');
 33:     /**
 34:      * Attribute definition: Overwrites base class.
 35:      *
 36:      * @var array
 37:      * @see Smarty_Internal_CompileBase
 38:      */
 39:     public $optional_attributes = array('once', 'assign');
 40: 
 41:     /**
 42:      * Compiles code for the {include_php} tag
 43:      *
 44:      * @param  array  $args     array with attributes from parser
 45:      * @param  object $compiler compiler object
 46:      *
 47:      * @throws SmartyException
 48:      * @return string compiled code
 49:      */
 50:     public function compile($args, $compiler)
 51:     {
 52:         if (!($compiler->smarty instanceof SmartyBC)) {
 53:             throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable");
 54:         }
 55:         // check and get attributes
 56:         $_attr = $this->getAttributes($compiler, $args);
 57: 
 58:         /** @var Smarty_Internal_Template $_smarty_tpl
 59:          * used in evaluated code
 60:          */
 61:         $_smarty_tpl = $compiler->template;
 62:         $_filepath = false;
 63:         eval('$_file = ' . $_attr['file'] . ';');
 64:         if (!isset($compiler->smarty->security_policy) && file_exists($_file)) {
 65:             $_filepath = $_file;
 66:         } else {
 67:             if (isset($compiler->smarty->security_policy)) {
 68:                 $_dir = $compiler->smarty->security_policy->trusted_dir;
 69:             } else {
 70:                 $_dir = $compiler->smarty->trusted_dir;
 71:             }
 72:             if (!empty($_dir)) {
 73:                 foreach ((array) $_dir as $_script_dir) {
 74:                     $_script_dir = rtrim($_script_dir, '/\\') . DS;
 75:                     if (file_exists($_script_dir . $_file)) {
 76:                         $_filepath = $_script_dir . $_file;
 77:                         break;
 78:                     }
 79:                 }
 80:             }
 81:         }
 82:         if ($_filepath == false) {
 83:             $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", $compiler->lex->taglineno);
 84:         }
 85: 
 86:         if (isset($compiler->smarty->security_policy)) {
 87:             $compiler->smarty->security_policy->isTrustedPHPDir($_filepath);
 88:         }
 89: 
 90:         if (isset($_attr['assign'])) {
 91:             // output will be stored in a smarty variable instead of being displayed
 92:             $_assign = $_attr['assign'];
 93:         }
 94:         $_once = '_once';
 95:         if (isset($_attr['once'])) {
 96:             if ($_attr['once'] == 'false') {
 97:                 $_once = '';
 98:             }
 99:         }
100: 
101:         if (isset($_assign)) {
102:             return "<?php ob_start(); include{$_once} ('{$_filepath}'); \$_smarty_tpl->assign({$_assign},ob_get_contents()); ob_end_clean();?>";
103:         } else {
104:             return "<?php include{$_once} ('{$_filepath}');?>\n";
105:         }
106:     }
107: }
108: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen