Changeset 39 in ExiteCMS8


Ignore:
Timestamp:
04/03/11 14:37:36 (14 months ago)
Author:
WanWizard
Message:

Merged Fuel 1.0.0-rc1

Location:
trunk/fuel/packages
Files:
17 added
6 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/fuel/packages/auth/bootstrap.php

    r36 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/classes/auth.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/classes/auth/acl/driver.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    3333        ! array_key_exists('id', $config) && $config['id'] = $config['driver']; 
    3434 
    35         $class = 'Auth_Acl_'.ucfirst($config['driver']); 
     35        $class = \Inflector::get_namespace($config['driver']).'Auth_Acl_'.ucfirst(\Inflector::denamespace($config['driver'])); 
    3636        $driver = new $class($config); 
    3737        static::$_instances[$driver->get_id()] = $driver; 
  • trunk/fuel/packages/auth/classes/auth/acl/simpleacl.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    3333        } 
    3434 
    35         $area = $condition[0]; 
    36         $rights = $condition[1]; 
    37         $current_roles = $group->get_roles($entity[1]); 
     35        $area    = $condition[0]; 
     36        $rights  = $condition[1]; 
     37        $current_roles  = $group->get_roles($entity[1]); 
    3838        $current_rights = ''; 
    3939        if (is_array($current_roles)) 
     
    4343            foreach ($current_roles as $r_role) 
    4444            { 
    45                 if ( ! array_key_exists($r_role, $roles) || ($r_rights = $roles[$r_role]) === false) 
     45                // continue if the role wasn't found 
     46                if ( ! array_key_exists($r_role, $roles)) 
     47                { 
     48                    continue; 
     49                } 
     50                $r_rights = $roles[$r_role]; 
     51 
     52                // if one of the roles has a negative wildcard (false) return it 
     53                if ($r_rights === false) 
    4654                { 
    4755                    return false; 
    4856                } 
    49  
    50                 if (array_key_exists($area, $r_rights)) 
     57                // if one of the roles has a positive wildecard (true) return it 
     58                elseif ($r_rights === true) 
    5159                { 
    52                     $current_rights = ($r_rights === true || $current_rights === true) 
    53                         ? true 
    54                         : $current_rights . $r_rights[$area]; 
     60                    return true; 
     61                } 
     62                // if there are roles for the current area, merge them with earlier fetched roles 
     63                elseif (array_key_exists($area, $r_rights)) 
     64                { 
     65                    $current_rights = array_unique(array_merge($current_rights, $r_rights[$area])); 
    5566                } 
    5667            } 
    5768        } 
    5869 
    59         // start checking rights, terminate false when character not found 
    60         $rights = array_unique(preg_split('//', $rights, -1, PREG_SPLIT_NO_EMPTY)); 
     70        // start checking rights, terminate false when right not found 
    6171        foreach ($rights as $right) 
    6272        { 
    63             if (strpos($current_rights, $right) === false) 
     73            if ( ! in_array($right, $current_rights)) 
    6474            { 
    6575                return false; 
     
    6777        } 
    6878 
     79        // all necessary rights were found, return true 
    6980        return true; 
    7081    } 
  • trunk/fuel/packages/auth/classes/auth/driver.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/classes/auth/exception.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/classes/auth/group/driver.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    3333        ! array_key_exists('id', $config) && $config['id'] = $config['driver']; 
    3434 
    35         $class = 'Auth_Group_'.ucfirst($config['driver']); 
     35        $class = \Inflector::get_namespace($config['driver']).'Auth_Group_'.ucfirst(\Inflector::denamespace($config['driver'])); 
    3636        $driver = new $class($config); 
    3737        static::$_instances[$driver->get_id()] = $driver; 
  • trunk/fuel/packages/auth/classes/auth/group/simplegroup.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/classes/auth/login/driver.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    3333        ! array_key_exists('id', $config) && $config['id'] = $config['driver']; 
    3434 
    35         $class = 'Auth_Login_'.ucfirst($config['driver']); 
     35        $class = \Inflector::get_namespace($config['driver']).'Auth_Login_'.ucfirst(\Inflector::denamespace($config['driver'])); 
    3636        $driver = new $class($config); 
    3737        static::$_instances[$driver->get_id()] = $driver; 
  • trunk/fuel/packages/auth/classes/auth/login/simpleauth.php

    r18 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/auth/config/simpleauth.php

    r18 r39  
    1111 
    1212    'roles' => array( 
    13         '#' => array('website' => 'r'), // default rights 
    14         'banned' => false, 
    15         'user' => array('comments' => 'cr'), 
    16         'moderator' => array('comments' => 'ud'), 
    17         'admin' => array('website' => 'cud', 'admin' => 'crud'), 
    18         'super' => true, 
     13        '#'          => array('website' => array('read')), // default rights 
     14        'banned'     => false, 
     15        'user'       => array('comments' => array('create', 'read')), 
     16        'moderator'  => array('comments' => array('update', 'delete')), 
     17        'admin'      => array( 
     18            'website'  => array('create', 'update', 'delete'), 
     19            'admin'    => array('create', 'read', 'update', 'delete'), 
     20        ), 
     21        'super'      => true, 
    1922    ), 
    2023 
  • trunk/fuel/packages/oil/bootstrap.php

    r36 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
    1515 
    1616Autoloader::add_classes(array( 
    17     'Oil\\Cli'                          => __DIR__.'/classes/cli.php', 
     17    'Oil\\Command'                  => __DIR__.'/classes/command.php', 
    1818    'Oil\\Console'                      => __DIR__.'/classes/console.php', 
    1919    'Oil\\Exception'                    => __DIR__.'/classes/exception.php', 
  • trunk/fuel/packages/oil/classes/console.php

    r6 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Phil Sturgeon 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    3737        while (ob_get_level ()) 
    3838        { 
    39             ob_end_clean(); 
    40         } 
    41  
     39             ob_end_clean(); 
     40        } 
     41         
    4242        ob_implicit_flush(true); 
    4343 
     
    4848    private function main() 
    4949    { 
    50         echo sprintf( 
     50        \Cli::write(sprintf( 
    5151            'Fuel %s - PHP %s (%s) (%s) [%s]', 
    5252            \Fuel::VERSION, 
     
    5555            self::build_date(), 
    5656            PHP_OS 
    57         ) . PHP_EOL; 
     57        )); 
    5858 
    5959        // Loop until they break it 
    6060        while (TRUE) 
    6161        { 
    62             echo ">>> "; 
    63  
    64             if ( ! $__line = rtrim(trim(trim(fgets(STDIN)), PHP_EOL), ';')) 
     62            if (\Cli::$readline_support) 
     63            { 
     64                readline_completion_function(array(__CLASS__, 'tab_complete')); 
     65            } 
     66 
     67            if ( ! $__line = rtrim(trim(trim(\Cli::input('>>> ')), PHP_EOL), ';')) 
    6568            { 
    6669                continue; 
     
    7073            { 
    7174                break; 
     75            } 
     76 
     77            // Add this line to history 
     78            //$this->history[] = array_slice($this->history, 0, -99) + array($line); 
     79            if (\Cli::$readline_support) 
     80            { 
     81                readline_add_history($__line); 
    7282            } 
    7383 
     
    8595            if ($ret === false) 
    8696            { 
    87                 \Cli::write(\Cli::color('Parse Error - ' . $__line, 'light_red')); 
     97                \Cli::error('Parse Error - ' . $__line); 
    8898                \Cli::beep(); 
    8999            } 
     
    93103                if (is_bool($ret)) 
    94104                { 
    95                     echo ($ret ? "true" : "false"); 
    96                 } 
    97                 else if (is_string($ret)) 
     105                    echo $ret ? 'true' : 'false'; 
     106                } 
     107                elseif (is_string($ret)) 
    98108                { 
    99109                    echo addcslashes($ret, "\0..\37\177..\377"); 
    100110                } 
    101                 else if ( ! is_null($ret)) 
     111                elseif ( ! is_null($ret)) 
    102112                { 
    103113                    var_export($ret); 
     
    119129    } 
    120130 
    121     private function is_immediate($line) 
     131    private static function is_immediate($line) 
    122132    { 
    123133        $skip = array( 
     
    141151                $sq = !$sq; 
    142152            } 
    143             else if ($c == '"') 
     153            elseif ($c == '"') 
    144154            { 
    145155                $dq = !$dq; 
    146156            } 
    147157 
    148             else if ( ($sq) || ($dq) && $c == "\\") 
     158            elseif ( ($sq) || ($dq) && $c == "\\") 
    149159            { 
    150160                ++$i; 
     
    162172        } 
    163173 
    164         $kw = preg_split("[^A-Za-z0-9_]", $code); 
     174        $kw = preg_split("[^a-z0-9_]i", $code); 
    165175        foreach ($kw as $i) 
    166176        { 
     
    174184    } 
    175185 
    176     private function build_date() 
     186    public static function tab_complete($line, $pos, $cursor) 
     187    { 
     188        $const = array_keys(get_defined_constants()); 
     189        $var = array_keys($GLOBALS); 
     190        $func = get_defined_functions(); 
     191 
     192        foreach ($func["user"] as $i) 
     193        { 
     194                $func["internal"][] = $i; 
     195        } 
     196        $func = $func["internal"]; 
     197 
     198        return array_merge($const, $var, $func); 
     199    } 
     200 
     201    private static function build_date() 
    177202    { 
    178203        ob_start(); 
  • trunk/fuel/packages/oil/classes/exception.php

    r2 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/oil/classes/generate.php

    r31 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    2525class Generate 
    2626{ 
     27    public static $create_folders = array(); 
     28    public static $create_files = array(); 
     29 
     30    public static $scaffolding = false; 
     31 
    2732    private static $_default_constraints = array( 
    2833        'varchar' => 255, 
     34        'char' => 255, 
    2935        'int' => 11 
    3036    ); 
    3137 
    32     public function controller($args) 
     38    public static function controller($args, $build = true) 
    3339    { 
    3440        $args = self::_clear_args($args); 
     
    3844        $filepath = APPPATH . 'classes/controller/' . $singular .'.php'; 
    3945 
    40         $class_name = ucfirst($singular); 
     46        // Uppercase each part of the class name and remove hyphens 
     47        $class_name = static::class_name($singular); 
    4148 
    4249        // Stick "blogs" to the start of the array 
     
    4451 
    4552        // Create views folder and each view file 
    46         static::views($args); 
    47  
    48         if (empty($actions)) 
    49         { 
    50             $actions = array('index'); 
    51         } 
    52          
     53        static::views($args, false); 
     54 
     55       $actions or $actions = array('index'); 
     56 
    5357        $action_str = ''; 
    5458        foreach ($actions as $action) 
     
    5761    public function action_'.$action.'() 
    5862    { 
    59         $this->template->title = \'' . \Inflector::humanize($singular) .' &raquo ' . \Inflector::humanize($action) . '\'; 
     63        $this->template->title = \'' . \Inflector::humanize($singular) .' » ' . \Inflector::humanize($action) . '\'; 
    6064        $this->template->content = View::factory(\''.$singular .'/' . $action .'\'); 
    6165    }'.PHP_EOL; 
     
    7478 
    7579        // Write controller 
    76         if (self::write($filepath, $controller)) 
    77         { 
    78             \Cli::write("\t".'Created controller: ' . \Fuel::clean_path($filepath)); 
    79         } 
    80     } 
    81  
    82  
    83     public function model($args) 
     80        static::create($filepath, $controller, 'controller'); 
     81        $build and static::build(); 
     82    } 
     83 
     84 
     85    public static function model($args, $build = true) 
    8486    { 
    8587        $singular = strtolower(array_shift($args)); 
     
    9294        $plural = \Inflector::pluralize($singular); 
    9395 
    94         $filepath = APPPATH . 'classes/model/' . $singular .'.php'; 
    95  
    96         $class_name = ucfirst($singular); 
     96        $filepath = APPPATH . 'classes/model/' . str_replace('_', '/', $singular) .'.php'; 
     97 
     98        // Uppercase each part of the class name and remove hyphens 
     99        $class_name = static::class_name($singular); 
    97100 
    98101        $model = <<<MODEL 
    99102<?php 
    100103 
    101 class Model_{$class_name} extends ActiveRecord\Model { } 
     104class Model_{$class_name} extends Orm\Model { } 
    102105 
    103106/* End of file $singular.php */ 
    104107MODEL; 
    105108 
    106         if (self::write($filepath, $model)) 
    107         { 
    108             \Cli::write("\t".'Created model: ' . \Fuel::clean_path($filepath)); 
    109         } 
     109        // Build the model 
     110        static::create($filepath, $model, 'model'); 
    110111 
    111112        if ( ! empty($args)) 
    112113        { 
    113114            array_unshift($args, 'create_'.$plural); 
    114             static::migration($args); 
    115         } 
    116     } 
    117  
    118  
    119     public function views($args) 
     115            static::migration($args, false); 
     116        } 
     117 
     118        else 
     119        { 
     120            throw new Exception('Not enough arguments to create this migration.'); 
     121        } 
     122 
     123        $build and static::build(); 
     124    } 
     125 
     126 
     127    public static function views($args, $build = true) 
    120128    { 
    121129        $args = self::_clear_args($args); 
    122         $folder = array_shift($args); 
    123         $controller_title = \Inflector::humanize($folder); 
    124  
    125         empty($args) and $args = array('index'); 
     130        $controller = strtolower(array_shift($args)); 
     131        $controller_title = \Inflector::humanize($controller); 
     132 
     133        $view_dir = APPPATH.'views/'.trim(str_replace(array('_', '-'), DS, $controller), DS).DS; 
     134 
     135        $args or $args = array('index'); 
    126136 
    127137        // Make the directory for these views to be store in 
    128         if ( ! is_dir($view_dir = APPPATH . 'views/'.$folder.'/')) 
    129         { 
    130             mkdir($view_dir, 0777); 
    131         } 
     138        is_dir($view_dir) or static::$create_folders[] = $view_dir; 
    132139 
    133140        // Add the default template if it doesnt exist 
    134         if ( ! file_exists($app_template = APPPATH . 'views/template.php')) 
    135         { 
    136             copy(PKGPATH . 'oil/views/default/template.php', $app_template); 
    137             chmod($app_template, 0666); 
    138         } 
    139         unset($app_template); 
     141        if ( ! file_exists($app_template = APPPATH.'views/template.php')) 
     142        { 
     143            static::create($app_template, file_get_contents(PKGPATH.'oil/views/default/template.php'), 'view'); 
     144        } 
    140145 
    141146        foreach ($args as $action) 
    142147        { 
    143148            $view_title = \Inflector::humanize($action); 
    144 //          $view_filepath = \Fuel::clean_path($view_file = $view_dir . $action . '.php'); 
    145             $view_filepath = $view_file = $view_dir . $action . '.php'; 
    146  
    147149            $view = <<<VIEW 
    148 <p>Edit this content in {$view_filepath}</p> 
     150<p>{$view_title}</p> 
    149151VIEW; 
    150152 
    151             if (self::write($view_file, $view)) 
    152             { 
    153                 \Cli::write("\t".'Created view: ' . \Fuel::clean_path($view_file)); 
    154             } 
    155         } 
    156     } 
    157  
    158  
    159     public function migration($args) 
    160     { 
    161          
     153            // Create this view 
     154            static::create($view_dir.$action.'.php', $view, 'view'); 
     155        } 
     156 
     157        $build and static::build(); 
     158    } 
     159 
     160 
     161    public static function migration($args, $build = true) 
     162    { 
    162163        // Get the migration name 
    163         $migration_name = strtolower(array_shift($args)); 
    164          
     164        $migration_name = strtolower(str_replace('-', '_', array_shift($args))); 
     165 
     166        // Check if a migration with this name already exists 
     167        if (count($duplicates = glob(APPPATH."migrations/*_{$migration_name}*")) > 0) 
     168        { 
     169            // Don't override a file 
     170            if (\Cli::option('s', \Cli::option('skip')) === true) 
     171            { 
     172                return; 
     173            } 
     174 
     175            // Tear up the file path and name to get the last duplicate 
     176            $file_name = pathinfo(end($duplicates), PATHINFO_FILENAME); 
     177 
     178            // Override the (most recent) migration with the same name by using its number 
     179            if (\Cli::option('f', \Cli::option('force')) === true) 
     180            { 
     181                list($number) = explode('_', $file_name); 
     182            } 
     183 
     184            // Name clashes but this is done by hand. Assume they know what they're doing and just increment the file 
     185            elseif (static::$scaffolding === false) 
     186            { 
     187                // Increment the name of this 
     188                $migration_name = \Str::increment(substr($file_name, 4), 2); 
     189            } 
     190        } 
     191 
    165192        // See if the action exists 
    166193        $methods = get_class_methods(__NAMESPACE__ . '\Generate_Migration_Actions'); 
    167          
     194 
    168195        // For empty migrations that dont have actions 
    169196        $migration = array('', ''); 
    170          
     197 
    171198        // Loop through the actions and act on a matching action appropriately 
    172         foreach($methods as $method_name) 
    173         {    
     199        foreach ($methods as $method_name) 
     200        { 
    174201            // If the miration name starts with the name of the action method 
    175             if(substr($migration_name, 0, strlen($method_name)) === $method_name) 
    176             { 
    177                  
     202            if (substr($migration_name, 0, strlen($method_name)) === $method_name) 
     203            { 
    178204                /** 
    179205                 *  Create an array of the subject the migration is about 
     
    190216                $subjects = array(false, false); 
    191217                $matches = explode('_', str_replace($method_name . '_', '', $migration_name)); 
    192                  
    193                 if(count($matches) == 1) { // create_{table} 
     218 
     219                // create_{table} 
     220                if (count($matches) == 1) 
     221                { 
    194222                    $subjects = array(false, $matches[0]); 
    195223                } 
    196                 else if(count($matches) == 3) // add_{field}_to_{table} 
     224 
     225                // add_{field}_to_{table} 
     226                else if (count($matches) == 3 && $matches[1] == 'to') 
    197227                { 
    198228                    $subjects = array($matches[0], $matches[2]); 
    199229                } 
     230 
     231                // create_{table} (with underscores in table name) 
     232                else if (count($matches) !== 0) 
     233                { 
     234                    $subjects = array(false, implode('_', $matches)); 
     235                } 
     236 
     237                // There is no subject here so just carry on with a normal empty migration 
    200238                else 
    201239                { 
    202                     // There is no subject here so just carry on with a normal empty migration 
    203240                    break; 
    204241                } 
    205                  
     242 
    206243                // We always pass in fields to a migration, so lets sort them out here. 
    207244                $fields = array(); 
    208                 foreach($args as $field) 
     245                foreach ($args as $field) 
    209246                { 
    210247                    $field_array = array(); 
    211                      
     248 
    212249                    // Each paramater for a field is seperated by the : character 
    213250                    $parts = explode(":", $field); 
    214                      
     251 
    215252                    // We must have the 'name:type' if nothing else! 
    216                     if(count($parts) >= 2) 
     253                    if (count($parts) >= 2) 
    217254                    { 
    218255                        $field_array['name'] = array_shift($parts); 
    219                         foreach($parts as $part_i => $part) 
     256                        foreach ($parts as $part_i => $part) 
    220257                        { 
    221258                            preg_match('/([a-z0-9_-]+)(?:\[([a-z0-9]+)\])?/i', $part, $part_matches); 
    222259                            array_shift($part_matches); 
    223                              
    224                             if(count($part_matches) < 1) 
     260 
     261                            if (count($part_matches) < 1) 
    225262                            { 
    226263                                // Move onto the next part, something is wrong here... 
    227264                                continue; 
    228265                            } 
    229                              
     266 
    230267                            $option_name = ''; // This is the name of the option to be passed to the action in a field 
    231268                            $option = $part_matches; 
    232                              
     269 
    233270                            // The first option always has to be the field type 
    234                             if($part_i == 0) 
     271                            if ($part_i == 0) 
    235272                            { 
    236273                                $option_name = 'type'; 
    237274                                $type = $option[0]; 
    238                                 if($type === 'string') 
     275                                if ($type === 'string') 
    239276                                { 
    240277                                    $type = 'varchar'; 
    241278                                } 
    242                                 else if($type === 'integer') 
     279                                else if ($type === 'integer') 
    243280                                { 
    244281                                    $type = 'int'; 
    245282                                } 
    246283 
    247                                 if(!in_array($type, array('text', 'blob', 'datetime', 'date', 'timestamp', 'time'))) 
     284                                if ( ! in_array($type, array('text', 'blob', 'datetime', 'date', 'timestamp', 'time'))) 
    248285                                { 
    249                                     if(!isset($option[1]) || $option[1] == NULL) 
     286                                    if ( ! isset($option[1]) || $option[1] == NULL) 
    250287                                    { 
    251                                         if(isset(self::$_default_constraints[$type])) 
     288                                        if (isset(self::$_default_constraints[$type])) 
    252289                                        { 
    253290                                            $field_array['constraint'] = self::$_default_constraints[$type]; 
     
    266303                                // ... always be passed through to the action making it really easy to add extra options for a field 
    267304                                $option_name = array_shift($option); 
    268                                 if(count($option) > 0) 
     305                                if (count($option) > 0) 
    269306                                { 
    270307                                    $option = $option[0]; 
     
    274311                                    $option = true; 
    275312                                } 
    276                             }    
    277                              
     313                            } 
     314 
    278315                            $field_array[$option_name] = $option; 
    279                                                      
     316 
    280317                        } 
    281318                        $fields[] = $field_array; 
     
    287324                    } 
    288325                } 
    289                  
     326 
    290327                // Call the magic action which returns an array($up, $down) for the migration 
    291                 \Cli::write("\tBuilding magic migration:" . $method_name); 
    292328                $migration = call_user_func(__NAMESPACE__ . "\Generate_Migration_Actions::{$method_name}", $subjects, $fields); 
    293                  
    294             } 
    295             else 
    296             { 
    297                 // No magic action for this migration... 
    298             } 
    299         } 
    300          
     329            } 
     330        } 
     331 
    301332        // Build the migration 
    302         if ($filepath = static::_build_migration($migration_name, $migration[0], $migration[1])) 
    303         { 
    304             \Cli::write("\tCreated migration: " . \Fuel::clean_path($filepath), 'green'); 
    305         } 
    306     } 
    307  
    308  
    309     public function help() 
     333        list($up, $down)=$migration; 
     334 
     335        $migration_name = ucfirst(strtolower($migration_name)); 
     336 
     337        $migration = <<<MIGRATION 
     338<?php 
     339 
     340namespace Fuel\Migrations; 
     341 
     342class {$migration_name} { 
     343 
     344    public function up() 
     345    { 
     346{$up} 
     347    } 
     348 
     349    public function down() 
     350    { 
     351{$down} 
     352    } 
     353} 
     354MIGRATION; 
     355 
     356        $number = isset($number) ? $number : static::_find_migration_number(); 
     357        $filepath = APPPATH . 'migrations/'.$number.'_' . strtolower($migration_name) . '.php'; 
     358 
     359        static::create($filepath, $migration, 'migration'); 
     360 
     361        $build and static::build(); 
     362    } 
     363 
     364 
     365    public static function help() 
    310366    { 
    311367        $output = <<<HELP 
     
    328384  php oil g scaffold/template_subfolder <modelname> [<fieldname1>:<type1> |<fieldname2>:<type2> |..] 
    329385 
    330 Note that the next two lines are equivalent:  
     386Note that the next two lines are equivalent: 
    331387  php oil g scaffold <modelname> ... 
    332388  php oil g scaffold/default <modelname> ... 
    333    
     389 
    334390Documentation: 
    335391  http://fuelphp.com/docs/packages/oil/generate.html 
     
    340396 
    341397 
    342     // Helper functions 
    343  
    344  
    345     private function write($filepath, $data) 
    346     { 
    347         if ( ! $handle = @fopen($filepath, 'w+')) 
    348         { 
    349             throw new Exception('Cannot open file: '. $filepath); 
    350         } 
    351  
    352         $result = @fwrite($handle, $data); 
    353  
    354         // Write $somecontent to our opened file. 
    355         if ($result === FALSE) 
    356         { 
    357             throw new Exception('Cannot write to file: '. $filepath); 
    358         } 
    359  
    360         @fclose($handle); 
    361  
    362         chmod($filepath, 0666); 
     398    public static function create($filepath, $contents, $type = 'file') 
     399    { 
     400        // Final check for stupid characters 
     401        if (in_array($type, array('controller', 'model'))) 
     402        { 
     403            $filepath = str_replace(array('_', '-'), '/', $filepath); 
     404        } 
     405 
     406        $directory = dirname($filepath); 
     407        is_dir($directory) or static::$create_folders[] = $directory; 
     408 
     409        // Check if a file exists then work out how to react 
     410        if (file_exists($filepath)) 
     411        { 
     412            // Don't override a file 
     413            if (\Cli::option('s', \Cli::option('skip')) === true) 
     414            { 
     415                // Don't bother trying to make this, carry on camping 
     416                return; 
     417            } 
     418 
     419            // If we aren't skipping it, tell em to use -f 
     420            if (\Cli::option('f', \Cli::option('force')) === null) 
     421            { 
     422                throw new Exception($filepath .' already exists, use -f or --force to override.'); 
     423                exit; 
     424            } 
     425        } 
     426 
     427        static::$create_files[] = array( 
     428            'path' => $filepath, 
     429            'contents' => $contents, 
     430            'type' => $type 
     431        ); 
     432    } 
     433 
     434 
     435    public static function build() 
     436    { 
     437        foreach (static::$create_folders as $folder) 
     438        { 
     439            is_dir($folder) or mkdir($folder, 0755, TRUE); 
     440        } 
     441 
     442        foreach (static::$create_files as $file) 
     443        { 
     444            \Cli::write("\tCreating {$file['type']}: {$file['path']}", 'green'); 
     445 
     446            if ( ! $handle = @fopen($file['path'], 'w+')) 
     447            { 
     448                throw new Exception('Cannot open file: '. $file['path']); 
     449            } 
     450 
     451            $result = @fwrite($handle, $file['contents']); 
     452 
     453            // Write $somecontent to our opened file. 
     454            if ($result === FALSE) 
     455            { 
     456                throw new Exception('Cannot write to file: '. $file['path']); 
     457            } 
     458 
     459            @fclose($handle); 
     460 
     461            @chmod($file['path'], 0666); 
     462        } 
    363463 
    364464        return $result; 
    365465    } 
    366      
    367     private function _build_migration($migration_name, $up, $down) 
    368     { 
    369         $migration_name = ucfirst(strtolower($migration_name)); 
    370  
    371         $migration = <<<MIGRATION 
    372 <?php 
    373  
    374 namespace Fuel\Migrations; 
    375  
    376 class {$migration_name} { 
    377  
    378     function up() 
    379     { 
    380 {$up} 
    381     } 
    382  
    383     function down() 
    384     { 
    385 {$down} 
     466 
     467    public static function class_name($name) 
     468    { 
     469        return str_replace(array(' ', '-'), '_', ucwords(str_replace('_', ' ', $name))); 
     470    } 
     471 
     472    // Helper methods 
     473 
     474    private static function _find_migration_number() 
     475    { 
     476        $glob = glob(APPPATH .'migrations/*_*.php'); 
     477        list($last) = explode('_', basename(end($glob))); 
     478 
     479        return str_pad($last + 1, 3, '0', STR_PAD_LEFT); 
     480    } 
     481 
     482    private static function _update_current_version($version) 
     483    { 
     484        if (file_exists($app_path = APPPATH.'config'.DS.'migrations.php')) 
     485        { 
     486            $contents = file_get_contents($app_path); 
     487        } 
     488        elseif (file_exists($core_path = COREPATH.'config'.DS.'migrations.php')) 
     489        { 
     490            $contents = file_get_contents($core_path); 
     491        } 
     492        else 
     493        { 
     494            throw new Exception('Config file core/config/migrations.php'); 
     495            exit; 
     496        } 
     497 
     498        $contents = preg_replace("#('version'[ \t]+=>)[ \t]+([0-9]+),#i", "$1 $version,", $contents); 
     499 
     500        static::create($app_path, $contents, 'config'); 
     501    } 
     502 
     503    private static function _clear_args($actions = array()) 
     504    { 
     505        foreach ($actions as $key => $action) 
     506        { 
     507            if (substr($action, 0, 1) === '-') 
     508            { 
     509                unset($actions[$key]); 
     510            } 
     511        } 
     512 
     513        return $actions; 
    386514    } 
    387515} 
    388 MIGRATION; 
    389  
    390         $number = self::_find_migration_number(); 
    391         $filepath = APPPATH . 'migrations/'.$number.'_' . strtolower($migration_name) . '.php'; 
    392  
    393         if (glob(APPPATH . 'migrations/*_' . strtolower($migration_name) . '.php')) 
    394         { 
    395             throw new Exception('A migration with this name already exists.'); 
    396         } 
    397  
    398         if (self::write($filepath, $migration)) 
    399         { 
    400             self::_update_current_version(intval($number)); 
    401             return $filepath; 
    402         } 
    403  
    404         return false; 
    405     } 
    406  
    407     private function _find_migration_number() 
    408     { 
    409         list($last) = explode('_', basename(end(glob(APPPATH .'migrations/*_*.php')))); 
    410  
    411         return str_pad($last + 1, 3, '0', STR_PAD_LEFT); 
    412     } 
    413  
    414     private function _update_current_version($version) 
    415     { 
    416         $contents = ''; 
    417         $path = ''; 
    418         if (file_exists($path = APPPATH.'config'.DS.'migration.php')) 
    419         { 
    420             $contents = file_get_contents($path); 
    421         } 
    422         elseif (file_exists($path = COREPATH.'config'.DS.'migration.php')) 
    423         { 
    424             $contents = file_get_contents($path ); 
    425         } 
    426  
    427         $contents = preg_replace("#('version'[ \t]+=>)[ \t]+([0-9]+),#i", "$1 $version,", $contents); 
    428  
    429         self::write($path, $contents); 
    430     } 
    431  
    432     private function _clear_args($actions = array()) 
    433     { 
    434         foreach ($actions as $key => $action) 
    435         { 
    436             if (substr($action, 0, 1) === '-') 
    437             { 
    438                 unset($actions[$key]); 
    439             } 
    440         } 
    441  
    442         return $actions; 
    443     } 
    444 } 
    445516 
    446517/* End of file oil/classes/generate.php */ 
  • trunk/fuel/packages/oil/classes/generate/migration/actions.php

    r17 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
  • trunk/fuel/packages/oil/classes/package.php

    r8 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    2525class Package 
    2626{ 
    27     protected static $protected = array('auth', 'activerecord', 'octane', 'oil'); 
     27    protected static $protected = array('auth', 'activerecord', 'oil', 'orm'); 
    2828 
    2929    protected static $git = 'git'; 
     
    5353            $zip_url = 'http://' . rtrim($source, '/').'/fuel-'.$package.'/zipball/'.$version; 
    5454 
    55             if ($fp = @fopen($zip_url, 'r')) 
     55            if ($fp = fopen($zip_url, 'r')) 
    5656            { 
    5757                // We don't actually need this, just checking the file is there 
     
    178178            $path = str_replace($tmp_package_folder, $package_folder, $file); 
    179179            chmod($path, octdec(755)); 
    180             \Cli::write("\t" . \Fuel::clean_path($path)); 
     180            \Cli::write("\t" . $path); 
    181181        } 
    182182    } 
  • trunk/fuel/packages/oil/classes/refine.php

    r6 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    4242        if ( ! $file = \Fuel::find_file('tasks', $task)) 
    4343        { 
    44             throw new Exception(sprintf('Task "%s" does not exist.', $task)); 
     44            $files = \Fuel::list_files('tasks'); 
     45            $possibilities = array(); 
     46            foreach($files as $file) 
     47            { 
     48                $possible_task = pathinfo($file, \PATHINFO_FILENAME); 
     49                $difference = levenshtein($possible_task, $task); 
     50                $possibilities[$difference] = $possible_task; 
     51            } 
     52 
     53            ksort($possibilities); 
     54             
     55            if ($possibilities and current($possibilities) <= 5) 
     56            { 
     57                throw new Exception(sprintf('Task "%s" does not exist. Did you mean "%s"?', strtolower($task), current($possibilities))); 
     58            } 
     59            else 
     60            { 
     61                throw new Exception(sprintf('Task "%s" does not exist.', strtolower($task))); 
     62            } 
     63             
    4564            return; 
    4665        } 
  • trunk/fuel/packages/oil/classes/scaffold.php

    r12 r39  
    55 * Fuel is a fast, lightweight, community driven PHP5 framework. 
    66 * 
    7  * @package     Fuel 
    8  * @version     1.0 
    9  * @author      Fuel Development Team 
    10  * @license     MIT License 
    11  * @copyright   2010 - 2011 Fuel Development Team 
    12  * @link        http://fuelphp.com 
     7 * @package    Fuel 
     8 * @version    1.0 
     9 * @author     Fuel Development Team 
     10 * @license    MIT License 
     11 * @copyright  2010 - 2011 Fuel Development Team 
     12 * @link       http://fuelphp.com 
    1313 */ 
    1414 
     
    2525class Scaffold 
    2626{ 
    27     public function generate($args, $subfolder = 'default') 
     27    public static function _init() 
     28    { 
     29        Generate::$scaffolding = true; 
     30    } 
     31 
     32    public static function generate($args, $subfolder = 'default') 
    2833    { 
    2934        $subfolder = trim($subfolder, '/'); 
    30         if( ! is_dir( PKGPATH.'oil/views/'.$subfolder)) 
     35        if ( ! is_dir( PKGPATH.'oil/views/'.$subfolder)) 
    3136        { 
    3237            throw new Exception('The subfolder for scaffolding templates doesn\'t exist or is spelled wrong: '.$subfolder.' '); 
    3338        } 
    34      
     39 
    3540        // Do this first as there is the largest chance of error here 
    36         Generate::model($args); 
    37          
     41        Generate::model($args, false); 
     42 
    3843        // Go through all arguments after the first and make them into field arrays 
    3944        $fields = array(); 
     
    4550            $fields[] = array( 
    4651                'name' => strtolower($matches[1]), 
    47                 'type' => $matches[2], 
     52                'type' => isset($matches[2]) ? $matches[2] : 'string', 
    4853                'constraint' => isset($matches[4]) ? $matches[4] : null 
    4954            ); 
     
    5156 
    5257        $data['singular'] = $singular = strtolower(array_shift($args)); 
    53         $data['model'] = $model_name = 'Model_' . ucfirst($singular); 
     58        $data['model'] = $model_name = 'Model_'.Generate::class_name($singular); 
    5459        $data['plural'] = $plural = \Inflector::pluralize($singular); 
    5560        $data['fields'] = $fields; 
    5661 
    57         $filepath = APPPATH . 'classes/controller/' . $plural . '.php'; 
     62        $filepath = APPPATH.'classes/controller/'.$plural.'.php'; 
    5863        $controller = \View::factory($subfolder.'/scaffold/controller', $data); 
    5964 
     
    8792 
    8893        // Write controller 
    89         if (self::write($filepath, $controller)) 
     94        Generate::create($filepath, $controller, 'controller'); 
     95 
     96        // Create each of the views 
     97        foreach (array('index', 'view', 'create', 'edit', '_form') as $view) 
    9098        { 
    91             \Cli::write('Created controller: ' . \Fuel::clean_path($filepath)); 
     99            Generate::create(APPPATH.'views/'.$plural.'/'.$view.'.php', \View::factory($subfolder.'/scaffold/views/'.$view, $data), 'view'); 
    92100        } 
    93101 
     
    95103        if ( ! file_exists($app_template = APPPATH . 'views/template.php')) 
    96104        { 
    97             copy(PKGPATH . 'oil/views/'.$subfolder.'/template.php', $app_template); 
    98             chmod($app_template, 0666); 
    99         } 
    100          
    101         // Create view folder if not already there 
    102         if ( ! is_dir($view_folder = APPPATH . 'views/' . $plural . '/')) 
    103         { 
    104             mkdir(APPPATH . 'views/' . $plural, 0755); 
     105            Generate::create($app_template, file_get_contents(PKGPATH . 'oil/views/default/template.php'), 'view'); 
    105106        } 
    106107 
    107         // Create each of the views 
    108         foreach (array('index', 'view', 'create', 'edit', '_form') as $view) 
    109         { 
    110             static::write($view_file = $view_folder . $view . '.php', \View::factory($subfolder.'/scaffold/views/'.$view, $data)); 
    111  
    112             \Cli::write('Created view: ' . \Fuel::clean_path($view_file)); 
    113         } 
    114     } 
    115  
    116     private function write($filepath, $data) 
    117     { 
    118         if ( ! $handle = fopen($filepath, 'w+')) 
    119         { 
    120             throw new Exception('Cannot open file: '. \Fuel::clean_path($filepath)); 
    121         } 
    122  
    123         $result = @fwrite($handle, $data); 
    124  
    125         // Write $somecontent to our opened file. 
    126         if ($result === FALSE) 
    127         { 
    128             throw new Exception('Cannot write to file: '. \Fuel::clean_path($filepath)); 
    129         } 
    130  
    131         @fclose($handle); 
    132  
    133         chmod($filepath, 0666); 
    134  
    135         return $result; 
     108        Generate::build(); 
    136109    } 
    137110 
  • trunk/fuel/packages/oil/views/default/scaffold/actions/create.php

    r12 r39  
    99            if ($<?php echo $singular; ?> and $<?php echo $singular; ?>->save()) 
    1010            { 
    11                 Session::set_flash('notice', 'Added ' . $<?php echo $singular; ?> . ' #' . $<?php echo $singular; ?>->id . '.'); 
     11                Session::set_flash('notice', 'Added <?php echo $singular; ?> #' . $<?php echo $singular; ?>->id . '.'); 
    1212 
    13                 Output::redirect('<?php echo $plural; ?>'); 
     13                Response::redirect('<?php echo $plural; ?>'); 
    1414            } 
    1515 
  • trunk/fuel/packages/oil/views/default/scaffold/actions/delete.php

    r12 r39  
    1111        } 
    1212 
    13         Output::redirect('<?php echo $plural; ?>'); 
     13        Response::redirect('<?php echo $plural; ?>'); 
  • trunk/fuel/packages/oil/views/default/scaffold/actions/edit.php

    r12 r39  
    99            if ($<?php echo $singular; ?>->save()) 
    1010            { 
    11                 Session::set_flash('notice', 'Updated ' . $<?php echo $singular; ?> . ' #' . $<?php echo $singular; ?>->id); 
     11                Session::set_flash('notice', 'Updated <?php echo $singular; ?> #' . $<?php echo $singular; ?>->id); 
    1212 
    13                 Output::redirect('<?php echo $plural; ?>'); 
     13                Response::redirect('<?php echo $plural; ?>'); 
    1414            } 
    1515 
    1616            else 
    1717            { 
    18                 Session::set_flash('notice', 'Could not update ' . $<?php echo $singular; ?> . ' #' . $id); 
     18                Session::set_flash('notice', 'Could not update <?php echo $singular; ?> #' . $id); 
    1919            } 
    2020        } 
  • trunk/fuel/packages/oil/views/default/scaffold/views/create.php

    r12 r39  
    33<?php echo '<?php'; ?> echo render('<?php echo $plural; ?>/_form'); ?> 
    44 
    5 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
     5<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
  • trunk/fuel/packages/oil/views/default/scaffold/views/edit.php

    r12 r39  
    33<?php echo '<?php'; ?> echo render('<?php echo $plural; ?>/_form'); ?> 
    44 
    5 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> | 
    6 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
     5<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?> | 
     6<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
  • trunk/fuel/packages/oil/views/default/scaffold/views/index.php

    r12 r39  
    1717        <td><?php echo '<?php'; ?> echo $<?php echo $singular.'->'.$field['name']; ?>; <?php echo '?>'; ?></td> 
    1818<?php endforeach; ?> 
    19         <td><?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?></td> 
    20         <td><?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?></td> 
    21         <td><?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/delete/'.$<?php echo $singular; ?>->id, 'Delete', array('onclick' => "return confirm('Are you sure?')")); <?php echo '?>'; ?></td> 
     19        <td><?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/view/'.$<?php echo $singular; ?>->id, 'View'); <?php echo '?>'; ?></td> 
     20        <td><?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?></td> 
     21        <td><?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/delete/'.$<?php echo $singular; ?>->id, 'Delete', array('onclick' => "return confirm('Are you sure?')")); <?php echo '?>'; ?></td> 
    2222    </tr> 
    2323    <?php echo '<?php endforeach; ?>'; ?> 
     
    2626<br /> 
    2727 
    28 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/create', 'Add new <?php echo \Inflector::humanize($singular); ?>'); <?php echo '?>'; ?> 
     28<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/create', 'Add new <?php echo \Inflector::humanize($singular); ?>'); <?php echo '?>'; ?> 
  • trunk/fuel/packages/oil/views/default/scaffold/views/view.php

    r12 r39  
    66<?php endforeach; ?> 
    77 
    8 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> |  
    9 <?php echo '<?php'; ?> echo HTML::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
     8<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>/edit/'.$<?php echo $singular; ?>->id, 'Edit'); <?php echo '?>'; ?> |  
     9<?php echo '<?php'; ?> echo Html::anchor('<?php echo $plural; ?>', 'Back'); <?php echo '?>'; ?> 
  • trunk/fuel/packages/oil/views/default/template.php

    r12 r39  
    55    <title><?php echo $title; ?></title> 
    66    <style type="text/css"> 
    7         body { background-color: #F2F2F2; margin: 45px 0 0 0; font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif; font-size: 18px } 
     7        body { background-color: #F2F2F2; margin: 45px 0 0 0; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size: 18px } 
    88        #wrapper { width: 740px; margin: 0 auto; } 
    99        h1 { color: #333333; font: normal normal normal 62px/1em Impact, Charcoal, sans-serif; margin: 0 0 15px 0; } 
Note: See TracChangeset for help on using the changeset viewer.