ups... coś nie wyszło. Teraz powinno być ok. To samo co poprzedni commit.
[watermeloncms.git] / cms / wtrmln / libs / plugins_handle.php
blob7ed550b1df841e28166317155fbc15722072971d
1 <?php if(!defined('WTRMLN_IS')) die;
2 /********************************************************************
4 Watermelon CMS
6 Copyright 2008 Radosław Pietruszewski
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ********************************************************************/
24 * Lib PluginsHandle
25 * wersja 1.4.0
27 * Łączność z pluginami / między pluginami
29 * (ta klasa jest do wyrzucenia, teraz używamy PluginsConfigDatabase
33 class PluginsHandle
36 * private static PluginsHandle $instance
38 * Zawiera instancję tej klasy
40 private static $instance = NULL;
43 * private array $data
45 * Dane PluginsHandle (dostęp od nich przez funkcje getData, putData i deleteDate)
48 private static $data = array();
51 * public mixed getData(string $module[, string $key]);
53 * Zwraca zawartość całego przedziału $module, lub
54 * konkretnej komórki $module:$key, jeśli $key podane
58 public function getData($module, $key = NULL)
60 //$instance = self::Instance();
62 if($key == NULL)
64 return self::$data[$module];
66 else
68 return self::$data[$module][$key];
73 * public void putData(string $module, string $text)
75 * Wstawia w przedziale $module nową komórkę
76 * o treści $text [w rzeczywistości odpala putDataNormal]
78 ***********************
80 * public void putData(string $module, string $key, string $text)
82 * Wstawia w przedziale $module nową komórkę
83 * o nazwie $key, o treści $text [w rzeczywistości odpala putDataAssoc]
87 public function putData($module, $key, $text = NULL)
89 //$instance = self::Instance();
91 if($text == NULL)
93 $text = $key; // żeby nie pomieszać
95 $this->putDataNormal($module, $text);
97 else
99 $this->putDataAssoc($module, $key, $text);
104 * public void deleteData(string $module, string $key)
106 * Usuwa komórkę $module:$key
110 public function deleteData($module, $key)
112 //$instance = self::Instance();
114 unset(self::$data[$module][$key]);
118 * public void insertData(string $module, string $key, string $text)
120 * Dodaje $text do $module:$key
124 public function insertData($module, $key, $text)
126 //$instance = self::Instance();
128 self::$data[$module][$key] .= $text;
132 * public static PluginsHandle Instance()
134 * Singleton... (zwraca instancję tej klasy)
138 public static function Instance()
140 if(!self::$instance instanceof self)
141 self::$instance = new self;
142 return self::$instance;
146 ## private
150 * private void putDataNormal(string $module, string $text)
152 * Wstawia w przedziale $module nową komórkę
153 * o treści $text
155 * Wywoływane poprzez putData(...)
159 private function putDataNormal($module, $text)
161 //$instance = self::Instance();
163 self::$data[$module][] = $text;
167 * private void putDataAssoc(string $module, string $key, string $text)
169 * Wstawia w przedziale $module nową komórkę
170 * o nazwie $key, o treści $text
172 * Wywoływane poprzez putData(...)
176 private function putDataAssoc($module, $key, $text)
178 //$instance = self::Instance();
180 self::$data[$module][$key] = $text;