diff --git a/thinkphp/library/org/crypt.php b/thinkphp/library/org/crypt.php index 0832cd6bc..e3d8894b6 100644 --- a/thinkphp/library/org/crypt.php +++ b/thinkphp/library/org/crypt.php @@ -233,5 +233,4 @@ protected static function compareString($known, $input) } return $result === 0; } - } diff --git a/thinkphp/library/org/image/driver/gd.php b/thinkphp/library/org/image/driver/gd.php index 4ffd8d0ee..35543bf67 100644 --- a/thinkphp/library/org/image/driver/gd.php +++ b/thinkphp/library/org/image/driver/gd.php @@ -17,7 +17,7 @@ class Gd { /** * 图像资源对象 - * + * * @var resource */ private $im; @@ -29,14 +29,14 @@ class Gd /** * 图像信息,包括 width, height, type, mime, size - * + * * @var array */ private $info; /** * 构造方法,可用于打开一张图像 - * + * * @param string $imgname 图像路径 */ public function __construct($imgname = null) @@ -495,8 +495,15 @@ public function water($source, $locate = THINKIMAGE_WATER_SOUTHEAST) * @return $this * @throws Exception */ - public function text($text, $font, $size, $color = '#00000000', - $locate = THINKIMAGE_WATER_SOUTHEAST, $offset = 0, $angle = 0) { + public function text( + $text, + $font, + $size, + $color = '#00000000', + $locate = THINKIMAGE_WATER_SOUTHEAST, + $offset = 0, + $angle = 0 + ) { //资源检测 if (empty($this->im)) { throw new Exception('没有可以被写入文字的图像资源'); diff --git a/thinkphp/library/org/image/driver/gif.php b/thinkphp/library/org/image/driver/gif.php index 1429ae690..d79d0cb52 100644 --- a/thinkphp/library/org/image/driver/gif.php +++ b/thinkphp/library/org/image/driver/gif.php @@ -53,7 +53,7 @@ public function __construct($src = null, $mod = 'url') /** * 设置或获取当前帧的数据 - * + * * @param string $stream 二进制数据流 * @return mixed 获取到的数据 */ @@ -68,7 +68,7 @@ public function image($stream = null) /** * 将当前帧移动到下一帧 - * + * * @return string 当前帧数据 */ public function nextImage() @@ -78,7 +78,7 @@ public function nextImage() /** * 编码并保存当前GIF图片 - * + * * @param string $gifname 图片名称 */ public function save($gifname) @@ -86,7 +86,6 @@ public function save($gifname) $gif = new GIFEncoder($this->frames, $this->delays, 0, 2, 0, 0, 0, 'bin'); file_put_contents($gifname, $gif->GetAnimation()); } - } /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -137,8 +136,14 @@ class GIFEncode :: */ public function GIFEncoder( - $GIF_src, $GIF_dly, $GIF_lop, $GIF_dis, - $GIF_red, $GIF_grn, $GIF_blu, $GIF_mod + $GIF_src, + $GIF_dly, + $GIF_lop, + $GIF_dis, + $GIF_red, + $GIF_grn, + $GIF_blu, + $GIF_mod ) { if (!is_array($GIF_src)) { printf("%s: %s", $this->VER, $this->ERR['ERR00']); @@ -164,15 +169,15 @@ public function GIFEncoder( } for ($j = (13 + 3 * (2 << (ord($this->BUF[$i]{10}) & 0x07))), $k = true; $k; $j++) { switch ($this->BUF[$i]{ $j}) { - case "!": - if ((substr($this->BUF[$i], ($j + 3), 8)) == "NETSCAPE") { - printf("%s: %s ( %s source )!", $this->VER, $this->ERR['ERR03'], ($i + 1)); - exit(0); - } - break; - case ";": - $k = false; - break; + case "!": + if ((substr($this->BUF[$i], ($j + 3), 8)) == "NETSCAPE") { + printf("%s: %s ( %s source )!", $this->VER, $this->ERR['ERR03'], ($i + 1)); + exit(0); + } + break; + case ";": + $k = false; + break; } } } @@ -216,18 +221,23 @@ public function GIFAddFrames($i, $d) $Global_len = 2 << (ord($this->BUF[0]{10}) & 0x07); $Locals_len = 2 << (ord($this->BUF[$i]{10}) & 0x07); - $Global_rgb = substr($this->BUF[0], 13, - 3 * (2 << (ord($this->BUF[0]{10}) & 0x07))); - $Locals_rgb = substr($this->BUF[$i], 13, - 3 * (2 << (ord($this->BUF[$i]{10}) & 0x07))); + $Global_rgb = substr( + $this->BUF[0], + 13, + 3 * (2 << (ord($this->BUF[0]{10}) & 0x07)) + ); + $Locals_rgb = substr( + $this->BUF[$i], + 13, + 3 * (2 << (ord($this->BUF[$i]{10}) & 0x07)) + ); $Locals_ext = "!\xF9\x04" . chr(($this->DIS << 2) + 0) . chr(($d >> 0) & 0xFF) . chr(($d >> 8) & 0xFF) . "\x0\x0"; if ($this->COL > -1 && ord($this->BUF[$i]{10}) & 0x80) { for ($j = 0; $j < (2 << (ord($this->BUF[$i]{10}) & 0x07)); $j++) { - if ( - ord($Locals_rgb{3 * $j + 0}) == (($this->COL >> 16) & 0xFF) && + if (ord($Locals_rgb{3 * $j + 0}) == (($this->COL >> 16) & 0xFF) && ord($Locals_rgb{3 * $j + 1}) == (($this->COL >> 8) & 0xFF) && ord($Locals_rgb{3 * $j + 2}) == (($this->COL >> 0) & 0xFF) ) { @@ -238,17 +248,17 @@ public function GIFAddFrames($i, $d) } } switch ($Locals_tmp{0}) { - case "!": - /** - * @var string $Locals_img; - */ - $Locals_img = substr($Locals_tmp, 8, 10); - $Locals_tmp = substr($Locals_tmp, 18, strlen($Locals_tmp) - 18); - break; - case ",": - $Locals_img = substr($Locals_tmp, 0, 10); - $Locals_tmp = substr($Locals_tmp, 10, strlen($Locals_tmp) - 10); - break; + case "!": + /** + * @var string $Locals_img; + */ + $Locals_img = substr($Locals_tmp, 8, 10); + $Locals_tmp = substr($Locals_tmp, 18, strlen($Locals_tmp) - 18); + break; + case ",": + $Locals_img = substr($Locals_tmp, 0, 10); + $Locals_tmp = substr($Locals_tmp, 10, strlen($Locals_tmp) - 10); + break; } if (ord($this->BUF[$i]{10}) & 0x80 && $this->IMG > -1) { if ($Global_len == $Locals_len) { @@ -295,8 +305,7 @@ public function GIFBlockCompare($GlobalBlock, $LocalBlock, $Len) { for ($i = 0; $i < $Len; $i++) { - if ( - $GlobalBlock{3 * $i + 0} != $LocalBlock{3 * $i + 0} || + if ($GlobalBlock{3 * $i + 0} != $LocalBlock{3 * $i + 0} || $GlobalBlock{3 * $i + 1} != $LocalBlock{3 * $i + 1} || $GlobalBlock{3 * $i + 2} != $LocalBlock{3 * $i + 2} ) { diff --git a/thinkphp/library/org/image/driver/imagick.php b/thinkphp/library/org/image/driver/imagick.php index a75574b89..b5a483633 100644 --- a/thinkphp/library/org/image/driver/imagick.php +++ b/thinkphp/library/org/image/driver/imagick.php @@ -521,8 +521,15 @@ public function water($source, $locate = THINKIMAGE_WATER_SOUTHEAST) * @param integer $offset 文字相对当前位置的偏移量 * @param integer $angle 文字倾斜角度 */ - public function text($text, $font, $size, $color = '#00000000', - $locate = THINKIMAGE_WATER_SOUTHEAST, $offset = 0, $angle = 0) { + public function text( + $text, + $font, + $size, + $color = '#00000000', + $locate = THINKIMAGE_WATER_SOUTHEAST, + $offset = 0, + $angle = 0 + ) { //资源检测 if (empty($this->im)) { throw new \Exception('没有可以被写入文字的图像资源'); @@ -659,5 +666,4 @@ public function __destruct() { empty($this->im) || $this->im->destroy(); } - } diff --git a/thinkphp/library/org/oauth/driver/baidu.php b/thinkphp/library/org/oauth/driver/baidu.php index c245e3b59..fbdb5f86e 100644 --- a/thinkphp/library/org/oauth/driver/baidu.php +++ b/thinkphp/library/org/oauth/driver/baidu.php @@ -99,5 +99,4 @@ public function getOauthInfo() throw new \Exception("获取百度用户信息失败:{$data['error_msg']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/diandian.php b/thinkphp/library/org/oauth/driver/diandian.php index 305601d4f..a4c5da2b1 100644 --- a/thinkphp/library/org/oauth/driver/diandian.php +++ b/thinkphp/library/org/oauth/driver/diandian.php @@ -99,5 +99,4 @@ public function getOauthInfo() E("获取点点用户信息失败:{$data}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/douban.php b/thinkphp/library/org/oauth/driver/douban.php index fb671aa06..b24f26c2c 100644 --- a/thinkphp/library/org/oauth/driver/douban.php +++ b/thinkphp/library/org/oauth/driver/douban.php @@ -97,5 +97,4 @@ public function getOauthInfo() E("获取豆瓣用户信息失败:{$data['msg']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/github.php b/thinkphp/library/org/oauth/driver/github.php index 47ff4db4e..f9e781c9f 100644 --- a/thinkphp/library/org/oauth/driver/github.php +++ b/thinkphp/library/org/oauth/driver/github.php @@ -98,5 +98,4 @@ public function getOauthInfo() E("获取Github用户信息失败:{$data}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/google.php b/thinkphp/library/org/oauth/driver/google.php index 970249ac2..4cd070724 100644 --- a/thinkphp/library/org/oauth/driver/google.php +++ b/thinkphp/library/org/oauth/driver/google.php @@ -104,5 +104,4 @@ public function getOauthInfo() E("获取Google用户信息失败:{$data}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/kaixin.php b/thinkphp/library/org/oauth/driver/kaixin.php index 889e89244..eba516495 100644 --- a/thinkphp/library/org/oauth/driver/kaixin.php +++ b/thinkphp/library/org/oauth/driver/kaixin.php @@ -99,5 +99,4 @@ public function getOauthInfo() E("获取开心网用户信息失败:{$data['error']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/msn.php b/thinkphp/library/org/oauth/driver/msn.php index f1b4d6040..ae6e79eb7 100644 --- a/thinkphp/library/org/oauth/driver/msn.php +++ b/thinkphp/library/org/oauth/driver/msn.php @@ -105,5 +105,4 @@ public function getOauthInfo() E("获取msn用户信息失败:{$data}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/sina.php b/thinkphp/library/org/oauth/driver/sina.php index 7129e16cd..acf19adb7 100644 --- a/thinkphp/library/org/oauth/driver/sina.php +++ b/thinkphp/library/org/oauth/driver/sina.php @@ -99,5 +99,4 @@ public function getOauthInfo() E("获取人人网用户信息失败:{$data['error_msg']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/sohu.php b/thinkphp/library/org/oauth/driver/sohu.php index 06db5e687..8be8f87c7 100644 --- a/thinkphp/library/org/oauth/driver/sohu.php +++ b/thinkphp/library/org/oauth/driver/sohu.php @@ -99,5 +99,4 @@ public function getOauthInfo() E("获取搜狐用户信息失败:{$data['message']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/t163.php b/thinkphp/library/org/oauth/driver/t163.php index 640dee03e..6130958b6 100644 --- a/thinkphp/library/org/oauth/driver/t163.php +++ b/thinkphp/library/org/oauth/driver/t163.php @@ -100,5 +100,4 @@ public function getOauthInfo() E("获取网易微博用户信息失败:{$data['error']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/taobao.php b/thinkphp/library/org/oauth/driver/taobao.php index 3345f2185..e694c6134 100644 --- a/thinkphp/library/org/oauth/driver/taobao.php +++ b/thinkphp/library/org/oauth/driver/taobao.php @@ -103,5 +103,4 @@ public function getOauthInfo() E("获取淘宝网用户信息失败:{$data['error_response']['msg']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/tencent.php b/thinkphp/library/org/oauth/driver/tencent.php index 2afa2d2cf..64c6a49e8 100644 --- a/thinkphp/library/org/oauth/driver/tencent.php +++ b/thinkphp/library/org/oauth/driver/tencent.php @@ -104,5 +104,4 @@ public function getOauthInfo() E("获取人人网用户信息失败:{$data['error_msg']}"); } } - } diff --git a/thinkphp/library/org/oauth/driver/x360.php b/thinkphp/library/org/oauth/driver/x360.php index 7eb6d82d7..cc684dff5 100644 --- a/thinkphp/library/org/oauth/driver/x360.php +++ b/thinkphp/library/org/oauth/driver/x360.php @@ -99,5 +99,4 @@ public function getOauthInfo() E("获取360用户信息失败:{$data['error']}"); } } - } diff --git a/thinkphp/library/org/parser/driver/markdown.php b/thinkphp/library/org/parser/driver/markdown.php index 39634b613..9e3cb2801 100644 --- a/thinkphp/library/org/parser/driver/markdown.php +++ b/thinkphp/library/org/parser/driver/markdown.php @@ -213,7 +213,8 @@ protected function stripLinkDefinitions($text) $less_than_tab = $this->tab_width - 1; # Link defs are in the form: ^[id]: url "optional title" - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ^[ ]{0,' . $less_than_tab . '}\[(.+)\][ ]?: # id = $1 [ ]* \n? # maybe *one* newline @@ -236,7 +237,8 @@ protected function stripLinkDefinitions($text) (?:\n+|\Z) }xm', array(&$this, '_stripLinkDefinitions_callback'), - $text); + $text + ); return $text; } protected function _stripLinkDefinitions_callback($matches) @@ -303,14 +305,16 @@ protected function hashHTMLBlocks($text) | >', $nested_tags_level) . # end of opening tag '.*?' . # last level nested tag content - str_repeat(' + str_repeat( + ' # closing nested tag ) | <(?!/\2\s*> # other tags with a different name ) )*', - $nested_tags_level); + $nested_tags_level + ); $content2 = str_replace('\2', '\3', $content); # First, look for nested blocks, e.g.: @@ -324,7 +328,8 @@ protected function hashHTMLBlocks($text) # the inner nested divs must be indented. # We need to do this before the next, more liberal match, because the next # match will start at the first `
` and stop at the first `
`. - $text = preg_replace_callback('{(?> + $text = preg_replace_callback( + '{(?> (?> (?<=\n\n) # Starting after a blank line | # or @@ -386,7 +391,8 @@ protected function hashHTMLBlocks($text) ) )}Sxmi', array(&$this, '_hashHTMLBlocks_callback'), - $text); + $text + ); return $text; } @@ -488,7 +494,8 @@ protected function doHorizontalRules($text) $ # End of line. }mx', "\n" . $this->hashBlock("empty_element_suffix") . "\n", - $text); + $text + ); } protected $span_gamut = array( @@ -530,8 +537,11 @@ protected function runSpanGamut($text) protected function doHardBreaks($text) { # Do hard breaks: - return preg_replace_callback('/ {2,}\n/', - array(&$this, '_doHardBreaks_callback'), $text); + return preg_replace_callback( + '/ {2,}\n/', + array(&$this, '_doHardBreaks_callback'), + $text + ); } protected function _doHardBreaks_callback($matches) { @@ -552,7 +562,8 @@ protected function doAnchors($text) # # First, handle reference-style links: [link text] [id] # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ( # wrap whole match in $1 \[ (' . $this->nested_brackets_re . ') # link text = $2 @@ -566,12 +577,15 @@ protected function doAnchors($text) \] ) }xs', - array(&$this, '_doAnchors_reference_callback'), $text); + array(&$this, '_doAnchors_reference_callback'), + $text + ); # # Next, inline-style links: [link text](url "optional title") # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ( # wrap whole match in $1 \[ (' . $this->nested_brackets_re . ') # link text = $2 @@ -593,21 +607,26 @@ protected function doAnchors($text) \) ) }xs', - array(&$this, '_doAnchors_inline_callback'), $text); + array(&$this, '_doAnchors_inline_callback'), + $text + ); # # Last, handle reference-style shortcuts: [link text] # These must come last in case you've also got [link text][1] # or [link text](/foo) # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ( # wrap whole match in $1 \[ ([^\[\]]+) # link text = $2; can\'t contain [ or ] \] ) }xs', - array(&$this, '_doAnchors_reference_callback'), $text); + array(&$this, '_doAnchors_reference_callback'), + $text + ); $this->in_anchor = false; return $text; @@ -675,7 +694,8 @@ protected function doImages($text) # # First, handle reference-style labeled images: ![alt text][id] # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ( # wrap whole match in $1 !\[ (' . $this->nested_brackets_re . ') # alt text = $2 @@ -690,13 +710,16 @@ protected function doImages($text) ) }xs', - array(&$this, '_doImages_reference_callback'), $text); + array(&$this, '_doImages_reference_callback'), + $text + ); # # Next, handle inline images: ![alt text](url "optional title") # Don't forget: encode * and _ # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ( # wrap whole match in $1 !\[ (' . $this->nested_brackets_re . ') # alt text = $2 @@ -719,7 +742,9 @@ protected function doImages($text) \) ) }xs', - array(&$this, '_doImages_inline_callback'), $text); + array(&$this, '_doImages_inline_callback'), + $text + ); return $text; } @@ -779,8 +804,11 @@ protected function doHeaders($text) # Header 2 # -------- # - $text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx', - array(&$this, '_doHeaders_callback_setext'), $text); + $text = preg_replace_callback( + '{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx', + array(&$this, '_doHeaders_callback_setext'), + $text + ); # atx-style headers: # # Header 1 @@ -789,7 +817,8 @@ protected function doHeaders($text) # ... # ###### Header 6 # - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ^(\#{1,6}) # $1 = string of #\'s [ ]* (.+?) # $2 = Header text @@ -797,7 +826,9 @@ protected function doHeaders($text) \#* # optional closing #\'s (not counted) \n+ }xm', - array(&$this, '_doHeaders_callback_atx'), $text); + array(&$this, '_doHeaders_callback_atx'), + $text + ); return $text; } @@ -869,17 +900,23 @@ protected function doLists($text) # See extended comment in _ProcessListItems(). if ($this->list_level) { - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ ^ ' . $whole_list_re . ' }mx', - array(&$this, '_doLists_callback'), $text); + array(&$this, '_doLists_callback'), + $text + ); } else { - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ (?:(?<=\n)\n|\A\n?) # Must eat the newline ' . $whole_list_re . ' }mx', - array(&$this, '_doLists_callback'), $text); + array(&$this, '_doLists_callback'), + $text + ); } } @@ -938,7 +975,8 @@ protected function processListItems($list_str, $marker_any_re) # trim trailing blank lines: $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str); - $list_str = preg_replace_callback('{ + $list_str = preg_replace_callback( + '{ (\n)? # leading line = $1 (^[ ]*) # leading whitespace = $2 (' . $marker_any_re . ' # list marker and space = $3 @@ -948,7 +986,9 @@ protected function processListItems($list_str, $marker_any_re) (?:(\n+(?=\n))|\n) # tailing blank line = $5 (?= \n* (\z | \2 (' . $marker_any_re . ') (?:[ ]+|(?=\n)))) }xm', - array(&$this, '_processListItems_callback'), $list_str); + array(&$this, '_processListItems_callback'), + $list_str + ); $this->list_level--; return $list_str; @@ -981,7 +1021,8 @@ protected function doCodeBlocks($text) # # Process Markdown `
` blocks.
         #
-        $text = preg_replace_callback('{
+        $text = preg_replace_callback(
+            '{
 				(?:\n\n|\A\n?)
 				(	            # $1 = the code block -- one or more lines, starting with a space/tab
 				  (?>
@@ -991,7 +1032,9 @@ protected function doCodeBlocks($text)
 				)
 				((?=^[ ]{0,' . $this->tab_width . '}\S)|\Z)	# Lookahead for non-space at line-start, or end of doc
 			}xm',
-            array(&$this, '_doCodeBlocks_callback'), $text);
+            array(&$this, '_doCodeBlocks_callback'),
+            $text
+        );
 
         return $text;
     }
@@ -1183,7 +1226,8 @@ protected function doItalicsAndBold($text)
 
     protected function doBlockQuotes($text)
     {
-        $text = preg_replace_callback('/
+        $text = preg_replace_callback(
+            '/
 			  (								# Wrap whole match in $1
 				(?>
 				  ^[ ]*>[ ]?			# ">" at the start of a line
@@ -1193,7 +1237,9 @@ protected function doBlockQuotes($text)
 				)+
 			  )
 			/xm',
-            array(&$this, '_doBlockQuotes_callback'), $text);
+            array(&$this, '_doBlockQuotes_callback'),
+            $text
+        );
 
         return $text;
     }
@@ -1207,8 +1253,11 @@ protected function _doBlockQuotes_callback($matches)
         $bq = preg_replace('/^/m', "  ", $bq);
         # These leading spaces cause problem with 
 content,
         # so we need to fix that:
-        $bq = preg_replace_callback('{(\s*
.+?
)}sx', - array(&$this, '_doBlockQuotes_callback2'), $bq); + $bq = preg_replace_callback( + '{(\s*
.+?
)}sx', + array(&$this, '_doBlockQuotes_callback2'), + $bq + ); return "\n" . $this->hashBlock("
\n$bq\n
") . "\n\n"; } @@ -1311,8 +1360,11 @@ protected function encodeAmpsAndAngles($text) } else { # Ampersand-encoding based entirely on Nat Irons's Amputator # MT plugin: - $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', - '&', $text); + $text = preg_replace( + '/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', + '&', + $text + ); } # Encode remaining <'s $text = str_replace('<', '<', $text); @@ -1322,11 +1374,15 @@ protected function encodeAmpsAndAngles($text) protected function doAutoLinks($text) { - $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', - array(&$this, '_doAutoLinks_url_callback'), $text); + $text = preg_replace_callback( + '{<((https?|ftp|dict):[^\'">\s]+)>}i', + array(&$this, '_doAutoLinks_url_callback'), + $text + ); # Email addresses: - $text = preg_replace_callback('{ + $text = preg_replace_callback( + '{ < (?:mailto:)? ( @@ -1344,7 +1400,9 @@ protected function doAutoLinks($text) ) > }xi', - array(&$this, '_doAutoLinks_email_callback'), $text); + array(&$this, '_doAutoLinks_email_callback'), + $text + ); return $text; } @@ -1389,8 +1447,9 @@ protected function encodeEmailAddress($addr) $r = ($seed * (1 + $key)) % 100; # Pseudo-random function. # roughly 10% raw, 45% hex, 45% dec # '@' *must* be encoded. I insist. - if ($r > 90 && '@' != $char) /* do nothing */; - elseif ($r < 45) { + if ($r > 90 && '@' != $char) { + /* do nothing */; + } elseif ($r < 45) { $chars[$key] = '&#x' . dechex($ord) . ';'; } else { $chars[$key] = '&#' . $ord . ';'; @@ -1472,19 +1531,22 @@ protected function handleSpanToken($token, &$str) # returning the corresponding value that should replace it. # switch ($token{0}) { - case "\\": - return $this->hashPart("&#" . ord($token{1}) . ";"); - case "`": - # Search for end marker in remaining text. - if (preg_match('/^(.*?[^`])' . preg_quote($token) . '(?!`)(.*)$/sm', - $str, $matches)) { - $str = $matches[2]; - $codespan = $this->makeCodeSpan($matches[1]); - return $this->hashPart($codespan); - } - return $token; // return as text since no ending marker found. - default: - return $this->hashPart($token); + case "\\": + return $this->hashPart("&#" . ord($token{1}) . ";"); + case "`": + # Search for end marker in remaining text. + if (preg_match( + '/^(.*?[^`])' . preg_quote($token) . '(?!`)(.*)$/sm', + $str, + $matches + )) { + $str = $matches[2]; + $codespan = $this->makeCodeSpan($matches[1]); + return $this->hashPart($codespan); + } + return $token; // return as text since no ending marker found. + default: + return $this->hashPart($token); } } @@ -1509,8 +1571,11 @@ protected function detab($text) # tab characters. Then we reconstruct every line by adding the # appropriate number of space between each blocks. - $text = preg_replace_callback('/^.*\t.*$/m', - array(&$this, '_detab_callback'), $text); + $text = preg_replace_callback( + '/^.*\t.*$/m', + array(&$this, '_detab_callback'), + $text + ); return $text; } @@ -1554,12 +1619,14 @@ protected function unhash($text) # # Swap back in all the tags hashed by _HashHTMLBlocks. # - return preg_replace_callback('/(.)\x1A[0-9]+\1/', - array(&$this, '_unhash_callback'), $text); + return preg_replace_callback( + '/(.)\x1A[0-9]+\1/', + array(&$this, '_unhash_callback'), + $text + ); } protected function _unhash_callback($matches) { return $this->html_hashes[$matches[0]]; } - } diff --git a/thinkphp/library/org/parser/driver/ubb.php b/thinkphp/library/org/parser/driver/ubb.php index bf8614f1b..7e45f84b1 100644 --- a/thinkphp/library/org/parser/driver/ubb.php +++ b/thinkphp/library/org/parser/driver/ubb.php @@ -82,8 +82,11 @@ private function closeTag($data, $rule = '') if (is_string($data)) { list($tag, $reg[0], $reg[1], $func) = $rule; do { - $data = preg_replace_callback("/({$reg[0]})(.*?)({$reg[1]})/is", - [$this, 'closeTag'], $data); + $data = preg_replace_callback( + "/({$reg[0]})(.*?)({$reg[1]})/is", + [$this, 'closeTag'], + $data + ); } while ($count && $count--); //递归解析,直到嵌套解析完毕 return $data; } elseif (is_array($data)) { @@ -91,8 +94,11 @@ private function closeTag($data, $rule = '') if (preg_match("/{$reg[0]}/is", $data[$num - 2])) { //存在嵌套,进一步解析 $count = 1; - $data[$num - 2] = preg_replace_callback("/({$reg[0]})(.*?)({$reg[1]})/is", - [$this, 'closeTag'], $data[$num - 2] . $data[$num - 1]); + $data[$num - 2] = preg_replace_callback( + "/({$reg[0]})(.*?)({$reg[1]})/is", + [$this, 'closeTag'], + $data[$num - 2] . $data[$num - 1] + ); return $data[1] . $data[$num - 2]; } else { //不存在嵌套,直接解析内容 @@ -297,8 +303,9 @@ private function encodeEmailAddress($addr) $r = ($seed * (1 + $key)) % 100; # Pseudo-random function. # roughly 10% raw, 45% hex, 45% dec # '@' *must* be encoded. I insist. - if ($r > 90 && '@' != $char) /* do nothing */; - elseif ($r < 45) { + if ($r > 90 && '@' != $char) { + /* do nothing */; + } elseif ($r < 45) { $chars[$key] = '&#x' . dechex($ord) . ';'; } else { $chars[$key] = '&#' . $ord . ';'; diff --git a/thinkphp/library/org/transform.php b/thinkphp/library/org/transform.php index 0625cbe90..73aea0d54 100644 --- a/thinkphp/library/org/transform.php +++ b/thinkphp/library/org/transform.php @@ -13,6 +13,7 @@ // 内容解析类 use think\Exception as Exception; + class Transform { private static $handler = []; diff --git a/thinkphp/library/org/transform/driver/base64.php b/thinkphp/library/org/transform/driver/base64.php index 85c67d74c..acfa3ef2e 100644 --- a/thinkphp/library/org/transform/driver/base64.php +++ b/thinkphp/library/org/transform/driver/base64.php @@ -13,7 +13,7 @@ /** * Base64编码实现 - * + * */ class Base64 { @@ -83,5 +83,4 @@ public function decode($data, $target = '') // 原始解码,并返回结果 return base64_decode($data); } - } diff --git a/thinkphp/library/org/upload.php b/thinkphp/library/org/upload.php index 4820d5170..96a42e6d8 100644 --- a/thinkphp/library/org/upload.php +++ b/thinkphp/library/org/upload.php @@ -19,32 +19,32 @@ class Upload private $config = [ // 允许上传的文件MiMe类型 'mimes' => [], - // 上传的文件大小限制 (0-不做限制) - 'maxSize' => 0, + // 上传的文件大小限制 (0-不做限制) + 'maxSize' => 0, // 允许上传的文件后缀 - 'exts' => [], + 'exts' => [], // 自动子目录保存文件 - 'autoSub' => true, + 'autoSub' => true, // 子目录创建方式,[0]-函数名,[1]-参数,多个参数使用数组 - 'subName' => ['date', 'Y-m-d'], + 'subName' => ['date', 'Y-m-d'], //保存根路径 'rootPath' => './Uploads/', - // 保存路径 - 'savePath' => '', + // 保存路径 + 'savePath' => '', // 上传文件命名规则,[0]-函数名,[1]-参数,多个参数使用数组 - 'saveName' => ['uniqid', ''], + 'saveName' => ['uniqid', ''], // 文件保存后缀,空则使用原后缀 - 'saveExt' => '', + 'saveExt' => '', // 存在同名是否覆盖 'replace' => false, - // 是否生成hash编码 - 'hash' => true, + // 是否生成hash编码 + 'hash' => true, // 检测文件是否存在回调,如果存在返回文件信息数组 'callback' => false, - // 文件上传驱动e, - 'driver' => '', + // 文件上传驱动e, + 'driver' => '', // 上传驱动配置 - 'driverConfig' => [], + 'driverConfig' => [], ]; /** @@ -463,5 +463,4 @@ private function getName($rule, $filename) } return $name; } - } diff --git a/thinkphp/library/org/upload/driver/ftp.php b/thinkphp/library/org/upload/driver/ftp.php index 33d0a6b09..1c8f6596b 100644 --- a/thinkphp/library/org/upload/driver/ftp.php +++ b/thinkphp/library/org/upload/driver/ftp.php @@ -171,5 +171,4 @@ public function __destruct() { ftp_close($this->link); } - } diff --git a/thinkphp/library/org/upload/driver/local.php b/thinkphp/library/org/upload/driver/local.php index a6f11a120..484cd7c6c 100644 --- a/thinkphp/library/org/upload/driver/local.php +++ b/thinkphp/library/org/upload/driver/local.php @@ -122,5 +122,4 @@ public function getError() { return $this->error; } - } diff --git a/thinkphp/library/org/upload/driver/sae.php b/thinkphp/library/org/upload/driver/sae.php index af924bc21..32a92eded 100644 --- a/thinkphp/library/org/upload/driver/sae.php +++ b/thinkphp/library/org/upload/driver/sae.php @@ -110,5 +110,4 @@ public function getError() { return $this->error; } - } diff --git a/thinkphp/library/org/upload/driver/upyun.php b/thinkphp/library/org/upload/driver/upyun.php index c52a0e691..d6b260320 100644 --- a/thinkphp/library/org/upload/driver/upyun.php +++ b/thinkphp/library/org/upload/driver/upyun.php @@ -226,5 +226,4 @@ private function error($header) $message = is_null($message) ? 'File Not Found' : "[{$status}]:{$message}"; $this->error = $message; } - } diff --git a/thinkphp/library/org/verify.php b/thinkphp/library/org/verify.php index 744ba49fb..836f0f081 100644 --- a/thinkphp/library/org/verify.php +++ b/thinkphp/library/org/verify.php @@ -301,5 +301,4 @@ private function authcode($str) $str = substr(md5($str), 8, 10); return md5($key . $str); } - } diff --git a/thinkphp/library/think/cache/driver/db.php b/thinkphp/library/think/cache/driver/db.php index 11b12baf5..4339871a4 100644 --- a/thinkphp/library/think/cache/driver/db.php +++ b/thinkphp/library/think/cache/driver/db.php @@ -150,5 +150,4 @@ public function clear() { return $this->handler->execute('TRUNCATE TABLE `' . $this->options['table'] . '`'); } - } diff --git a/thinkphp/library/think/cache/driver/redis.php b/thinkphp/library/think/cache/driver/redis.php index 8771b3df7..0d37f4974 100644 --- a/thinkphp/library/think/cache/driver/redis.php +++ b/thinkphp/library/think/cache/driver/redis.php @@ -123,5 +123,4 @@ public function clear() { return $this->handler->flushDB(); } - } diff --git a/thinkphp/library/think/cache/driver/secache.php b/thinkphp/library/think/cache/driver/secache.php index 5c7f541b1..aa9baf99d 100644 --- a/thinkphp/library/think/cache/driver/secache.php +++ b/thinkphp/library/think/cache/driver/secache.php @@ -116,7 +116,6 @@ public function clear() { return $this->handler->_format(true); } - } if (!defined('SECACHE_SIZE')) { @@ -704,8 +703,7 @@ public function _alloc_idx($data) public function _create_node($pos, $data) { - $this->_puts($pos * $this->idx_node_size + $this->idx_node_base - , pack('V1V1V1V1V1V1H*', $data['next'], $data['prev'], $data['data'], $data['size'], $data['lru_right'], $data['lru_left'], $data['key'])); + $this->_puts($pos * $this->idx_node_size + $this->idx_node_base, pack('V1V1V1V1V1V1H*', $data['next'], $data['prev'], $data['data'], $data['size'], $data['lru_right'], $data['lru_left'], $data['key'])); return $pos; } @@ -779,5 +777,4 @@ public function triggerError($errstr, $errno) { triggerError($errstr, $errno); } - } diff --git a/thinkphp/library/think/config.php b/thinkphp/library/think/config.php index 16ae684f7..96038add1 100644 --- a/thinkphp/library/think/config.php +++ b/thinkphp/library/think/config.php @@ -128,5 +128,4 @@ public static function set($name, $value = null, $range = '') return self::$config[$range]; } } - } diff --git a/thinkphp/library/think/controller/hprose.php b/thinkphp/library/think/controller/hprose.php index d86dd03cb..cfb028981 100644 --- a/thinkphp/library/think/controller/hprose.php +++ b/thinkphp/library/think/controller/hprose.php @@ -63,5 +63,6 @@ public function __construct() * @return mixed */ public function __call($method, $args) - {} + { + } } diff --git a/thinkphp/library/think/controller/jsonrpc.php b/thinkphp/library/think/controller/jsonrpc.php index d87137082..7e5667b1d 100644 --- a/thinkphp/library/think/controller/jsonrpc.php +++ b/thinkphp/library/think/controller/jsonrpc.php @@ -41,5 +41,6 @@ public function __construct() * @return mixed */ public function __call($method, $args) - {} + { + } } diff --git a/thinkphp/library/think/controller/rpc.php b/thinkphp/library/think/controller/rpc.php index 0c87f08ab..06fcf3972 100644 --- a/thinkphp/library/think/controller/rpc.php +++ b/thinkphp/library/think/controller/rpc.php @@ -58,5 +58,6 @@ public function __construct() * @return mixed */ public function __call($method, $args) - {} + { + } } diff --git a/thinkphp/library/think/controller/yar.php b/thinkphp/library/think/controller/yar.php index 05627c75c..04ecd5a58 100644 --- a/thinkphp/library/think/controller/yar.php +++ b/thinkphp/library/think/controller/yar.php @@ -46,5 +46,6 @@ public function __construct() * @return mixed */ public function __call($method, $args) - {} + { + } } diff --git a/thinkphp/library/think/cookie.php b/thinkphp/library/think/cookie.php index 8a0ceca5e..c79bdaa2a 100644 --- a/thinkphp/library/think/cookie.php +++ b/thinkphp/library/think/cookie.php @@ -16,17 +16,17 @@ class Cookie protected static $config = [ // cookie 名称前缀 - 'prefix' => '', + 'prefix' => '', // cookie 保存时间 - 'expire' => 0, + 'expire' => 0, // cookie 保存路径 - 'path' => '/', + 'path' => '/', // cookie 有效域名 - 'domain' => '', + 'domain' => '', // cookie 启用安全传输 - 'secure' => false, + 'secure' => false, // httponly设置 - 'httponly' => '', + 'httponly' => '', ]; /** @@ -164,5 +164,4 @@ private static function jsonFormatProtect(&$val, $key, $type = 'encode') $val = 'decode' == $type ? urldecode($val) : urlencode($val); } } - } diff --git a/thinkphp/library/think/db.php b/thinkphp/library/think/db.php index 6fadfcf05..a3d586b57 100644 --- a/thinkphp/library/think/db.php +++ b/thinkphp/library/think/db.php @@ -72,7 +72,9 @@ private static function parseConfig($config) */ private static function parseDsn($dsnStr) { - if (empty($dsnStr)) {return false;} + if (empty($dsnStr)) { + return false; + } $info = parse_url($dsnStr); if (!$info) { return false; diff --git a/thinkphp/library/think/db/driver.php b/thinkphp/library/think/db/driver.php index 593930451..88330e4ae 100644 --- a/thinkphp/library/think/db/driver.php +++ b/thinkphp/library/think/db/driver.php @@ -125,7 +125,8 @@ public function connect($config = '', $linkNum = 0, $autoConnection = false) * @return string */ protected function parseDsn($config) - {} + { + } /** * 释放查询结果 @@ -154,7 +155,9 @@ public function query($str, $fetchSql = false, $master = false) $this->queryStr = $str; if (!empty($this->bind)) { $that = $this; - $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->quote($val);}, $this->bind)); + $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) { + return $that->quote($val); + }, $this->bind)); } if ($fetchSql) { return $this->queryStr; @@ -213,7 +216,9 @@ public function execute($str, $fetchSql = false) $this->queryStr = $str; if (!empty($this->bind)) { $that = $this; - $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->quote($val);}, $this->bind)); + $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) { + return $that->quote($val); + }, $this->bind)); } if ($fetchSql) { return $this->queryStr; @@ -1085,7 +1090,9 @@ public function parseSql($sql, $options = []) $this->parseLock(isset($options['lock']) ? $options['lock'] : false), $this->parseComment(!empty($options['comment']) ? $options['comment'] : ''), $this->parseForce(!empty($options['force']) ? $options['force'] : ''), - ], $sql); + ], + $sql + ); return $sql; } @@ -1207,9 +1214,8 @@ protected function multiConnect($master = false) // 数据库读写是否分离 if ($this->config['rw_separate']) { // 主从式采用读写分离 - if ($master) + if ($master) { // 主服务器写入 - { $r = $m; } else { if (is_numeric($this->config['slave_no'])) { diff --git a/thinkphp/library/think/db/driver/sqlsrv.php b/thinkphp/library/think/db/driver/sqlsrv.php index f6d171777..309a31c59 100644 --- a/thinkphp/library/think/db/driver/sqlsrv.php +++ b/thinkphp/library/think/db/driver/sqlsrv.php @@ -174,5 +174,4 @@ public function delete($options = []) . $this->parseComment(!empty($options['comment']) ? $options['comment'] : ''); return $this->execute($sql, $this->parseBind(!empty($options['bind']) ? $options['bind'] : [])); } - } diff --git a/thinkphp/library/think/db/lite.php b/thinkphp/library/think/db/lite.php index 701861238..948be1878 100644 --- a/thinkphp/library/think/db/lite.php +++ b/thinkphp/library/think/db/lite.php @@ -89,7 +89,7 @@ public function __construct($config = '') * 连接数据库方法 * @access public */ - public function connect($config = '', $linkNum = 0,$autoConnection = false) + public function connect($config = '', $linkNum = 0, $autoConnection = false) { if (!isset($this->linkID[$linkNum])) { if (empty($config)) { @@ -140,7 +140,9 @@ public function query($str, $fetchSql = false, $master = false) $this->queryStr = $str; if (!empty($this->bind)) { $that = $this; - $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->quote($val);}, $this->bind)); + $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) { + return $that->quote($val); + }, $this->bind)); } if ($fetchSql) { return $this->queryStr; @@ -199,7 +201,9 @@ public function execute($str, $fetchSql = false) $this->queryStr = $str; if (!empty($this->bind)) { $that = $this; - $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->quote($val);}, $this->bind)); + $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) { + return $that->quote($val); + }, $this->bind)); } if ($fetchSql) { return $this->queryStr; @@ -485,9 +489,8 @@ protected function multiConnect($master = false) // 数据库读写是否分离 if ($this->config['rw_separate']) { // 主从式采用读写分离 - if ($master) - // 主服务器写入 - { + if ($master) { + // 主服务器写入 $r = $m; } else { if (is_numeric($this->config['slave_no'])) { diff --git a/thinkphp/library/think/exception.php b/thinkphp/library/think/exception.php index 54643a627..6c852288b 100644 --- a/thinkphp/library/think/exception.php +++ b/thinkphp/library/think/exception.php @@ -11,5 +11,6 @@ namespace think; -class Exception extends \Exception -{} +class Exception extends \Exception +{ +} diff --git a/thinkphp/library/think/lang.php b/thinkphp/library/think/lang.php index cf42fd277..6ac679bfa 100644 --- a/thinkphp/library/think/lang.php +++ b/thinkphp/library/think/lang.php @@ -59,7 +59,7 @@ public static function load($file, $range = '') self::$lang[$range] = []; } // 批量定义 - if(!isset(self::$lang[$range])) { + if (!isset(self::$lang[$range])) { self::$lang[$range] = []; } return self::$lang[$range] = array_merge(self::$lang[$range], array_change_key_case($lang)); diff --git a/thinkphp/library/think/loader.php b/thinkphp/library/think/loader.php index b2a676d2e..c779bed30 100644 --- a/thinkphp/library/think/loader.php +++ b/thinkphp/library/think/loader.php @@ -373,7 +373,10 @@ public static function instance($class, $method = '') public static function parseName($name, $type = 0) { if ($type) { - return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function ($match) {return strtoupper($match[1]);}, $name)); + return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function ($match) { + return strtoupper($match[1]); + + }, $name)); } else { return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); } diff --git a/thinkphp/library/think/model.php b/thinkphp/library/think/model.php index 3ce0dc2d1..63cc4c8aa 100644 --- a/thinkphp/library/think/model.php +++ b/thinkphp/library/think/model.php @@ -144,7 +144,8 @@ public function __unset($name) // 回调方法 初始化模型 protected function _initialize() - {} + { + } /** * 对写入到数据库的数据进行处理 @@ -185,7 +186,8 @@ protected function _write_data($data) } // 写入数据前的回调方法 包括新增和更新 protected function _before_write(&$data) - {} + { + } /** * 新增数据 @@ -239,10 +241,12 @@ public function add($data = '', $replace = false) } // 插入数据前的回调方法 protected function _before_insert(&$data, $options = []) - {} + { + } // 插入成功后的回调方法 protected function _after_insert($data, $options = []) - {} + { + } public function addAll($dataList, $options = [], $replace = false) { @@ -340,10 +344,12 @@ public function save($data = '') } // 更新数据前的回调方法 protected function _before_update(&$data, $options = []) - {} + { + } // 更新成功后的回调方法 protected function _after_update($data, $options = []) - {} + { + } /** * 删除数据 @@ -413,7 +419,8 @@ public function delete($options = []) } // 删除成功后的回调方法 protected function _after_delete($data, $options = []) - {} + { + } /** * 查询数据集 @@ -516,7 +523,8 @@ protected function _read_datalist($resultSet, $options) } // 查询成功后的回调方法 protected function _after_select(&$resultSet, $options = []) - {} + { + } /** * 生成查询SQL 可用于子查询 @@ -575,7 +583,8 @@ protected function _parseOptions($options = []) } // 表达式过滤回调方法 protected function _options_filter(&$options) - {} + { + } /** * 数据类型检测 @@ -693,7 +702,8 @@ protected function _read_data($data, $options) } // 数据读取成功后的回调方法 protected function _after_find(&$result, $options = []) - {} + { + } /** * 创建数据对象 但不保存到数据库 @@ -748,7 +758,8 @@ public function create($data = '', $type = '') } // 数据对象创建后的回调方法 protected function _create_filter(&$data) - {} + { + } /** * 切换当前的数据库连接 @@ -785,7 +796,8 @@ public function db($linkId = '', $config = '') } // 数据库切换后回调方法 protected function _after_db() - {} + { + } /** * 得到当前的数据对象名称 @@ -951,7 +963,9 @@ protected function parseSql($sql) // 分析表达式 $sql = strtr($sql, ['__TABLE__' => $this->getTableName(), '__PREFIX__' => $this->tablePrefix]); $prefix = $this->tablePrefix; - $sql = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $sql); + $sql = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $sql); $this->db->setModel($this->name); return $sql; } @@ -990,13 +1004,17 @@ public function _join($join, $type = 'INNER') $prefix = $this->tablePrefix; if (is_array($join)) { foreach ($join as $key => &$_join) { - $_join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $_join); + $_join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $_join); $_join = false !== stripos($_join, 'JOIN') ? $_join : $type . ' JOIN ' . $_join; } $this->options['join'] = $join; } elseif (!empty($join)) { //将__TABLE_NAME__字符串替换成带前缀的表名 - $join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $join); + $join = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $join); $this->options['join'][] = false !== stripos($join, 'JOIN') ? $join : $type . ' JOIN ' . $join; } return $this; @@ -1093,7 +1111,9 @@ public function union($union, $all = false) if (is_string($union)) { $prefix = $this->tablePrefix; //将__TABLE_NAME__字符串替换成带前缀的表名 - $options = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $union); + $options = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $union); } elseif (is_array($union)) { if (isset($union[0])) { $this->options['union'] = array_merge($this->options['union'], $union); @@ -1272,7 +1292,9 @@ public function table($table) $this->options['table'] = $table; } elseif (!empty($table)) { //将__TABLE_NAME__替换成带前缀的表名 - $table = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $table); + $table = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $table); $this->options['table'] = $table; } return $this; @@ -1291,7 +1313,9 @@ public function using($using) $this->options['using'] = $using; } elseif (!empty($using)) { //将__TABLE_NAME__替换成带前缀的表名 - $using = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) {return $prefix . strtolower($match[1]);}, $using); + $using = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $using); $this->options['using'] = $using; } return $this; diff --git a/thinkphp/library/think/response.php b/thinkphp/library/think/response.php index 4b209778f..bde375961 100644 --- a/thinkphp/library/think/response.php +++ b/thinkphp/library/think/response.php @@ -162,5 +162,4 @@ public static function sendHttpStatus($status) header('Status:' . $status . ' ' . $_status[$status]); } } - } diff --git a/thinkphp/library/think/route.php b/thinkphp/library/think/route.php index ffd663162..88d57d5df 100644 --- a/thinkphp/library/think/route.php +++ b/thinkphp/library/think/route.php @@ -591,7 +591,9 @@ private static function parseRule($rule, $route, $pathinfo) $var = array_merge($matches, $var); // 解析剩余的URL参数 if (!empty($paths)) { - preg_replace_callback('/(\w+)\/([^\/]+)/', function ($match) use (&$var) {$var[strtolower($match[1])] = strip_tags($match[2]);}, implode('/', $paths)); + preg_replace_callback('/(\w+)\/([^\/]+)/', function ($match) use (&$var) { + $var[strtolower($match[1])] = strip_tags($match[2]); + }, implode('/', $paths)); } // 解析路由自动传人参数 if (is_array($route) && isset($route[1])) { diff --git a/thinkphp/library/think/session.php b/thinkphp/library/think/session.php index 70f6c1bab..157fbbde2 100644 --- a/thinkphp/library/think/session.php +++ b/thinkphp/library/think/session.php @@ -238,5 +238,4 @@ private static function regenerate() { session_regenerate_id(); } - } diff --git a/thinkphp/library/think/session/driver.php b/thinkphp/library/think/session/driver.php index b9fff5781..3dbbc1415 100644 --- a/thinkphp/library/think/session/driver.php +++ b/thinkphp/library/think/session/driver.php @@ -21,5 +21,4 @@ public function __construct($config = []) { $this->config = array_merge($this->config, $config); } - } diff --git a/thinkphp/library/think/slog.php b/thinkphp/library/think/slog.php index 02cfb889c..5abe48a7f 100644 --- a/thinkphp/library/think/slog.php +++ b/thinkphp/library/think/slog.php @@ -378,5 +378,4 @@ public static function __callStatic($method, $args) return call_user_func_array(['\think\Slog', 'record'], $args); } } - } diff --git a/thinkphp/library/think/template.php b/thinkphp/library/think/template.php index 717bd5c98..9cb0271cd 100644 --- a/thinkphp/library/think/template.php +++ b/thinkphp/library/think/template.php @@ -78,7 +78,8 @@ private function stripPreg($str) return str_replace( ['{', '}', '(', ')', '|', '[', ']', '-', '+', '*', '.', '^', '?'], ['\{', '\}', '\(', '\)', '\|', '\[', '\]', '\-', '\+', '\*', '\.', '\^', '\?'], - $str); + $str + ); } /** diff --git a/thinkphp/library/think/template/taglib.php b/thinkphp/library/think/template/taglib.php index 7ee296ba1..a5931b0c3 100644 --- a/thinkphp/library/think/template/taglib.php +++ b/thinkphp/library/think/template/taglib.php @@ -97,7 +97,9 @@ public function parseXmlAttr($attr, $tag) } $xml = (array) ($xml->tag->attributes()); $array = array_change_key_case($xml['@attributes']); - if (!is_array($array)) return []; + if (!is_array($array)) { + return []; + } $tag = strtolower($tag); if (isset($this->tags[$tag]['attr'])) { $attrs = explode(',', $this->tags[$tag]['attr']); @@ -183,11 +185,14 @@ public function parseThinkVar($varStr) if (count($vars) >= 3) { $vars[2] = trim($vars[2]); switch ($vars[1]) { - case 'SERVER':$parseStr = '$_SERVER[\'' . $vars[2] . '\']'; + case 'SERVER': + $parseStr = '$_SERVER[\'' . $vars[2] . '\']'; break; - case 'GET':$parseStr = '$_GET[\'' . $vars[2] . '\']'; + case 'GET': + $parseStr = '$_GET[\'' . $vars[2] . '\']'; break; - case 'POST':$parseStr = '$_POST[\'' . $vars[2] . '\']'; + case 'POST': + $parseStr = '$_POST[\'' . $vars[2] . '\']'; break; case 'COOKIE': if (isset($vars[3])) { @@ -203,11 +208,14 @@ public function parseThinkVar($varStr) $parseStr = '$_SESSION[\'' . $vars[2] . '\']'; } break; - case 'ENV':$parseStr = '$_ENV[\'' . $vars[2] . '\']'; + case 'ENV': + $parseStr = '$_ENV[\'' . $vars[2] . '\']'; break; - case 'REQUEST':$parseStr = '$_REQUEST[\'' . $vars[2] . '\']'; + case 'REQUEST': + $parseStr = '$_REQUEST[\'' . $vars[2] . '\']'; break; - case 'CONST':$parseStr = strtoupper($vars[2]); + case 'CONST': + $parseStr = strtoupper($vars[2]); break; case 'LANG': $parseStr = '\think\Lang::get("' . $vars[2] . '")'; @@ -221,11 +229,14 @@ public function parseThinkVar($varStr) } } else if (count($vars) == 2) { switch ($vars[1]) { - case 'NOW':$parseStr = "date('Y-m-d g:i a',time())"; + case 'NOW': + $parseStr = "date('Y-m-d g:i a',time())"; break; - case 'VERSION':$parseStr = 'THINK_VERSION'; + case 'VERSION': + $parseStr = 'THINK_VERSION'; break; - default:if (defined($vars[1])) { + default: + if (defined($vars[1])) { $parseStr = $vars[1]; } diff --git a/thinkphp/library/think/view.php b/thinkphp/library/think/view.php index d114be67d..9bcd16e59 100644 --- a/thinkphp/library/think/view.php +++ b/thinkphp/library/think/view.php @@ -258,5 +258,4 @@ protected function getThemePath($module = MODULE_NAME) } return $tmplPath . $theme; } - } diff --git a/thinkphp/library/traits/controller/ajax.php b/thinkphp/library/traits/controller/ajax.php index 586e34c18..31ca0f135 100644 --- a/thinkphp/library/traits/controller/ajax.php +++ b/thinkphp/library/traits/controller/ajax.php @@ -63,5 +63,4 @@ protected function success($message, $jumpUrl = '', $wait = 3) $jumpUrl = $jumpUrl ?: $_SERVER["HTTP_REFERER"]; return $this->result('', $message, 1, $jumpUrl, $wait); } - } diff --git a/thinkphp/library/traits/controller/view.php b/thinkphp/library/traits/controller/view.php index 6b10e0a96..5a0b7a40e 100644 --- a/thinkphp/library/traits/controller/view.php +++ b/thinkphp/library/traits/controller/view.php @@ -126,5 +126,4 @@ protected function success($message, $jumpUrl = '', $wait = 3) $jumpUrl = $jumpUrl ?: $_SERVER["HTTP_REFERER"]; return $this->result('', $message, 1, $jumpUrl, $wait); } - } diff --git a/thinkphp/library/traits/model/relation.php b/thinkphp/library/traits/model/relation.php index 9bfa4f57d..83a7aea6c 100644 --- a/thinkphp/library/traits/model/relation.php +++ b/thinkphp/library/traits/model/relation.php @@ -325,12 +325,10 @@ protected function opRelation($opType, $data = '', $name = '') // 插入关联表数据 $sql = 'INSERT INTO ' . $mappingRelationTable . ' (' . $mappingFk . ',' . $mappingRelationFk . ') SELECT a.' . $this->getPk() . ',b.' . $model->getPk() . ' FROM ' . $this->getTableName() . ' AS a ,' . $model->getTableName() . " AS b where a." . $this->getPk() . ' =' . $pk . ' AND b.' . $model->getPk() . ' IN (' . $relationId . ") "; $result = $model->execute($sql); - if (false !== $result) + if (false !== $result) { // 提交事务 - { $this->commit(); - } else - // 事务回滚 + } else // 事务回滚 { $this->rollback(); } diff --git a/thinkphp/library/traits/model/view.php b/thinkphp/library/traits/model/view.php index 797cc954d..c1551b196 100644 --- a/thinkphp/library/traits/model/view.php +++ b/thinkphp/library/traits/model/view.php @@ -22,7 +22,8 @@ trait View * @return void */ protected function _checkTableInfo() - {} + { + } /** * 得到完整的数据表名