Skip to content

Commit

Permalink
refs #1067 : modify - modern constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
inureyes committed Aug 2, 2015
1 parent c1d1ffa commit 39fd29f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 54 deletions.
8 changes: 4 additions & 4 deletions framework/legacy/Needlworks.Cache.PageCache.Legacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class pageCache {
var $absoluteFilePathOwner;
var $absoluteFilePathGuest;
var $error;*/
function pageCache($name = null) {
function __construct($name = null) {
$this->reset();
if ($name != null) {
$this->name = $name;
Expand Down Expand Up @@ -219,7 +219,7 @@ class queryCache {
var $contents;
var $prefix;
var $error;*/
function queryCache($query = null, $prefix = null) {
function __construct($query = null, $prefix = null) {
$this->reset();
$this->query = $query;
$this->prefix = $prefix;
Expand Down Expand Up @@ -321,7 +321,7 @@ function _error($error) {
// blogSettings, ServiceSettings, activePlugins, etc..
// Textcube will use it as global object.
class globalCacheStorage extends pageCache {
function globalCacheStorage($blogid = null) {
function __construct($blogid = null) {
$this->_isChanged = false;
$this->_gCacheStorage = array();
if (is_null($blogid)) {
Expand Down Expand Up @@ -621,7 +621,7 @@ function flushItemsByPlugin($pluginName) {
unset($tag);
}
// if ($xmls->doesExist('/plugin/binding/sidebar')) {
// TODO: 사이드바 캐시때 처리하도록 하지요.
// TODO: 사이드바 캐시때 처리하도록 하지요.
// }
if ($xmls->doesExist('/plugin/binding/formatter[lang()]')) {
CacheControl::flushCategory();
Expand Down
74 changes: 37 additions & 37 deletions framework/legacy/Needlworks.PHP.Pop3.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)

class Pop3 {
function Pop3() {
$this->ctx = null;
function __construct() {
$this->context = null;
$this->logger = null;
$this->uidl_filter = null;
$this->size_filter = null;
Expand All @@ -17,40 +17,40 @@ function Pop3() {
$this->clearStatus();
}

function log($msg) {
public function log($msg) {
if (!$this->logger) {
return;
}
call_user_func($this->logger, $msg);
}

function connect($server, $port = 110, $bSSL = false) {
public function connect($server, $port = 110, $bSSL = false) {
$this->clearStatus();
$this->ctx = fsockopen($bSSL ? "ssl://$server" : $server, $port);
if (!$this->ctx) {
$this->context = fsockopen($bSSL ? "ssl://$server" : $server, $port);
if (!$this->context) {
return false;
}
$line = fgets($this->ctx, 1024);
$line = fgets($this->context, 1024);
return $this->checkStatus($line);
}

function authorize($username, $password) {
public function authorize($username, $password) {
$this->clearStatus();
$this->log("Send: USER $username");
if (!fputs($this->ctx, "USER $username\r\n")) {
if (!fputs($this->context, "USER $username\r\n")) {
return false;
}
if (!$this->receiveResult()) {
return false;
}
$this->log("Send: PASS [......]");
if (!fputs($this->ctx, "PASS $password\r\n")) {
if (!fputs($this->context, "PASS $password\r\n")) {
return false;
}
return $this->receiveResult();
}

function retr($nr = false) {
public function retr($nr = false) {
$this->clearStatus();
if ($nr != false) {
$numbers = array($nr);
Expand All @@ -60,7 +60,7 @@ function retr($nr = false) {

foreach ($numbers as $nr) {
$this->log("Send: RETR $nr");
if (!fputs($this->ctx, "RETR $nr\r\n")) {
if (!fputs($this->context, "RETR $nr\r\n")) {
return false;
}
if (!$this->receiveResult(true)) {
Expand All @@ -74,7 +74,7 @@ function retr($nr = false) {
return true;
}

function dele($nr = false) {
public function dele($nr = false) {
$this->clearStatus();
if ($nr != false) {
$numbers = array($nr);
Expand All @@ -83,7 +83,7 @@ function dele($nr = false) {
}
foreach ($numbers as $nr) {
$this->log("Send: DELE $nr");
if (!fputs($this->ctx, "DELE $nr\r\n")) {
if (!fputs($this->context, "DELE $nr\r\n")) {
return false;
}
if (!$this->receiveResult(false)) {
Expand All @@ -93,43 +93,43 @@ function dele($nr = false) {
return true;
}

function quit() {
public function quit() {
$this->clearStatus();
$this->log("Send: QUIT");
if (!fputs($this->ctx, "QUIT\r\n")) {
if (!fputs($this->context, "QUIT\r\n")) {
return false;
}
return true;
}

function setLogger($func) {
public function setLogger($func) {
$this->logger =& $func;
}

function setUidFilter($func) {
public function setUidFilter($func) {
$this->uidl_filter =& $func;
}

function setSizeFilter($func) {
public function setSizeFilter($func) {
$this->size_filter =& $func;
}

function setStatCallback($func) {
public function setStatCallback($func) {
$this->stat_callback =& $func;
}

function setRetrCallback($func) {
public function setRetrCallback($func) {
$this->retr_callback =& $func;
}

function setFallbackCharset($charset) {
public function setFallbackCharset($charset) {
$this->fallback_charset = $charset;
}

function uidl() {
public function uidl() {
$this->clearStatus();
$this->log("Send: UIDL");
if (!fputs($this->ctx, "UIDL\r\n")) {
if (!fputs($this->context, "UIDL\r\n")) {
return false;
}
if (!$this->receiveResult(true)) {
Expand All @@ -152,10 +152,10 @@ function uidl() {
return true;
}

function list_size() {
public function list_size() {
$this->clearStatus();
$this->log("Send: STAT");
if (!fputs($this->ctx, "STAT\r\n")) {
if (!fputs($this->context, "STAT\r\n")) {
return false;
}
if (!$this->receiveResult(false)) {
Expand All @@ -173,7 +173,7 @@ function list_size() {
}

$this->log("Send: LIST");
if (!fputs($this->ctx, "LIST\r\n")) {
if (!fputs($this->context, "LIST\r\n")) {
return false;
}
if (!$this->receiveResult(true)) {
Expand All @@ -195,7 +195,7 @@ function list_size() {
return true;
}

function run() {
public function run() {
if (!$this->list_size()) {
return;
}
Expand All @@ -207,15 +207,15 @@ function run() {
}
}

function clearStatus() {
public function clearStatus() {
$this->status = '';
$this->error = '';
$this->results = array();
}

function receiveResult($checkPeriod = false) {
public function receiveResult($checkPeriod = false) {
$count = 1000000; /* Maximum 1000000 lines! it's enough to handle 6MB bytes */
$line = fgets($this->ctx, 1024);
$line = fgets($this->context, 1024);
$this->log("Recv: " . trim($line));
if (!$line) {
return false;
Expand All @@ -228,7 +228,7 @@ function receiveResult($checkPeriod = false) {
}
$this->results = array();
while ($count--) {
$line = fgets($this->ctx, 1024);
$line = fgets($this->context, 1024);
$line = trim($line);
if ($line == '.') {
break;
Expand All @@ -239,7 +239,7 @@ function receiveResult($checkPeriod = false) {
return true;
}

function checkStatus($line) {
public function checkStatus($line) {
$this->status = substr($line, 4);
if (substr($line, 0, 3) == '+OK') {
return true;
Expand All @@ -248,11 +248,11 @@ function checkStatus($line) {
return false;
}

function getLastError() {
public function getLastError() {
return $this->error;
}

function _decode_header_core($matches) {
private function _decode_header_core($matches) {
static $rewrite_charset = array(
'ks_c_5601-1987' => 'euc-kr'
);
Expand All @@ -277,7 +277,7 @@ function _decode_header_core($matches) {
return $content;
}

function decode_header($hdr) {
public function decode_header($hdr) {
if (strstr($hdr, "=?")) {
$hdr = preg_replace_callback("/=\?([^?]+)\?([BbQq])\?([^?]+)\?=/", array(&$this, '_decode_header_core'), $hdr);
} else {
Expand All @@ -288,7 +288,7 @@ function decode_header($hdr) {
return $hdr;
}

function parse(& $data, $begin = 0, $end = 0) {
public function parse(& $data, $begin = 0, $end = 0) {
if ($end == 0) {
$end = count($data);
}
Expand Down
26 changes: 13 additions & 13 deletions framework/legacy/Needlworks.PHP.XMLRPC.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class XMLRPC {

var $useOldXmlRPC = false; // for 2003-before-version

function XMLRPC() {
function __construct() {
$this->_registry = array();
}

function call() {
public function call() {
if (func_num_args() < 1) {
return false;
}
Expand Down Expand Up @@ -103,13 +103,13 @@ function call() {
return true;
}

function registerMethod($method, $function) {
if (function_exists($function)) {
$this->_registry[$method] = $function;
public function registerMethod($method, $public function) {
if (public function_exists($public function)) {
$this->_registry[$method] = $public function;
}
}

function receive($xml = null) {
public function receive($xml = null) {
if (empty($xml)) {
if (empty($_SERVER['CONTENT_TYPE']) || empty($GLOBALS['HTTP_RAW_POST_DATA']) || ($_SERVER['CONTENT_TYPE'] != 'text/xml')) {
return false;
Expand Down Expand Up @@ -154,7 +154,7 @@ function receive($xml = null) {
return true;
}

function sendResponse($param = null) {
public function sendResponse($param = null) {
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?><methodResponse><params>';
if (!is_null($param)) {
Expand All @@ -165,7 +165,7 @@ function sendResponse($param = null) {
echo '</params></methodResponse>';
}

function sendFault($code = 0, $string = 'Error') {
public function sendFault($code = 0, $string = 'Error') {
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<methodResponse><fault><value><struct><member><name>faultCode</name><value><i4>';
Expand All @@ -175,7 +175,7 @@ function sendFault($code = 0, $string = 'Error') {
echo '</string></value></member></struct></value></fault></methodResponse>';
}

function _encodeValue($value) {
private function _encodeValue($value) {
echo '<value>';
if (is_a($value, 'XMLCustomType')) {
echo "<{$value->name}>";
Expand Down Expand Up @@ -241,7 +241,7 @@ function _encodeValue($value) {
echo '</value>';
}

function _decodeValue(&$value) {
private function _decodeValue(&$value) {
if (isset($value[0])) {
return null;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ function _decodeValue(&$value) {
return null;
}

function encodingStringEx($text) {
public function encodingStringEx($text) {
$l = strlen($text);
$retString = '';
// ### TODO: Use a buffer rather than going character by
Expand Down Expand Up @@ -387,7 +387,7 @@ function encodingStringEx($text) {
class XMLRPCFault {
var $code, $string;

function XMLRPCFault($code = 0, $string = 'Error') {
public function __construct($code = 0, $string = 'Error') {
$this->code = $code;
$this->string = $string;
}
Expand All @@ -396,7 +396,7 @@ function XMLRPCFault($code = 0, $string = 'Error') {
class XMLCustomType {
var $value, $name;

function XMLCustomType($varString, $varName) {
public function __construct($varString, $varName) {
$this->name = $varName;
$this->value = $varString;
}
Expand Down

0 comments on commit 39fd29f

Please sign in to comment.