@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public $sDefaultChangeFreq = 'monthly'; |
14 | 14 | public $nMaxFileSize = 9961472; // max file size, 10MB by specification |
15 | - public $nMaxUrlCount = 50000; // max number of URLs per file, 50000 by specification |
|
15 | + public $nMaxUrlCount = 50000; // max number of URLs per file, 50000 by specification |
|
16 | 16 | |
17 | 17 | public $sPath = ''; |
18 | 18 | public $sDomain = ''; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $this->sPath = $sPath; |
35 | 35 | $this->sDomain = $sDomain; |
36 | 36 | |
37 | - $this->oIndexFile = fopen($sPath . 'sitemap.xml', 'w'); |
|
37 | + $this->oIndexFile = fopen($sPath.'sitemap.xml', 'w'); |
|
38 | 38 | if ($this->oIndexFile === false) { |
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
42 | - fwrite($this->oIndexFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n"); |
|
42 | + fwrite($this->oIndexFile, '<?xml version="1.0" encoding="UTF-8"?>'."\n"); |
|
43 | 43 | fwrite($this->oIndexFile, '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); |
44 | 44 | } |
45 | 45 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | $sXML = '<url>'; |
56 | - $sXML .= '<loc>' . xmlentities($this->sDomain . $sFile) . '</loc>'; |
|
57 | - $sXML .= '<lastmod>' . xmlentities(date('c', $dLastMod)) . '</lastmod>'; |
|
58 | - $sXML .= '<changefreq>' . xmlentities($sChangeFreq) . '</changefreq>'; |
|
59 | - $sXML .= '<priority>' . xmlentities($nPriority) . '</priority>'; |
|
56 | + $sXML .= '<loc>'.xmlentities($this->sDomain.$sFile).'</loc>'; |
|
57 | + $sXML .= '<lastmod>'.xmlentities(date('c', $dLastMod)).'</lastmod>'; |
|
58 | + $sXML .= '<changefreq>'.xmlentities($sChangeFreq).'</changefreq>'; |
|
59 | + $sXML .= '<priority>'.xmlentities($nPriority).'</priority>'; |
|
60 | 60 | $sXML .= '</url>'; |
61 | 61 | |
62 | 62 | $this->writeInternal($sXML); |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | |
76 | 76 | // open new XML file? |
77 | 77 | if ($this->oSitemapFile === false) { |
78 | - $this->nSitemapIndex ++; |
|
79 | - $sFilename = 'sitemap-' . $this->nSitemapIndex . '.xml.gz'; |
|
80 | - $this->oSitemapFile = gzopen($this->sPath . $sFilename, 'wb'); |
|
78 | + $this->nSitemapIndex++; |
|
79 | + $sFilename = 'sitemap-'.$this->nSitemapIndex.'.xml.gz'; |
|
80 | + $this->oSitemapFile = gzopen($this->sPath.$sFilename, 'wb'); |
|
81 | 81 | |
82 | - fwrite($this->oIndexFile, '<sitemap><loc>' . xmlentities($this->sDomain . $sFilename) . '</loc><lastmod>' . xmlentities(date('c')) . '</lastmod></sitemap>'); |
|
82 | + fwrite($this->oIndexFile, '<sitemap><loc>'.xmlentities($this->sDomain.$sFilename).'</loc><lastmod>'.xmlentities(date('c')).'</lastmod></sitemap>'); |
|
83 | 83 | |
84 | - gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n"); |
|
84 | + gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>'."\n"); |
|
85 | 85 | gzwrite($this->oSitemapFile, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); |
86 | 86 | // includes end of xml-tag |
87 | 87 | $this->nWrittenSize = 108; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // write string to XML |
92 | 92 | gzwrite($this->oSitemapFile, $str); |
93 | 93 | $this->nWrittenSize += strlen($str); |
94 | - $this->nWrittenCount ++; |
|
94 | + $this->nWrittenCount++; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public function close() |
@@ -19,14 +19,14 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | // chicken-egg problem ... |
22 | -require_once $opt['rootpath'] . 'lib2/const.inc.php'; |
|
22 | +require_once $opt['rootpath'].'lib2/const.inc.php'; |
|
23 | 23 | |
24 | 24 | // do all output in text format |
25 | 25 | $opt['gui'] = GUI_TEXT; |
26 | 26 | |
27 | 27 | // include the main library |
28 | -require_once $opt['rootpath'] . 'lib2/common.inc.php'; |
|
29 | -require_once $opt['rootpath'] . 'lib2/cli.class.php'; |
|
28 | +require_once $opt['rootpath'].'lib2/common.inc.php'; |
|
29 | +require_once $opt['rootpath'].'lib2/cli.class.php'; |
|
30 | 30 | |
31 | 31 | if (($opt['debug'] & DEBUG_OUTOFSERVICE) == DEBUG_OUTOFSERVICE) { |
32 | 32 | $cli->debug('exit because DEBUG_OUTOFSERVICE is set'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * Unicode Reminder メモ |
6 | 6 | ***************************************************************************/ |
7 | 7 | |
8 | -require_once __DIR__. '/../vendor/autoload.php'; |
|
8 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
9 | 9 | |
10 | 10 | class mail extends Smarty |
11 | 11 | { |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | |
30 | 30 | global $opt; |
31 | 31 | |
32 | - $this->template_dir = $opt['rootpath'] . 'templates2/mail/'; |
|
33 | - $this->compile_dir = $opt['rootpath'] . 'cache2/smarty/compiled/'; |
|
32 | + $this->template_dir = $opt['rootpath'].'templates2/mail/'; |
|
33 | + $this->compile_dir = $opt['rootpath'].'cache2/smarty/compiled/'; |
|
34 | 34 | $this->plugins_dir = [ |
35 | 35 | 'plugins', |
36 | - __DIR__ . '/../src/Oc/SmartyPlugins' |
|
36 | + __DIR__.'/../src/Oc/SmartyPlugins' |
|
37 | 37 | ]; |
38 | 38 | |
39 | 39 | // disable caching ... |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | global $opt; |
56 | 56 | |
57 | - return 'mail|' . $opt['template']['locale'] . '|' . $this->compile_id; |
|
57 | + return 'mail|'.$opt['template']['locale'].'|'.$this->compile_id; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function assign_rs($name, $rs) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | global $tpl, $opt; |
72 | 72 | |
73 | - if (!$this->template_exists($this->name . '.tpl')) { |
|
73 | + if (!$this->template_exists($this->name.'.tpl')) { |
|
74 | 74 | $tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND); |
75 | 75 | } |
76 | 76 | $this->assign('template', $this->name); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | set_php_locale(); |
101 | 101 | } |
102 | 102 | |
103 | - $body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id()); |
|
103 | + $body = $this->fetch($this->main_template.'.tpl', '', $this->get_compile_id()); |
|
104 | 104 | |
105 | 105 | if ($this->recipient_locale != $sender_locale) { |
106 | 106 | $opt['template']['locale'] = $sender_locale; |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $aAddHeaders = array(); |
118 | - $aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>'; |
|
118 | + $aAddHeaders[] = 'From: "'.$this->from.'" <'.$this->from.'>'; |
|
119 | 119 | |
120 | 120 | if ($this->replyTo !== null) { |
121 | - $aAddHeaders[] = 'Reply-To: ' . $this->replyTo; |
|
121 | + $aAddHeaders[] = 'Reply-To: '.$this->replyTo; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | if ($this->returnPath !== null) { |
125 | - $aAddHeaders[] = 'Return-Path: ' . $this->returnPath; |
|
125 | + $aAddHeaders[] = 'Return-Path: '.$this->returnPath; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers)); |
129 | 129 | |
130 | - return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders); |
|
130 | + return mb_send_mail($this->to, $opt['mail']['subject'].$this->subject, $body, $mailheaders); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public static function is_existent_maildomain($domain) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function getPubDate() |
43 | 43 | { |
44 | 44 | if (empty($this->pubDate)) { |
45 | - return date("d.m.y H:i:s") . "GMT"; |
|
45 | + return date("d.m.y H:i:s")."GMT"; |
|
46 | 46 | } else { |
47 | 47 | return $this->pubDate; |
48 | 48 | } |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | { |
58 | 58 | $out = $this->header(); |
59 | 59 | $out .= "<channel>\n"; |
60 | - $out .= "<title>" . $this->title . "</title>\n"; |
|
61 | - $out .= "<link>" . $this->link . "</link>\n"; |
|
62 | - $out .= "<description>" . $this->description . "</description>\n"; |
|
63 | - $out .= "<language>" . $this->language . "</language>\n"; |
|
64 | - $out .= "<pubDate>" . $this->getPubDate() . "</pubDate>\n"; |
|
60 | + $out .= "<title>".$this->title."</title>\n"; |
|
61 | + $out .= "<link>".$this->link."</link>\n"; |
|
62 | + $out .= "<description>".$this->description."</description>\n"; |
|
63 | + $out .= "<language>".$this->language."</language>\n"; |
|
64 | + $out .= "<pubDate>".$this->getPubDate()."</pubDate>\n"; |
|
65 | 65 | |
66 | 66 | foreach ($this->tags as $key => $val) { |
67 | 67 | $out .= "<$key>$val</$key>\n"; |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | |
89 | 89 | public function header() |
90 | 90 | { |
91 | - $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n"; |
|
92 | - $out .= '<rss version="2.0">' . "\n"; |
|
91 | + $out = '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
|
92 | + $out .= '<rss version="2.0">'."\n"; |
|
93 | 93 | |
94 | 94 | return $out; |
95 | 95 | } |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | public function out() |
142 | 142 | { |
143 | 143 | $out = "<item>\n"; |
144 | - $out .= "<title>" . $this->title . "</title>\n"; |
|
145 | - $out .= "<link>" . $this->link . "</link>\n"; |
|
146 | - $out .= "<description>" . $this->description . "</description>\n"; |
|
147 | - $out .= "<pubDate>" . $this->getPubDate() . "</pubDate>\n"; |
|
144 | + $out .= "<title>".$this->title."</title>\n"; |
|
145 | + $out .= "<link>".$this->link."</link>\n"; |
|
146 | + $out .= "<description>".$this->description."</description>\n"; |
|
147 | + $out .= "<pubDate>".$this->getPubDate()."</pubDate>\n"; |
|
148 | 148 | |
149 | 149 | if ($this->attachment != "") { |
150 | 150 | $out .= "<enclosure url='{$this->attachment}' length='{$this->length}' type='{$this->mimetype}' />"; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if (empty($this->guid)) { |
154 | 154 | $this->guid = $this->link; |
155 | 155 | } |
156 | - $out .= "<guid>" . $this->guid . "</guid>\n"; |
|
156 | + $out .= "<guid>".$this->guid."</guid>\n"; |
|
157 | 157 | |
158 | 158 | foreach ($this->tags as $key => $val) { |
159 | 159 | $out .= "<$key>$val</$key\n>"; |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | * Unicode Reminder メモ |
6 | 6 | ***************************************************************************/ |
7 | 7 | |
8 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
9 | -require_once __DIR__ . '/Net/IDNA2.php'; |
|
8 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
9 | +require_once __DIR__.'/Net/IDNA2.php'; |
|
10 | 10 | |
11 | 11 | // !! THIS CODE IS ALSO USED IN OKAPI !! |
12 | 12 | // Any changes must be tested with OKAPI services/logs/submit method. |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $config->set('Attr.IDPrefix', 'custom_'); |
51 | 51 | |
52 | 52 | // enable 'display' and 'visibility' styles for mystery descriptions |
53 | - $config->set('CSS.AllowTricky', true); // + display, visibility, overflow |
|
54 | - $config->set('CSS.ForbiddenProperties', 'overflow'); // - overflow |
|
53 | + $config->set('CSS.AllowTricky', true); // + display, visibility, overflow |
|
54 | + $config->set('CSS.ForbiddenProperties', 'overflow'); // - overflow |
|
55 | 55 | |
56 | 56 | // prepare additional definitions |
57 | 57 | $def = $config->getHTMLDefinition(true); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); // HTML5 attribs currently not supported by TinyMCE |
66 | 66 | $def->addElement('legend', 'Inline', 'Flow', 'Common'); |
67 | 67 | $def->addElement('q', 'Inline', 'Inline', 'Common', ['cite' => 'URI']); |
68 | - $def->addElement('strike', 'Inline', 'Inline', 'Common'); // -> wird in CSS umgewandelt |
|
68 | + $def->addElement('strike', 'Inline', 'Inline', 'Common'); // -> wird in CSS umgewandelt |
|
69 | 69 | $def->addElement( |
70 | 70 | 'area', |
71 | 71 | 'Inline', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $errmsg = ""; |
40 | 40 | } |
41 | 41 | |
42 | - require __DIR__ . '/../html/error.php'; |
|
42 | + require __DIR__.'/../html/error.php'; |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | ) { |
68 | 68 | $error_handled = true; |
69 | 69 | |
70 | - $error = "(" . $error['type'] . ") " . $error['message'] . |
|
71 | - " at line " . $error['line'] . " of " . $error['file']; |
|
70 | + $error = "(".$error['type'].") ".$error['message']. |
|
71 | + " at line ".$error['line']." of ".$error['file']; |
|
72 | 72 | php_errormail($error); |
73 | 73 | |
74 | 74 | $errtitle = "PHP-Fehler"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $errmsg = $error; |
78 | 78 | } |
79 | 79 | |
80 | - require __DIR__ . '/../html/error.php'; |
|
80 | + require __DIR__.'/../html/error.php'; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | global $opt, $sql_errormail, $absolute_server_URI; |
95 | 95 | |
96 | 96 | $sendMail = true; |
97 | - $subject = '[' . $opt['page']['domain'] . '] PHP error'; |
|
97 | + $subject = '['.$opt['page']['domain'].'] PHP error'; |
|
98 | 98 | |
99 | 99 | if (isset($opt['db']['error']['mail']) && $opt['db']['error']['mail'] != '') { |
100 | 100 | $sendMail = mb_send_mail($opt['db']['error']['mail'], $subject, $errmsg); |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | function admin_errormail($to, $errortype, $message, $headers) |
115 | 115 | { |
116 | 116 | global $opt; |
117 | - $errorlog_dir = $opt['rootpath'] . 'var/errorlog'; |
|
118 | - $errorlog_path = $errorlog_dir . "/errorlog-" . date("Y-m-d"); |
|
117 | + $errorlog_dir = $opt['rootpath'].'var/errorlog'; |
|
118 | + $errorlog_path = $errorlog_dir."/errorlog-".date("Y-m-d"); |
|
119 | 119 | |
120 | - $error_mail_limit = 32768; // send max 32 KB = ca. 5-20 errors per day/logfile |
|
120 | + $error_mail_limit = 32768; // send max 32 KB = ca. 5-20 errors per day/logfile |
|
121 | 121 | |
122 | 122 | // All errors which may happen here are ignored, to avoid error recursions. |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | @mkdir($errorlog_dir); |
126 | 126 | } |
127 | 127 | $old_logsize = @filesize($errorlog_path) + 0; |
128 | - $msg = date("Y-m-d H:i:s.u") . " " . $errortype . "\n" . $message . "\n" . |
|
128 | + $msg = date("Y-m-d H:i:s.u")." ".$errortype."\n".$message."\n". |
|
129 | 129 | "-------------------------------------------------------------------------\n\n"; |
130 | 130 | try { |
131 | 131 | error_log( |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | if ($old_logsize < $error_mail_limit && $new_logsize >= $error_mail_limit) { |
144 | 144 | mb_send_mail( |
145 | 145 | $to, |
146 | - "too many " . $errortype, |
|
147 | - "Errors/Warnings are recorded in " . $errorlog_path . ".\n" . |
|
148 | - "Email Reporting is DISABLED for today now. Please check the logfile\n" . |
|
146 | + "too many ".$errortype, |
|
147 | + "Errors/Warnings are recorded in ".$errorlog_path.".\n". |
|
148 | + "Email Reporting is DISABLED for today now. Please check the logfile\n". |
|
149 | 149 | "and RENAME or delete it when done, so that logging is re-enabled.", |
150 | 150 | $headers |
151 | 151 | ); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | while ($nCurPos < mb_strlen($str)) { |
231 | 231 | $nNextSep = mb_strlen($str); |
232 | - for ($nSepPos = 0; $nSepPos < mb_strlen($sep); $nSepPos ++) { |
|
232 | + for ($nSepPos = 0; $nSepPos < mb_strlen($sep); $nSepPos++) { |
|
233 | 233 | $nThisPos = mb_strpos($str, mb_substr($sep, $nSepPos, 1), $nCurPos); |
234 | 234 | if ($nThisPos !== false) { |
235 | 235 | if ($nNextSep > $nThisPos) { |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $retval = 'E '; |
309 | 309 | } |
310 | 310 | |
311 | - $retval = $retval . sprintf("%03d", floor($lon)) . '° '; |
|
311 | + $retval = $retval.sprintf("%03d", floor($lon)).'° '; |
|
312 | 312 | $lon = $lon - floor($lon); |
313 | - $retval = $retval . sprintf("%06.3f", round($lon * 60, 3)) . '\''; |
|
313 | + $retval = $retval.sprintf("%06.3f", round($lon * 60, 3)).'\''; |
|
314 | 314 | |
315 | 315 | return $retval; |
316 | 316 | } |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | $retval = 'N '; |
326 | 326 | } |
327 | 327 | |
328 | - $retval = $retval . sprintf("%02d", floor($lat)) . '° '; |
|
328 | + $retval = $retval.sprintf("%02d", floor($lat)).'° '; |
|
329 | 329 | $lat = $lat - floor($lat); |
330 | - $retval = $retval . sprintf("%06.3f", round($lat * 60, 3)) . '\''; |
|
330 | + $retval = $retval.sprintf("%06.3f", round($lat * 60, 3)).'\''; |
|
331 | 331 | |
332 | 332 | return $retval; |
333 | 333 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | |
144 | 144 | } |
145 | 145 | $fnl = strlen($filename); |
146 | - $fh = "\x14\x00"; // ver needed to extract |
|
147 | - $fh .= "\x00\x00"; // gen purpose bit flag |
|
148 | - $fh .= "\x08\x00"; // compression method |
|
146 | + $fh = "\x14\x00"; // ver needed to extract |
|
147 | + $fh .= "\x00\x00"; // gen purpose bit flag |
|
148 | + $fh .= "\x08\x00"; // compression method |
|
149 | 149 | $fh .= "\x00\x00\x00\x00"; // last mod time and date |
150 | 150 | $fh .= pack( |
151 | 151 | "V3v2", |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | //local file header |
161 | 161 | $lfh = "PK\x03\x04"; |
162 | - $lfh .= $fh . $filename; |
|
162 | + $lfh .= $fh.$filename; |
|
163 | 163 | $zipdata = $lfh; |
164 | 164 | $zipdata .= $gzdata; |
165 | 165 | $zipdata .= pack("V3", $crc, $gzsize, $datasize); |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | "va*v3V2", |
171 | 171 | 0, |
172 | 172 | $fh, |
173 | - 0, // file comment length |
|
174 | - 0, // disk number start |
|
175 | - 0, // internal file attributes |
|
176 | - $attr, // external file attributes - 'archive/directory' bit set |
|
173 | + 0, // file comment length |
|
174 | + 0, // disk number start |
|
175 | + 0, // internal file attributes |
|
176 | + $attr, // external file attributes - 'archive/directory' bit set |
|
177 | 177 | $this->offset |
178 | - ) . $filename; |
|
178 | + ).$filename; |
|
179 | 179 | |
180 | 180 | $this->offset += 42 + $fnl + $gzsize; |
181 | 181 | $this->cdir[] = $cdir; |
182 | - $this->cnt ++; |
|
182 | + $this->cnt++; |
|
183 | 183 | $this->idx = $this->cnt - 1; |
184 | 184 | } |
185 | 185 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $cdsl, // size of central dir |
229 | 229 | $zdsl, // offset to start of central dir |
230 | 230 | 0 |
231 | - ); // .zip file comment length |
|
231 | + ); // .zip file comment length |
|
232 | 232 | return $this->zipfile; |
233 | 233 | } |
234 | 234 |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | // |
24 | 24 | |
25 | 25 | // }}} |
26 | -require_once __DIR__ . '/IDNA2/Exception.php'; |
|
27 | -require_once __DIR__ . '/IDNA2/Exception/Nameprep.php'; |
|
26 | +require_once __DIR__.'/IDNA2/Exception.php'; |
|
27 | +require_once __DIR__.'/IDNA2/Exception/Nameprep.php'; |
|
28 | 28 | // adjusted paths for OC distribution |
29 | 29 | |
30 | 30 | /** |
@@ -272,16 +272,16 @@ discard block |
||
272 | 272 | * @access private |
273 | 273 | */ |
274 | 274 | private static $_np_prohibit_ranges = array( |
275 | - array(0x80, 0x9F ), |
|
276 | - array(0x2060, 0x206F ), |
|
277 | - array(0x1D173, 0x1D17A ), |
|
278 | - array(0xE000, 0xF8FF ), |
|
279 | - array(0xF0000, 0xFFFFD ), |
|
275 | + array(0x80, 0x9F), |
|
276 | + array(0x2060, 0x206F), |
|
277 | + array(0x1D173, 0x1D17A), |
|
278 | + array(0xE000, 0xF8FF), |
|
279 | + array(0xF0000, 0xFFFFD), |
|
280 | 280 | array(0x100000, 0x10FFFD), |
281 | - array(0xFDD0, 0xFDEF ), |
|
282 | - array(0xD800, 0xDFFF ), |
|
283 | - array(0x2FF0, 0x2FFB ), |
|
284 | - array(0xE0020, 0xE007F ) |
|
281 | + array(0xFDD0, 0xFDEF), |
|
282 | + array(0xD800, 0xDFFF), |
|
283 | + array(0x2FF0, 0x2FFB), |
|
284 | + array(0xE0020, 0xE007F) |
|
285 | 285 | ); |
286 | 286 | |
287 | 287 | /** |
@@ -2328,8 +2328,7 @@ discard block |
||
2328 | 2328 | // Forcing conversion of input to UCS4 array |
2329 | 2329 | // If one time encoding is given, use this, else the objects property |
2330 | 2330 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
2331 | - case 'utf8': |
|
2332 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
2331 | + case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded); |
|
2333 | 2332 | break; |
2334 | 2333 | case 'ucs4_string': |
2335 | 2334 | $decoded = $this->_ucs4_string_to_ucs4($decoded); |
@@ -2349,7 +2348,7 @@ discard block |
||
2349 | 2348 | |
2350 | 2349 | foreach ($decoded as $k => $v) { |
2351 | 2350 | // Make sure to use just the plain dot |
2352 | - switch($v) { |
|
2351 | + switch ($v) { |
|
2353 | 2352 | case 0x3002: |
2354 | 2353 | case 0xFF0E: |
2355 | 2354 | case 0xFF61: |
@@ -2370,11 +2369,11 @@ discard block |
||
2370 | 2369 | // Skip first char |
2371 | 2370 | if ($k) { |
2372 | 2371 | $encoded = ''; |
2373 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
2372 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k) - $last_begin))); |
|
2374 | 2373 | if ($encoded) { |
2375 | 2374 | $output .= $encoded; |
2376 | 2375 | } else { |
2377 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
2376 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k) - $last_begin))); |
|
2378 | 2377 | } |
2379 | 2378 | $output .= chr($decoded[$k]); |
2380 | 2379 | } |
@@ -2385,11 +2384,11 @@ discard block |
||
2385 | 2384 | if ($last_begin) { |
2386 | 2385 | $inp_len = sizeof($decoded); |
2387 | 2386 | $encoded = ''; |
2388 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); |
|
2387 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len) - $last_begin))); |
|
2389 | 2388 | if ($encoded) { |
2390 | 2389 | $output .= $encoded; |
2391 | 2390 | } else { |
2392 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); |
|
2391 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len) - $last_begin))); |
|
2393 | 2392 | } |
2394 | 2393 | return $output; |
2395 | 2394 | } |
@@ -2440,7 +2439,7 @@ discard block |
||
2440 | 2439 | $conv = $this->_decode($v); |
2441 | 2440 | if ($conv) $arr[$k] = $conv; |
2442 | 2441 | } |
2443 | - $return = $email_pref . '@' . join('.', $arr); |
|
2442 | + $return = $email_pref.'@'.join('.', $arr); |
|
2444 | 2443 | } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
2445 | 2444 | // No no in strict mode |
2446 | 2445 | if ($this->_strict_mode) { |
@@ -2473,8 +2472,7 @@ discard block |
||
2473 | 2472 | // The output is UTF-8 by default, other output formats need conversion here |
2474 | 2473 | // If one time encoding is given, use this, else the objects property |
2475 | 2474 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
2476 | - case 'utf8': |
|
2477 | - return $return; |
|
2475 | + case 'utf8' : return $return; |
|
2478 | 2476 | break; |
2479 | 2477 | case 'ucs4_string': |
2480 | 2478 | return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
@@ -2507,20 +2505,20 @@ discard block |
||
2507 | 2505 | if (!empty($parts_arr['user'])) { |
2508 | 2506 | $ret_url .= $parts_arr['user']; |
2509 | 2507 | if (!empty($parts_arr['pass'])) { |
2510 | - $ret_url .= ':' . $parts_arr['pass']; |
|
2508 | + $ret_url .= ':'.$parts_arr['pass']; |
|
2511 | 2509 | } |
2512 | 2510 | $ret_url .= '@'; |
2513 | 2511 | } |
2514 | 2512 | $ret_url .= $parts_arr['host']; |
2515 | 2513 | if (!empty($parts_arr['port'])) { |
2516 | - $ret_url .= ':' . $parts_arr['port']; |
|
2514 | + $ret_url .= ':'.$parts_arr['port']; |
|
2517 | 2515 | } |
2518 | 2516 | $ret_url .= $parts_arr['path']; |
2519 | 2517 | if (!empty($parts_arr['query'])) { |
2520 | - $ret_url .= '?' . $parts_arr['query']; |
|
2518 | + $ret_url .= '?'.$parts_arr['query']; |
|
2521 | 2519 | } |
2522 | 2520 | if (!empty($parts_arr['fragment'])) { |
2523 | - $ret_url .= '#' . $parts_arr['fragment']; |
|
2521 | + $ret_url .= '#'.$parts_arr['fragment']; |
|
2524 | 2522 | } |
2525 | 2523 | return $ret_url; |
2526 | 2524 | } |
@@ -2598,7 +2596,7 @@ discard block |
||
2598 | 2596 | } |
2599 | 2597 | |
2600 | 2598 | // Start with the prefix; copy it to output |
2601 | - $encoded = $this->_punycode_prefix . $encoded; |
|
2599 | + $encoded = $this->_punycode_prefix.$encoded; |
|
2602 | 2600 | |
2603 | 2601 | // If we have basic code points in output, add an hyphen to the end |
2604 | 2602 | if ($codecount) { |
@@ -2629,9 +2627,8 @@ discard block |
||
2629 | 2627 | $delta++; |
2630 | 2628 | } else if ($decoded[$i] == $cur_code) { |
2631 | 2629 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
2632 | - $t = ($k <= $bias)? |
|
2633 | - $this->_tmin : |
|
2634 | - (($k >= $bias + $this->_tmax)? $this->_tmax : $k - $bias); |
|
2630 | + $t = ($k <= $bias) ? |
|
2631 | + $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
2635 | 2632 | |
2636 | 2633 | if ($q < $t) { |
2637 | 2634 | break; |
@@ -2668,11 +2665,11 @@ discard block |
||
2668 | 2665 | private function _decode($encoded) |
2669 | 2666 | { |
2670 | 2667 | // We do need to find the Punycode prefix |
2671 | - if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) { |
|
2668 | + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { |
|
2672 | 2669 | return false; |
2673 | 2670 | } |
2674 | 2671 | |
2675 | - $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded); |
|
2672 | + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); |
|
2676 | 2673 | |
2677 | 2674 | // If nothing left after removing the prefix, it is hopeless |
2678 | 2675 | if (!$encode_test) { |
@@ -2699,14 +2696,13 @@ discard block |
||
2699 | 2696 | $idx = 0; |
2700 | 2697 | $char = $this->_initial_n; |
2701 | 2698 | |
2702 | - for ($enco_idx = ($delim_pos)? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { |
|
2703 | - for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { |
|
2699 | + for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { |
|
2700 | + for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { |
|
2704 | 2701 | $digit = $this->_decodeDigit($encoded{$enco_idx++}); |
2705 | 2702 | $idx += $digit * $w; |
2706 | 2703 | |
2707 | 2704 | $t = ($k <= $bias) ? |
2708 | - $this->_tmin : |
|
2709 | - (($k >= $bias + $this->_tmax)? $this->_tmax : ($k - $bias)); |
|
2705 | + $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
2710 | 2706 | |
2711 | 2707 | if ($digit < $t) { |
2712 | 2708 | break; |
@@ -2717,7 +2713,7 @@ discard block |
||
2717 | 2713 | |
2718 | 2714 | $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); |
2719 | 2715 | $is_first = false; |
2720 | - $char += (int) ($idx / ($deco_len + 1)); |
|
2716 | + $char += (int)($idx / ($deco_len + 1)); |
|
2721 | 2717 | $idx %= ($deco_len + 1); |
2722 | 2718 | |
2723 | 2719 | if ($deco_len > 0) { |
@@ -2745,14 +2741,14 @@ discard block |
||
2745 | 2741 | */ |
2746 | 2742 | private function _adapt($delta, $npoints, $is_first) |
2747 | 2743 | { |
2748 | - $delta = (int) ($is_first ? ($delta / $this->_damp) : ($delta / 2)); |
|
2749 | - $delta += (int) ($delta / $npoints); |
|
2744 | + $delta = (int)($is_first ? ($delta / $this->_damp) : ($delta / 2)); |
|
2745 | + $delta += (int)($delta / $npoints); |
|
2750 | 2746 | |
2751 | 2747 | for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) { |
2752 | - $delta = (int) ($delta / ($this->_base - $this->_tmin)); |
|
2748 | + $delta = (int)($delta / ($this->_base - $this->_tmin)); |
|
2753 | 2749 | } |
2754 | 2750 | |
2755 | - return (int) ($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); |
|
2751 | + return (int)($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); |
|
2756 | 2752 | } |
2757 | 2753 | |
2758 | 2754 | /** |
@@ -2779,7 +2775,7 @@ discard block |
||
2779 | 2775 | private function _decodeDigit($cp) |
2780 | 2776 | { |
2781 | 2777 | $cp = ord($cp); |
2782 | - return ($cp - 48 < 10)? $cp - 22 : (($cp - 65 < 26)? $cp - 65 : (($cp - 97 < 26)? $cp - 97 : $this->_base)); |
|
2778 | + return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base)); |
|
2783 | 2779 | } |
2784 | 2780 | |
2785 | 2781 | /** |
@@ -2807,12 +2803,12 @@ discard block |
||
2807 | 2803 | |
2808 | 2804 | // Try to find prohibited input |
2809 | 2805 | if (in_array($v, self::$_np_prohibit) || in_array($v, self::$_general_prohibited)) { |
2810 | - throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v)); |
|
2806 | + throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+'.sprintf('%08X', $v)); |
|
2811 | 2807 | } |
2812 | 2808 | |
2813 | 2809 | foreach (self::$_np_prohibit_ranges as $range) { |
2814 | 2810 | if ($range[0] <= $v && $v <= $range[1]) { |
2815 | - throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+' . sprintf('%08X', $v)); |
|
2811 | + throw new Net_IDNA2_Exception_Nameprep('Prohibited input U+'.sprintf('%08X', $v)); |
|
2816 | 2812 | } |
2817 | 2813 | } |
2818 | 2814 | |
@@ -2862,7 +2858,7 @@ discard block |
||
2862 | 2858 | // Rewind the for loop by one, since there can be more possible compositions |
2863 | 2859 | $i--; |
2864 | 2860 | $out_len--; |
2865 | - $last_class = ($i == $last_starter)? 0 : $this->_getCombiningClass($output[$i - 1]); |
|
2861 | + $last_class = ($i == $last_starter) ? 0 : $this->_getCombiningClass($output[$i - 1]); |
|
2866 | 2862 | |
2867 | 2863 | continue; |
2868 | 2864 | } |
@@ -2899,7 +2895,7 @@ discard block |
||
2899 | 2895 | |
2900 | 2896 | $result = array(); |
2901 | 2897 | $T = $this->_tbase + $sindex % $this->_tcount; |
2902 | - $result[] = (int)($this->_lbase + $sindex / $this->_ncount); |
|
2898 | + $result[] = (int)($this->_lbase + $sindex / $this->_ncount); |
|
2903 | 2899 | $result[] = (int)($this->_vbase + ($sindex % $this->_ncount) / $this->_tcount); |
2904 | 2900 | |
2905 | 2901 | if ($T != $this->_tbase) { |
@@ -2985,7 +2981,7 @@ discard block |
||
2985 | 2981 | */ |
2986 | 2982 | private function _getCombiningClass($char) |
2987 | 2983 | { |
2988 | - return isset(self::$_np_norm_combcls[$char])? self::$_np_norm_combcls[$char] : 0; |
|
2984 | + return isset(self::$_np_norm_combcls[$char]) ? self::$_np_norm_combcls[$char] : 0; |
|
2989 | 2985 | } |
2990 | 2986 | |
2991 | 2987 | /** |
@@ -3146,7 +3142,7 @@ discard block |
||
3146 | 3142 | throw new UnexpectedValueException('This might be UTF-8, but I don\'t understand it at byte '.$k); |
3147 | 3143 | } |
3148 | 3144 | if ('add' == $mode) { |
3149 | - $output[$out_len] = (int) $v; |
|
3145 | + $output[$out_len] = (int)$v; |
|
3150 | 3146 | ++$out_len; |
3151 | 3147 | continue; |
3152 | 3148 | } |
@@ -3205,14 +3201,14 @@ discard block |
||
3205 | 3201 | // 4 bytes |
3206 | 3202 | $output .= chr(240 + ($v >> 18)) |
3207 | 3203 | . chr(128 + (($v >> 12) & 63)) |
3208 | - . chr(128 + (($v >> 6) & 63)) |
|
3204 | + . chr(128 + (($v >> 6) & 63)) |
|
3209 | 3205 | . chr(128 + ($v & 63)); |
3210 | 3206 | } else if ($v < 1 << 26) { |
3211 | 3207 | // 5 bytes |
3212 | 3208 | $output .= chr(248 + ($v >> 24)) |
3213 | 3209 | . chr(128 + (($v >> 18) & 63)) |
3214 | 3210 | . chr(128 + (($v >> 12) & 63)) |
3215 | - . chr(128 + (($v >> 6) & 63)) |
|
3211 | + . chr(128 + (($v >> 6) & 63)) |
|
3216 | 3212 | . chr(128 + ($v & 63)); |
3217 | 3213 | } else if ($v < 1 << 31) { |
3218 | 3214 | // 6 bytes |
@@ -3220,7 +3216,7 @@ discard block |
||
3220 | 3216 | . chr(128 + (($v >> 24) & 63)) |
3221 | 3217 | . chr(128 + (($v >> 18) & 63)) |
3222 | 3218 | . chr(128 + (($v >> 12) & 63)) |
3223 | - . chr(128 + (($v >> 6) & 63)) |
|
3219 | + . chr(128 + (($v >> 6) & 63)) |
|
3224 | 3220 | . chr(128 + ($v & 63)); |
3225 | 3221 | } else { |
3226 | 3222 | throw new UnexpectedValueException('Conversion from UCS-4 to UTF-8 failed: malformed input'); |
@@ -3245,7 +3241,7 @@ discard block |
||
3245 | 3241 | // Take array values and split output to 4 bytes per value |
3246 | 3242 | // The bit mask is 255, which reads &11111111 |
3247 | 3243 | foreach ($input as $v) { |
3248 | - $output .= ($v & (255 << 24) >> 24) . ($v & (255 << 16) >> 16) . ($v & (255 << 8) >> 8) . ($v & 255); |
|
3244 | + $output .= ($v & (255 << 24) >> 24).($v & (255 << 16) >> 16).($v & (255 << 8) >> 8).($v & 255); |
|
3249 | 3245 | } |
3250 | 3246 | return $output; |
3251 | 3247 | } |
@@ -3280,7 +3276,7 @@ discard block |
||
3280 | 3276 | $out_len++; |
3281 | 3277 | $output[$out_len] = 0; |
3282 | 3278 | } |
3283 | - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); |
|
3279 | + $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4))); |
|
3284 | 3280 | } |
3285 | 3281 | return $output; |
3286 | 3282 | } |
@@ -3331,7 +3327,7 @@ discard block |
||
3331 | 3327 | $return = ''; |
3332 | 3328 | |
3333 | 3329 | for ($i = $w; $i > -1; $i--) { |
3334 | - $return .= ($octet & (1 << $i))? '1' : '0'; |
|
3330 | + $return .= ($octet & (1 << $i)) ? '1' : '0'; |
|
3335 | 3331 | } |
3336 | 3332 | |
3337 | 3333 | return $return; |