helper.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: helper.php 8146 2009-04-16 18:12:01Z renan.saddam $ */
00003 /**
00004  * Backend for helpers.
00005  *
00006  * Internal methods for the Helpers.
00007  *
00008  * PHP versions 4 and 5
00009  *
00010  * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
00011  * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
00012  *
00013  * Licensed under The MIT License
00014  * Redistributions of files must retain the above copyright notice.
00015  *
00016  * @filesource
00017  * @copyright     Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
00018  * @link          http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
00019  * @package       cake
00020  * @subpackage    cake.cake.libs.view
00021  * @since         CakePHP(tm) v 0.2.9
00022  * @version       $Revision: 8146 $
00023  * @modifiedby    $LastChangedBy: renan.saddam $
00024  * @lastmodified  $Date: 2009-04-16 14:12:01 -0400 (Thu, 16 Apr 2009) $
00025  * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
00026  */
00027 /**
00028  * Included libs
00029  */
00030 App::import('Core', 'Overloadable');
00031 
00032 /**
00033  * Backend for helpers.
00034  *
00035  * Long description for class
00036  *
00037  * @package       cake
00038  * @subpackage    cake.cake.libs.view
00039  */
00040 class Helper extends Overloadable {
00041 /**
00042  * List of helpers used by this helper
00043  *
00044  * @var array
00045  */
00046     var $helpers = null;
00047 /**
00048  * Base URL
00049  *
00050  * @var string
00051  */
00052     var $base = null;
00053 /**
00054  * Webroot path
00055  *
00056  * @var string
00057  */
00058     var $webroot = null;
00059 /**
00060  * Theme name
00061  *
00062  * @var string
00063  */
00064     var $themeWeb = null;
00065 /**
00066  * URL to current action.
00067  *
00068  * @var string
00069  */
00070     var $here = null;
00071 /**
00072  * Parameter array.
00073  *
00074  * @var array
00075  */
00076     var $params = array();
00077 /**
00078  * Current action.
00079  *
00080  * @var string
00081  */
00082     var $action = null;
00083 /**
00084  * Plugin path
00085  *
00086  * @var string
00087  */
00088     var $plugin = null;
00089 /**
00090  * POST data for models
00091  *
00092  * @var array
00093  */
00094     var $data = null;
00095 /**
00096  * List of named arguments
00097  *
00098  * @var array
00099  */
00100     var $namedArgs = null;
00101 /**
00102  * URL argument separator character
00103  *
00104  * @var string
00105  */
00106     var $argSeparator = null;
00107 /**
00108  * Contains model validation errors of form post-backs
00109  *
00110  * @access public
00111  * @var array
00112  */
00113     var $validationErrors = null;
00114 /**
00115  * Holds tag templates.
00116  *
00117  * @access public
00118  * @var array
00119  */
00120     var $tags = array();
00121 /**
00122  * Holds the content to be cleaned.
00123  *
00124  * @access private
00125  * @var mixed
00126  */
00127     var $__tainted = null;
00128 /**
00129  * Holds the cleaned content.
00130  *
00131  * @access private
00132  * @var mixed
00133  */
00134     var $__cleaned = null;
00135 /**
00136  * Default overload methods
00137  *
00138  * @access protected
00139  */
00140     function get__($name) {}
00141     function set__($name, $value) {}
00142     function call__($method, $params) {
00143         trigger_error(sprintf(__('Method %1$s::%2$s does not exist', true), get_class($this), $method), E_USER_WARNING);
00144     }
00145 
00146 /**
00147  * Parses tag templates into $this->tags.
00148  *
00149  * @param $name file name
00150  * @return array merged tags from config/$name.php
00151  */
00152     function loadConfig($name = 'tags') {
00153         if (file_exists(CONFIGS . $name .'.php')) {
00154             require(CONFIGS . $name .'.php');
00155             if (isset($tags)) {
00156                 $this->tags = array_merge($this->tags, $tags);
00157             }
00158         }
00159         return $this->tags;
00160     }
00161 /**
00162  * Finds URL for specified action.
00163  *
00164  * Returns an URL pointing to a combination of controller and action. Param
00165  * $url can be:
00166  *  + Empty - the method will find adress to actuall controller/action.
00167  *  + '/' - the method will find base URL of application.
00168  *  + A combination of controller/action - the method will find url for it.
00169  *
00170  * @param  mixed  $url    Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4"
00171  *                        or an array specifying any of the following: 'controller', 'action',
00172  *                        and/or 'plugin', in addition to named arguments (keyed array elements),
00173  *                        and standard URL arguments (indexed array elements)
00174  * @param boolean $full   If true, the full base URL will be prepended to the result
00175  * @return string  Full translated URL with base path.
00176  */
00177     function url($url = null, $full = false) {
00178         return h(Router::url($url, $full));
00179     }
00180 /**
00181  * Checks if a file exists when theme is used, if no file is found default location is returned
00182  *
00183  * @param  string  $file
00184  * @return string  $webPath web path to file.
00185  */
00186     function webroot($file) {
00187         $webPath = "{$this->webroot}" . $file;
00188         if (!empty($this->themeWeb)) {
00189             $os = env('OS');
00190             if (!empty($os) && strpos($os, 'Windows') !== false) {
00191                 if (strpos(WWW_ROOT . $this->themeWeb  . $file, '\\') !== false) {
00192                     $path = str_replace('/', '\\', WWW_ROOT . $this->themeWeb  . $file);
00193                 }
00194             } else {
00195                 $path = WWW_ROOT . $this->themeWeb  . $file;
00196             }
00197             if (file_exists($path)) {
00198                 $webPath = "{$this->webroot}" . $this->themeWeb . $file;
00199             }
00200         }
00201         if (strpos($webPath, '//') !== false) {
00202             return str_replace('//', '/', $webPath);
00203         }
00204         return $webPath;
00205     }
00206 
00207 /**
00208  * Used to remove harmful tags from content
00209  *
00210  * @param mixed $output
00211  * @return cleaned content for output
00212  * @access public
00213  */
00214     function clean($output) {
00215         $this->__reset();
00216         if (empty($output)) {
00217             return null;
00218         }
00219         if (is_array($output)) {
00220             foreach ($output as $key => $value) {
00221                 $return[$key] = $this->clean($value);
00222             }
00223             return $return;
00224         }
00225         $this->__tainted = $output;
00226         $this->__clean();
00227         return $this->__cleaned;
00228     }
00229 /**
00230  * Returns a space-delimited string with items of the $options array. If a
00231  * key of $options array happens to be one of:
00232  *  + 'compact'
00233  *  + 'checked'
00234  *  + 'declare'
00235  *  + 'readonly'
00236  *  + 'disabled'
00237  *  + 'selected'
00238  *  + 'defer'
00239  *  + 'ismap'
00240  *  + 'nohref'
00241  *  + 'noshade'
00242  *  + 'nowrap'
00243  *  + 'multiple'
00244  *  + 'noresize'
00245  *
00246  * And its value is one of:
00247  *  + 1
00248  *  + true
00249  *  + 'true'
00250  *
00251  * Then the value will be reset to be identical with key's name.
00252  * If the value is not one of these 3, the parameter is not output.
00253  *
00254  * @param  array  $options Array of options.
00255  * @param  array  $exclude Array of options to be excluded.
00256  * @param  string $insertBefore String to be inserted before options.
00257  * @param  string $insertAfter  String to be inserted ater options.
00258  * @return string
00259  */
00260     function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
00261         if (is_array($options)) {
00262             $options = array_merge(array('escape' => true), $options);
00263 
00264             if (!is_array($exclude)) {
00265                 $exclude = array();
00266             }
00267             $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape')));
00268             $values = array_intersect_key(array_values($options), $keys);
00269             $escape = $options['escape'];
00270             $attributes = array();
00271 
00272             foreach ($keys as $index => $key) {
00273                 $attributes[] = $this->__formatAttribute($key, $values[$index], $escape);
00274             }
00275             $out = implode(' ', $attributes);
00276         } else {
00277             $out = $options;
00278         }
00279         return $out ? $insertBefore . $out . $insertAfter : '';
00280     }
00281 /**
00282  * @param  string $key
00283  * @param  string $value
00284  * @return string
00285  * @access private
00286  */
00287     function __formatAttribute($key, $value, $escape = true) {
00288         $attribute = '';
00289         $attributeFormat = '%s="%s"';
00290         $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');
00291         if (is_array($value)) {
00292             $value = '';
00293         }
00294 
00295         if (in_array($key, $minimizedAttributes)) {
00296             if ($value === 1 || $value === true || $value === 'true' || $value == $key) {
00297                 $attribute = sprintf($attributeFormat, $key, $key);
00298             }
00299         } else {
00300             $attribute = sprintf($attributeFormat, $key, ($escape ? h($value) : $value));
00301         }
00302         return $attribute;
00303     }
00304 /**
00305  * Sets this helper's model and field properties to the dot-separated value-pair in $entity.
00306  *
00307  * @param mixed $entity A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName"
00308  * @param boolean $setScope Sets the view scope to the model specified in $tagValue
00309  * @return void
00310  */
00311     function setEntity($entity, $setScope = false) {
00312         $view =& ClassRegistry::getObject('view');
00313 
00314         if ($setScope) {
00315             $view->modelScope = false;
00316         } elseif (join('.', $view->entity()) == $entity) {
00317             return;
00318         }
00319 
00320         if ($entity === null) {
00321             $view->model = null;
00322             $view->association = null;
00323             $view->modelId = null;
00324             $view->modelScope = false;
00325             return;
00326         }
00327 
00328         $model = $view->model;
00329         $sameScope = $hasField = false;
00330         $parts = array_values(Set::filter(explode('.', $entity), true));
00331 
00332         if (empty($parts)) {
00333             return;
00334         }
00335 
00336         if (count($parts) === 1 || is_numeric($parts[0])) {
00337             $sameScope = true;
00338         } else {
00339             if (ClassRegistry::isKeySet($parts[0])) {
00340                 $model = $parts[0];
00341             }
00342         }
00343 
00344         if (ClassRegistry::isKeySet($model)) {
00345             $ModelObj =& ClassRegistry::getObject($model);
00346             for ($i = 0; $i < count($parts); $i++) {
00347                 if ($ModelObj->hasField($parts[$i]) || array_key_exists($parts[$i], $ModelObj->validate)) {
00348                     $hasField = $i;
00349                     if ($hasField === 0 || ($hasField === 1 && is_numeric($parts[0]))) {
00350                         $sameScope = true;
00351                     }
00352                     break;
00353                 }
00354             }
00355 
00356             if ($sameScope === true && in_array($parts[0], array_keys($ModelObj->hasAndBelongsToMany))) {
00357                 $sameScope = false;
00358             }
00359         }
00360 
00361         if (!$view->association && $parts[0] == $view->field && $view->field != $view->model) {
00362             array_unshift($parts, $model);
00363             $hasField = true;
00364         }
00365         $view->field = $view->modelId = $view->fieldSuffix = $view->association = null;
00366 
00367         switch (count($parts)) {
00368             case 1:
00369                 if ($view->modelScope === false) {
00370                     $view->model = $parts[0];
00371                 } else {
00372                     $view->field = $parts[0];
00373                     if ($sameScope === false) {
00374                         $view->association = $parts[0];
00375                     }
00376                 }
00377             break;
00378             case 2:
00379                 if ($view->modelScope === false) {
00380                     list($view->model, $view->field) = $parts;
00381                 } elseif ($sameScope === true && $hasField === 0) {
00382                     list($view->field, $view->fieldSuffix) = $parts;
00383                 } elseif ($sameScope === true && $hasField === 1) {
00384                     list($view->modelId, $view->field) = $parts;
00385                 } else {
00386                     list($view->association, $view->field) = $parts;
00387                 }
00388             break;
00389             case 3:
00390                 if ($sameScope === true && $hasField === 1) {
00391                     list($view->modelId, $view->field, $view->fieldSuffix) = $parts;
00392                 } elseif ($hasField === 2) {
00393                     list($view->association, $view->modelId, $view->field) = $parts;
00394                 } else {
00395                     list($view->association, $view->field, $view->fieldSuffix) = $parts;
00396                 }
00397             break;
00398             case 4:
00399                 if ($parts[0] === $view->model) {
00400                     list($view->model, $view->modelId, $view->field, $view->fieldSuffix) = $parts;
00401                 } else {
00402                     list($view->association, $view->modelId, $view->field, $view->fieldSuffix) = $parts;
00403                 }
00404             break;
00405         }
00406 
00407         if (!isset($view->model) || empty($view->model)) {
00408             $view->model = $view->association;
00409             $view->association = null;
00410         } elseif ($view->model === $view->association) {
00411             $view->association = null;
00412         }
00413 
00414         if ($setScope) {
00415             $view->modelScope = true;
00416         }
00417     }
00418 /**
00419  * Gets the currently-used model of the rendering context.
00420  *
00421  * @return string
00422  */
00423     function model() {
00424         $view =& ClassRegistry::getObject('view');
00425         if (!empty($view->association)) {
00426             return $view->association;
00427         } else {
00428             return $view->model;
00429         }
00430     }
00431 /**
00432  * Gets the ID of the currently-used model of the rendering context.
00433  *
00434  * @return mixed
00435  */
00436     function modelID() {
00437         $view =& ClassRegistry::getObject('view');
00438         return $view->modelId;
00439     }
00440 /**
00441  * Gets the currently-used model field of the rendering context.
00442  *
00443  * @return string
00444  */
00445     function field() {
00446         $view =& ClassRegistry::getObject('view');
00447         return $view->field;
00448     }
00449 /**
00450  * Returns false if given FORM field has no errors. Otherwise it returns the constant set in the array Model->validationErrors.
00451  *
00452  * @param string $model     Model name as string
00453  * @param string $field     Fieldname as string
00454  * @param integer $modelID  Unique index identifying this record within the form
00455  * @return boolean True on errors.
00456  */
00457     function tagIsInvalid($model = null, $field = null, $modelID = null) {
00458         foreach (array('model', 'field', 'modelID') as $key) {
00459             if (empty(${$key})) {
00460                 ${$key} = $this->{$key}();
00461             }
00462         }
00463         $view =& ClassRegistry::getObject('view');
00464         $errors = $this->validationErrors;
00465 
00466         if ($view->model !== $model && isset($errors[$view->model][$model])) {
00467             $errors = $errors[$view->model];
00468         }
00469 
00470         if (!isset($modelID)) {
00471             return empty($errors[$model][$field]) ? 0 : $errors[$model][$field];
00472         } else {
00473             return empty($errors[$model][$modelID][$field]) ? 0 : $errors[$model][$modelID][$field];
00474         }
00475     }
00476 /**
00477  * Generates a DOM ID for the selected element, if one is not set.
00478  *
00479  * @param mixed $options
00480  * @param string $id
00481  * @return mixed
00482  */
00483     function domId($options = null, $id = 'id') {
00484         $view =& ClassRegistry::getObject('view');
00485 
00486         if (is_array($options) && array_key_exists($id, $options) && $options[$id] === null) {
00487             unset($options[$id]);
00488             return $options;
00489         } elseif (!is_array($options) && $options !== null) {
00490             $this->setEntity($options);
00491             return $this->domId();
00492         }
00493 
00494         $dom = $this->model() . $this->modelID() . Inflector::camelize($view->field) . Inflector::camelize($view->fieldSuffix);
00495 
00496         if (is_array($options) && !array_key_exists($id, $options)) {
00497             $options[$id] = $dom;
00498         } elseif ($options === null) {
00499             return $dom;
00500         }
00501         return $options;
00502     }
00503 /**
00504  * Gets the input field name for the current tag
00505  *
00506  * @param array $options
00507  * @param string $key
00508  * @return array
00509  */
00510     function __name($options = array(), $field = null, $key = 'name') {
00511         $view =& ClassRegistry::getObject('view');
00512 
00513         if ($options === null) {
00514             $options = array();
00515         } elseif (is_string($options)) {
00516             $field = $options;
00517             $options = 0;
00518         }
00519 
00520         if (!empty($field)) {
00521             $this->setEntity($field);
00522         }
00523 
00524         if (is_array($options) && array_key_exists($key, $options)) {
00525             return $options;
00526         }
00527 
00528         switch ($field) {
00529             case '_method':
00530                 $name = $field;
00531             break;
00532             default:
00533                 $name = 'data[' . join('][', $view->entity()) . ']';
00534             break;
00535         }
00536 
00537         if (is_array($options)) {
00538             $options[$key] = $name;
00539             return $options;
00540         } else {
00541             return $name;
00542         }
00543     }
00544 /**
00545  * Gets the data for the current tag
00546  *
00547  * @param array $options
00548  * @param string $key
00549  * @return array
00550  * @access public
00551  */
00552     function value($options = array(), $field = null, $key = 'value') {
00553         if ($options === null) {
00554             $options = array();
00555         } elseif (is_string($options)) {
00556             $field = $options;
00557             $options = 0;
00558         }
00559 
00560         if (!empty($field)) {
00561             $this->setEntity($field);
00562         }
00563 
00564         if (is_array($options) && isset($options[$key])) {
00565             return $options;
00566         }
00567 
00568         $result = null;
00569 
00570         $modelName = $this->model();
00571         $fieldName = $this->field();
00572         $modelID = $this->modelID();
00573 
00574         if (is_null($fieldName)) {
00575             $fieldName = $modelName;
00576             $modelName = null;
00577         }
00578 
00579         if (isset($this->data[$fieldName]) && $modelName === null) {
00580             $result = $this->data[$fieldName];
00581         } elseif (isset($this->data[$modelName][$fieldName])) {
00582             $result = $this->data[$modelName][$fieldName];
00583         } elseif (isset($this->data[$fieldName]) && is_array($this->data[$fieldName])) {
00584             if (ClassRegistry::isKeySet($fieldName)) {
00585                 $model =& ClassRegistry::getObject($fieldName);
00586                 $result = $this->__selectedArray($this->data[$fieldName], $model->primaryKey);
00587             }
00588         } elseif (isset($this->data[$modelName][$modelID][$fieldName])) {
00589             $result = $this->data[$modelName][$modelID][$fieldName];
00590         }
00591 
00592         if (is_array($result)) {
00593             $view =& ClassRegistry::getObject('view');
00594             if (array_key_exists($view->fieldSuffix, $result)) {
00595                 $result = $result[$view->fieldSuffix];
00596             }
00597         }
00598 
00599         if (is_array($options)) {
00600             if (empty($result) && isset($options['default'])) {
00601                 $result = $options['default'];
00602             }
00603             unset($options['default']);
00604         }
00605 
00606         if (is_array($options)) {
00607             $options[$key] = $result;
00608             return $options;
00609         } else {
00610             return $result;
00611         }
00612     }
00613 /**
00614  * Sets the defaults for an input tag
00615  *
00616  * @param array $options
00617  * @param string $key
00618  * @return array
00619  * @access protected
00620  */
00621     function _initInputField($field, $options = array()) {
00622         if ($field !== null) {
00623             $this->setEntity($field);
00624         }
00625         $options = (array)$options;
00626         $options = $this->__name($options);
00627         $options = $this->value($options);
00628         $options = $this->domId($options);
00629         if ($this->tagIsInvalid()) {
00630             $options = $this->addClass($options, 'form-error');
00631         }
00632         return $options;
00633     }
00634 /**
00635  * Adds the given class to the element options
00636  *
00637  * @param array $options
00638  * @param string $class
00639  * @param string $key
00640  * @return array
00641  */
00642     function addClass($options = array(), $class = null, $key = 'class') {
00643         if (isset($options[$key]) && trim($options[$key]) != '') {
00644             $options[$key] .= ' ' . $class;
00645         } else {
00646             $options[$key] = $class;
00647         }
00648         return $options;
00649     }
00650 /**
00651  * Returns a string generated by a helper method
00652  *
00653  * This method can be overridden in subclasses to do generalized output post-processing
00654  *
00655  * @param  string  $str String to be output.
00656  * @return string
00657  */
00658     function output($str) {
00659         return $str;
00660     }
00661 /**
00662  * Before render callback.  Overridden in subclasses.
00663  *
00664  */
00665     function beforeRender() {
00666     }
00667 /**
00668  * After render callback.  Overridden in subclasses.
00669  *
00670  */
00671     function afterRender() {
00672     }
00673 /**
00674  * Before layout callback.  Overridden in subclasses.
00675  *
00676  */
00677     function beforeLayout() {
00678     }
00679 /**
00680  * After layout callback.  Overridden in subclasses.
00681  *
00682  */
00683     function afterLayout() {
00684     }
00685 /**
00686  * Transforms a recordset from a hasAndBelongsToMany association to a list of selected
00687  * options for a multiple select element
00688  *
00689  * @param mixed $data
00690  * @param string $key
00691  * @return array
00692  * @access private
00693  */
00694     function __selectedArray($data, $key = 'id') {
00695         if (!is_array($data)) {
00696             $model = $data;
00697             if (!empty($this->data[$model][$model])) {
00698                 return $this->data[$model][$model];
00699             }
00700             if (!empty($this->data[$model])) {
00701                 $data = $this->data[$model];
00702             }
00703         }
00704         $array = array();
00705         if (!empty($data)) {
00706             foreach ($data as $var) {
00707                 $array[$var[$key]] = $var[$key];
00708             }
00709         }
00710         return $array;
00711     }
00712 /**
00713  * Resets the vars used by Helper::clean() to null
00714  *
00715  * @access private
00716  */
00717     function __reset() {
00718         $this->__tainted = null;
00719         $this->__cleaned = null;
00720     }
00721 /**
00722  * Removes harmful content from output
00723  *
00724  * @access private
00725  */
00726     function __clean() {
00727         if (get_magic_quotes_gpc()) {
00728             $this->__cleaned = stripslashes($this->__tainted);
00729         } else {
00730             $this->__cleaned = $this->__tainted;
00731         }
00732 
00733         $this->__cleaned = str_replace(array("&amp;", "&lt;", "&gt;"), array("&amp;amp;", "&amp;lt;", "&amp;gt;"), $this->__cleaned);
00734         $this->__cleaned = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $this->__cleaned);
00735         $this->__cleaned = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $this->__cleaned);
00736         $this->__cleaned = html_entity_decode($this->__cleaned, ENT_COMPAT, "UTF-8");
00737         $this->__cleaned = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $this->__cleaned);
00738         $this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $this->__cleaned);
00739         $this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $this->__cleaned);
00740         $this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=*([\'\"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#iUu','$1=$2nomozbinding...', $this->__cleaned);
00741         $this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $this->__cleaned);
00742         $this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
00743         $this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
00744         $this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu', "$1>", $this->__cleaned);
00745         $this->__cleaned = preg_replace('#</*\w+:\w[^>]*>#i', "", $this->__cleaned);
00746         do {
00747             $oldstring = $this->__cleaned;
00748             $this->__cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->__cleaned);
00749         } while ($oldstring != $this->__cleaned);
00750         $this->__cleaned = str_replace(array("&amp;", "&lt;", "&gt;"), array("&amp;amp;", "&amp;lt;", "&amp;gt;"), $this->__cleaned);
00751     }
00752 }
00753 ?>

Generated on Sun Nov 22 00:30:54 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7