ACC SHELL

Path : /srv/www/vhosts/tsisystem/app/
File Upload :
Current File : /srv/www/vhosts/tsisystem/app/app_model.php

<?php

/* SVN FILE: $Id: app_model.php,v 1.2 2006/06/14 22:58:54 mruch Exp $ */

/**
 * Application model for Cake.
 *
 * This file is application-wide model file. You can put all
 * application-wide model-related methods here.
 *
 * PHP versions 4 and 5
 *
 * CakePHP :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright (c)	2006, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright (c) 2006, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
 * @package			cake
 * @subpackage		cake.app
 * @since			CakePHP v 0.2.9
 * @version			$Revision: 1.2 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2006/06/14 22:58:54 $
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */

/**
 * Application model for Cake.
 *
 * Add your application-wide methods in the class below, your models
 * will inherit them.
 *
 * @package		cake
 * @subpackage	cake.app
 */
class AppModel extends Model{

    /**
     *
     */
    function __construct()
    {
        parent::__construct();
        global $__have_names;
        if (empty($__have_names)) {
            $this->query('set names latin2');
            $__have_names = 1;
        }
    }

    /**
     *
     */
    function defaultize($data)
    {
        foreach ($this->_tableInfo->extract('name') as $name) {
            if (! isset($data[$this->name][$name])) {
                $data[$this->name][$name] = NULL;
            }
        }
        return $data;
    }

    /**
     *
     */
    function _clearCache()
    {
        // Call it twice because filename of main page cache is ".php"
        clearCache();
        clearCache();
    }

    /**
     *
     */
    function _cleanHTML($data)
    {
        $data = preg_replace(
            '#(<p>\s*&nbsp;\s*</p>)+#i', '<p>&nbsp;</p>', $data
        );

        /* Strict XHTML/CSS <> TinyMCE formatting
         * - align
         */
        $data = preg_replace('/<(div|p)([^>]*)align="([^>]*?)"([^>]*)>/i',
            '<\\1\\2style="text-align: \\3"\\4>', $data
        );

        /* - images */
        $data = preg_replace('/<img([^>]*)align="([^>]*?)"([^>]*)>/i',
            '<img\\1class="st-\\2"\\3>', $data);

        return $data;
    }
}

?>

ACC SHELL 2018