Permalink
Browse files

coding standards whitespace and single quote

  • Loading branch information...
dereuromark committed Jun 9, 2013
1 parent f6aedea commit a6f065e7a24fbf351a8c2332405f768b358103f7
View
@@ -373,7 +373,7 @@ protected function _bindTextDomain($domain) {
$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 @@ public static function loadMo($filename) {
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,27 +445,27 @@ public static function loadMo($filename) {
* @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)) {
$type = 1;
$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 @@ public static function loadPo($filename) {
$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,28 +487,28 @@ public static function loadPo($filename) {
$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]);
} elseif (preg_match("/msgstr[[:space:]]+\"(.+)\"$/i", $line, $regs) && $type == 2 && !$translationKey) {
$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 @@ public static function loadPo($filename) {
* @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 @@ public function testAjaxLogin() {
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 @@ public function testParanoid() {
$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 @@ public function testMapNesting() {
$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 @@ public function testNestedMappedData() {
$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 @@ public function testNestedMappedData() {
$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 @@ public function testNestedMappedData() {
$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 @@ public function testCaseList() {
}
if (1 > count($testCases)) {
- $buffer .= "EMPTY";
+ $buffer .= 'EMPTY';
echo $buffer;
}

0 comments on commit a6f065e

Please sign in to comment.