[P2-php-svn] [820] メソッドを分けてコード整理した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 1月 27日 (水) 23:05:51 JST


Revision: 820
          http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=820
Author:   akid
Date:     2010-01-27 23:05:51 +0900 (Wed, 27 Jan 2010)

Log Message:
-----------
メソッドを分けてコード整理した。

Modified Paths:
--------------
    p2/trunk/lib/ThreadRead.php


-------------- next part --------------
Modified: p2/trunk/lib/ThreadRead.php
===================================================================
--- p2/trunk/lib/ThreadRead.php	2010-01-27 11:20:41 UTC (rev 819)
+++ p2/trunk/lib/ThreadRead.php	2010-01-27 14:05:51 UTC (rev 820)
@@ -1052,21 +1052,7 @@
             $marutori_ht = '';
             //if (file_exists($_conf['idpw2ch_php']) || file_exists($_conf['sid2ch_php'])) {
                 
-                $marutori_ht = sprintf(' [%s]',
-                    P2View::tagA(
-                        UriUtil::buildQueryUri($_conf['read_php'],
-                            array(
-                                'host' => $this->host,
-                                'bbs'  => $this->bbs,
-                                'key'  => $this->key,
-                                'ls'   => $this->ls,
-                                'maru' => 'true',
-                                UA::getQueryKey() => UA::getQueryValue()
-                            )
-                        ),
-                        hs('œID‚Åp2‚ÉŽæ‚荞‚Þ')
-                    )
-                );
+                $marutori_ht = ' ' . $this->getMarutoriHtml();
                 
             //} else {
             //    $marutori_ht = "<a href=\"login2ch.php?b={$_conf['b']}\" target=\"subject\">œIDƒƒOƒCƒ“</a>";
@@ -1085,17 +1071,7 @@
                 $dat_response_status = "‘à’·! ‰ß‹ŽƒƒO‘qŒÉ‚ŁAhtml‰»‚³‚ꂽƒXƒŒƒbƒh‚ð”­Œ©‚µ‚Ü‚µ‚½B";
                 $kakolog_uri = "http://{$this->host}/{$matches[1]}";
 
-                $read_kako_url = UriUtil::buildQueryUri($_conf['read_php'],
-                    array(
-                        'host' => $this->host,
-                        'bbs'  => $this->bbs,
-                        'key'  => $this->key,
-                        'ls'   => $this->ls,
-                        'kakolog' => $kakolog_uri,
-                        'kakoget' => '1',
-                        UA::getQueryKey() => UA::getQueryValue()
-                    )
-                );
+                $read_kako_url = $this->getReadKakologUri($kakolog_uri);
 
                 $soko_atag = P2View::tagA($kakolog_uri . '.html',
                     'ƒXƒŒƒbƒh ' . $matches[3] . '.html',
@@ -1110,22 +1086,7 @@
                 
             } elseif (preg_match($waithtml_match, $read_response_html, $matches)) {
                 $dat_response_status = "‘à’·! ƒXƒŒƒbƒh‚Íhtml‰»‚³‚ê‚é‚Ì‚ð‘Ò‚Á‚Ä‚¢‚é‚悤‚Å‚·B";
-
-                $marutori_atag = P2View::tagA(
-                    UriUtil::buildQueryUri($_conf['read_php'],
-                        array(
-                            'host' => $this->host,
-                            'bbs'  => $this->bbs,
-                            'key'  => $this->key,
-                            'ls'   => $this->ls,
-                            'maru' => 'true',
-                            UA::getQueryKey() => UA::getQueryValue()
-                        )
-                    ),
-                    hs('œID‚Åp2‚ÉŽæ‚荞‚Þ')
-                );
-                $marutori_ht = " [$marutori_atag]";
-                
+                $marutori_ht = ' ' . $this->getMarutoriHtml();
                 $dat_response_msg_ht = "<p>2ch info - ‘à’·! ƒXƒŒƒbƒh‚Íhtml‰»‚³‚ê‚é‚Ì‚ð‘Ò‚Á‚Ä‚¢‚é‚悤‚Å‚·B {$marutori_ht}</p>";
                 
             } else {
@@ -1133,17 +1094,7 @@
                     $dat_response_status = "‚»‚ñ‚È”ÂorƒXƒŒƒbƒh‚È‚¢‚Å‚·B";
                     
                     $kako_html_url = $_GET['kakolog'] . ".html";
-                    $read_kako_url = UriUtil::buildQueryUri($_conf['read_php'],
-                        array(
-                            'host' => $this->host,
-                            'bbs'  => $this->bbs,
-                            'key'  => $this->key,
-                            'ls'   => $this->ls,
-                            'kakolog' => $_GET['kakolog'],
-                            'kakoget' => '1',
-                            UA::getQueryKey() => UA::getQueryValue()
-                        )
-                    );
+                    $read_kako_url = $this->getReadKakologUri($_GET['kakolog']);
 
                     $attrs = array();
                     if ($_conf['bbs_win_target']) {
@@ -1166,17 +1117,7 @@
             $dat_response_status = '';
             
             $kako_html_url = $_GET['kakolog'] . '.html';
-            $read_kako_url = UriUtil::buildQueryUri($_conf['read_php'],
-                array(
-                    'host' => $this->host,
-                    'bbs'  => $this->bbs,
-                    'key'  => $this->key,
-                    'ls'   => $this->ls,
-                    'kakolog' => $_GET['kakolog'],
-                    'kakoget' => '1',
-                    UA::getQueryKey() => UA::getQueryValue()
-                )
-            );
+            $read_kako_url = $this->getReadKakologUri($_GET['kakolog']);
             $attrs = array();
             if ($_conf['bbs_win_target']) {
                 $attrs['target'] = $_conf['bbs_win_target'];
@@ -1193,6 +1134,50 @@
     }
     
     /**
+     * @param   string  $kakolog  ‰ß‹ŽƒƒOURI‚©‚ç.html‚ðŠO‚µ‚½•¶Žš—ñ @see $kakohtml_match
+     * @return  string
+     */
+    private function getReadKakologUri($kakolog)
+    {
+        global $_conf;
+        
+        return UriUtil::buildQueryUri($_conf['read_php'],
+            array(
+                'host' => $this->host,
+                'bbs'  => $this->bbs,
+                'key'  => $this->key,
+                'ls'   => $this->ls,
+                'kakolog' => $kakolog,
+                'kakoget' => '1',
+                UA::getQueryKey() => UA::getQueryValue()
+            )
+        );
+    }
+    
+    /**
+     * @return  string  HTML
+     */
+    private function getMarutoriHtml()
+    {
+        global $_conf;
+        
+        $marutori_atag = P2View::tagA(
+            UriUtil::buildQueryUri($_conf['read_php'],
+                array(
+                    'host' => $this->host,
+                    'bbs'  => $this->bbs,
+                    'key'  => $this->key,
+                    'ls'   => $this->ls,
+                    'maru' => 'true',
+                    UA::getQueryKey() => UA::getQueryValue()
+                )
+            ),
+            hs('œID‚Åp2‚ÉŽæ‚荞‚Þ')
+        );
+        return "[$marutori_atag]";
+    }
+    
+    /**
      * >>1‚Ì‚Ý‚ðƒvƒŒƒrƒ…[•\Ž¦‚·‚邽‚ß‚ÌHTML‚ðŽæ“¾‚·‚éiƒIƒ“ƒUƒtƒ‰ƒC‚ɑΉžj
      *
      * @access  public



P2-php-svn メーリングリストの案内
Back to archive index