From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/ZhClient.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'includes/ZhClient.php') diff --git a/includes/ZhClient.php b/includes/ZhClient.php index 61faa8df..a04220c6 100644 --- a/includes/ZhClient.php +++ b/includes/ZhClient.php @@ -12,7 +12,7 @@ class ZhClient { * * @access private */ - function ZhClient($host, $port) { + function __construct($host, $port) { $this->mHost = $host; $this->mPort = $port; $this->mConnected = $this->connect(); @@ -35,7 +35,7 @@ class ZhClient { $errno = $errstr = ''; $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30); wfRestoreWarnings(); - if(!$this->mFP) { + if ( !$this->mFP ) { return false; } return true; @@ -47,8 +47,9 @@ class ZhClient { * @access private */ function query($request) { - if(!$this->mConnected) + if ( !$this->mConnected ) { return false; + } fwrite($this->mFP, $request); @@ -68,8 +69,9 @@ class ZhClient { $data .= $str; } //data should be of length $len. otherwise something is wrong - if(strlen($data) != $len) + if ( strlen($data) != $len ) { return false; + } return $data; } @@ -84,8 +86,9 @@ class ZhClient { $len = strlen($text); $q = "CONV $tolang $len\n$text"; $result = $this->query($q); - if(!$result) + if ( !$result ) { $result = $text; + } return $result; } @@ -99,8 +102,9 @@ class ZhClient { $len = strlen($text); $q = "CONV ALL $len\n$text"; $result = $this->query($q); - if(!$result) + if ( !$result ) { return false; + } list($infoline, $data) = explode('|', $result, 2); $info = explode(";", $infoline); $ret = array(); @@ -122,8 +126,8 @@ class ZhClient { $len = strlen($text); $q = "SEG $len\n$text"; $result = $this->query($q); - if(!$result) {// fallback to character based segmentation - $result = ZhClientFake::segment($text); + if ( !$result ) {// fallback to character based segmentation + $result = $this->segment($text); } return $result; } -- cgit v1.2.2