Skip to content

Commit

Permalink
TOKYOPenのXoopsLogger::instance()がstaticになったことへの対応
Browse files Browse the repository at this point in the history
  • Loading branch information
suin committed Feb 23, 2012
1 parent d43256c commit cb24110
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build/AdelieDebug.class.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/version
@@ -1 +1 @@
{"build":1327450292,"datetime":"2012-01-25 09:11:32"}
{"build":1329980270,"datetime":"2012-02-23 15:57:50"}
2 changes: 1 addition & 1 deletion source/AdelieDebug/Debug/XoopsDebugger.php
Expand Up @@ -23,7 +23,7 @@ public function prepare()
$GLOBALS['xoopsErrorHandler'] =& AdelieDebug_Debug_XoopsErrorHandler::getInstance();
$GLOBALS['xoopsErrorHandler']->activate(false);

$xoopsLogger = AdelieDebug_Debug_XoopsLogger::instance();
$xoopsLogger = AdelieDebug_Debug_XoopsLogger::getInstance();
$xoopsLogger->setLogger($this->logger);
$xoopsLogger->importParent();
$GLOBALS['xoopsLogger'] =& $xoopsLogger;
Expand Down
20 changes: 12 additions & 8 deletions source/AdelieDebug/Debug/XoopsLogger.php
Expand Up @@ -17,18 +17,22 @@ public function __construct()
{
}

public function instance()
/**
* @static
* @return AdelieDebug_Debug_XoopsLogger
*/
public static function getInstance()
{
static $instance = null;
$reflectionClass = new ReflectionClass('XoopsLogger');
$instanceMethod = $reflectionClass->getMethod('instance');

if ( $instance === null)
{
$instance = new self();
if ( $instanceMethod->isStatic() === true ) {
return AdelieDebug_Debug_XoopsLogger_TP::instance();
} else {
return AdelieDebug_Debug_XoopsLogger_XCL::instance();
}

return $instance;
}

public function setLogger(AdelieDebug_Debug_Logger $logger)
{
$this->logger = $logger;
Expand Down
16 changes: 16 additions & 0 deletions source/AdelieDebug/Debug/XoopsLogger/TP.php
@@ -0,0 +1,16 @@
<?php

class AdelieDebug_Debug_XoopsLogger_TP extends AdelieDebug_Debug_XoopsLogger
{
public static function instance()
{
static $instance = null;

if ( $instance === null)
{
$instance = new self();
}

return $instance;
}
}
16 changes: 16 additions & 0 deletions source/AdelieDebug/Debug/XoopsLogger/XCL.php
@@ -0,0 +1,16 @@
<?php

class AdelieDebug_Debug_XoopsLogger_XCL extends AdelieDebug_Debug_XoopsLogger
{
public function instance()
{
static $instance = null;

if ( $instance === null)
{
$instance = new self();
}

return $instance;
}
}

0 comments on commit cb24110

Please sign in to comment.