OSDN Git Service

MERGE: リビジョン1800。Skinクラスの2メソッドの名前変更
authorsakamocchi <o-takashi@sakamocchi.jp>
Mon, 30 Apr 2012 13:24:45 +0000 (22:24 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Mon, 30 Apr 2012 13:24:45 +0000 (22:24 +0900)
スキンの内容の取得先をデータベースとファイルから選択できるようにしているが、それをメソッド名に反映した。

Revision 1800:
CHANGE: rename two methods related to retrieve skin contents and related
modification

rename:
Skin::getContents() to Skin::getContentFromDB()
Skin::getFileConten() to
Skin::getContentFromFile()
http://nucleuscms.svn.sourceforge.net/viewvc/nucleuscms?view=revision&revision=1800

nucleus/libs/SKIN.php

index 84930a6..cdac253 100644 (file)
@@ -337,24 +337,24 @@ class Skin
                // set output type
                sendContentType($this->getContentType(), 'skin');
                
-               // set skin name as global var (so plugins can access it)
+               /* FIX: should be obsoleted */
                $currentSkinName = $this->getName();
                
+               // retrieve contents
                $contents = FALSE;
                if ( $type != 'fileparse' )
                {
-                       $contents = $this->getContent($type);
+                       $contents = $this->getContentFromDB($type);
                }
                else if ( $path !== ''  && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
                {
-                       $contents = $this->getFileContent($path);
+                       $contents = $this->getContentFromFile($path);
                }
-               
-               if ( !$contents )
+               // use base skin if this skin does not have contents
+               if ( $contents === FALSE )
                {
-                       // use base skin if this skin does not have contents
                        $defskin = new SKIN($CONF['BaseSkin']);
-                       $contents = $defskin->getContent($type);
+                       $contents = $defskin->getContentFromDB($type);
                        if ( !$contents )
                        {
                                echo _ERROR_SKIN;
@@ -368,9 +368,11 @@ class Skin
                Parser::setProperty('IncludeMode', $this->getIncludeMode());
                Parser::setProperty('IncludePrefix', $this->getIncludePrefix());
                
+               // call action handler
                $action_class = $this->action_class;
                $handler = new $action_class($type);
                
+               // register action handler to parser
                $actions = $handler->getDefinedActions($type);
                $parser = new Parser($actions, $handler);
                
@@ -383,32 +385,32 @@ class Skin
        }
        
        /**
-        * Skin::getContent()
-        * Get content of the skin part from the database
+        * Skin::getContentFromDB()
         * 
-        * @param       string  $type   type of the skin (e.g. index, item, search ...)
-        * @return      string  content of scontent
+        * @param       string  $skintype       skin type
+        * @return      string  content for the skin type
         */
-       public function getContent($type)
+       public function getContentFromDB($skintype)
        {
                $query = "SELECT scontent FROM %s WHERE sdesc=%d and stype='%s';";
-               $query = sprintf($query, sql_table('skin'), (integer) $this->id, sql_real_escape_string($type));
+               $query = sprintf($query, sql_table('skin'), (integer) $this->id, sql_real_escape_string($skintype));
                $res = sql_query($query);
                
                if ( sql_num_rows($res) == 0 )
                {
                        return FALSE;
                }
+               
                return sql_result($res, 0, 0);
        }
        
        /**
-        * Skin::getFileContent()
+        * Skin::getContentFromFile()
         * 
         * @param       string  $fullpath       fullpath to the file to parse
         * @return      mixed   file contents or FALSE
         */
-       public function getFileContent($fullpath)
+       public function getContentFromFile($fullpath)
        {
                $fsize = filesize($fullpath);
                if ( $fsize <= 0 )