diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 6235b45..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 643bc76..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.buildpath -.project -.settings -*.DS_Store -*.esproj -*corephp.esproj* \ No newline at end of file diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 404ab46..0000000 --- a/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -RewriteEngine On -RewriteRule ^(.*)$ public/$1 [QSA,L] \ No newline at end of file diff --git a/TODO.textile b/TODO.textile deleted file mode 100644 index ff67ffa..0000000 --- a/TODO.textile +++ /dev/null @@ -1,17 +0,0 @@ -h1. TODO - -h2. Framework - -* Generate URLs -* Cookie class -* File cache adapter -* Avoid Cache class and use magic methods on adapters -* Add exists method to cache adapters -* Return null when cache key does not exists - -h2. Server - -* Lighttpd configuration - Use mod_magnetic -* Apache configuration - Use .htaccess -* IIS configuration - Use what? - diff --git a/app/.DS_Store b/app/.DS_Store deleted file mode 100644 index d9cc3c4..0000000 Binary files a/app/.DS_Store and /dev/null differ diff --git a/app/bootfiles/locale.php b/app/bootfiles/locale.php deleted file mode 100644 index 8a05478..0000000 --- a/app/bootfiles/locale.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -setlocale( LC_ALL, 'fr_FR.UTF8' ); \ No newline at end of file diff --git a/app/bootfiles/routes.php b/app/bootfiles/routes.php deleted file mode 100644 index 5d92ac7..0000000 --- a/app/bootfiles/routes.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -use Controller\Router; - -// Admin route -Router::module( 'admin', function ( $admin ) { - $admin->connect( '/', array( 'controller' => 'dashboard' ) ); -}); - -// Root route -Router::connect( '/' ); \ No newline at end of file diff --git a/app/config/application.ini b/app/config/application.ini deleted file mode 100644 index f4d074e..0000000 --- a/app/config/application.ini +++ /dev/null @@ -1,38 +0,0 @@ -; Core PHP Framework -; Copyright (C) 2008-2009 Gabriel Sobrinho -; -; This file is part of Core PHP Framework. -; -; Core PHP Framework is free software: you can redistribute it and/or modify -; it under the terms of the GNU Lesser General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; Core PHP Framework is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU Lesser General Public License for more details. -; -; You should have received a copy of the GNU Lesser General Public License -; along with Core PHP Framework. If not, see . -; -; @package Core -; @subpackage Application -; @category Config -; @copyright 2008-2009 Gabriel Sobrinho -; @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) -; @version 0.1 - -[application] - application.environment = 'development' - application.charset = 'utf-8' - application.timezone = 'America/Sao_Paulo' - application.locale = 'pt_BR' - -[view] - view.layout = 'application' - view.render = 'php' - -[cache] - cache.adapter = 'apc' - cache.directory = 'tmp/cache' \ No newline at end of file diff --git a/app/controllers/ApplicationController.php b/app/controllers/ApplicationController.php deleted file mode 100644 index 404d511..0000000 --- a/app/controllers/ApplicationController.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @category Controllers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -/** - * Application controller - * - * @package Core - * @subpackage Application - * @category Controllers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -abstract class ApplicationController extends Controller { - protected $layout = 'application'; -} \ No newline at end of file diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php deleted file mode 100644 index 0daee39..0000000 --- a/app/controllers/HomeController.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @category Controllers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -/** - * Home controller - * - * @package Core - * @subpackage Application - * @category Controllers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class HomeController extends ApplicationController { - public function index () { - $plop = 'hey !'; - } -} \ No newline at end of file diff --git a/app/helpers/ApplicationHelper.php b/app/helpers/ApplicationHelper.php deleted file mode 100644 index fceb3c2..0000000 --- a/app/helpers/ApplicationHelper.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @category Helpers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -/** - * Application helper class - * - * @package Core - * @subpackage Application - * @category Helpers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -abstract class ApplicationHelper { - -} \ No newline at end of file diff --git a/app/helpers/HomeHelper.php b/app/helpers/HomeHelper.php deleted file mode 100644 index f422fd6..0000000 --- a/app/helpers/HomeHelper.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Application - * @category Helpers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -/** - * Home helper class - * - * @package Core - * @subpackage Application - * @category Helpers - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -abstract class HomeHelper extends ApplicationHelper { - -} \ No newline at end of file diff --git a/app/views/.DS_Store b/app/views/.DS_Store deleted file mode 100644 index e203623..0000000 Binary files a/app/views/.DS_Store and /dev/null differ diff --git a/app/views/home/index.phtml b/app/views/home/index.phtml deleted file mode 100644 index 58fbda6..0000000 --- a/app/views/home/index.phtml +++ /dev/null @@ -1,7 +0,0 @@ -

Hello world !

- - \ No newline at end of file diff --git a/app/views/layouts/application.phtml b/app/views/layouts/application.phtml deleted file mode 100644 index 97cc467..0000000 --- a/app/views/layouts/application.phtml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Core PHP - stylesheet('http://yui.yahooapis.com/combo?3.0.0/build/cssfonts/fonts-min.css&3.0.0/build/cssreset/reset-min.css&3.0.0/build/cssgrids/grids-min.css&3.0.0/build/cssbase/base-min.css') ?> - - -
- -
- - \ No newline at end of file diff --git a/core/.DS_Store b/core/.DS_Store deleted file mode 100644 index 6ba9e9c..0000000 Binary files a/core/.DS_Store and /dev/null differ diff --git a/core/Cache.php b/core/Cache.php deleted file mode 100644 index 71ff1b2..0000000 --- a/core/Cache.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -/** - * Cache class - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -abstract class Cache { - /** - * Cache adapter - * - * @var Cache\Adapter - */ - protected static $adapter; - - /** - * Factory cache adapter - * - * @return Cache\Adapter - * @throws Cache\Exception when adapter not found or isn't a valid cache adapter - */ - public static function getAdapter () { - if ( !self::$adapter instanceof Cache\Adapter ) { - $adapter = 'Cache\Adapters\\' . Inflector::camelize( Config::get( 'cache.adapter', 'file' ) ); - - if ( !class_exists( $adapter ) || !in_array( 'Cache\Adapter', class_implements( $adapter ) ) ) { - throw new Cache\Exception( "Cache adapter `$adapter' not found or isn't a valid cache adapter" ); - } - - self::$adapter = new $adapter; - } - - return self::$adapter; - } - - /** - * Retrieve item from the server - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get ( $key, $default = null ) { - return self::getAdapter()->get( $key ); - } - - /** - * Store data at the server - * - * @param string $key - * @param mixed $value - * @param integer $ttl - * @return boolean true on success or false otherwise - */ - public static function set ( $key, $value, $ttl = 0 ) { - return self::getAdapter()->set( $key, $value, $ttl ); - } - - /** - * Delete item from the server - * - * @param string $key - * @return boolean true on success or false otherwise - */ - public static function delete ( $key ) { - return self::getAdapter()->delete( $key ); - } - - /** - * Flush all existing items at the server - * - * @return boolean true on success or false otherwise - */ - public static function flush () { - return self::getAdapter()->flush(); - } -} \ No newline at end of file diff --git a/core/Cache/.DS_Store b/core/Cache/.DS_Store deleted file mode 100644 index 1f797e2..0000000 Binary files a/core/Cache/.DS_Store and /dev/null differ diff --git a/core/Cache/Adapter.php b/core/Cache/Adapter.php deleted file mode 100644 index 246d89b..0000000 --- a/core/Cache/Adapter.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache; - -/** - * Adapter class - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -interface Adapter { - /** - * Retrieve item from the server - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function get ( $key ); - - /** - * Store data at the server - * - * @param string $key - * @param mixed $value - * @param integer $ttl - * @return boolean true on success or false otherwise - */ - public function set ( $key, $value, $ttl) ; - - /** - * Delete item from the server - * - * @param string $key - * @return boolean true on success or false otherwise - */ - public function delete ( $key ); - - /** - * Flush all existing items at the server - * - * @return boolean true on success or false otherwise - */ - public function flush (); -} \ No newline at end of file diff --git a/core/Cache/Adapters/Apc.php b/core/Cache/Adapters/Apc.php deleted file mode 100644 index 58ed93f..0000000 --- a/core/Cache/Adapters/Apc.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache\Adapters; - -/** - * APC adapter class - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -class Apc implements \Cache\Adapter { - /** - * Verify APC support - * - * @throws \Cache\Exception when APC isn't loaded - */ - public function __construct () { - if ( !extension_loaded( 'apc' ) ) { - throw new \Cache\Exception( "Could not find extension APC" ); - } - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::get() - */ - public function get ( $key ) { - return apc_fetch( $key ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::set() - */ - public function set ( $key, $value, $ttl = 0 ) { - return apc_store( $key, $value, $ttl ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::delete() - */ - public function delete ( $key ) { - return apc_delete( $key ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::flush() - */ - public function flush () { - return apc_clear_cache( 'user' ); - } -} \ No newline at end of file diff --git a/core/Cache/Adapters/File.php b/core/Cache/Adapters/File.php deleted file mode 100644 index 9a7df9c..0000000 --- a/core/Cache/Adapters/File.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache\Adapters; - -/** - * File adapter class - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -class File implements \Cache\Adapter { - /** - * Verify file cache support - * - * @throws \Cache\Exception when cache dir isn't writable - */ - public function __construct () { - $this->directory = \Config::get( 'cache.directory', 'tmp/cache' ); - - if( !is_dir($this->directory ) || !is_writable( $this->directory ) ) { - throw new \Cache\Exception( "Cache directory `$this->directory' does not exists or is not writable" ); - } - - $this->directory = realpath( $this->directory ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::get() - */ - public function get ( $key ) { - $fileName = $this->getFileName( $key ); - - if ( !file_exists( $fileName ) ) { - return false; - } - - list( $expires, $data ) = unserialize( file_get_contents( $fileName ) ); - - if ( $expires && $expires <= time() ) { - $this->delete( $key ); - return false; - } - - return $data; - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::set() - */ - public function set ( $key, $value, $ttl = 0 ) { - if ( $ttl ) { - $ttl = time() + $ttl; - } - - $data = serialize( array( $ttl, $value ) ); - - return (bool)file_put_contents( $this->getFileName( $key ), $data, LOCK_EX ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::delete() - */ - public function delete ( $key ) { - return unlink( $this->getFileName( $key ) ); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::flush() - */ - public function flush () { - $pattern = $this->directory . DIRECTORY_SEPARATOR . '*'; - - foreach( new \GlobIterator( $pattern, \GlobIterator::CURRENT_AS_PATHNAME ) as $file ) { - unlink( $file ); - } - - return true; - } - - /** - * Get file name of $key - * - * @param string $key - * @return string - */ - protected function getFileName ( $key ) { - return $this->directory . DIRECTORY_SEPARATOR . md5( $key ); - } -} \ No newline at end of file diff --git a/core/Cache/Adapters/Memcached.php b/core/Cache/Adapters/Memcached.php deleted file mode 100644 index ede0273..0000000 --- a/core/Cache/Adapters/Memcached.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache\Adapters; - -/** - * Memcached adapter class - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Memcached implements \Cache\Adapter { - /** - * Memcached instance - * - * @var \Memcache - */ - protected $memcached; - - /** - * Default server - * - * @var string - */ - protected static $defaultServer = '127.0.0.1:11211'; - - /** - * Verify Memcached support - * - * @throws \Cache\Exception when Memcached isn't loaded - * @throws \Cache\Exception when server format - */ - public function __construct () { - if (!extension_loaded('memcached')) { - throw new \Cache\Exception("Could not find extension Memcached"); - } - - $this->memcached = new \Memcached; - - // TODO: can specify more than a once server with weight - if (!preg_match('/^(?[^:]+):(?\d+)$/', \Config::get('cache.server', '127.0.0.1:11211'), $server)) { - throw new \Cache\Exception('You must specify Memcached server with port, ie: 127.0.0.1:11211'); - } - - $this->memcached->addServer($server['host'], $server['port']); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::get() - */ - public function get ($key) { - return $this->memcached->get($key); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::set() - */ - public function set ($key, $value, $ttl = 0) { - return $this->memcached->set($key, $value, $ttl); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::delete() - */ - public function delete ($key) { - return $this->memcached->delete($key); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::flush() - */ - public function flush () { - return $this->memcached->flush(); - } -} - diff --git a/core/Cache/Adapters/Xcache.php b/core/Cache/Adapters/Xcache.php deleted file mode 100644 index 250b695..0000000 --- a/core/Cache/Adapters/Xcache.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache\Adapters; - -/** - * XCache adapter class - * - * @package Core - * @subpackage Cache - * @category Adapters - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Xcache implements \Cache\Adapter { - /** - * Verify XCache support - * - * @throws \Cache\Exception when XCache isn't loaded - */ - public function __construct () { - if (!extension_loaded('xcache')) { - throw new \Cache\Exception("Could not find extension Xcache"); - } - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::get() - */ - public function get ($key) { - return xcache_get($key); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::set() - */ - public function set ($key, $value, $ttl = 0) { - return xcache_set($key, $value, $ttl); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::delete() - */ - public function delete ($key) { - return xcache_unset($key); - } - - /** - * (non-PHPdoc) - * @see \Cache\Adapter::flush() - */ - public function flush () { - // FIXME: this fail without XCache authentication - return false; - } -} - diff --git a/core/Cache/Exception.php b/core/Cache/Exception.php deleted file mode 100644 index 935c683..0000000 --- a/core/Cache/Exception.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Cache; - -/** - * Cache exception class - * - * @package Core - * @subpackage Cache - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Exception extends \Exception { -} - diff --git a/core/Config.php b/core/Config.php deleted file mode 100644 index f26febf..0000000 --- a/core/Config.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Config - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1a - */ - -/** - * Config class - * - * @package Core - * @subpackage Config - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -abstract class Config { - /** - * Loaded configs - * - * @var array - */ - protected static $configs = array(); - - /** - * Parse application config files - */ - public static function parseApplicationFiles () { - foreach (new GlobIterator('app/config/*.ini', GlobIterator::CURRENT_AS_PATHNAME) as $file) { - self::$configs = array_merge(self::$configs, parse_ini_file($file)); - } - } - - /** - * Get a config value - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public static function get ($key, $default = null) { - return isset(self::$configs[$key]) ? self::$configs[$key] : $default; - } - - /** - * Set a config value - * - * @param string $key - * @param mixed $value - */ - public static function set ($key, $value) { - self::$configs[$key] = $value; - } -} \ No newline at end of file diff --git a/core/Controller.php b/core/Controller.php deleted file mode 100644 index 548e134..0000000 --- a/core/Controller.php +++ /dev/null @@ -1,212 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -/** - * Controller class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ - -abstract class Controller { - /** - * Layout - * - * @var string - */ - protected $layout = null; - - /** - * Performed? - * - * @var boolean - */ - private $performed = false; - - /** - * Lazy load request and session - * - * @param string $name - * @return Controller\Request or Controller\Session - */ - public function __get ( $name ) { - switch ( $name ) { - case 'request': - return $this->request = new Controller\Request; - - case 'session': - return $this->session = new Controller\Session; - - default: - trigger_error( sprintf( 'Undefined property: %s::$%s', get_class( $this ), $name ) ); - } - } - - /** - * Factory the controller - * - * @param string $controller controller name without 'Controller' at the end - * @return Controller - * @throws Controller\Exception when $controller not found - * @throws Controller\Exception when $controller is not a controller - */ - public static function factory ( $controller ) { - $controller = Inflector::camelize( $controller ) . 'Controller'; - - if ( !class_exists( $controller ) ) { - throw new Controller\Exception( "Controller `$controller' not found" ); - } - - if ( !is_subclass_of( $controller, __CLASS__ ) || $controller == 'ApplicationController' ) { - throw new Controller\Exception( "Controller `$controller' is not a controller" ); - } - - return new $controller; - } - - /** - * Dispatch a controller action - * - * @param string $controller - * @param string $action - * @throws Controller\Exception when action not found - * @throws Controller\Exception when action is not public - */ - public static function dispatch ( $controller, $action ) { - $kontroller = self::factory( $controller ); - $action = Inflector::camelize( $action, true ); - $reflection = new ReflectionClass( $kontroller ); - - if ( !$reflection->hasMethod( $action ) ) { - throw new Controller\Exception( "Action `$action' not found" ); - } - - if ( !$reflection->getMethod( $action )->isPublic() ) { - throw new Controller\Exception( "Action `$action' is not public" ); - } - - $kontroller->beforeAction(); - - if ( $kontroller->$action() !== false && !$kontroller->performed ) { - $kontroller->render(); - } - - $kontroller->afterAction(); - - return $kontroller; - } - - /** - * Method called before action - */ - protected function beforeAction () { - } - - /** - * Method called after action - */ - protected function afterAction () { - } - - /** - * Render template - * - * @param string $template - * @param string $layout - */ - protected function render ( $template = null, $layout = null ) { - $this->perform(); - - if ( !$template ) { - $template = param( 'controller' ) . '/' . param( 'action' ); - } else if ( strpos( '/', $template ) === false ) { - $template = param( 'controller' ) . '/' . $template; - } - - if ( is_null( $layout ) ) { - $layout = $this->layout; - } - - $view = new View( $template, $layout ); - $view->set( 'controller', $this ); - $view->set( $this ); - - echo $view->render(); - } - - /** - * Redirect request to $url - * - * @param string|array $url - * @param integer $status - * @return false - */ - protected function redirect ( $url, $status = 302 ) { - $this->perform(); - - $codes = array( - 301 => 'Moved Permanently', - 302 => 'Found', - 307 => 'Temporary Redirect' - ); - - if ( isset( $codes[$status] ) ) { - $this->header( "HTTP/1.1 $status $codes[$status]" ); - } - - $this->header( "Location: $url" ); - - return false; - } - - /** - * Throw a exception if controller has performed and set performed as true if not - * - * @throws Controller\DoubleRenderException - */ - private function perform () { - if ( $this->performed ) { - throw new Controller\DoubleRenderException( 'Can only render or redirect once per action' ); - } - - $this->performed = true; - } - - /** - * Wrapper to header function - * - * @param string $string - * @param boolean $replace - * @param integer $http_response_code - */ - protected function header ( $string, $replace = true, $http_response_code = null ) { - header( $string, $replace, $http_response_code ); - } -} \ No newline at end of file diff --git a/core/Controller/DoubleRenderException.php b/core/Controller/DoubleRenderException.php deleted file mode 100644 index 4e7ea10..0000000 --- a/core/Controller/DoubleRenderException.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Controller; - -/** - * Double render exception class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -class DoubleRenderException extends Exception { - -} \ No newline at end of file diff --git a/core/Controller/Exception.php b/core/Controller/Exception.php deleted file mode 100644 index 8a1f185..0000000 --- a/core/Controller/Exception.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Controller; - -/** - * Controller exception class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -class Exception extends \Exception { - -} \ No newline at end of file diff --git a/core/Controller/Request.php b/core/Controller/Request.php deleted file mode 100644 index a4653cf..0000000 --- a/core/Controller/Request.php +++ /dev/null @@ -1,160 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -namespace Controller; - -/** - * Controller request class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ -class Request { - /** - * GET method - * - * @var string - */ - const GET = 'GET'; - - /** - * POST method - * - * @var string - */ - const POST = 'POST'; - - /** - * HEAD method - * - * @var string - */ - const HEAD = 'HEAD'; - - /** - * DELETE method - * - * @var string - */ - const DELETE = 'DELETE'; - - /** - * PUT method - * - * @var string - */ - const PUT = 'PUT'; - - /** - * Override request method if request is POST and param( '_method' ) is valid - */ - public function __construct () { - if ( $this->isPost() && $method = param( '_method' ) ) { - $method = strtoupper( $method ); - - if ( in_array( $method, array( self::HEAD, self::DELETE, self::PUT ) ) ) { - $_SERVER['REQUEST_METHOD'] = $method; - } - } - } - - /** - * Get request method - * - * @return string or false - */ - public function method () { - return isset( $_SERVER['REQUEST_METHOD'] ) ? $_SERVER['REQUEST_METHOD'] : false; - } - - /** - * GET request? - * - * @return boolean - */ - public function isGet () { - return self::GET == $this->method(); - } - - /** - * POST request? - * - * @return boolean - */ - public function isPost () { - return self::POST == $this->method(); - } - - /** - * HEAD request? - * - * @return boolean - */ - public function isHead () { - return self::HEAD == $this->method(); - } - - /** - * DELETE request? - * - * @return boolean - */ - public function isDelete () { - return self::DELETE == $this->method(); - } - - /** - * PUT request? - * - * @return boolean - */ - public function isPut () { - return self::PUT == $this->method(); - } - - /** - * Ajax request? - * - * @return boolean - */ - public function isAjax () { - return isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'XmlHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH']; - } - - /** - * Returns the referring URL for this request or the default value - * - * @param string $default - * @return string - */ - public function referer ( $default = null ) { - return isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : $default; - } -} \ No newline at end of file diff --git a/core/Controller/Router.php b/core/Controller/Router.php deleted file mode 100644 index 4c2f7ca..0000000 --- a/core/Controller/Router.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.2 - */ - -namespace Controller; - -/** - * Controller router class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ - -abstract class Router { - /** - * Connected routes - * - * @var array - */ - protected static $routes = array(); - - /** - * Connect a route - * - * @param string $url - * @param array $options - */ - public static function connect ( $url, array $options = array() ) { - self::$routes[$url] = new Router\Route( $url, $options ); - } - - /** - * Connect a module - * - * @param string $module - * @param Closure $closure - */ - public static function module ( $module, \Closure $closure ) { - self::$routes[$module] = new Router\Module( $module, $closure ); - } - - /** - * Dispatch request - */ - public static function dispatch () { - $uri = preg_replace( '/^\/( ?=. )|( ?<=. )\/$/', '', $_SERVER['PATH_INFO'] ?: '/' ); - $options = null; - - foreach ( self::$routes as $route ) { - if ( $options = $route->match( $uri ) ) { - break; - } - } - - if ( !$options ) { - throw new Router\Exception( 'No route matches' ); - } - - foreach ( $options as $param => $value ) { - $_REQUEST[$param] = $value; - } - - \Controller::dispatch( $options['controller'], $options['action'] ); - } -} \ No newline at end of file diff --git a/core/Controller/Router/Exception.php b/core/Controller/Router/Exception.php deleted file mode 100644 index 4be5224..0000000 --- a/core/Controller/Router/Exception.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Controller\Router; - -/** - * Controller router exception class - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Exception extends \Exception { - -} \ No newline at end of file diff --git a/core/Controller/Router/Module.php b/core/Controller/Router/Module.php deleted file mode 100644 index 2c96583..0000000 --- a/core/Controller/Router/Module.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace Controller\Router; - -use Closure; - -/** - * Module class - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Module { - /** - * Module name - * - * @var string - */ - protected $module; - - /** - * Closure to configure route - * - * @var Closure - */ - protected $closure; - - /** - * Module routes - * - * @var array - */ - protected $routes; - - /** - * Initialize the module - * - * @param string $module - * @param Closure $closure - */ - public function __construct ($module, Closure $closure) { - $this->module = $module; - $this->closure = $closure; - } - - /** - * Route match with $uri? - * - * @param string $uri - * @return array or false - */ - public function match ($uri) { - $options = null; - - foreach ($this->routes() as $route) { - if ($options = $route->match($uri)) { - break; - } - } - - if ($options && $route instanceof Route) { - $options['controller'] = "$this->module/$options[controller]"; - } - - return $options; - } - - /** - * Connect a module route - * - * @param string $url - * @param array $options - */ - public function connect ($url, array $options = array()) { - $url = rtrim("$this->module/$url", '/'); - $this->routes[$url] = new Route($url, $options); - } - - /** - * Connect a submodule - * - * @param string $submodule - * @param Closure $closure - */ - public function submodule ($submodule, Closure $closure) { - $submodule = "$this->module/$submodule"; - $this->routes[$submodule] = new self($submodule, $closure); - } - - /** - * Get routes - */ - protected function routes () { - if (!$this->routes) { - $this->closure->__invoke($this); - } - - return $this->routes; - } -} \ No newline at end of file diff --git a/core/Controller/Router/Route.php b/core/Controller/Router/Route.php deleted file mode 100644 index f7f014b..0000000 --- a/core/Controller/Router/Route.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.2 - */ - -namespace Controller\Router; - -/** - * Route class - * - * @package Core - * @subpackage Controller - * @category Router - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ -class Route { - /** - * Default options - * - * @var array - */ - protected static $defaultOptions = array( - 'controller' => 'home', - 'action' => 'index', - 'format' => 'html' - ); - - /** - * URL - * - * @var string - */ - protected $url; - - /** - * Route options - * - * @var array - */ - protected $options; - - /** - * Compiled regex - * - * @var string - */ - protected $regex; - - /** - * Set $url and $options - * - * @param string $url - * @param array $options - */ - public function __construct ($url, array $options = array ()) { - $this->url = $url; - $this->options = array_merge(self::$defaultOptions, $options); - } - - /** - * Route match with $uri? - * - * @param string $uri - * @return array or false - */ - public function match ($uri) { - if (preg_match($this->regex(), $uri, $options)) { - return array_merge($this->options, $options); - } - - return false; - } - - /** - * Get route regex - */ - protected function regex () { - if (!$this->regex) { - $url = preg_replace('/\\\:([a-z\d_]+)/i', '(?<\1>[a-zA-Z\d_]+)', preg_quote($this->url, '/')); - $this->regex = '/^' . $url . '$/'; - } - - return $this->regex; - } -} \ No newline at end of file diff --git a/core/Controller/Session.php b/core/Controller/Session.php deleted file mode 100644 index 83b64ff..0000000 --- a/core/Controller/Session.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -namespace Controller; - -/** - * Session class - * - * @package Core - * @subpackage Controller - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ - -class Session { - /** - * Flash data - * - * @var mixed - */ - protected $flash; - - /** - * Initialize session data - */ - public function __construct () { - session_start(); - - if ( isset( $_SESSION['flash'] ) ) { - $this->flash = $_SESSION['flash']; - } - } - - /** - * Write session data and end session - */ - public function __destruct () { - if ( isset( $_SESSION['flash'] ) && $_SESSION['flash'] == $this->flash ) { - unset( $_SESSION['flash'] ); - } - - session_write_close(); - } - - /** - * Retrive a variable from session - * - * @param string $name - * @return mixed - */ - public function __get ( $name ) { - return $_SESSION[$name]; - } - - /** - * Register a session variable - * - * @param string $name - * @param mixed $value - */ - public function __set ( $name, $value ) { - $_SESSION[$name] = $value; - } - - /** - * Verify if a session variable is registered - * - * @param string $name - * @return boolean - */ - public function __isset ( $name ) { - return isset( $_SESSION[$name] ); - } - - /** - * Unregister a session variable - * - * @var string $name - */ - public function __unset ( $name ) { - unset( $_SESSION[$name] ); - } -} \ No newline at end of file diff --git a/core/Core.php b/core/Core.php deleted file mode 100644 index 5ae4b17..0000000 --- a/core/Core.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1a - */ - -/** - * Core class - * - * @package Core - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ - -abstract class Core { - /** - * Boot framework - */ - public static function boot () { - Config::parseApplicationFiles(); - self::loadVendorPlugins(); - self::loadBootFiles(); - } - - /** - * Load vendor plugins - */ - protected static function loadVendorPlugins () { - foreach ( new GlobIterator( 'vendor/*/init.php', GlobIterator::CURRENT_AS_PATHNAME ) as $file ) { - require_once $file; - } - } - - /** - * Load application boot files - */ - protected static function loadBootFiles () { - foreach ( new GlobIterator( 'app/bootfiles/*.php', GlobIterator::CURRENT_AS_PATHNAME ) as $file ) { - require_once $file; - } - } -} \ No newline at end of file diff --git a/core/Inflector.php b/core/Inflector.php deleted file mode 100644 index 14b07e8..0000000 --- a/core/Inflector.php +++ /dev/null @@ -1,274 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage Inflector - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -/** - * Inflector class - * - * @package Core - * @subpackage Inflector - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ -abstract class Inflector { - /** - * Plural rules - * - * @var array - */ - protected static $plurals = array ( - array( '/^kine|cow$/i', 'kine' ), - array( '/^moves|move$/i', 'moves' ), - array( '/^sexes|sex$/i', 'sexes' ), - array( '/^children|child$/i', 'children' ), - array( '/^men|man$/i', 'men' ), - array( '/^people|person$/i', 'people' ), - array( '/( quiz )$/i', '\\1zes' ), - array( '/^( ox )$/i', '\\1en' ), - array( '/( [m|l] )ouse$/i', '\\1ice' ), - array( '/( matr|vert|ind )( ?:ix|ex )$/i', '\\1ices' ), - array( '/( x|ch|ss|sh )$/i', '\\1es' ), - array( '/( [^aeiouy]|qu )y$/i', '\\1ies' ), - array( '/( hive )$/i', '\\1s' ), - array( '/( ?:( [^f] )fe|( [lr] )f )$/i', '\\1\\2ves' ), - array( '/sis$/i', 'ses' ), - array( '/( [ti] )um$/i', '\\1a' ), - array( '/( buffal|tomat )o$/i', '\\1oes' ), - array( '/( bu )s$/i', '\\1ses' ), - array( '/( alias|status )$/i', '\\1es' ), - array( '/( octop|vir )us$/i', '\\1i' ), - array( '/( ax|test )is$/i', '\\1es' ), - array( '/s$/i', 's' ), - array( '/$/', 's' ) ); - - /** - * Singular rules - * - * @var array - */ - protected static $singulars = array ( - array( '/^cow|kine$/i', 'cow' ), - array( '/^move|moves$/i', 'move' ), - array( '/^sex|sexes$/i', 'sex' ), - array( '/^child|children$/i', 'child' ), - array( '/^man|men$/i', 'man' ), - array( '/^person|people$/i', 'person' ), - array( '/( quiz )zes$/i', '\\1' ), - array( '/( matr )ices$/i', '\\1ix' ), - array( '/( vert|ind )ices$/i', '\\1ex' ), - array( '/^( ox )en/i', '\\1' ), - array( '/( alias|status )es$/i', '\\1' ), - array( '/( octop|vir )i$/i', '\\1us' ), - array( '/( cris|ax|test )es$/i', '\\1is' ), - array( '/( shoe )s$/i', '\\1' ), - array( '/( o )es$/i', '\\1' ), - array( '/( bus )es$/i', '\\1' ), - array( '/( [m|l] )ice$/i', '\\1ouse' ), - array( '/( x|ch|ss|sh )es$/i', '\\1' ), - array( '/( m )ovies$/i', '\\1ovie' ), - array( '/( s )eries$/i', '\\1eries' ), - array( '/( [^aeiouy]|qu )ies$/i', '\\1y' ), - array( '/( [lr] )ves$/i', '\\1f' ), - array( '/( tive )s$/i', '\\1' ), - array( '/( hive )s$/i', '\\1' ), - array( '/( [^f] )ves$/i', '\\1fe' ), - array( '/( ^analy )ses$/i', '\\1sis' ), - array( '/( ( a )naly|( b )a|( d )iagno|( p )arenthe|( p )rogno|( s )ynop|( t )he )ses$/i', '\\1\\2sis' ), - array( '/( [ti] )a$/i', '\\1um' ), - array( '/( n )ews$/i', '\\1ews' ), - array( '/s$/i', '' ) ); - - /** - * Uncountable words - * - * @var array - */ - protected static $uncountables = array( 'equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep' ); - - /** - * Add a new plural rule - * - * @param string $rule - * @param string $replacement - */ - public static function plural ( $rule, $replacement ) { - array_unshift( self::$plurals, array( $rule, $replacement ) ); - } - - /** - * Add a new singular rule - * - * @param string $rule - * @param string $replacement - */ - public static function singular ( $rule, $replacement ) { - array_unshift( self::$singulars, array( $rule, $replacement ) ); - } - - /** - * Add a new irregular rule - * - * @param string $singular - * @param string $plural - */ - public static function irregular ( $singular, $plural ) { - self::plural( "/^$singular|$plural$/i", $plural ); - self::singular( "/^$plural|$singular$/i", $singular ); - } - - /** - * Add a new uncountable words - * - * @param string|array $words - */ - public static function uncountable ( $words ) { - $words = array_map( 'mb_strtolower', ( array ) $words ); - self::$uncountables = array_merge( self::$uncountables, $words ); - } - - /** - * Flush all rules - */ - public static function flush () { - self::flushPlurals(); - self::flushSingulars(); - self::flushUncountables(); - } - - /** - * Flush plural rules - */ - public static function flushPlurals () { - self::$plurals = array(); - } - - /** - * Flush singular rules - */ - public static function flushSingulars () { - self::$singulars = array(); - } - - /** - * Flush uncountable words - */ - public static function flushUncountables () { - self::$uncountables = array(); - } - - /** - * Pluralize the word - * - * @param string $word - * @return string - */ - public static function pluralize ( $word ) { - if ( in_array( mb_strtolower( $word ), self::$uncountables ) ) { - return $word; - } - - foreach ( self::$plurals as $rule ) { - if ( preg_match( $rule[0], $word ) ) { - return preg_replace( $rule[0], $rule[1], $word ); - } - } - - return $word; - } - - /** - * Singularize the word - * - * @param string $word - * @return string - */ - public static function singularize ( $word ) { - if ( in_array( mb_strtolower( $word ), self::$uncountables ) ) { - return $word; - } - - foreach ( self::$singulars as $rule ) { - if ( preg_match( $rule[0], $word ) ) { - return preg_replace( $rule[0], $rule[1], $word ); - } - } - - return $word; - } - - /** - * Camelize the word - Also convert DIRECTORY_SEPARATOR to NAMESPACE_SEPARATOR to convert namespaces - * - * @param string $word - * @param boolean $lcfirst - * @return string - */ - public static function camelize ( $word, $lcfirst = false ) { - $word = str_replace( DIRECTORY_SEPARATOR, NAMESPACE_SEPARATOR, $word ); - $word = preg_replace( '/^.|[\\\_]./e', "mb_strtoupper( '\\0' )", $word ); - $word = str_replace( '_', '', $word ); - - if ( $lcfirst ) { - $word = mb_lcfirst( $word ); - } - - return $word; - } - - /** - * Underscore the word - Also convert NAMESPACE_SEPARATOR to DIRECTORY_SEPARATOR to convert path names - * - * @param string $word - * @return string - */ - public static function underscore ( $word ) { - $word = str_replace( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $word ); - $word = preg_replace( '/( [A-Z]+ )( [A-Z][a-z] )/', '\1_\2', $word ); - $word = preg_replace( '/( [a-z\d] )( [A-Z] )/', '\1_\2', $word ); - $word = str_replace( '-', '_', mb_strtolower( $word ) ); - - return $word; - } - - /** - * Slugarize the word removing accented chars. For example 'ãéüöí ìàíèção nãoñ' - * will be 'aeuoi-iaiecao-naon' - * - * @param string $word - * @param string $delimiter - * @return string - */ - public static function slug ( $word, $delimiter = '-' ) - { - $word = str_replace( "'", '', $word ); - $word = iconv( 'UTF-8', 'ASCII//TRANSLIT', $word ); - $word = preg_replace( '/[^a-z\d]+/i', $delimiter, $word ); - $word = strtolower( trim( $word, $delimiter ) ); - - return $word; - } -} \ No newline at end of file diff --git a/core/View.php b/core/View.php deleted file mode 100644 index 79b7cad..0000000 --- a/core/View.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage View - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -/** - * View class - * - * @package Core - * @subpackage View - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - */ -class View { - /** - * Current template - * - * @var string - */ - protected $template; - - /** - * Current layout - * - * @var string - */ - protected $layout; - - /** - * Template data - * - * @var array - */ - protected $data = array(); - - /** - * Configure view paths - * - * @param string $template - * @param string $layout - */ - public function __construct ( $template, $layout = null ) { - $this->template = 'app/views/' . Inflector::underscore( $template ) . '.phtml'; - - if ( $layout ) { - $this->layout = 'app/layouts/' . Inflector::underscore( $layout ) . '.phtml'; - } - } - - /** - * Set template data - * - * @param string|array|object $spect - * @param mixed $value - */ - public function set ( $spec, $value = null ) { - if ( is_array( $spec ) || is_object( $spec ) ) { - foreach ( $spec as $key => $value ) { - $this->data[$key] = $value; - } - } else { - $this->data[$spec] = $value; - } - } - - /** - * Get template data - * - * @param string $spec - */ - public function get ( $spec ) { - return isset( $this->data[$spec] ) ? $this->data[$spec] : null; - } - - public function render () { - } -} \ No newline at end of file diff --git a/core/View/Exception.php b/core/View/Exception.php deleted file mode 100644 index 81664c4..0000000 --- a/core/View/Exception.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @subpackage View - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -namespace View; - -/** - * View exception class - * - * @package Core - * @subpackage View - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - */ - -class Exception extends \Exception { - -} \ No newline at end of file diff --git a/core/functions.php b/core/functions.php deleted file mode 100644 index 8a8b444..0000000 --- a/core/functions.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * ( at your option ) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 ( LGPLv3 ) - * @version 0.1 - */ - -/** - * Namespace separator - * - * @var string - */ - -const NAMESPACE_SEPARATOR = '\\'; - -/** - * Autoload the received class - * - * @param string $class - * @return false if invalid class name - */ -function __autoload ( $class ) { - if ( preg_match( '/[^\\\a-z\d_]/i', $class ) ) { - return false; - } - - $file = str_replace( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $class ) . '.php'; - $fh = @fopen( $file, 'r', true ); - - if ( $fh ) { - fclose( $fh ); - require_once $file; - } -} - -/** - * Append paths to include_path - * - * @param string $path - * @param string $... - * @return string the old include_path on success or false on failure - */ -function append_include_path ( $path ) { - $paths = implode( PATH_SEPARATOR, func_get_args() ); - - return set_include_path( get_include_path() . PATH_SEPARATOR . $paths ); -} - -/** - * I believe that mb_lcfirst will be soon added in PHP, but for now this could be useful - * - * @param string $word - * @param string $encoding - * @return string - */ -function mb_lcfirst ( $word, $encoding = null ) { - if ( !$encoding ) { - $encoding = mb_internal_encoding(); - } - - return mb_strtolower( mb_substr( $word, 0, 1, $encoding ), $encoding ) - . mb_substr( $word, 1, mb_strlen( $word, $encoding ) - 1, $encoding ); -} - -/** - * Get a $_REQUEST value or the $default if not set - * - * @param string $key - * @param mixed $default - * @return mixed - */ -function param ( $key, $default = null ) { - return isset( $_REQUEST[$key] ) ? $_REQUEST[$key] : $default; -} \ No newline at end of file diff --git a/corephp.esproj/Project.espressostorage b/corephp.esproj/Project.espressostorage deleted file mode 100644 index 4e3e9ea..0000000 --- a/corephp.esproj/Project.espressostorage +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.macrabbit.Espresso.Publisher.PublishServers - - com.macrabbit.Espresso.Publisher.PublishServers.Order - - - diff --git a/corephp.esproj/user.parweb.espressostorage b/corephp.esproj/user.parweb.espressostorage deleted file mode 100644 index 8d8be28..0000000 --- a/corephp.esproj/user.parweb.espressostorage +++ /dev/null @@ -1,56 +0,0 @@ - - - - - ESProjectShowHiddenFilesKey - - ESProjectWindowState - - ContentSize - {1106, 650} - ProjectURL - file://localhost/Users/parweb/Sites/gitframework/corephp/corephp.esproj/ - StateType - ProjectWindow - TopLeftPoint - {87, 766} - - com.macrabbit.Espresso.FileManager.DisclosureCollapsed - - com.macrabbit.Espresso.FileManager.FileControllerState - - ExpandedURLs - - file://localhost/Users/parweb/Sites/gitframework/corephp/app/bootfiles - file://localhost/Users/parweb/Sites/gitframework/corephp/app/config - file://localhost/Users/parweb/Sites/gitframework/corephp/app/controllers - file://localhost/Users/parweb/Sites/gitframework/corephp/app/helpers - file://localhost/Users/parweb/Sites/gitframework/corephp/app/views/home - file://localhost/Users/parweb/Sites/gitframework/corephp/app/views/layouts - file://localhost/Users/parweb/Sites/gitframework/corephp/core/Controller/Router - - - com.macrabbit.Espresso.Publisher.DisclosureCollapsed - - com.macrabbit.Espresso.Workspace.Tabs - - Tabs - - - DocumentURL - file://localhost/Users/parweb/Sites/gitframework/corephp/app/controllers/HomeController.php - StateType - DefaultTab - - - DocumentURL - file://localhost/Users/parweb/Sites/gitframework/corephp/app/views/home/index.phtml - StateType - DefaultTab - - - - com.macrabbit.Espresso.WorkspaceTabs.DisclosureCollapsed - - - diff --git a/index.html b/index.html new file mode 100644 index 0000000..040b7c8 --- /dev/null +++ b/index.html @@ -0,0 +1,80 @@ + + + + + + + parweb/corephp @ GitHub + + + + + + + Fork me on GitHub + +
+ +
+ + + + +
+ +

corephp + by parweb

+ +
+ A PHP MVC RESTful framework +
+ +

Authors

+

Gabriel Sobrinho (gabriel.sobrinho@gmail.com)
parweb (parweb@gmail.com)

+

Contact

+

chris (parweb@gmail.com)

+ + +

Download

+

+ You can download this project in either + zip or + tar formats. +

+

You can also clone the project with Git + by running: +

$ git clone git://github.com/parweb/corephp
+

+ + + +
+ + + + diff --git a/public/.htaccess b/public/.htaccess deleted file mode 100644 index 1f5ee99..0000000 --- a/public/.htaccess +++ /dev/null @@ -1,6 +0,0 @@ -RewriteEngine On - -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.*)$ index.php/$1 [QSA,L] - diff --git a/public/index.php b/public/index.php deleted file mode 100644 index a6e6fd7..0000000 --- a/public/index.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * This file is part of Core PHP Framework. - * - * Core PHP Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Core PHP Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Core PHP Framework. If not, see . - * - * @package Core - * @copyright 2008-2009 Gabriel Sobrinho - * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License version 3 (LGPLv3) - * @version 0.1 - */ - -// Buffer and error reporting -ob_start(); -error_reporting( E_ALL | E_STRICT ); - -// Go to framework dir -chdir( dirname( __DIR__ ) ); - -// Autoload -require_once 'core/functions.php'; - -// Set include path -$cwd = getcwd(); -append_include_path( "$cwd/core", "$cwd/app/models", "$cwd/app/controllers", "$cwd/app/helpers" ); - -unset( $cwd ); - -// Boot and dispatch request -Core::boot(); -Controller\Router::dispatch(); \ No newline at end of file diff --git a/tmp/.DS_Store b/tmp/.DS_Store deleted file mode 100644 index 8b8a23c..0000000 Binary files a/tmp/.DS_Store and /dev/null differ diff --git a/tmp/cache/.empty b/tmp/cache/.empty deleted file mode 100644 index e69de29..0000000