-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c36ee62
Showing
18 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "libraries/flourish"] | ||
path = libraries/flourish | ||
url = git://github.com/wbond/flourish.git | ||
[submodule "libraries/moor"] | ||
path = libraries/moor | ||
url = git://github.com/wbond/moor.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Simple Unframework based on Flourish and Moor. | ||
|
||
$ git clone git://github.com/xoan/sunframework.git project | ||
$ cd project | ||
$ git submodule init | ||
$ git submodule update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
class ApplicationController extends MoorActionController | ||
{ | ||
protected $data = array(); | ||
|
||
protected function afterAction() | ||
{ | ||
render($this->data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
class Welcome extends ApplicationController | ||
{ | ||
public function index() | ||
{ | ||
// | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title><?php echo $this->get('title'); ?></title> | ||
</head> | ||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
$tmpl->set('title', 'Welcome#index'); | ||
$tmpl->place('header'); | ||
?> | ||
|
||
<p> | ||
Welcome#index<br /> | ||
<tt>application/views/welcome/index.html.php</tt> | ||
</p> | ||
|
||
<?php $tmpl->place('footer'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
$config['db'] = array( | ||
'development' => array( | ||
'type' => 'sqlite', | ||
'name' => DB_PATH.'/sqlite.db', | ||
'user' => '', | ||
'pass' => '', | ||
'host' => '' | ||
), | ||
'production' => array( | ||
'type' => '', | ||
'name' => '', | ||
'user' => '', | ||
'pass' => '', | ||
'host' => '' | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
function __autoload($class) | ||
{ | ||
$dirs = array( | ||
LIB_PATH.'/flourish/classes', | ||
LIB_PATH.'/moor', | ||
APP_PATH.'/classes', | ||
APP_PATH.'/controllers', | ||
APP_PATH.'/models' | ||
); | ||
foreach ($dirs as $dir) { | ||
if (file_exists($file = $dir.'/'.$class.'.php')) { | ||
return require $file; | ||
} | ||
} | ||
throw new Exception('The class '.$class.' could not be loaded'); | ||
} | ||
|
||
function render($data = null, $callback = null, $format = 'html') | ||
{ | ||
static $called = false; | ||
if ($called) { | ||
return; | ||
} else { | ||
$called = true; | ||
} | ||
extract($data); | ||
if (is_null($callback)) { | ||
$callback = Moor::getActiveCallback(); | ||
} | ||
$format = fRequest::getValid('format', array($format, 'rss', 'json')); | ||
$tmpl = new fTemplating(APP_PATH.'/views'); | ||
$tmpl->set(array( | ||
'header' => 'header.'.$format.'.php', | ||
'footer' => 'footer.'.$format.'.php' | ||
)); | ||
$view = APP_PATH.'/views'.Moor::pathTo($callback).'.'.$format.'.php'; | ||
if (file_exists($view)) { | ||
return include $view; | ||
} else { | ||
throw new MoorNotFoundException(); | ||
} | ||
} | ||
|
||
function not_found() | ||
{ | ||
header('HTTP/1.1 404 Not Found'); | ||
fHTML::sendHeader(); | ||
exit('<h1>404 Not Found</h1>'."\n". | ||
'<p>The page that you have requested could not be found.</p>'."\n"); | ||
} | ||
|
||
function link_to() | ||
{ | ||
$args = func_get_args(); | ||
return call_user_func_array( | ||
'Moor::linkTo', $args | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
Moor::setNotFoundCallback('not_found'); | ||
|
||
Moor::route('/', 'Welcome::index'); | ||
|
||
Moor::run(); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
define('ROOT_PATH', dirname(__FILE__)); | ||
define('CONF_PATH', ROOT_PATH.'/config'); | ||
define('DB_PATH', ROOT_PATH.'/database'); | ||
define('LIB_PATH', ROOT_PATH.'/libraries'); | ||
define('APP_PATH', ROOT_PATH.'/application'); | ||
|
||
include CONF_PATH.'/config.php'; | ||
include CONF_PATH.'/functions.php'; | ||
|
||
$db = $config['db'][ENV]; | ||
$database = new fDatabase($db['type'], $db['name'], $db['user'], $db['pass'], $db['host']); | ||
fORMDatabase::attach($database); | ||
|
||
fSession::open(); | ||
|
||
include CONF_PATH.'/route.php'; |
Submodule flourish
added at
45b38a
Submodule moor
added at
f0d8d0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RewriteEngine On | ||
RewriteBase / | ||
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f | ||
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d | ||
RewriteRule ^.*$ index.php [QSA,NS] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
define('ENV', file_exists('DEVELOPMENT') ? 'development' : 'production'); | ||
define('PUB_PATH', dirname(__FILE__)); | ||
|
||
switch (ENV) { | ||
case 'development': | ||
case 'production': | ||
default: | ||
include '../init.php'; | ||
} |