Permalink
Browse files

in the middle of major overhaul - refactoring and updating for latest…

… core implementations
  • Loading branch information...
1 parent 450d3ce commit 2a274937adab899f890a5f50509174644ff68843 @pointlessjon pointlessjon committed Oct 10, 2010
Showing with 1,975 additions and 1,004 deletions.
  1. +19 −33 config/bootstrap.php
  2. +26 −17 config/bootstrap/action.php
  3. +48 −0 config/bootstrap/cache.php
  4. +11 −2 config/bootstrap/connections.php
  5. +19 −0 config/bootstrap/console.php
  6. +94 −73 config/bootstrap/g11n.php
  7. +29 −14 config/bootstrap/libraries.php
  8. +58 −0 config/bootstrap/media.php
  9. +20 −0 config/bootstrap/session.php
  10. +0 −54 config/bootstrap/test.php
  11. +75 −0 config/routes.php
  12. +3 −3 controllers/PostsController.php
  13. +37 −5 controllers/SearchController.php
  14. +0 −71 controllers/UsersController.php
  15. +44 −3 extensions/command/Sphere.php
  16. +59 −0 extensions/helper/Gravatar.php
  17. +25 −16 extensions/helper/Post.php
  18. +41 −0 extensions/helper/Sphere.php
  19. +26 −13 extensions/helper/Thread.php
  20. +0 −51 extensions/helper/User.php
  21. 0 libraries/plugins/empty
  22. +28 −5 models/Comment.php
  23. +53 −33 models/Post.php
  24. +18 −16 models/Search.php
  25. +75 −66 models/SphereView.php
  26. +0 −50 models/User.php
  27. 0 resources/g11n/empty
  28. 0 resources/tmp/cache/empty
  29. 0 resources/tmp/logs/empty
  30. 0 resources/tmp/tests/empty
  31. +227 −217 tests/cases/models/PostTest.php
  32. +36 −18 views/layouts/default.html.php
  33. +10 −9 views/posts/add.html.php
  34. +19 −12 views/posts/comment.html.php
  35. +14 −0 views/search/filter.html.php
  36. +217 −19 views/search/index.html.php
  37. +138 −102 webroot/css/debug.css
  38. +304 −91 webroot/css/sphere.css
  39. +10 −0 webroot/directoryIteratorTest.php
  40. BIN webroot/img/icons/all.png
  41. BIN webroot/img/icons/globe.png
  42. BIN webroot/img/icons/lithium.png
  43. BIN webroot/img/icons/question.png
  44. BIN webroot/img/icons/sphere.png
  45. +1 −1 webroot/index.php
  46. +152 −0 webroot/js/jquery-1.4.1.min.js
  47. +39 −10 webroot/js/sphere.js
View
@@ -6,8 +6,6 @@
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
-namespace lithium;
-
/**
* This is the path to the class libraries used by your application, and must contain a copy of the
* Lithium core. By default, this directory is named 'libraries', and resides in the same
@@ -43,16 +41,28 @@
require __DIR__ . '/bootstrap/libraries.php';
/**
+ * This file defines the available database connections for the appliction.
+ */
+require __DIR__ . '/bootstrap/connections.php';
+
+/**
* This file defines bindings between classes which are triggered during the request cycle, and
* allow the framework to automatically configure its environmental settings. You can add your own
* behavior and modify the dispatch cycle to suit your needs.
*/
require __DIR__ . '/bootstrap/action.php';
/**
- * This file defines the available database connections for the appliction.
+ * This file contains configurations for connecting to external caching resources, as well as
+ * default caching rules for various systems within your application
*/
-require __DIR__ . '/bootstrap/connections.php';
+require __DIR__ . '/bootstrap/cache.php';
+
+/**
+ * This file contains configuration for session (and/or cookie) storage, and user or web service
+ * authentication.
+ */
+require __DIR__ . '/bootstrap/session.php';
/**
* This file contains your application's globalization rules, including inflections,
@@ -62,38 +72,14 @@
// require __DIR__ . '/bootstrap/g11n.php';
/**
- * This file contains filters for the test suite to bypass having a controller and render test
- * templates directly through the test dispatcher.
+ * This file contains configurations for handling different content types within the framework,
+ * including converting data to and from different formats, and handling static media assets.
*/
-require __DIR__ . '/bootstrap/test.php';
+// require __DIR__ . '/bootstrap/media.php';
/**
- * This configures your session storage. The Cookie storage adapter must be connected first, since
- * it intercepts any writes where the `'expires'` key is set in the options array. When creating a
- * new application, it is suggested that you change the value of `'key'` below.
+ * This file configures console filters and settings, specifically output behavior and coloring.
*/
-use \lithium\storage\Session;
-
-Session::config(array(
- 'default' => array('adapter' => 'Php')
-));
-
-use \lithium\security\Auth;
-
-Auth::config(array(
- 'user' => array(
- 'adapter' => 'Form',
- 'model' => 'app\models\User',
- 'query' => 'login',
- 'fields' => array('username', 'password')
- )
-));
-
-// use \lithium\action\Dispatcher;
-//
-// Dispatcher::applyFilter('_call', function($self, $params, $chain) {
-// $result = Auth::check('user', $params['request']);
-// return $chain->next($self, $params, $chain);
-// });
+require __DIR__ . '/bootstrap/console.php';
?>
@@ -1,6 +1,6 @@
<?php
/**
- * Lithium: the most rad php framework
+ * Anologue: anonymous, linear dialogue
*
* @copyright Copyright 2010, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
@@ -17,31 +17,40 @@
* @see lithium\util\collection\Filters
*/
-use \lithium\net\http\Router;
-use \lithium\core\Environment;
-use \lithium\action\Dispatcher;
+use lithium\core\Libraries;
+use lithium\net\http\Router;
+use lithium\core\Environment;
+use lithium\action\Dispatcher;
/**
- * Loads application routes before the request is dispatched. Change this to `include_once` if
- * more than one request cycle is executed per HTTP request.
+ * This filter intercepts the `run()` method of the `Dispatcher`, and first passes the `'request'`
+ * parameter (an instance of the `Request` object) to the `Environment` class to detect which
+ * environment the application is running in. Then, loads all application routes in all plugins,
+ * loading the default application routes last.
*
- * @see lithium\net\http\Router
- */
-Dispatcher::applyFilter('run', function($self, $params, $chain) {
- include __DIR__ . '/../routes.php';
- return $chain->next($self, $params, $chain);
-});
-
-/**
- * Intercepts the `Dispatcher` as it finds a controller object, and passes the `'request'` parameter
- * to the `Environment` class to detect which environment the application is running in.
+ * Change this code if plugin routes must be loaded in a specific order (i.e. not the same order as
+ * the plugins are added in your bootstrap configuration), or if application routes must be loaded
+ * first (in which case the default catch-all routes should be removed).
+ *
+ * If `Dispatcher::run()` is called multiple times in the course of a single request, change the
+ * `include`s to `include_once`.
*
* @see lithium\action\Request
* @see lithium\core\Environment
+ * @see lithium\net\http\Router
*/
-Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
+Dispatcher::applyFilter('run', function($self, $params, $chain) {
Environment::set($params['request']);
+
+ foreach (array_reverse(Libraries::get()) as $name => $config) {
+ if ($name === 'lithium') {
+ continue;
+ }
+ $file = "{$config['path']}/config/routes.php";
+ file_exists($file) ? include $file : null;
+ }
return $chain->next($self, $params, $chain);
});
+
?>
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2010, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * This file creates a default cache configuration using the most optimized adapter available, and
+ * uses it to provide default caching for high-overhead operations.
+ */
+use lithium\storage\Cache;
+use lithium\core\Libraries;
+use lithium\action\Dispatcher;
+use lithium\storage\cache\adapter\Apc;
+
+if (PHP_SAPI === 'cli') {
+ //return;
+}
+
+/**
+ * If APC is not available and the cache directory is not writeable, bail out.
+ */
+if (!($apcEnabled = Apc::enabled()) && !is_writable(LITHIUM_APP_PATH . '/resources/tmp/cache')) {
+ return;
+}
+
+Cache::config(array(
+ 'default' => array(
+ 'adapter' => '\lithium\storage\cache\adapter\\' . ($apcEnabled ? 'Apc' : 'File')
+ )
+));
+
+Dispatcher::applyFilter('run', function($self, $params, $chain) {
+ if ($cache = Cache::read('default', 'core.libraries')) {
+ $cache = (array) unserialize($cache) + Libraries::cache();
+ Libraries::cache($cache);
+ }
+ $result = $chain->next($self, $params, $chain);
+
+ if ($cache != Libraries::cache()) {
+ Cache::write('default', 'core.libraries', serialize(Libraries::cache()), '+1 day');
+ }
+ return $result;
+});
+
+?>
@@ -9,10 +9,19 @@
use \lithium\data\Connections;
Connections::add('default', array(
- 'type' => 'Http',
+ 'type' => 'http',
'adapter' => 'CouchDb',
'host' => 'localhost',
- 'database' => 'lithosphere'
+ 'database' => 'lithosphere',
+ 'version' => '1.0'
+));
+
+Connections::add('test', array(
+ 'type' => 'http',
+ 'adapter' => 'CouchDb',
+ 'host' => 'localhost',
+ 'database' => 'lithosphere_test',
+ 'version' => '1.0'
));
?>
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2010, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+use lithium\console\Dispatcher;
+
+Dispatcher::applyFilter('_call', function($self, $params, $chain) {
+ $params['callable']->response->styles(array(
+ 'heading' => '\033[1;30;46m'
+ ));
+ return $chain->next($self, $params, $chain);
+});
+
+
+?>
Oops, something went wrong.

0 comments on commit 2a27493

Please sign in to comment.