Exemple #1
0
     */
    function getApplicationInfo()
    {
        return array('appname' => 'CherryTool', 'version' => '1.0', 'description' => 'CherryPHP helper tool', 'copyright' => "Copyright (c) 2012, The CherryPHP Project\nDistributed under GNU GPL version 3");
    }
    /**
     * Init is called when the application is created. This is the perfect place to
     * register command line arguments, hook events and set up defaults.
     */
    function init()
    {
        // Help:  -h or --help
        $this->addArgument('h', 'help', 'Show this help');
        // Application path:  -a path or --app path
        // Bound to $this->apppath
        $this->addArgument('v', 'verbose', 'Verbose mode', array($this, 'verbose'));
        $this->addCommand('action', 'Perform an action');
    }
    /**
     * Main function, when we get here everything has been parsed and loaded Ok.
     */
    function main()
    {
        if ($this->hasArgument('h') || count($this->parameters) == 0) {
            $this->usage();
            return 1;
        }
    }
}
$lepton->runApplication(new \MyApp\Application());
Exemple #2
0
<?php

define('APPLICATION', 'LeptonApplication');
// Bootstrap
if (!@(include_once "lib/bootstrap.php")) {
    $libpath = getenv('CHERRY_LIB');
    if (!$libpath) {
        fprintf(STDERR, "Define the CHERRY_LIB envvar first.");
        exit(1);
    }
    require_once $libpath . '/lib/bootstrap.php';
}
$lepton = new \cherry\Lepton(__FILE__);
use cherry\base\Event;
use cherry\base\EventEmitter;
use cherry\BundleManager;
use Cherry\Extension\ExtensionManager;
BundleManager::load('cherry.net');
BundleManager::load('cherry.mvc');
BundleManager::load('cherry.crypto');
BundleManager::load('cherry.user');
//ExtensionManager::load('cherrybar');
$rt = \Cherry\Mvc\Router\StaticRoutes::getInstance();
$rt->addRoute('/start/', '\\MyApp\\Controllers\\IndexController:start');
$app = new \cherry\Mvc\Application();
$lepton->runApplication($app);
//$lv = new \cherry\mvc\view\LipsumView();
//echo $lv->getViewcontents();