Skip to content

Commit

Permalink
Update framework
Browse files Browse the repository at this point in the history
  • Loading branch information
websiteduck committed Feb 16, 2015
1 parent b7015de commit e56fec1
Show file tree
Hide file tree
Showing 71 changed files with 7,599 additions and 2,186 deletions.
1 change: 1 addition & 0 deletions application/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
25 changes: 25 additions & 0 deletions application/class_callbacks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Class callbacks get ran whenever an instance of the specified class
* gets created by the \Get class.
*/

$config = static::$config;

return array(
'IgniteXT.Profiler' => function($profiler) use ($config) {
$profiler->log_everything = false;
},

'IgniteXT.Database' => function ($database) use ($config) {
$database->connect_dsn('sqlite:ixt_demo.sqlite');
},

'IgniteXT.Router' => function ($router) use ($config) {
$router->_404 = (object)array(
'controller' => $config->get('404_controller'),
'action' => $config->get('404_action'),
);
$router->routes = $config->get('routes');
},
);
30 changes: 30 additions & 0 deletions application/class_injections.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

// Automatically inject dependencies into these classes.

return array(
'IgniteXT.Service_Entity' => array(
'config' => 'IgniteXT.Config',
),

'IgniteXT.Controller' => array(
'db' => 'IgniteXT.Database',
'display' => 'IgniteXT.Display',
'input' => 'IgniteXT.Input',
'router' => 'IgniteXT.Router',
'session' => 'IgniteXT.Session',
),

'IgniteXT.Model' => array(
'db' => 'IgniteXT.Database',
'display' => 'IgniteXT.Display',
'input' => 'IgniteXT.Input',
'router' => 'IgniteXT.Router',
'session' => 'IgniteXT.Session',
),

'IgniteXT.Display' => array(
'input' => 'IgniteXT.Input',
'session' => 'IgniteXT.Session',
),
);
11 changes: 11 additions & 0 deletions application/class_redirects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return array(

'soft' => array(
),

'hard' => array(
),

);
28 changes: 18 additions & 10 deletions application/config/base.php → application/config/base/base.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
return array(

// The application identifier will be used by system classes to prevent multiple
// applications from interfering with each other when using shared resources such
// as PHP sessions.
'APP_ID' => 'ignitext_demos',
'APP_ID' => 'ixt_demos',

// Relative URL, if your index.php file is in http://example.com/ixt/ then
// BASE_URL will be "/ixt/". If it's in your root folder, leave this as "/"
Expand All @@ -12,14 +13,21 @@
// The ASSETS URL contains your publicly accessible files such as javascript,
// css, and image files.
'ASSETS' => '/assets/',

'class_callbacks' => array(
'\\IgniteXT\\Profiler' => function($profiler) {
$profiler->log_everything = false;
},
'\\IgniteXT\\Database' => function($database) {
$database->connect_dsn('sqlite:ixt_demo.sqlite');
}
)

/*
'db_driver' => 'mysql',
'db_host' => 'localhost',
'db_port' => '3306',
'db_username' => 'root',
'db_password' => '',
'db_database' => '',
'db_charset' => 'utf8',
*/

'404_controller' => '_404',
'404_action' => 'index',

'class_redirects' => require(APP_DIR . 'class_redirects.php'),
'class_injections' => require(APP_DIR . 'class_injections.php'),
'routes' => require(APP_DIR . 'routes.php'),
);
4 changes: 0 additions & 4 deletions application/config/development.php

This file was deleted.

11 changes: 11 additions & 0 deletions application/config/development/development.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
return array(
'inherits' => 'base',

'ini_set' => array(
'error_reporting' => E_ALL & ~E_NOTICE,
'display_errors' => '1'
),

'enable_stack_trace' => true,
);
4 changes: 0 additions & 4 deletions application/config/production.php

This file was deleted.

9 changes: 9 additions & 0 deletions application/config/production/production.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
return array(
'inherits' => 'base',

'ini_set' => array(
'error_reporting' => E_ALL & ~E_NOTICE,
'display_errors' => '0'
)
);
26 changes: 26 additions & 0 deletions application/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Restful Routes
* Syntax:
* $routes[] = array('restful', url, controller, [enable params]);
* Examples:
* $routes[] = array('restful', 'photos', 'Photos'), // example.com/photos/list will resolve to Photos::getList()
* $routes[] = array('restful', '(?P<username>.+?)/photos', 'Users.Photos'), // $_GET['username'] will contain the username variable
* $routes[] = array('restful', '', 'Static_Pages'), // This should be defined last since it will match all URLs
* $routes[] = array('restful', 'users', 'Users', true), //Enable params maps /users/view/123 to \Controllers\Users::view('123')
*
* Direct Routes
* Syntax:
* $routes[] = array('direct', url, controller, action, [enable params], [method]);
* Examples:
* $routes[] = array('direct', 'photos', 'Photos', 'list'), // example.com/photos will resolve to Photos::list()
* $routes[] = array('direct', '', 'Index', 'index', true, 'get'),
* $routes[] = array('direct', 'business-hours', 'Business_Info', 'business_hours', false, 'get'),
*/
$routes = array();
$routes[] = array('restful', 'libraries/stopwatch', 'Libraries.Stopwatch');
$routes[] = array('restful', 'libraries/form-validation', 'Libraries.Form_Validation');
$routes[] = array('restful', 'user-manager/users', 'User_Manager.Users');
$routes[] = array('direct', 'user-manager', 'User_Manager.Users', 'get_list', false);
$routes[] = array('restful', '', 'Index');
return $routes;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
namespace Controllers;

class index extends \IgniteXT\Controller
class Index extends \IgniteXT\Controller
{
function index()
function get_index()
{
$this->display->template('index');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
namespace Controllers\Libraries;

class Form_Validation extends \IgniteXT\Controller
{
function get_index()
{
$form_validation = \Get::a('IgniteXT.Form_Validation');
$form_validation->load();
$this->data['form_validation'] = $form_validation;
$this->display->template('libraries/form_validation');
}

function post_index()
{
$form_validation = \Get::a('IgniteXT.Form_Validation');
$rules_array = array(
array('first_name', 'First Name', 'required|min_length[2]'),
array('last_name', 'Last Name', 'required|min_length[2]'),
array('email', 'Email', 'required|email'),
array('number', 'Number', 'required|numeric'),
array('integer', 'Integer', 'integer'),
array('decimal', 'Decimal', 'required|decimal|range[10,20]')
);
$form_validation->set_rules($rules_array);
$form_validation->validate($_POST);

if (strpos($_POST['underscore'],'_') === false) {
$form_validation->set_error('underscore', 'The Underscore field must contain an underscore.');
}

$form_validation->save();
$this->router->redirect('libraries/form-validation');
}
}
30 changes: 0 additions & 30 deletions application/source/base/controllers/libraries/form_validation.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace Controllers\Libraries;

class stopwatch extends \IgniteXT\Controller
class Stopwatch extends \IgniteXT\Controller
{
function index()
function get_index()
{
$actions[] = 'Create IXT_Stopwatch';
$stopwatch = \Get::a('\IgniteXT\Stopwatch');
$stopwatch = \Get::a('IgniteXT.Stopwatch');

$actions[] = 'Create mark "one"';
$stopwatch->mark('one');
Expand All @@ -20,7 +20,7 @@ function index()
$elapsed = $stopwatch->elapsed_time('one','two');
$actions[] = 'Elapsed time: ' . number_format($elapsed, 4) . ' seconds';

$data['actions'] = $actions;
$this->display->template('libraries/stopwatch', $data);
$this->data['actions'] = $actions;
$this->display->template('libraries/stopwatch');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
<title><?=$tpl->title?></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo ASSETS ?>js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo ASSETS ?>css/bootstrap.min.css" media="all" />
<link rel="stylesheet" type="text/css" href="<?php echo ASSETS ?>css/ignitext.css" />
<link rel="shortcut icon" href="<?php echo ASSETS ?>img/favicon.ico" >
<link rel="stylesheet" type="text/css" href="<?php echo ASSETS ?>css/bootstrap.min.css" media="all">
<link rel="stylesheet" type="text/css" href="<?php echo ASSETS ?>css/ignitext.css">
<link rel="shortcut icon" href="<?php echo ASSETS ?>img/favicon.ico">
</head>
<body>

<div id="container">

<div id="header">
<img src="<?php echo ASSETS ?>img/ignitext.png" style="float: left;" />
<img src="<?php echo ASSETS ?>img/ignitext.png" style="float: left;">
<div id="menu">
<ul>
<li>
Expand All @@ -27,11 +27,11 @@
</a>
<ul class="dropdown-menu">
<li><h3>&nbsp; Libraries</h3></li>
<li><a href="<?php echo BASE_URL ?>libraries/form_validation">IXT_Form_Validation</a></li>
<li><a href="<?php echo BASE_URL ?>libraries/form-validation">IXT_Form_Validation</a></li>
<li><a href="<?php echo BASE_URL ?>libraries/stopwatch">IXT_Stopwatch</a></li>
<li class="divider"></li>
<li><h3>&nbsp; Demo Apps</h3></li>
<li><a href="<?php echo BASE_URL ?>user_manager/">User Manager</a></li>
<li><a href="<?php echo BASE_URL ?>user-manager">User Manager</a></li>
</ul>
</div>
</li>
Expand All @@ -46,25 +46,25 @@
<?php foreach ($tpl->breadcrumbs as $breadcrumb): ?>
<?php list($title, $url) = $breadcrumb; ?>
<?php if (!empty($url)): ?>
<li><a href="<?php echo BASE_URL . $url ?>"><?php echo $title ?></a> <span class="divider">/</span></li>
<li><a href="<?=BASE_URL?><?=$url?>"><?=$title?></a> <span class="divider">/</span></li>
<?php else: ?>
<li><?php echo $title ?> <span class="divider">/</span></li>
<li><?=$title?> <span class="divider">/</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>

<div id="content">
<div id="page_title" class="page-header"><h1><?php echo $tpl->title ?></h1></div>
<?php echo $tpl->content ?>
<br style="clear: both;" />
<div id="page_title" class="page-header"><h1><?=$tpl->title?></h1></div>
<?=$tpl->content?>
<br style="clear: both;">
</div>

<div id="footer">
<p style="text-align: center;">&copy; <?=date('Y')?> Website Duck LLC</p>
<p style="text-align: center;">
<a href="http://twitter.github.com/bootstrap">Twitter Bootstrap</a> &nbsp; // &nbsp;
<a href="http://p.yusukekamiyamane.com">Fugue Icons by Yusuke Kamiyamane</a>
<br />
<br>
For more information, see the <a href="https://github.com/websiteduck/IgniteXT-Demos/blob/master/README">README</a>.
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
?>
<h2>Libraries</h2>
<ul>
<li><a href="<?=BASE_URL?>libraries/form_validation">\Libraries\IXT_Form_Validation</a></li>
<li><a href="<?=BASE_URL?>libraries/form-validation">\Libraries\IXT_Form_Validation</a></li>
<li><a href="<?=BASE_URL?>libraries/stopwatch">\Libraries\IXT_Stopwatch</a></li>
</ul>

<h2>Demo Apps</h2>
<ul>
<li><a href="<?=BASE_URL?>user_manager/">User Manager</a></li>
<li><a href="<?=BASE_URL?>user-manager">User Manager</a></li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<?php $form_validation->set_delim('<li class="error">','</li>'); ?>

<?php if ($form_validation->checked_invalid()): ?>
<div class="alert alert-error">
<ul style="margin-bottom: 0;">
<?php echo $form_validation->get_errors() ?>
</ul>
</div>
<div class="alert alert-error">
<ul style="margin-bottom: 0;">
<?=$form_validation->get_errors()?>
</ul>
</div>
<?php endif; ?>

<?php if ($form_validation->checked_valid()): ?>
Expand Down
Loading

0 comments on commit e56fec1

Please sign in to comment.