mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Making static methods static.
This commit is contained in:
parent
f13e70b936
commit
dbe4747add
3 changed files with 19 additions and 19 deletions
|
@ -40,7 +40,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function paranoid($string, $allowed = array()) {
|
public static function paranoid($string, $allowed = array()) {
|
||||||
$allow = null;
|
$allow = null;
|
||||||
if (!empty($allowed)) {
|
if (!empty($allowed)) {
|
||||||
foreach ($allowed as $value) {
|
foreach ($allowed as $value) {
|
||||||
|
@ -68,7 +68,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function escape($string, $connection = 'default') {
|
public static function escape($string, $connection = 'default') {
|
||||||
$db =& ConnectionManager::getDataSource($connection);
|
$db =& ConnectionManager::getDataSource($connection);
|
||||||
if (is_numeric($string) || $string === null || is_bool($string)) {
|
if (is_numeric($string) || $string === null || is_bool($string)) {
|
||||||
return $string;
|
return $string;
|
||||||
|
@ -96,7 +96,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function html($string, $options = array()) {
|
public static function html($string, $options = array()) {
|
||||||
static $defaultCharset = false;
|
static $defaultCharset = false;
|
||||||
if ($defaultCharset === false) {
|
if ($defaultCharset === false) {
|
||||||
$defaultCharset = Configure::read('App.encoding');
|
$defaultCharset = Configure::read('App.encoding');
|
||||||
|
@ -127,7 +127,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function stripWhitespace($str) {
|
public static function stripWhitespace($str) {
|
||||||
$r = preg_replace('/[\n\r\t]+/', '', $str);
|
$r = preg_replace('/[\n\r\t]+/', '', $str);
|
||||||
return preg_replace('/\s{2,}/', ' ', $r);
|
return preg_replace('/\s{2,}/', ' ', $r);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @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('/(<a[^>]*>)(<img[^>]+alt=")([^"]*)("[^>]*>)(<\/a>)/i', '$1$3$5<br />', $str);
|
||||||
$str = preg_replace('/(<img[^>]+alt=")([^"]*)("[^>]*>)/i', '$2<br />', $str);
|
$str = preg_replace('/(<img[^>]+alt=")([^"]*)("[^>]*>)/i', '$2<br />', $str);
|
||||||
$str = preg_replace('/<img[^>]*>/i', '', $str);
|
$str = preg_replace('/<img[^>]*>/i', '', $str);
|
||||||
|
@ -155,7 +155,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function stripScripts($str) {
|
public static function stripScripts($str) {
|
||||||
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/i', '', $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
|
* @param string $str String to sanitize
|
||||||
* @return string sanitized string
|
* @return string sanitized string
|
||||||
*/
|
*/
|
||||||
public function stripAll($str) {
|
public static function stripAll($str) {
|
||||||
$str = Sanitize::stripWhitespace($str);
|
$str = Sanitize::stripWhitespace($str);
|
||||||
$str = Sanitize::stripImages($str);
|
$str = Sanitize::stripImages($str);
|
||||||
$str = Sanitize::stripScripts($str);
|
$str = Sanitize::stripScripts($str);
|
||||||
|
@ -186,7 +186,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function stripTags() {
|
public static function stripTags() {
|
||||||
$params = params(func_get_args());
|
$params = params(func_get_args());
|
||||||
$str = $params[0];
|
$str = $params[0];
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function clean($data, $options = array()) {
|
public static function clean($data, $options = array()) {
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ class Sanitize {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function formatColumns(&$model) {
|
public static function formatColumns(&$model) {
|
||||||
foreach ($model->data as $name => $values) {
|
foreach ($model->data as $name => $values) {
|
||||||
if ($name == $model->alias) {
|
if ($name == $model->alias) {
|
||||||
$curModel =& $model;
|
$curModel =& $model;
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Security extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function inactiveMins() {
|
public static function inactiveMins() {
|
||||||
switch (Configure::read('Security.level')) {
|
switch (Configure::read('Security.level')) {
|
||||||
case 'high':
|
case 'high':
|
||||||
return 10;
|
return 10;
|
||||||
|
@ -78,7 +78,7 @@ class Security extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function generateAuthKey() {
|
public static function generateAuthKey() {
|
||||||
if (!class_exists('String')) {
|
if (!class_exists('String')) {
|
||||||
App::import('Core', 'String');
|
App::import('Core', 'String');
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class Security extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function hash($string, $type = null, $salt = false) {
|
public static function hash($string, $type = null, $salt = false) {
|
||||||
$_this =& Security::getInstance();
|
$_this =& Security::getInstance();
|
||||||
|
|
||||||
if ($salt) {
|
if ($salt) {
|
||||||
|
@ -154,7 +154,7 @@ class Security extends Object {
|
||||||
* @static
|
* @static
|
||||||
* @see Security::hash()
|
* @see Security::hash()
|
||||||
*/
|
*/
|
||||||
function setHash($hash) {
|
public static function setHash($hash) {
|
||||||
$_this =& Security::getInstance();
|
$_this =& Security::getInstance();
|
||||||
$_this->hashType = $hash;
|
$_this->hashType = $hash;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ class Security extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function cipher($text, $key) {
|
public static function cipher($text, $key) {
|
||||||
if (empty($key)) {
|
if (empty($key)) {
|
||||||
trigger_error(__('You cannot use an empty key for Security::cipher()', true), E_USER_WARNING);
|
trigger_error(__('You cannot use an empty key for Security::cipher()', true), E_USER_WARNING);
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -34,7 +34,7 @@ class String {
|
||||||
* @return RFC 4122 UUID
|
* @return RFC 4122 UUID
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function uuid() {
|
public static function uuid() {
|
||||||
$node = env('SERVER_ADDR');
|
$node = env('SERVER_ADDR');
|
||||||
$pid = null;
|
$pid = null;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class String {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
|
public static function tokenize($data, $separator = ',', $leftBound = '(', $rightBound = ')') {
|
||||||
if (empty($data) || is_array($data)) {
|
if (empty($data) || is_array($data)) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ class String {
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
function insert($str, $data, $options = array()) {
|
public static function insert($str, $data, $options = array()) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
|
'before' => ':', 'after' => null, 'escape' => '\\', 'format' => null, 'clean' => false
|
||||||
);
|
);
|
||||||
|
@ -272,7 +272,7 @@ class String {
|
||||||
* @static
|
* @static
|
||||||
* @see String::insert()
|
* @see String::insert()
|
||||||
*/
|
*/
|
||||||
function cleanInsert($str, $options) {
|
public static function cleanInsert($str, $options) {
|
||||||
$clean = $options['clean'];
|
$clean = $options['clean'];
|
||||||
if (!$clean) {
|
if (!$clean) {
|
||||||
return $str;
|
return $str;
|
||||||
|
|
Loading…
Reference in a new issue