Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203634

Change subject: Cleanup, set explicit visibility
......................................................................

Cleanup, set explicit visibility

* Set an explicit visiblity on everything
* Can't use self:: inside closures in PHP <5.4
* Rename hook handler function to "on$hookName"

Change-Id: I65ba03edefabf54b66339d8319eee01876af88bd
---
M Josa.class.php
M Josa.php
2 files changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Josa 
refs/changes/34/203634/1

diff --git a/Josa.class.php b/Josa.class.php
index 2b4e428..e8054c1 100644
--- a/Josa.class.php
+++ b/Josa.class.php
@@ -7,7 +7,7 @@
 */
 
 class Josa {
-       static $josaMap = array(
+       private static $josaMap = array(
                'Eul/Ruel' => array( '을', '를', '을(를)' ), # 곶감을 / 사과를
                'Eun/Neun' => array( '은', '는', '은(는)' ), # 곶감은 / 사과는
                'E/Ga' => array( '이', '가', '이(가)' ), # 곶감이 / 사과가
@@ -17,10 +17,14 @@
                'E/'  => array( '이', '', '(이)' ), # 태준이가 / 철수가
        );
 
-       static function InitParserFunction( &$parser ) {
+       /**
+        * @param Parser $parser
+        * @return bool
+        */
+       public static function onParserFirstCallInit( Parser &$parser ) {
                foreach ( self::$josaMap as $key => $value ) {
                        $parser->setFunctionHook( $key, function( $parser, 
$str, $with_str = true ) use ($key) {
-                               $josa = self::getJosa( $key, $str );
+                               $josa = Josa::getJosa( $key, $str );
                                if ( $with_str ) {
                                        return $str . $josa;
                                } else {
@@ -31,7 +35,7 @@
                return true;
        }
 
-       static function getJosa( $type, $str ) {
+       public static function getJosa( $type, $str ) {
                if ( mb_substr( $str, -2, 2, 'utf-8' ) == ']]' ) { # if end 
with internel link
                        $str = mb_substr( $str, 0, -2, 'utf-8' );
                }
@@ -48,7 +52,7 @@
                return self::$josaMap[$type][$idx];
        }
 
-       static function utf8_to_unicode( $str ) {
+       private static function utf8_to_unicode( $str ) {
                $values = array();
                $lookingFor = 1;
                for ( $i = 0; $i < strlen( $str ); $i++ ) {
diff --git a/Josa.php b/Josa.php
index 2d69027..b06815b 100644
--- a/Josa.php
+++ b/Josa.php
@@ -18,7 +18,7 @@
        'descriptionmsg' => 'josa-desc',
        'version'  => '0.1.1',
 );
-$wgHooks['ParserFirstCallInit'][] = 'Josa::InitParserFunction';
+$wgHooks['ParserFirstCallInit'][] = 'Josa::onParserFirstCallInit';
 
 // Load i18n files
 $wgMessagesDirs['Josa'] = __DIR__ . '/i18n';

-- 
To view, visit https://gerrit.wikimedia.org/r/203634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65ba03edefabf54b66339d8319eee01876af88bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Josa
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to