diff --git a/composer.json b/composer.json index a187ad9..8c45455 100644 --- a/composer.json +++ b/composer.json @@ -7,5 +7,9 @@ "email": "phedor@edu.yar.ru" } ], - "require": {} + "require": { + "psr-0": { + "": "src/" + } + } } diff --git a/core/connection/all.php b/core/connection/all.php deleted file mode 100644 index 3bc9748..0000000 --- a/core/connection/all.php +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/core/database.php b/core/database.php deleted file mode 100644 index 52eca1a..0000000 --- a/core/database.php +++ /dev/null @@ -1,16 +0,0 @@ -connect($dsn); - return $database; - } -} diff --git a/core/drivers/database.mysql.php b/core/drivers/database.mysql.php deleted file mode 100644 index 99eb601..0000000 --- a/core/drivers/database.mysql.php +++ /dev/null @@ -1,50 +0,0 @@ -db = $db); - } - - public function close() - { - return mysql_close($this->db); - } - - public function query($query) - { - $res = mysql_query($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query) - { - $res = $this->query($query); - - while ($row = mysql_fetch_array ($res)) - $rows[] = $row; - mysql_free_result($res); - return ($rows) ? $rows : array(); - } - - public function fetchOneArray($query) - { - $res = $this->query($query); - $row = mysql_fetch_array($res); - mysql_free_result($res); - return ($row) ? $row : array(); - } -} - -?> \ No newline at end of file diff --git a/core/drivers/database.odbc.php b/core/drivers/database.odbc.php deleted file mode 100644 index cb166bf..0000000 --- a/core/drivers/database.odbc.php +++ /dev/null @@ -1,54 +0,0 @@ -db = $db); - } - - public function close() - { - return odbc_close($this->db); - } - - public function query($query) - { - $res = odbc_exec($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query) - { - $res = $this->query($query); - $to = odbc_num_fields($res); - while (odbc_fetch_row($res)) { - for ($i = 1; $i <= $to; $i++) { - $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); - } - $rows[] = $row; - } - return ($rows)? $rows : array(); - } - - public function fetchOneArray($query) - { - $res = $this->query($query); - if (!odbc_fetch_row($res)) return array (); - $to = odbc_num_fields($res); - for ($i = 1; $i <= $to; $i++) { - $row [odbc_field_name($res, $i)] = trim(odbc_result($res, $i)); - } - return $row; - } -} - -?> \ No newline at end of file diff --git a/core/drivers/database.pgsql.php b/core/drivers/database.pgsql.php deleted file mode 100644 index 64de93f..0000000 --- a/core/drivers/database.pgsql.php +++ /dev/null @@ -1,74 +0,0 @@ -db = $db); - } - - public function close() - { - return pg_close($this->db); - } - - public function query($query) - { - $res = pg_query($this->db, $query) - or die("Error: wrong SQL query #$query#"); - return $res; - } - - public function fetchAllArray($query, $type = PGSQL_ASSOC) - { - $res = $this->query($query); - - $rows = array(); - while ($row = pg_fetch_array($res, NULL, $type)) { - $rows[] = $this->clean($row); - } - pg_free_result($res); - return ($rows) ? $rows : array(); - } - - public function affectedRows() - { - return pg_affected_rows($this->db); - } - - private function clean($row) - { - foreach ($row as $key => $value) { - $row[$key] = trim($value); - } - return $row; - } - - public function fetchOneArray($query, $type = PGSQL_ASSOC) - { - $res = $this->query($query); - $row = pg_fetch_array($res, NULL, $type); - pg_free_result($res); - return ($row) ? $this->clean($row) : array(); - } - - function getNextId($seq) - { - $result = $this->fetchOneArray("SELECT nextval('$seq')"); - return $result['nextval']; - } -} diff --git a/core/drivers/db.php b/core/drivers/db.php deleted file mode 100644 index 3e5014d..0000000 --- a/core/drivers/db.php +++ /dev/null @@ -1,50 +0,0 @@ -query("INSERT INTO $table (" . implode(",", array_keys($values)) - . ") VALUES (" . implode(",", array_map(array('self', 'quote'), array_values($values))) . ")"); - } - - function update($table, array $values, $cond) - { - return $this->query("UPDATE $table SET " . implode(",", - array_map(array('self', 'assign_quote'), array_keys($values), array_values($values))) . " WHERE $cond"); - } - - function check_text($text) - { - if(strlen($text) > self::limit) $text = substr($text, 0, self::limit); - $text = htmlspecialchars(trim($text)); - return $text; - } -} - -?> \ No newline at end of file diff --git a/core/safecollection.php b/core/safecollection.php deleted file mode 100644 index df5529d..0000000 --- a/core/safecollection.php +++ /dev/null @@ -1,35 +0,0 @@ -data = $this->_stripSlashes($this->data); - } - $this->data = $this->data; - } - - function import(array $data) - { - parent::import($data); - $this->_clean(); - } - - /** - * Strip slashes code from php.net website. - * - * @param mixed $value - * @return array - */ - protected function _stripSlashes($value) - { - if(is_array($value)) { - return array_map(array($this,'_stripSlashes'), $value); - } else { - return stripslashes($value); - } - } -} diff --git a/core/adapter.php b/src/adapter.php similarity index 90% rename from core/adapter.php rename to src/adapter.php index 39af4c2..42bd4ab 100644 --- a/core/adapter.php +++ b/src/adapter.php @@ -14,7 +14,7 @@ class Adapter public function get($name) { if (is_array ($this->adaptee)) { - return $this->adaptee [$name]; + return $this->adaptee[$name]; } else { return $this->adaptee->$name; } diff --git a/core/arr.php b/src/arr.php similarity index 100% rename from core/arr.php rename to src/arr.php diff --git a/core/collection.php b/src/collection.php similarity index 100% rename from core/collection.php rename to src/collection.php diff --git a/core/config.php b/src/config.php similarity index 100% rename from core/config.php rename to src/config.php diff --git a/core/connection/httpconnection.php b/src/connection/httpconnection.php similarity index 98% rename from core/connection/httpconnection.php rename to src/connection/httpconnection.php index b2b25f3..534be58 100644 --- a/core/connection/httpconnection.php +++ b/src/connection/httpconnection.php @@ -1,7 +1,6 @@ value; } } - -?> \ No newline at end of file diff --git a/core/query/meta.php b/src/query/meta.php similarity index 100% rename from core/query/meta.php rename to src/query/meta.php diff --git a/core/query/query.php b/src/query/query.php similarity index 100% rename from core/query/query.php rename to src/query/query.php diff --git a/core/query/table.php b/src/query/table.php similarity index 100% rename from core/query/table.php rename to src/query/table.php diff --git a/core/registry.php b/src/registry.php similarity index 92% rename from core/registry.php rename to src/registry.php index 661dad5..862a3d4 100644 --- a/core/registry.php +++ b/src/registry.php @@ -5,7 +5,6 @@ * http://www.patternsforphp.com/wiki/Singleton * http://www.phppatterns.com/docs/design/the_registry?s=registry */ -require_once 'core/settings.php'; class Registry extends Settings { diff --git a/search/htmlhelper.php b/src/search/htmlhelper.php similarity index 100% rename from search/htmlhelper.php rename to src/search/htmlhelper.php diff --git a/search/index.php b/src/search/index.php similarity index 100% rename from search/index.php rename to src/search/index.php diff --git a/search/lexer.php b/src/search/lexer.php similarity index 100% rename from search/lexer.php rename to src/search/lexer.php diff --git a/search/search.php b/src/search/search.php similarity index 100% rename from search/search.php rename to src/search/search.php diff --git a/search/searcher.php b/src/search/searcher.php similarity index 100% rename from search/searcher.php rename to src/search/searcher.php diff --git a/search/stemmer.php b/src/search/stemmer.php similarity index 100% rename from search/stemmer.php rename to src/search/stemmer.php diff --git a/core/session.php b/src/session.php similarity index 100% rename from core/session.php rename to src/session.php diff --git a/core/settings.php b/src/settings.php similarity index 99% rename from core/settings.php rename to src/settings.php index 35de901..3566c89 100644 --- a/core/settings.php +++ b/src/settings.php @@ -1,7 +1,5 @@ \ No newline at end of file diff --git a/core/shortcut.php b/src/shortcut.php similarity index 100% rename from core/shortcut.php rename to src/shortcut.php diff --git a/core/sort.php b/src/sort.php similarity index 100% rename from core/sort.php rename to src/sort.php diff --git a/core/spell.php b/src/spell.php similarity index 99% rename from core/spell.php rename to src/spell.php index bc45a0d..43b0ce8 100644 --- a/core/spell.php +++ b/src/spell.php @@ -96,5 +96,3 @@ class Spell return false; } } - -?> \ No newline at end of file diff --git a/core/tabletree.php b/src/tabletree.php similarity index 100% rename from core/tabletree.php rename to src/tabletree.php diff --git a/core/tales.php b/src/tales.php similarity index 100% rename from core/tales.php rename to src/tales.php diff --git a/core/tools/drawing.php b/src/tools/drawing.php similarity index 100% rename from core/tools/drawing.php rename to src/tools/drawing.php diff --git a/core/tools/exceltable.php b/src/tools/exceltable.php similarity index 100% rename from core/tools/exceltable.php rename to src/tools/exceltable.php diff --git a/core/tools/image.php b/src/tools/image.php similarity index 100% rename from core/tools/image.php rename to src/tools/image.php diff --git a/core/tools/password.php b/src/tools/password.php similarity index 100% rename from core/tools/password.php rename to src/tools/password.php diff --git a/core/tools/string.php b/src/tools/string.php similarity index 100% rename from core/tools/string.php rename to src/tools/string.php diff --git a/core/tools/tableview.php b/src/tools/tableview.php similarity index 100% rename from core/tools/tableview.php rename to src/tools/tableview.php diff --git a/core/tools/templateimage.php b/src/tools/templateimage.php similarity index 100% rename from core/tools/templateimage.php rename to src/tools/templateimage.php diff --git a/core/tools/translit.php b/src/tools/translit.php similarity index 100% rename from core/tools/translit.php rename to src/tools/translit.php diff --git a/core/tree/database.php b/src/tree/database.php similarity index 100% rename from core/tree/database.php rename to src/tree/database.php diff --git a/core/tree/dbtree.php b/src/tree/dbtree.php similarity index 100% rename from core/tree/dbtree.php rename to src/tree/dbtree.php diff --git a/core/tree/sort.php b/src/tree/sort.php similarity index 100% rename from core/tree/sort.php rename to src/tree/sort.php diff --git a/core/validator/rule/abstract.php b/src/validator/rule/abstract.php similarity index 100% rename from core/validator/rule/abstract.php rename to src/validator/rule/abstract.php diff --git a/core/validator/rule/all.php b/src/validator/rule/all.php similarity index 100% rename from core/validator/rule/all.php rename to src/validator/rule/all.php diff --git a/core/validator/rule/alpha.php b/src/validator/rule/alpha.php similarity index 100% rename from core/validator/rule/alpha.php rename to src/validator/rule/alpha.php diff --git a/core/validator/rule/code.php b/src/validator/rule/code.php similarity index 100% rename from core/validator/rule/code.php rename to src/validator/rule/code.php diff --git a/core/validator/rule/count.php b/src/validator/rule/count.php similarity index 100% rename from core/validator/rule/count.php rename to src/validator/rule/count.php diff --git a/core/validator/rule/date.php b/src/validator/rule/date.php similarity index 100% rename from core/validator/rule/date.php rename to src/validator/rule/date.php diff --git a/core/validator/rule/email.php b/src/validator/rule/email.php similarity index 100% rename from core/validator/rule/email.php rename to src/validator/rule/email.php diff --git a/core/validator/rule/emaillist.php b/src/validator/rule/emaillist.php similarity index 100% rename from core/validator/rule/emaillist.php rename to src/validator/rule/emaillist.php diff --git a/core/validator/rule/isfile.php b/src/validator/rule/isfile.php similarity index 100% rename from core/validator/rule/isfile.php rename to src/validator/rule/isfile.php diff --git a/core/validator/rule/match.php b/src/validator/rule/match.php similarity index 100% rename from core/validator/rule/match.php rename to src/validator/rule/match.php diff --git a/core/validator/rule/notnull.php b/src/validator/rule/notnull.php similarity index 100% rename from core/validator/rule/notnull.php rename to src/validator/rule/notnull.php diff --git a/core/validator/rule/numeric.php b/src/validator/rule/numeric.php similarity index 100% rename from core/validator/rule/numeric.php rename to src/validator/rule/numeric.php diff --git a/core/validator/rule/time.php b/src/validator/rule/time.php similarity index 100% rename from core/validator/rule/time.php rename to src/validator/rule/time.php diff --git a/core/validator/rule/unique.php b/src/validator/rule/unique.php similarity index 100% rename from core/validator/rule/unique.php rename to src/validator/rule/unique.php diff --git a/core/validator/validator.php b/src/validator/validator.php similarity index 100% rename from core/validator/validator.php rename to src/validator/validator.php diff --git a/core/view/compositeview.php b/src/view/compositeview.php similarity index 100% rename from core/view/compositeview.php rename to src/view/compositeview.php diff --git a/core/view/view.php b/src/view/view.php similarity index 100% rename from core/view/view.php rename to src/view/view.php diff --git a/core/zipfile.php b/src/zipfile.php similarity index 100% rename from core/zipfile.php rename to src/zipfile.php