Making static methods static.

This commit is contained in:
Mark Story 2010-04-14 00:29:44 -04:00
parent f13e70b936
commit dbe4747add
3 changed files with 19 additions and 19 deletions

View file

@ -40,7 +40,7 @@ class Sanitize {
* @access public
* @static
*/
function paranoid($string, $allowed = array()) {
public static function paranoid($string, $allowed = array()) {
$allow = null;
if (!empty($allowed)) {
foreach ($allowed as $value) {
@ -68,7 +68,7 @@ class Sanitize {
* @access public
* @static
*/
function escape($string, $connection = 'default') {
public static function escape($string, $connection = 'default') {
$db =& ConnectionManager::getDataSource($connection);
if (is_numeric($string) || $string === null || is_bool($string)) {
return $string;
@ -96,7 +96,7 @@ class Sanitize {
* @access public
* @static
*/
function html($string, $options = array()) {
public static function html($string, $options = array()) {
static $defaultCharset = false;
if ($defaultCharset === false) {
$defaultCharset = Configure::read('App.encoding');
@ -127,7 +127,7 @@ class Sanitize {
* @access public
* @static
*/
function stripWhitespace($str) {
public static function stripWhitespace($str) {
$r = preg_replace('/[\n\r\t]+/', '', $str);
return preg_replace('/\s{2,}/', ' ', $r);
}
@ -140,7 +140,7 @@ class Sanitize {
* @access public
* @static
*/
function stripImages($str) {
public static function stripImages($str) {
$str = preg_replace('/(<a[^>]*>)(<img[^>]+alt=")([^"]*)("[^>]*>)(<\/a>)/i', '$1$3$5<br />', $str);
$str = preg_replace('/(<img[^>]+alt=")([^"]*)("[^>]*>)/i', '$2<br />', $str);
$str = preg_replace('/<img[^>]*>/i', '', $str);
@ -155,7 +155,7 @@ class Sanitize {
* @access public
* @static
*/
function stripScripts($str) {
public static function stripScripts($str) {
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/i', '', $str);
}
@ -165,7 +165,7 @@ class Sanitize {
* @param string $str String to sanitize
* @return string sanitized string
*/
public function stripAll($str) {
public static function stripAll($str) {
$str = Sanitize::stripWhitespace($str);
$str = Sanitize::stripImages($str);
$str = Sanitize::stripScripts($str);
@ -186,7 +186,7 @@ class Sanitize {
* @access public
* @static
*/
function stripTags() {
public static function stripTags() {
$params = params(func_get_args());
$str = $params[0];
@ -217,7 +217,7 @@ class Sanitize {
* @access public
* @static
*/
function clean($data, $options = array()) {
public static function clean($data, $options = array()) {
if (empty($data)) {
return $data;
}
@ -281,7 +281,7 @@ class Sanitize {
* @access public
* @static
*/
function formatColumns(&$model) {
public static function formatColumns(&$model) {
foreach ($model->data as $name => $values) {
if ($name == $model->alias) {
$curModel =& $model;

View file

@ -56,7 +56,7 @@ class Security extends Object {
* @access public
* @static
*/
function inactiveMins() {
public static function inactiveMins() {
switch (Configure::read('Security.level')) {
case 'high':
return 10;
@ -78,7 +78,7 @@ class Security extends Object {
* @access public
* @static
*/
function generateAuthKey() {
public static function generateAuthKey() {
if (!class_exists('String')) {
App::import('Core', 'String');
}
@ -110,7 +110,7 @@ class Security extends Object {
* @access public
* @static
*/
function hash($string, $type = null, $salt = false) {
public static function hash($string, $type = null, $salt = false) {
$_this =& Security::getInstance();
if ($salt) {
@ -154,7 +154,7 @@ class Security extends Object {
* @static
* @see Security::hash()
*/
function setHash($hash) {
public static function setHash($hash) {
$_this =& Security::getInstance();
$_this->hashType = $hash;
}
@ -168,7 +168,7 @@ class Security extends Object {
* @access public
* @static
*/
function cipher($text, $key) {
public static function cipher($text, $key) {
if (empty($key)) {
trigger_error(__('You cannot use an empty key for Security::cipher()', true), E_USER_WARNING);
return '';

View file

@ -34,7 +34,7 @@ class String {
* @return RFC 4122 UUID
* @static
*/
function uuid() {
public static function uuid() {
$node = env('SERVER_ADDR');
$pid = null;
@ -114,7 +114,7 @@ class String {
* @access public
* @static
*/
function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
if (empty($data) || is_array($data)) {
return $data;
}
@ -205,7 +205,7 @@ class String {
* @access public
* @static
*/
function insert($str, $data, $options = array()) {
public static function insert($str, $data, $options = array()) {
$defaults = array(
'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
);
@ -272,7 +272,7 @@ class String {
* @static
* @see String::insert()
*/
function cleanInsert($str, $options) {
public static function cleanInsert($str, $options) {
$clean = $options['clean'];
if (!$clean) {
return $str;