Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Mendel <cybot_tm@users.sourceforge.net>2008-05-09 14:41:16 +0400
committerSebastian Mendel <cybot_tm@users.sourceforge.net>2008-05-09 14:41:16 +0400
commitfa21fe3ea5d76e0d7978096e837e9950bd9feef6 (patch)
tree829ab19853df950a085cc30a7cb34d005668642b /libraries/PMA.php
parent91007aa3d69d5f8c7f909593f0607e844de76b40 (diff)
make the database list more magic:
load/fetch only if really required use SPL ArrayObject to behave like an array
Diffstat (limited to 'libraries/PMA.php')
-rw-r--r--libraries/PMA.php94
1 files changed, 94 insertions, 0 deletions
diff --git a/libraries/PMA.php b/libraries/PMA.php
new file mode 100644
index 0000000000..25c69f6199
--- /dev/null
+++ b/libraries/PMA.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Enter description here...
+ *
+ */
+require_once './libraries/List_Database.class.php';
+
+/**
+ * phpMyAdmin mian Controller
+ *
+ *
+ *
+ */
+class PMA
+{
+ /**
+ * Holds database list
+ *
+ * @var PMA_List_Datase
+ */
+ protected $databases = null;
+
+ /**
+ * DBMS user link
+ *
+ * @var resource
+ */
+ protected $userlink = null;
+
+ /**
+ * DBMS control link
+ *
+ * @var resource
+ */
+ protected $controllink = null;
+
+ /**
+ * magic access to protected/inaccessible members/properties
+ *
+ * @see http://php.net/language.oop5.overloading
+ */
+ public function __get($param)
+ {
+ switch ($param) {
+ case 'databases' :
+ return $this->getDatabaseList();
+ break;
+ case 'userlink' :
+ return $this->userlink;
+ break;
+ case 'controllink' :
+ return $this->controllink;
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * magic access to protected/inaccessible members/properties
+ *
+ * @see http://php.net/language.oop5.overloading
+ */
+ public function __set($param, $value)
+ {
+ switch ($param) {
+ case 'userlink' :
+ $this->userlink = $value;
+ break;
+ case 'controllink' :
+ $this->controllink = $value;
+ break;
+ }
+ }
+
+ /**
+ * Accessor to PMA::$databases
+ *
+ * @uses PMA::$databases
+ * @uses PMA::$userlink
+ * @uses PMA::$controllink
+ * @uses PMA_List_Database
+ * @return PMA_List_Databases
+ */
+ public function getDatabaseList()
+ {
+ if (null === $this->databases) {
+ $this->databases = new PMA_List_Database($this->userlink, $this->controllink);
+ }
+
+ return $this->databases;
+ }
+}
+?> \ No newline at end of file