OSDN Git Service

#17934 - Append UpdateContext class.
authormumin <mumincacao@users.sourceforge.jp>
Fri, 24 Jul 2009 13:58:49 +0000 (22:58 +0900)
committermumin <mumincacao@users.sourceforge.jp>
Fri, 24 Jul 2009 13:58:49 +0000 (22:58 +0900)
documents/changes.en.txt
documents/changes.ja.txt
trust_path/modules/sd3rd/class/updater/Context.class.php [new file with mode: 0644]
trust_path/modules/sd3rd/class/updater/UpdateUtils.class.php

index 3c3889d..bb7c53d 100644 (file)
@@ -1,3 +1,4 @@
+#17934 - Append UpdateContext class.
 #17933 - Static method cannot use $this.
 #17932 - UpdateUtils::getFileList() required one argument.
 #17931 - Effect of argument $lf is reverse on UpdateUtils::output().
index b8cba44..9fc540e 100644 (file)
@@ -1,3 +1,4 @@
+#17934 - \95¡\90\94\82Ó\82\9f\82¢\82é\82É\82Ü\82½\82ª\82é\82Å\81[\82½\82ð\95Û\8e\9d\82·\82é\82­\82ç\82·\82ð\92Ç\89Á
 #17933 - \82·\82½\82Ä\82¡\82Á\82­\82ß\82»\82Á\82Ç\82Å $this \82ð\8eg\82¨\82¤\82Æ\82µ\82Ä\93{\82ç\82ê\82Ä\82½\82Ì\82Å\8fC\90³
 #17932 - UpdateUtils::getFileList() \82É\88ø\90\94\82ð\93n\82µ\96Y\82ê\82Ä\82½\82Ì\82Å\8fC\90³
 #17931 - UpdateUtils::output() \82Ì\88ø\90\94 $lf \82Ì\8cø\89Ê\82ª\8bt\93]\82µ\82Ä\82½\82Ì\82Å\8fC\90³
diff --git a/trust_path/modules/sd3rd/class/updater/Context.class.php b/trust_path/modules/sd3rd/class/updater/Context.class.php
new file mode 100644 (file)
index 0000000..3d0c327
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+/**
+ * @file
+ * @package sd3rd
+ * @version $Id$
+**/
+
+if(!defined('XOOPS_ROOT_PATH'))
+{
+    exit();
+}
+
+/**
+ * Updater global context.
+**/
+class Sd3rd_Context
+{
+    protected static /*** mixed{}{} ***/ $_mValues = array();
+    
+    /**
+     * Reset all data.
+     * 
+     * @param   void
+     * 
+     * @return  void
+    **/
+    public static function reset()
+    {
+        self::$_mValues = array();
+    }
+    
+    /**
+     * resetSection
+     * 
+     * @param   string  $section
+     * 
+     * @return  void
+    **/
+    public static function resetSection(/*** string ***/ $section)
+    {
+        if(!isset(self::$_mValues[$section]))
+        {
+            throw new Sd3rd_NotFoundException('Request section is not found.');
+        }
+        unset(self::$_mValues[$section]);
+    }
+    
+    /**
+     * Set value.
+     * 
+     * @param   string  $section
+     * @param   string  $key
+     * @param   mixed   $value
+     * 
+     * @return  void
+    **/
+    public static function set(/*** string ***/ $section,/*** string ***/ $key,/*** mixed ***/ $value)
+    {
+        self::$_mValues[$section][$key] = $value;
+    }
+    
+    /**
+     * Get request value.
+     * 
+     * @param   string  $section
+     * @param   string  $key
+     * 
+     * @return  mixed
+    **/
+    public static function get(/*** string ***/ $section,/*** string ***/ $key)
+    {
+        if(!isset(self::$_mValues[$section][$key]))
+        {
+            throw new Sd3rd_NotFoundException('Request key is not found.');
+        }
+        return self::$_mValues[$section][$key];
+    }
+    
+    /**
+     * Get request section values.
+     * 
+     * @param   string  $section
+     * 
+     * @return  mixed{}
+    **/
+    public static function getSection(/*** string ***/ $section)
+    {
+        if(!isset(self::$_mValues[$section]))
+        {
+            throw new Sd3rd_NotFoundException('Request section is not found.');
+        }
+        return self::$_mValues[$section];
+    }
+}
+
+?>
index ea62624..3b78b7a 100644 (file)
@@ -13,6 +13,7 @@ if(!defined('XOOPS_ROOT_PATH'))
 require_once SD3RD_TRUST_PATH . '/class/Sd3rdUtils.class.php';
 require_once SD3RD_TRUST_PATH . '/class/AssetManager.class.php';
 require_once SD3RD_TRUST_PATH . '/class/updater/Exception.class.php';
+require_once SD3RD_TRUST_PATH . '/class/updater/Context.class.php';
 require_once SD3RD_TRUST_PATH . '/class/updater/AbstractProcess.class.php';
 
 /**