@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // 过滤查询特殊字符 |
| 405 | 405 | if (preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) { |
| 406 | - $value .= ' '; |
|
| 406 | + $value.=' '; |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | /** |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | * |
| 412 | 412 | * @return string|null |
| 413 | 413 | */ |
| 414 | -function config($name=null,$value=null,$default=null){ |
|
| 414 | +function config($name=null, $value=null, $default=null) { |
|
| 415 | 415 | $config=\puck\Conf::load(); |
| 416 | - if ($name===null){ |
|
| 416 | + if ($name === null) { |
|
| 417 | 417 | return $config->all(); |
| 418 | 418 | } |
| 419 | - if ($value===null){ |
|
| 420 | - return $config->get($name,$default); |
|
| 419 | + if ($value === null) { |
|
| 420 | + return $config->get($name, $default); |
|
| 421 | 421 | } |
| 422 | - $config->set($name,$value); |
|
| 422 | + $config->set($name, $value); |
|
| 423 | 423 | } |
| 424 | 424 | /** |
| 425 | 425 | * 字符串命名风格转换 |
@@ -122,18 +122,18 @@ discard block |
||
| 122 | 122 | * @param string $str |
| 123 | 123 | */ |
| 124 | 124 | function setPinyin($str) { |
| 125 | - $py = mt_rand(0, iconv_strlen( $str, 'UTF-8' )-1); |
|
| 126 | - $t_str = iconv_substr( $str, $py, 1, 'UTF-8'); |
|
| 127 | - if(mt_rand(0,10) > 5) { |
|
| 128 | - $pinyin = " "; |
|
| 125 | + $py=mt_rand(0, iconv_strlen($str, 'UTF-8') - 1); |
|
| 126 | + $t_str=iconv_substr($str, $py, 1, 'UTF-8'); |
|
| 127 | + if (mt_rand(0, 10) > 5) { |
|
| 128 | + $pinyin=" "; |
|
| 129 | 129 | } |
| 130 | - $pinyin = $this->_pinyin->convert($t_str,PINYIN_UNICODE); |
|
| 131 | - $pinyin=implode(" ",$pinyin); |
|
| 132 | - if(mt_rand(0,10) > 5) { |
|
| 133 | - $pinyin .= " "; |
|
| 130 | + $pinyin=$this->_pinyin->convert($t_str, PINYIN_UNICODE); |
|
| 131 | + $pinyin=implode(" ", $pinyin); |
|
| 132 | + if (mt_rand(0, 10) > 5) { |
|
| 133 | + $pinyin.=" "; |
|
| 134 | 134 | } |
| 135 | - if($t_str != "%"){ |
|
| 136 | - $str = preg_replace("'$t_str'", $pinyin, $str, 1); |
|
| 135 | + if ($t_str != "%") { |
|
| 136 | + $str=preg_replace("'$t_str'", $pinyin, $str, 1); |
|
| 137 | 137 | } |
| 138 | 138 | return $str; |
| 139 | 139 | } |
@@ -144,18 +144,18 @@ discard block |
||
| 144 | 144 | * @param string $str |
| 145 | 145 | */ |
| 146 | 146 | function setRepeat($str) { |
| 147 | - $len = iconv_strlen( $str, 'UTF-8' ); |
|
| 148 | - $action = 0; |
|
| 149 | - $temp = ''; |
|
| 150 | - for( $i=0; $i<$len; $i++ ){ |
|
| 151 | - $t_str = iconv_substr( $str, $i, 1 ,'UTF-8'); |
|
| 152 | - if( mt_rand( 1, 50 ) > 48 && $action == 0) { |
|
| 153 | - if(!preg_match("@[a-z0-9%\\s]+@i", $t_str)) { |
|
| 154 | - $temp .= $t_str; |
|
| 155 | - $action = 1; |
|
| 147 | + $len=iconv_strlen($str, 'UTF-8'); |
|
| 148 | + $action=0; |
|
| 149 | + $temp=''; |
|
| 150 | + for ($i=0; $i < $len; $i++) { |
|
| 151 | + $t_str=iconv_substr($str, $i, 1, 'UTF-8'); |
|
| 152 | + if (mt_rand(1, 50) > 48 && $action == 0) { |
|
| 153 | + if (!preg_match("@[a-z0-9%\\s]+@i", $t_str)) { |
|
| 154 | + $temp.=$t_str; |
|
| 155 | + $action=1; |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | - $temp .= $t_str; |
|
| 158 | + $temp.=$t_str; |
|
| 159 | 159 | } |
| 160 | 160 | return $temp; |
| 161 | 161 | } |