mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
coding standards whitespace and single quote
This commit is contained in:
parent
f6aedea271
commit
a6f065e7a2
5 changed files with 26 additions and 26 deletions
|
@ -373,7 +373,7 @@ class I18n {
|
|||
$head = $this->_domains[$domain][$this->_lang][$this->category][""];
|
||||
|
||||
foreach (explode("\n", $head) as $line) {
|
||||
$header = strtok($line,":");
|
||||
$header = strtok($line, ':');
|
||||
$line = trim(strtok("\n"));
|
||||
$this->_domains[$domain][$this->_lang][$this->category]["%po-header"][strtolower($header)] = $line;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ class I18n {
|
|||
if ($data = file_get_contents($filename)) {
|
||||
$translations = array();
|
||||
$header = substr($data, 0, 20);
|
||||
$header = unpack("L1magic/L1version/L1count/L1o_msg/L1o_trn", $header);
|
||||
$header = unpack('L1magic/L1version/L1count/L1o_msg/L1o_trn', $header);
|
||||
extract($header);
|
||||
|
||||
if ((dechex($magic) === '950412de' || dechex($magic) === 'ffffffff950412de') && !$version) {
|
||||
|
@ -445,19 +445,19 @@ class I18n {
|
|||
* @return mixed Array of translations on success or false on failure
|
||||
*/
|
||||
public static function loadPo($filename) {
|
||||
if (!$file = fopen($filename, "r")) {
|
||||
if (!$file = fopen($filename, 'r')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = 0;
|
||||
$translations = array();
|
||||
$translationKey = "";
|
||||
$translationKey = '';
|
||||
$plural = 0;
|
||||
$header = "";
|
||||
$header = '';
|
||||
|
||||
do {
|
||||
$line = trim(fgets($file));
|
||||
if ($line === "" || $line[0] === "#") {
|
||||
if ($line === '' || $line[0] === '#') {
|
||||
continue;
|
||||
}
|
||||
if (preg_match("/msgid[[:space:]]+\"(.+)\"$/i", $line, $regs)) {
|
||||
|
@ -465,7 +465,7 @@ class I18n {
|
|||
$translationKey = stripcslashes($regs[1]);
|
||||
} elseif (preg_match("/msgid[[:space:]]+\"\"$/i", $line, $regs)) {
|
||||
$type = 2;
|
||||
$translationKey = "";
|
||||
$translationKey = '';
|
||||
} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && ($type == 1 || $type == 2 || $type == 3)) {
|
||||
$type = 3;
|
||||
$translationKey .= stripcslashes($regs[1]);
|
||||
|
@ -474,7 +474,7 @@ class I18n {
|
|||
$type = 4;
|
||||
} elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && ($type == 1 || $type == 3) && $translationKey) {
|
||||
$type = 4;
|
||||
$translations[$translationKey] = "";
|
||||
$translations[$translationKey] = '';
|
||||
} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 4 && $translationKey) {
|
||||
$translations[$translationKey] .= stripcslashes($regs[1]);
|
||||
} elseif (preg_match("/msgid_plural[[:space:]]+\".*\"$/i", $line, $regs)) {
|
||||
|
@ -487,7 +487,7 @@ class I18n {
|
|||
$type = 7;
|
||||
} elseif (preg_match("/msgstr\[(\d+)\][[:space:]]+\"\"$/i", $line, $regs) && ($type == 6 || $type == 7) && $translationKey) {
|
||||
$plural = $regs[1];
|
||||
$translations[$translationKey][$plural] = "";
|
||||
$translations[$translationKey][$plural] = '';
|
||||
$type = 7;
|
||||
} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 7 && $translationKey) {
|
||||
$translations[$translationKey][$plural] .= stripcslashes($regs[1]);
|
||||
|
@ -495,20 +495,20 @@ class I18n {
|
|||
$header .= stripcslashes($regs[1]);
|
||||
$type = 5;
|
||||
} elseif (preg_match("/msgstr[[:space:]]+\"\"$/i", $line, $regs) && !$translationKey) {
|
||||
$header = "";
|
||||
$header = '';
|
||||
$type = 5;
|
||||
} elseif (preg_match("/^\"(.*)\"$/i", $line, $regs) && $type == 5) {
|
||||
$header .= stripcslashes($regs[1]);
|
||||
} else {
|
||||
unset($translations[$translationKey]);
|
||||
$type = 0;
|
||||
$translationKey = "";
|
||||
$translationKey = '';
|
||||
$plural = 0;
|
||||
}
|
||||
} while (!feof($file));
|
||||
fclose($file);
|
||||
|
||||
$merge[""] = $header;
|
||||
$merge[''] = $header;
|
||||
return array_merge($merge, $translations);
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ class I18n {
|
|||
* @return mixed Array of definitions on success or false on failure
|
||||
*/
|
||||
public static function loadLocaleDefinition($filename) {
|
||||
if (!$file = fopen($filename, "r")) {
|
||||
if (!$file = fopen($filename, 'r')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -988,7 +988,7 @@ class AuthComponentTest extends CakeTestCase {
|
|||
App::build(array(
|
||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||
));
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = "XMLHttpRequest";
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
|
||||
|
|
|
@ -271,12 +271,12 @@ class SanitizeTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
|
||||
$string = "x' AND 1=(SELECT COUNT(*) FROM users); --";
|
||||
$expected = "xAND1SELECTCOUNTFROMusers";
|
||||
$expected = 'xAND1SELECTCOUNTFROMusers';
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$string = "x'; DROP TABLE members; --";
|
||||
$expected = "xDROPTABLEmembers";
|
||||
$expected = 'xDROPTABLEmembers';
|
||||
$result = Sanitize::paranoid($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
|
|
@ -2443,8 +2443,8 @@ class SetTest extends CakeTestCase {
|
|||
$expected->hash = '68a9f053b19526d08e36c6a9ad150737933816a5';
|
||||
$expected->get_vars = '';
|
||||
$expected->redirect = '';
|
||||
$expected->created = "1195055503";
|
||||
$expected->updated = "1195055503";
|
||||
$expected->created = '1195055503';
|
||||
$expected->updated = '1195055503';
|
||||
// @codingStandardsIgnoreEnd
|
||||
$this->assertEquals($expected, $mapped[1]);
|
||||
|
||||
|
@ -2492,9 +2492,9 @@ class SetTest extends CakeTestCase {
|
|||
$expected->Author->id = '1';
|
||||
$expected->Author->user = 'mariano';
|
||||
$expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
|
||||
$expected->Author->created = "2007-03-17 01:16:23";
|
||||
$expected->Author->updated = "2007-03-17 01:18:31";
|
||||
$expected->Author->test = "working";
|
||||
$expected->Author->created = '2007-03-17 01:16:23';
|
||||
$expected->Author->updated = '2007-03-17 01:18:31';
|
||||
$expected->Author->test = 'working';
|
||||
$expected->Author->_name_ = 'Author';
|
||||
|
||||
$expected2 = new stdClass;
|
||||
|
@ -2511,9 +2511,9 @@ class SetTest extends CakeTestCase {
|
|||
$expected2->Author->id = '3';
|
||||
$expected2->Author->user = 'larry';
|
||||
$expected2->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
|
||||
$expected2->Author->created = "2007-03-17 01:20:23";
|
||||
$expected2->Author->updated = "2007-03-17 01:22:31";
|
||||
$expected2->Author->test = "working";
|
||||
$expected2->Author->created = '2007-03-17 01:20:23';
|
||||
$expected2->Author->updated = '2007-03-17 01:22:31';
|
||||
$expected2->Author->test = 'working';
|
||||
$expected2->Author->_name_ = 'Author';
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
|
@ -2546,7 +2546,7 @@ class SetTest extends CakeTestCase {
|
|||
$expected->Author->password = '5f4dcc3b5aa765d61d8327deb882cf99';
|
||||
$expected->Author->created = "2007-03-17 01:16:23";
|
||||
$expected->Author->updated = "2007-03-17 01:18:31";
|
||||
$expected->Author->test = "working";
|
||||
$expected->Author->test = 'working';
|
||||
$expected->Author->_name_ = 'Author';
|
||||
// @codingStandardsIgnoreEnd
|
||||
$this->assertEquals($expected, $result);
|
||||
|
|
|
@ -162,7 +162,7 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
}
|
||||
|
||||
if (1 > count($testCases)) {
|
||||
$buffer .= "EMPTY";
|
||||
$buffer .= 'EMPTY';
|
||||
echo $buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue