Sources for file plugins/class/smarty.php in version 4.0 Beta 1



Click on a comment to hide it. Click here to show all comments.

/**
 * Project:     Xnyo 4: Bubbles
 * File:        plugins/class/smarty.php
 *
 * Version:     4.0-dev
 * SVN Id:      $Id: smarty.php 5 2007-05-18 03:49:07Z bok $
 * SVN URL:     $HeadURL:
http://svn.syd.wholesalebroadband.com.au/xnyo/trunk/plugins/class/smarty.php $
 * Authors:     Robert Amos <bok[at]odynia.org>
 *
 * Copyright (c) 2001-2007 Robert Amos <bok[at]odynia.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/

/**
 * This file extends the Smarty Template Engine to use our plugin directories
 * and the {$xnyo} template variable.
**/

class XnyoSmarty extends Smarty implements XnyoClassPlugin
{
    
// Plugin Information
    
public $_plugin_info = array
    (
        
'name' => 'Xnyo Smarty Plugin',
        
'description' => 'Loads the Smarty Template Engine',
        
'action' => XNYO_PLUGIN_ACTION_GLOBAL,
        
'varname' => 'smarty'
    
);
    
    
/**
     * Constructor
    **/
    
private $xnyo;
    public function 
__construct()
    {
        
$this->xnyo $GLOBALS['xnyo_parent'];

        
// update the smarty plugin directories
        
$this->xnyo->plugins->update_smarty_dir($this);
        
        
// update the {$xnyo} variable
        
$this->xnyo->smartyvar->init($this);

        
/**
         * Default settings change
        **/
        
if (XNYO_DEBUG$this->xnyo->d('Changing default smarty settings.');

        
// reset the template dir
        
if (defined('SMARTY_TEMPLATE_DIR'))
            
$this->template_dir SMARTY_TEMPLATE_DIR;

        
// and the compile dir
        
if (defined('SMARTY_COMPILE_DIR'))
            
$this->compile_dir SMARTY_COMPILE_DIR;
        
        
// and the cache dir!
        
if (defined('SMARTY_CACHE_DIR'))
            
$this->cache_dir SMARTY_CACHE_DIR;

        
// and sub-directories are so much quicker
        
$this->use_sub_dirs true;

        
// Speed hacks for Smarty development/production modes
        
if (XNYO_PRODUCTION)
        {
            
// we're in production mode!
            
            // in production mode templates shouldn't change, no need
            // to check for it
            
$this->compile_check false;
            
            
// should never ever force a recompile
            
$this->force_compile false;
        } else
        {
            
// in development mode, speed isn't necessary, but having things
            // easy to check on is
            
$this->compile_check true;
        }

        
// call the Smarty Constructor
        
parent::Smarty();
    }

}

Website is Copyright © Odynia.org 2000-2005 - Xnyo is released under a BSD license.