Source for file AddEntryPoint.php

Documentation is available at AddEntryPoint.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  AddEntryPoint.php
  5.  *
  6.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: 7a47005ba7a65c14b63abfcdf0f097ccdc1642d0 $
  10.  */
  11.  
  12. require_once 'Ethna/class/Plugin/Handle/AddAction.php';
  13.  
  14. // {{{ Ethna_Plugin_Handle_AddEntryPoint
  15. /**
  16.  *  add-action handler
  17.  *
  18.  *  @author     ICHII Takashi <ichii386@schweetheart.jp>
  19.  *  @access     public
  20.  *  @package    Ethna
  21.  */
  22. {
  23.     /**
  24.      *  add action entry point
  25.      *
  26.      *  @access public
  27.      */
  28.     function perform()
  29.     {
  30.         $r $this->_getopt(array('basedir=''skelfile=''gateway='));
  31.         if (Ethna::isError($r)) {
  32.             return $r;
  33.         }
  34.         list($opt_list$arg_list$r;
  35.  
  36.         // action_name
  37.         $action_name array_shift($arg_list);
  38.         if ($action_name == null{
  39.             return Ethna::raiseError('action name isn\'t set.''usage');
  40.         }
  41.         $r Ethna_Controller::checkActionName($action_name);
  42.         if (Ethna::isError($r)) {
  43.             return $r;
  44.         }
  45.  
  46.         // add entry point
  47.         $ret $this->_perform('EntryPoint'$action_name$opt_list);
  48.         if (Ethna::isError($ret|| $ret === false
  49.             return $ret;
  50.         }
  51.  
  52.         // add action (no effects if already exists.)
  53.         $ret $this->_perform('Action'$action_name$opt_list);
  54.         if (Ethna::isError($ret|| $ret === false
  55.             return $ret;
  56.         }
  57.  
  58.         return true;
  59.  
  60.     }
  61.  
  62.     /**
  63.      *  get handler's description
  64.      *
  65.      *  @access public
  66.      */
  67.     function getDescription()
  68.     {
  69.         return <<<EOS
  70. add new action and its entry point to project:
  71.     {$this->id} [-b|--basedir=dir] [-s|--skelfile=file] [-g|--gateway=www|cli] [action]
  72.  
  73. EOS;
  74.     }
  75.  
  76.     /**
  77.      *  @access public
  78.      */
  79.     function getUsage()
  80.     {
  81.         return <<<EOS
  82. ethna {$this->id} [-b|--basedir=dir] [-s|--skelfile=file] [-g|--gateway=www|cli] [action]
  83. EOS;
  84.     }
  85. }
  86. // }}}

Documentation generated on Fri, 11 Nov 2011 03:57:27 +0900 by phpDocumentor 1.4.3