mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge pull request #665 from samsonasik/short-array-syntax
replace array() with short array syntax []
This commit is contained in:
commit
17307c9fee
@ -54,38 +54,38 @@ class Checks extends Controller
|
||||
|
||||
public function api()
|
||||
{
|
||||
$data = array(
|
||||
$data = [
|
||||
"total_users" => 3,
|
||||
"users" => array(
|
||||
array(
|
||||
"users" => [
|
||||
[
|
||||
"id" => 1,
|
||||
"name" => "Nitya",
|
||||
"address" => array(
|
||||
"address" => [
|
||||
"country" => "India",
|
||||
"city" => "Kolkata",
|
||||
"zip" => 700102,
|
||||
)
|
||||
),
|
||||
array(
|
||||
]
|
||||
],
|
||||
[
|
||||
"id" => 2,
|
||||
"name" => "John",
|
||||
"address" => array(
|
||||
"address" => [
|
||||
"country" => "USA",
|
||||
"city" => "Newyork",
|
||||
"zip" => "NY1234",
|
||||
)
|
||||
),
|
||||
array(
|
||||
]
|
||||
],
|
||||
[
|
||||
"id" => 3,
|
||||
"name" => "Viktor",
|
||||
"address" => array(
|
||||
"address" => [
|
||||
"country" => "Australia",
|
||||
"city" => "Sydney",
|
||||
"zip" => 123456,
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ abstract class BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* the Command's Arguments description
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array();
|
||||
protected $arguments = [];
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
|
@ -81,18 +81,18 @@ class CreateMigration extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array(
|
||||
protected $arguments = [
|
||||
'migration_name' => 'The migration file name'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* the Command's Options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
protected $options = [
|
||||
'-n' => 'Set migration namespace'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Creates a new migration file with the current timestamp.
|
||||
|
@ -87,11 +87,11 @@ class MigrateRefresh extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
protected $options = [
|
||||
'-n' => 'Set migration namespace',
|
||||
'-g' => 'Set database group',
|
||||
'-all' => 'Set latest for all namespace, will ignore (-n) option'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Does a rollback followed by a latest to refresh the current state
|
||||
|
@ -82,9 +82,9 @@ class Seed extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array(
|
||||
protected $arguments = [
|
||||
'seeder_name' => 'The seeder name to run'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* the Command's Options
|
||||
|
@ -83,16 +83,16 @@ class Help extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array(
|
||||
protected $arguments = [
|
||||
'command_name' => 'The command name [default: "help"]'
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* the Command's Options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
protected $options = [];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
@ -83,14 +83,14 @@ class ListCommands extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array();
|
||||
protected $arguments = [];
|
||||
|
||||
/**
|
||||
* the Command's Options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* The length of the longest command name.
|
||||
|
@ -76,18 +76,18 @@ class CreateMigration extends BaseCommand
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = array();
|
||||
protected $arguments = [];
|
||||
|
||||
/**
|
||||
* the Command's Options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
protected $options = [
|
||||
'-n' => 'Set migration namespace',
|
||||
'-g' => 'Set database group',
|
||||
'-t' => 'Set table name',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Creates a new migration file with the current timestamp.
|
||||
|
@ -949,7 +949,7 @@ if ( ! function_exists('function_usable'))
|
||||
{
|
||||
if ( ! isset($_suhosin_func_blacklist))
|
||||
{
|
||||
$_suhosin_func_blacklist = extension_loaded('suhosin') ? explode(',', trim(ini_get('suhosin.executor.func.blacklist'))) : array();
|
||||
$_suhosin_func_blacklist = extension_loaded('suhosin') ? explode(',', trim(ini_get('suhosin.executor.func.blacklist'))) : [];
|
||||
}
|
||||
|
||||
return ! in_array($function_name, $_suhosin_func_blacklist, TRUE);
|
||||
|
@ -1466,7 +1466,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->dataCache['table_names'] = array();
|
||||
$this->dataCache['table_names'] = [];
|
||||
$query = $this->query($sql);
|
||||
|
||||
foreach ($query->getResultArray() as $row)
|
||||
@ -1546,7 +1546,7 @@ abstract class BaseConnection implements ConnectionInterface
|
||||
}
|
||||
|
||||
$query = $this->query($sql);
|
||||
$this->dataCache['field_names'][$table] = array();
|
||||
$this->dataCache['field_names'][$table] = [];
|
||||
|
||||
foreach ($query->getResultArray() as $row)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ abstract class BaseUtils
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->db->dataCache['db_names'] = array();
|
||||
$this->db->dataCache['db_names'] = [];
|
||||
|
||||
$query = $this->db->query($this->listDatabases);
|
||||
if ($query === FALSE)
|
||||
@ -187,7 +187,7 @@ abstract class BaseUtils
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$result = [];
|
||||
foreach ($this->db->listTables() as $table_name)
|
||||
{
|
||||
$res = $this->db->query(sprintf($this->optimizeTable, $this->db->escapeIdentifiers($table_name)));
|
||||
@ -265,7 +265,7 @@ abstract class BaseUtils
|
||||
// Next blast through the result array and build out the rows
|
||||
while ($row = $query->getUnbufferedRow('array'))
|
||||
{
|
||||
$line = array();
|
||||
$line = [];
|
||||
foreach ($row as $item)
|
||||
{
|
||||
$line[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $item) . $enclosure;
|
||||
@ -286,10 +286,10 @@ abstract class BaseUtils
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXMLFromResult(ResultInterface $query, $params = array())
|
||||
public function getXMLFromResult(ResultInterface $query, $params = [])
|
||||
{
|
||||
// Set our default values
|
||||
foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
|
||||
foreach (['root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t"] as $key => $val)
|
||||
{
|
||||
if ( ! isset($params[$key]))
|
||||
{
|
||||
@ -326,27 +326,27 @@ abstract class BaseUtils
|
||||
* @return mixed
|
||||
* @throws \CodeIgniter\DatabaseException
|
||||
*/
|
||||
public function backup($params = array())
|
||||
public function backup($params = [])
|
||||
{
|
||||
// If the parameters have not been submitted as an
|
||||
// array then we know that it is simply the table
|
||||
// name, which is a valid short cut.
|
||||
if (is_string($params))
|
||||
{
|
||||
$params = array('tables' => $params);
|
||||
$params = ['tables' => $params];
|
||||
}
|
||||
|
||||
// Set up our default preferences
|
||||
$prefs = array(
|
||||
'tables' => array(),
|
||||
'ignore' => array(),
|
||||
$prefs = [
|
||||
'tables' => [],
|
||||
'ignore' => [],
|
||||
'filename' => '',
|
||||
'format' => 'gzip', // gzip, zip, txt
|
||||
'add_drop' => TRUE,
|
||||
'add_insert' => TRUE,
|
||||
'newline' => "\n",
|
||||
'foreign_key_checks' => TRUE
|
||||
);
|
||||
];
|
||||
|
||||
// Did the user submit any preferences? If so set them....
|
||||
if (count($params) > 0)
|
||||
@ -368,7 +368,7 @@ abstract class BaseUtils
|
||||
}
|
||||
|
||||
// Validate the format
|
||||
if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE))
|
||||
if ( ! in_array($prefs['format'], ['gzip', 'zip', 'txt'], TRUE))
|
||||
{
|
||||
$prefs['format'] = 'txt';
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ class Connection extends BaseConnection implements ConnectionInterface
|
||||
}
|
||||
$query = $query->getResultObject();
|
||||
|
||||
$retval = array();
|
||||
$retval = [];
|
||||
for ($i = 0, $c = count($query); $i < $c; $i ++ )
|
||||
{
|
||||
$retval[$i] = new \stdClass();
|
||||
@ -441,7 +441,7 @@ class Connection extends BaseConnection implements ConnectionInterface
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$retval = array();
|
||||
$retval = [];
|
||||
foreach (explode("\n", $row['Create Table']) as $line)
|
||||
{
|
||||
$line = trim($line);
|
||||
@ -493,13 +493,13 @@ class Connection extends BaseConnection implements ConnectionInterface
|
||||
{
|
||||
if ( ! empty($this->mysqli->connect_errno))
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'code' => $this->mysqli->connect_errno,
|
||||
'message' => $this->_mysqli->connect_error
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return array('code' => $this->connID->errno, 'message' => $this->connID->error);
|
||||
return ['code' => $this->connID->errno, 'message' => $this->connID->error];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -158,7 +158,7 @@ class Forge extends \CodeIgniter\Database\Forge
|
||||
}
|
||||
}
|
||||
|
||||
return array($sql . implode(',', $field));
|
||||
return [$sql . implode(',', $field)];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@ -221,13 +221,13 @@ class Forge extends \CodeIgniter\Database\Forge
|
||||
continue;
|
||||
}
|
||||
|
||||
is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]);
|
||||
is_array($this->keys[$i]) OR $this->keys[$i] = [$this->keys[$i]];
|
||||
|
||||
$sql .= ",\n\tKEY " . $this->db->escapeIdentifiers(implode('_', $this->keys[$i]))
|
||||
. ' (' . implode(', ', $this->db->escapeIdentifiers($this->keys[$i])) . ')';
|
||||
}
|
||||
|
||||
$this->keys = array();
|
||||
$this->keys = [];
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
@ -268,11 +268,11 @@ class Negotiate
|
||||
|
||||
unset($pairs[0]);
|
||||
|
||||
$parameters = array();
|
||||
$parameters = [];
|
||||
|
||||
foreach ($pairs as $pair)
|
||||
{
|
||||
$param = array();
|
||||
$param = [];
|
||||
preg_match(
|
||||
'/^(?P<name>.+?)=(?P<quoted>"|\')?(?P<value>.*?)(?:\k<quoted>)?$/', $pair, $param
|
||||
);
|
||||
|
@ -102,7 +102,7 @@ class Request extends Message implements RequestInterface
|
||||
|
||||
if ($proxy_ips)
|
||||
{
|
||||
foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header)
|
||||
foreach (['HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP'] as $header)
|
||||
{
|
||||
if (($spoof = $this->getServer($header)) !== NULL)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ if ( ! function_exists('directory_map'))
|
||||
{
|
||||
if ($fp = @opendir($source_dir))
|
||||
{
|
||||
$filedata = array();
|
||||
$filedata = [];
|
||||
$new_depth = $directory_depth - 1;
|
||||
$source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||
|
||||
@ -215,14 +215,14 @@ if ( ! function_exists('get_filenames'))
|
||||
*/
|
||||
function get_filenames(string $source_dir, bool $include_path = false, bool $recursion = false): array
|
||||
{
|
||||
static $filedata = array();
|
||||
static $filedata = [];
|
||||
|
||||
if ($fp = @opendir($source_dir))
|
||||
{
|
||||
// reset the array and make sure $source_dir has a trailing slash on the initial call
|
||||
if ($recursion === false)
|
||||
{
|
||||
$filedata = array();
|
||||
$filedata = [];
|
||||
$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
*/
|
||||
function get_dir_file_info(string $source_dir, bool $top_level_only = true, bool $recursion = false): array
|
||||
{
|
||||
static $filedata = array();
|
||||
static $filedata = [];
|
||||
$relative_path = $source_dir;
|
||||
|
||||
if ($fp = @opendir($source_dir))
|
||||
@ -276,7 +276,7 @@ if ( ! function_exists('get_dir_file_info'))
|
||||
// reset the array and make sure $source_dir has a trailing slash on the initial call
|
||||
if ($recursion === false)
|
||||
{
|
||||
$filedata = array();
|
||||
$filedata = [];
|
||||
$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
|
@ -66,10 +66,10 @@ if ( ! function_exists('strip_image_tags'))
|
||||
function strip_image_tags(string $str)
|
||||
{
|
||||
return preg_replace(
|
||||
array(
|
||||
[
|
||||
'#<img[\s/]+.*?src\s*=\s*(["\'])([^\\1]+?)\\1.*?\>#i',
|
||||
'#<img[\s/]+.*?src\s*=\s*?(([^\s"\'=<>`]+)).*?\>#i'
|
||||
), '\\2', $str
|
||||
], '\\2', $str
|
||||
);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ if ( ! function_exists('encode_php_tags'))
|
||||
*/
|
||||
function encode_php_tags(string $str): string
|
||||
{
|
||||
return str_replace(array('<?', '?>'), array('<?', '?>'), $str);
|
||||
return str_replace(['<?', '?>'], ['<?', '?>'], $str);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ if ( ! function_exists('anchor_popup'))
|
||||
|
||||
if ( ! is_array($attributes))
|
||||
{
|
||||
$attributes = array($attributes);
|
||||
$attributes = [$attributes];
|
||||
|
||||
// Ref: http://www.w3schools.com/jsref/met_win_open.asp
|
||||
$window_name = '_blank';
|
||||
@ -325,7 +325,7 @@ if ( ! function_exists('anchor_popup'))
|
||||
$window_name = '_blank';
|
||||
}
|
||||
|
||||
foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'no', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val)
|
||||
foreach (['width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'no', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0'] as $key => $val)
|
||||
{
|
||||
$atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val;
|
||||
unset($attributes[$key]);
|
||||
@ -427,7 +427,7 @@ if ( ! function_exists('safe_mailto'))
|
||||
|
||||
$x[] = '>';
|
||||
|
||||
$temp = array();
|
||||
$temp = [];
|
||||
for ($i = 0, $l = strlen($title); $i < $l; $i ++)
|
||||
{
|
||||
$ordinal = ord($title[$i]);
|
||||
@ -449,7 +449,7 @@ if ( ! function_exists('safe_mailto'))
|
||||
$number = ($count === 3) ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) : (($temp[0] % 32) * 64) + ($temp[1] % 64);
|
||||
$x[] = '|' . $number;
|
||||
$count = 1;
|
||||
$temp = array();
|
||||
$temp = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -597,12 +597,12 @@ if ( ! function_exists('url_title'))
|
||||
{
|
||||
$q_separator = preg_quote($separator, '#');
|
||||
|
||||
$trans = array(
|
||||
$trans = [
|
||||
'&.+?;' => '',
|
||||
'[^\w\d _-]' => '',
|
||||
'\s+' => $separator,
|
||||
'(' . $q_separator . ')+' => $separator
|
||||
);
|
||||
];
|
||||
|
||||
$str = strip_tags($str);
|
||||
foreach ($trans as $key => $val)
|
||||
|
@ -116,7 +116,7 @@ class Security
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $filenameBadChars = array(
|
||||
public $filenameBadChars = [
|
||||
'../', '<!--', '-->', '<', '>',
|
||||
"'", '"', '&', '$', '#',
|
||||
'{', '}', '[', ']', '=',
|
||||
@ -133,7 +133,7 @@ class Security
|
||||
'%3f', // ?
|
||||
'%3b', // ;
|
||||
'%3d' // =
|
||||
);
|
||||
];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
|
16
system/ThirdParty/PSR/Log/AbstractLogger.php
vendored
16
system/ThirdParty/PSR/Log/AbstractLogger.php
vendored
@ -18,7 +18,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
public function emergency($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||
}
|
||||
@ -33,7 +33,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
public function alert($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::ALERT, $message, $context);
|
||||
}
|
||||
@ -47,7 +47,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
public function critical($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||
}
|
||||
@ -60,7 +60,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
public function error($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::ERROR, $message, $context);
|
||||
}
|
||||
@ -75,7 +75,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
public function warning($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::WARNING, $message, $context);
|
||||
}
|
||||
@ -87,7 +87,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
public function notice($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::NOTICE, $message, $context);
|
||||
}
|
||||
@ -101,7 +101,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
public function info($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::INFO, $message, $context);
|
||||
}
|
||||
@ -113,7 +113,7 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
public function debug($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::DEBUG, $message, $context);
|
||||
}
|
||||
|
18
system/ThirdParty/PSR/Log/LoggerInterface.php
vendored
18
system/ThirdParty/PSR/Log/LoggerInterface.php
vendored
@ -26,7 +26,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array());
|
||||
public function emergency($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
@ -38,7 +38,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array());
|
||||
public function alert($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Critical conditions.
|
||||
@ -49,7 +49,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array());
|
||||
public function critical($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Runtime errors that do not require immediate action but should typically
|
||||
@ -59,7 +59,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array());
|
||||
public function error($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Exceptional occurrences that are not errors.
|
||||
@ -71,7 +71,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array());
|
||||
public function warning($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Normal but significant events.
|
||||
@ -80,7 +80,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array());
|
||||
public function notice($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Interesting events.
|
||||
@ -91,7 +91,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array());
|
||||
public function info($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Detailed debug information.
|
||||
@ -100,7 +100,7 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array());
|
||||
public function debug($message, array $context = []);
|
||||
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
@ -110,5 +110,5 @@ interface LoggerInterface
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function log($level, $message, array $context = array());
|
||||
public function log($level, $message, array $context = []);
|
||||
}
|
||||
|
18
system/ThirdParty/PSR/Log/LoggerTrait.php
vendored
18
system/ThirdParty/PSR/Log/LoggerTrait.php
vendored
@ -19,7 +19,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
public function emergency($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||
}
|
||||
@ -34,7 +34,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
public function alert($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::ALERT, $message, $context);
|
||||
}
|
||||
@ -48,7 +48,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
public function critical($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||
}
|
||||
@ -61,7 +61,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
public function error($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::ERROR, $message, $context);
|
||||
}
|
||||
@ -76,7 +76,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
public function warning($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::WARNING, $message, $context);
|
||||
}
|
||||
@ -88,7 +88,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
public function notice($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::NOTICE, $message, $context);
|
||||
}
|
||||
@ -102,7 +102,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
public function info($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::INFO, $message, $context);
|
||||
}
|
||||
@ -114,7 +114,7 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
public function debug($message, array $context = [])
|
||||
{
|
||||
$this->log(LogLevel::DEBUG, $message, $context);
|
||||
}
|
||||
@ -127,5 +127,5 @@ trait LoggerTrait
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
abstract public function log($level, $message, array $context = array());
|
||||
abstract public function log($level, $message, array $context = []);
|
||||
}
|
||||
|
2
system/ThirdParty/PSR/Log/NullLogger.php
vendored
2
system/ThirdParty/PSR/Log/NullLogger.php
vendored
@ -20,7 +20,7 @@ class NullLogger extends AbstractLogger
|
||||
* @param array $context
|
||||
* @return null
|
||||
*/
|
||||
public function log($level, $message, array $context = array())
|
||||
public function log($level, $message, array $context = [])
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ class Parser extends View
|
||||
function strpos_all($haystack, $needle)
|
||||
{
|
||||
$offset = 0;
|
||||
$allpos = array();
|
||||
$allpos = [];
|
||||
while (($pos = strpos($haystack, $needle, $offset)) !== FALSE)
|
||||
{
|
||||
$offset = $pos + 1;
|
||||
|
@ -5,25 +5,25 @@ class CITestSeeder extends \CodeIgniter\Database\Seeder
|
||||
public function run()
|
||||
{
|
||||
// Job Data
|
||||
$data = array(
|
||||
'user' => array(
|
||||
array('name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'),
|
||||
array('name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'),
|
||||
array('name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'),
|
||||
array('name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK')
|
||||
),
|
||||
'job' => array(
|
||||
array('name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
|
||||
array('name' => 'Politician', 'description' => 'This is not really a job'),
|
||||
array('name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'),
|
||||
array('name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician')
|
||||
),
|
||||
'misc' => array(
|
||||
array('key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'),
|
||||
array('key' => '\\%foo456', 'value' => 'Entry with \\%'),
|
||||
array('key' => 'spaces and tabs', 'value' => ' One two three tab')
|
||||
)
|
||||
);
|
||||
$data = [
|
||||
'user' => [
|
||||
['name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'],
|
||||
['name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'],
|
||||
['name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'],
|
||||
['name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK']
|
||||
],
|
||||
'job' => [
|
||||
['name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'],
|
||||
['name' => 'Politician', 'description' => 'This is not really a job'],
|
||||
['name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'],
|
||||
['name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician']
|
||||
],
|
||||
'misc' => [
|
||||
['key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'],
|
||||
['key' => '\\%foo456', 'value' => 'Entry with \\%'],
|
||||
['key' => 'spaces and tabs', 'value' => ' One two three tab']
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($data as $table => $dummy_data)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ class CommomFunctionsTest extends \CIUnitTestCase
|
||||
|
||||
public function testStringifyAttributes()
|
||||
{
|
||||
$this->assertEquals(' class="foo" id="bar"', stringify_attributes(array('class' => 'foo', 'id' => 'bar')));
|
||||
$this->assertEquals(' class="foo" id="bar"', stringify_attributes(['class' => 'foo', 'id' => 'bar']));
|
||||
|
||||
$atts = new stdClass;
|
||||
$atts->class = 'foo';
|
||||
@ -29,14 +29,14 @@ class CommomFunctionsTest extends \CIUnitTestCase
|
||||
|
||||
$this->assertEquals(' class="foo" id="bar"', stringify_attributes('class="foo" id="bar"'));
|
||||
|
||||
$this->assertEquals('', stringify_attributes(array()));
|
||||
$this->assertEquals('', stringify_attributes([]));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public function testStringifyJsAttributes()
|
||||
{
|
||||
$this->assertEquals('width=800,height=600', stringify_attributes(array('width' => '800', 'height' => '600'), TRUE));
|
||||
$this->assertEquals('width=800,height=600', stringify_attributes(['width' => '800', 'height' => '600'], TRUE));
|
||||
|
||||
$atts = new stdClass;
|
||||
$atts->width = 800;
|
||||
|
@ -52,10 +52,10 @@ class InsertTest extends \CIUnitTestCase
|
||||
{
|
||||
$builder = $this->db->table('jobs');
|
||||
|
||||
$insertData = array(
|
||||
$insertData = [
|
||||
['id' => 2, 'name' => 'Commedian', 'description' => 'Theres something in your teeth'],
|
||||
['id' => 3, 'name' => 'Cab Driver', 'description' => 'Iam yellow'],
|
||||
);
|
||||
];
|
||||
|
||||
$this->db->shouldReturn('execute', 1)
|
||||
->shouldReturn('affectedRows', 1);
|
||||
|
@ -21,11 +21,11 @@ class ReplaceTest extends \CIUnitTestCase
|
||||
|
||||
$expected = "REPLACE INTO \"jobs\" (\"title\", \"name\", \"date\") VALUES (:title, :name, :date)";
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'title' => 'My title',
|
||||
'name' => 'My Name',
|
||||
'date' => 'My date'
|
||||
);
|
||||
];
|
||||
|
||||
$this->assertSame($expected, $builder->replace($data, true));
|
||||
}
|
||||
|
@ -77,10 +77,10 @@ class UpdateTest extends \CIUnitTestCase
|
||||
{
|
||||
$builder = new BaseBuilder('jobs', $this->db);
|
||||
|
||||
$updateData = array(
|
||||
$updateData = [
|
||||
['id' => 2, 'name' => 'Comedian', 'description' => 'Theres something in your teeth'],
|
||||
['id' => 3, 'name' => 'Cab Driver', 'description' => 'Iam yellow'],
|
||||
);
|
||||
];
|
||||
|
||||
$this->db->shouldReturn('execute', 1)
|
||||
->shouldReturn('affectedRows', 1);
|
||||
|
@ -11,7 +11,7 @@ class InsertTest extends \CIDatabaseTestCase
|
||||
|
||||
public function testInsert()
|
||||
{
|
||||
$job_data = array('name' => 'Grocery Sales', 'description' => 'Discount!');
|
||||
$job_data = ['name' => 'Grocery Sales', 'description' => 'Discount!'];
|
||||
|
||||
$this->db->table('job')->insert($job_data);
|
||||
|
||||
@ -22,10 +22,10 @@ class InsertTest extends \CIDatabaseTestCase
|
||||
|
||||
public function testInsertBatch()
|
||||
{
|
||||
$job_data = array(
|
||||
array('name' => 'Comedian', 'description' => 'Theres something in your teeth'),
|
||||
array('name' => 'Cab Driver', 'description' => 'Iam yellow'),
|
||||
);
|
||||
$job_data = [
|
||||
['name' => 'Comedian', 'description' => 'Theres something in your teeth'],
|
||||
['name' => 'Cab Driver', 'description' => 'Iam yellow'],
|
||||
];
|
||||
|
||||
$this->db->table('job')->insertBatch($job_data);
|
||||
|
||||
@ -37,7 +37,7 @@ class InsertTest extends \CIDatabaseTestCase
|
||||
|
||||
public function testReplaceWithNoMatchingData()
|
||||
{
|
||||
$data = array('id' => 5, 'name' => 'Cab Driver', 'description' => 'Iam yellow');
|
||||
$data = ['id' => 5, 'name' => 'Cab Driver', 'description' => 'Iam yellow'];
|
||||
|
||||
$this->db->table('job')->replace($data);
|
||||
|
||||
@ -52,7 +52,7 @@ class InsertTest extends \CIDatabaseTestCase
|
||||
|
||||
public function testReplaceWithMatchingData()
|
||||
{
|
||||
$data = array('id' => 1, 'name' => 'Cab Driver', 'description' => 'Iam yellow');
|
||||
$data = ['id' => 1, 'name' => 'Cab Driver', 'description' => 'Iam yellow'];
|
||||
|
||||
$this->db->table('job')->replace($data);
|
||||
|
||||
|
@ -382,24 +382,24 @@ class URITest extends \CIUnitTestCase
|
||||
|
||||
public function defaultDots()
|
||||
{
|
||||
return array (
|
||||
array ('/foo/..', '/'),
|
||||
array ('//foo//..', '/'),
|
||||
array ('/foo/../..', '/'),
|
||||
array ('/foo/../.', '/'),
|
||||
array ('/./foo/..', '/'),
|
||||
array ('/./foo', '/foo'),
|
||||
array ('/./foo/', '/foo/'),
|
||||
array ('/./foo/bar/baz/pho/../..', '/foo/bar'),
|
||||
array ('*', '*'),
|
||||
array ('/foo', '/foo'),
|
||||
array ('/abc/123/../foo/', '/abc/foo/'),
|
||||
array ('/a/b/c/./../../g', '/a/g'),
|
||||
array ('/b/c/./../../g', '/g'),
|
||||
array ('/b/c/./../../g', '/g'),
|
||||
array ('/c/./../../g', '/g'),
|
||||
array ('/./../../g', '/g'),
|
||||
);
|
||||
return [
|
||||
['/foo/..', '/'],
|
||||
['//foo//..', '/'],
|
||||
['/foo/../..', '/'],
|
||||
['/foo/../.', '/'],
|
||||
['/./foo/..', '/'],
|
||||
['/./foo', '/foo'],
|
||||
['/./foo/', '/foo/'],
|
||||
['/./foo/bar/baz/pho/../..', '/foo/bar'],
|
||||
['*', '*'],
|
||||
['/foo', '/foo'],
|
||||
['/abc/123/../foo/', '/abc/foo/'],
|
||||
['/a/b/c/./../../g', '/a/g'],
|
||||
['/b/c/./../../g', '/g'],
|
||||
['/b/c/./../../g', '/g'],
|
||||
['/c/./../../g', '/g'],
|
||||
['/./../../g', '/g'],
|
||||
];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -41,12 +41,11 @@ final class cookieHelperTest extends \CIUnitTestCase
|
||||
|
||||
public function testSetCookieByArrayParameters()
|
||||
{
|
||||
$cookieAttr = array
|
||||
(
|
||||
$cookieAttr = [
|
||||
'name' => $this->name,
|
||||
'value' => $this->value,
|
||||
'expire' => $this->expire
|
||||
);
|
||||
];
|
||||
//set_cookie($cookieAttr);
|
||||
$this->response->setCookie($cookieAttr);
|
||||
|
||||
|
@ -164,14 +164,14 @@ EOH;
|
||||
$expected = <<<EOH
|
||||
<input type="text" name="username" value="johndoe" id="username" maxlength="100" size="50" style="width:50%" />\n
|
||||
EOH;
|
||||
$data = array(
|
||||
$data = [
|
||||
'name' => 'username',
|
||||
'id' => 'username',
|
||||
'value' => 'johndoe',
|
||||
'maxlength' => '100',
|
||||
'size' => '50',
|
||||
'style' => 'width:50%',
|
||||
);
|
||||
];
|
||||
$this->assertEquals($expected, form_input($data));
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
@ -222,12 +222,12 @@ EOH;
|
||||
<option value="xlarge">Extra Large Shirt</option>
|
||||
</select>\n
|
||||
EOH;
|
||||
$options = array(
|
||||
$options = [
|
||||
'small' => 'Small Shirt',
|
||||
'med' => 'Medium Shirt',
|
||||
'large' => 'Large Shirt',
|
||||
'xlarge' => 'Extra Large Shirt',
|
||||
);
|
||||
];
|
||||
$this->assertEquals($expected, form_dropdown('shirts', $options, 'large'));
|
||||
$expected = <<<EOH
|
||||
<select name="shirts" multiple="multiple">
|
||||
@ -237,18 +237,18 @@ EOH;
|
||||
<option value="xlarge">Extra Large Shirt</option>
|
||||
</select>\n
|
||||
EOH;
|
||||
$shirts_on_sale = array('small', 'large');
|
||||
$shirts_on_sale = ['small', 'large'];
|
||||
$this->assertEquals($expected, form_dropdown('shirts', $options, $shirts_on_sale));
|
||||
$options = array(
|
||||
'Swedish Cars' => array(
|
||||
$options = [
|
||||
'Swedish Cars' => [
|
||||
'volvo' => 'Volvo',
|
||||
'saab' => 'Saab'
|
||||
),
|
||||
'German Cars' => array(
|
||||
],
|
||||
'German Cars' => [
|
||||
'mercedes' => 'Mercedes',
|
||||
'audi' => 'Audi'
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
$expected = <<<EOH
|
||||
<select name="cars" multiple="multiple">
|
||||
<optgroup label="Swedish Cars">
|
||||
@ -261,7 +261,7 @@ EOH;
|
||||
</optgroup>
|
||||
</select>\n
|
||||
EOH;
|
||||
$this->assertEquals($expected, form_dropdown('cars', $options, array('volvo', 'audi')));
|
||||
$this->assertEquals($expected, form_dropdown('cars', $options, ['volvo', 'audi']));
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
public function testFormDropdownWithSelectedAttribute()
|
||||
@ -322,13 +322,13 @@ EOH;
|
||||
<option value="xlarge">Extra Large Shirt</option>
|
||||
</select>\n
|
||||
EOH;
|
||||
$options = array(
|
||||
$options = [
|
||||
'small' => 'Small Shirt',
|
||||
'med' => 'Medium Shirt',
|
||||
'large' => 'Large Shirt',
|
||||
'xlarge' => 'Extra Large Shirt',
|
||||
);
|
||||
$this->assertEquals($expected, form_multiselect('shirts[]', $options, array('med', 'large')));
|
||||
];
|
||||
$this->assertEquals($expected, form_multiselect('shirts[]', $options, ['med', 'large']));
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
public function test_form_fieldset()
|
||||
|
@ -35,7 +35,7 @@ final class HTMLHelperTest extends \CIUnitTestCase
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar');
|
||||
$list = ['foo', 'bar'];
|
||||
|
||||
$this->assertEquals(ltrim($expected), ul($list));
|
||||
}
|
||||
@ -51,7 +51,7 @@ EOH;
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar');
|
||||
$list = ['foo', 'bar'];
|
||||
|
||||
$this->assertEquals($expected, ul($list, 'class="test"'));
|
||||
}
|
||||
@ -73,7 +73,7 @@ EOH;
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar', array('foo', 'bar'));
|
||||
$list = ['foo', 'bar', ['foo', 'bar']];
|
||||
|
||||
$this->assertEquals(ltrim($expected), ul($list));
|
||||
}
|
||||
@ -91,7 +91,7 @@ EOH;
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar');
|
||||
$list = ['foo', 'bar'];
|
||||
|
||||
$this->assertEquals(ltrim($expected), ol($list));
|
||||
}
|
||||
@ -107,7 +107,7 @@ EOH;
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar');
|
||||
$list = ['foo', 'bar'];
|
||||
|
||||
$this->assertEquals($expected, ol($list, 'class="test"'));
|
||||
}
|
||||
@ -129,7 +129,7 @@ EOH;
|
||||
EOH;
|
||||
|
||||
$expected = ltrim($expected);
|
||||
$list = array('foo', 'bar', array('foo', 'bar'));
|
||||
$list = ['foo', 'bar', ['foo', 'bar']];
|
||||
|
||||
$this->assertEquals(ltrim($expected), ol($list));
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
{
|
||||
return [
|
||||
'egpage01' => ['<a href="http://example.com/index.php/news/local/123" title="News title">My News</a>', 'news/local/123', 'My News', 'title="News title"'],
|
||||
'egpage02' => ['<a href="http://example.com/index.php/news/local/123" title="The best news!">My News</a>', 'news/local/123', 'My News', array ('title' => 'The best news!')],
|
||||
'egpage02' => ['<a href="http://example.com/index.php/news/local/123" title="The best news!">My News</a>', 'news/local/123', 'My News', ['title' => 'The best news!']],
|
||||
'egpage03' => ['<a href="http://example.com/index.php">Click here</a>', '', 'Click here'],
|
||||
'egpage04' => ['<a href="http://example.com/index.php">Click here</a>', '/', 'Click here'],
|
||||
];
|
||||
@ -594,7 +594,7 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
'normal02' => ['<a href="http://example.com/index.php" onclick="window.open(\'http://example.com/index.php\', \'_blank\'); return false;">Bananas</a>', '/', 'Bananas'],
|
||||
'normal07' => ['<a href="http://example.com/index.php" onclick="window.open(\'http://example.com/index.php\', \'_blank\'); return false;">http://example.com/index.php</a>', '/'],
|
||||
'normal08' => ['<a href="http://example.com/index.php/news/local/123" onclick="window.open(\'http://example.com/index.php/news/local/123\', \'_blank\', \'width=800,height=600,scrollbars=yes,menubar=no,status=yes,resizable=yes,screenx=0,screeny=0\'); return false;">Click Me!</a>',
|
||||
'news/local/123', 'Click Me!', array (
|
||||
'news/local/123', 'Click Me!', [
|
||||
'width' => 800,
|
||||
'height' => 600,
|
||||
'scrollbars' => 'yes',
|
||||
@ -603,12 +603,12 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
'screenx' => 0,
|
||||
'screeny' => 0,
|
||||
'window_name' => '_blank'
|
||||
)],
|
||||
]],
|
||||
'normal09' => [
|
||||
'<a href="http://example.com/index.php/news/local/123" onclick="window.open(\'http://example.com/index.php/news/local/123\', \'_blank\', \'width=800,height=600,scrollbars=yes,menubar=no,status=yes,resizable=yes,screenx=0,screeny=0\'); return false;">Click Me!</a>',
|
||||
'news/local/123',
|
||||
'Click Me!',
|
||||
array ()],
|
||||
[]],
|
||||
];
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
{
|
||||
return [
|
||||
'page01' => ['<a href="mailto:me@my-site.com">Click Here to Contact Me</a>', 'me@my-site.com', 'Click Here to Contact Me'],
|
||||
'page02' => ['<a href="mailto:me@my-site.com" title="Mail me">Contact Me</a>', 'me@my-site.com', 'Contact Me', array ('title' => 'Mail me')],
|
||||
'page02' => ['<a href="mailto:me@my-site.com" title="Mail me">Contact Me</a>', 'me@my-site.com', 'Contact Me', ['title' => 'Mail me']],
|
||||
'page03' => ['<a href="mailto:me@my-site.com">me@my-site.com</a>', 'me@my-site.com'],
|
||||
];
|
||||
}
|
||||
@ -670,7 +670,7 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
'page01' => ["<script type=\"text/javascript\">//<![CDATA[var l=new Array();l[0] = '>';l[1] = 'a';l[2] = '/';l[3] = '<';l[4] = '|101';l[5] = '|77';l[6] = '|32';l[7] = '|116';l[8] = '|99';l[9] = '|97';l[10] = '|116';l[11] = '|110';l[12] = '|111';l[13] = '|67';l[14] = '|32';l[15] = '|111';l[16] = '|116';l[17] = '|32';l[18] = '|101';l[19] = '|114';l[20] = '|101';l[21] = '|72';l[22] = '|32';l[23] = '|107';l[24] = '|99';l[25] = '|105';l[26] = '|108';l[27] = '|67';l[28] = '>';l[29] = '\"';l[30] = '|109';l[31] = '|111';l[32] = '|99';l[33] = '|46';l[34] = '|101';l[35] = '|116';l[36] = '|105';l[37] = '|115';l[38] = '|45';l[39] = '|121';l[40] = '|109';l[41] = '|64';l[42] = '|101';l[43] = '|109';l[44] = ':';l[45] = 'o';l[46] = 't';l[47] = 'l';l[48] = 'i';l[49] = 'a';l[50] = 'm';l[51] = '\"';l[52] = '=';l[53] = 'f';l[54] = 'e';l[55] = 'r';l[56] = 'h';l[57] = ' ';l[58] = 'a';l[59] = '<';for (var i = l.length-1; i >= 0; i=i-1) {if (l[i].substring(0, 1) === '|') document.write(\"&#\"+unescape(l[i].substring(1))+\";\");else document.write(unescape(l[i]));}//]]></script>",
|
||||
'me@my-site.com', 'Click Here to Contact Me'],
|
||||
'page02' => ["<script type=\"text/javascript\">//<![CDATA[var l=new Array();l[0] = '>';l[1] = 'a';l[2] = '/';l[3] = '<';l[4] = '|101';l[5] = '|77';l[6] = '|32';l[7] = '|116';l[8] = '|99';l[9] = '|97';l[10] = '|116';l[11] = '|110';l[12] = '|111';l[13] = '|67';l[14] = '>';l[15] = '\"';l[16] = '|101';l[17] = '|109';l[18] = '|32';l[19] = '|108';l[20] = '|105';l[21] = '|97';l[22] = '|77';l[23] = ' title=\"';l[24] = '\"';l[25] = '|109';l[26] = '|111';l[27] = '|99';l[28] = '|46';l[29] = '|101';l[30] = '|116';l[31] = '|105';l[32] = '|115';l[33] = '|45';l[34] = '|121';l[35] = '|109';l[36] = '|64';l[37] = '|101';l[38] = '|109';l[39] = ':';l[40] = 'o';l[41] = 't';l[42] = 'l';l[43] = 'i';l[44] = 'a';l[45] = 'm';l[46] = '\"';l[47] = '=';l[48] = 'f';l[49] = 'e';l[50] = 'r';l[51] = 'h';l[52] = ' ';l[53] = 'a';l[54] = '<';for (var i = l.length-1; i >= 0; i=i-1) {if (l[i].substring(0, 1) === '|') document.write(\"&#\"+unescape(l[i].substring(1))+\";\");else document.write(unescape(l[i]));}//]]></script>",
|
||||
'me@my-site.com', 'Contact Me', array ('title' => 'Mail me')],
|
||||
'me@my-site.com', 'Contact Me', ['title' => 'Mail me']],
|
||||
'page03' => ["<script type=\"text/javascript\">//<![CDATA[var l=new Array();l[0] = '>';l[1] = 'a';l[2] = '/';l[3] = '<';l[4] = '|109';l[5] = '|111';l[6] = '|99';l[7] = '|46';l[8] = '|101';l[9] = '|116';l[10] = '|105';l[11] = '|115';l[12] = '|45';l[13] = '|121';l[14] = '|109';l[15] = '|64';l[16] = '|101';l[17] = '|109';l[18] = '>';l[19] = '\"';l[20] = '|109';l[21] = '|111';l[22] = '|99';l[23] = '|46';l[24] = '|101';l[25] = '|116';l[26] = '|105';l[27] = '|115';l[28] = '|45';l[29] = '|121';l[30] = '|109';l[31] = '|64';l[32] = '|101';l[33] = '|109';l[34] = ':';l[35] = 'o';l[36] = 't';l[37] = 'l';l[38] = 'i';l[39] = 'a';l[40] = 'm';l[41] = '\"';l[42] = '=';l[43] = 'f';l[44] = 'e';l[45] = 'r';l[46] = 'h';l[47] = ' ';l[48] = 'a';l[49] = '<';for (var i = l.length-1; i >= 0; i=i-1) {if (l[i].substring(0, 1) === '|') document.write(\"&#\"+unescape(l[i].substring(1))+\";\");else document.write(unescape(l[i]));}//]]></script>",
|
||||
'me@my-site.com'],
|
||||
];
|
||||
@ -832,10 +832,10 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
|
||||
public function testUrlTitle()
|
||||
{
|
||||
$words = array (
|
||||
$words = [
|
||||
'foo bar /' => 'foo-bar',
|
||||
'\ testing 12' => 'testing-12'
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($words as $in => $out)
|
||||
{
|
||||
@ -845,10 +845,10 @@ class URLHelperTest extends \CIUnitTestCase
|
||||
|
||||
public function testUrlTitleExtraDashes()
|
||||
{
|
||||
$words = array (
|
||||
$words = [
|
||||
'_foo bar_' => 'foo_bar',
|
||||
'_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS'
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($words as $in => $out)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user