# Vérification du niveau de titre
if ($this->getOpt('first_title_level') > 4) {
# traitement des titres à la setext
if ($this->getOpt('active_setext_title') && $this->getOpt('active_title')) {
# Transformation des mots Wiki
if ($this->getOpt('active_wikiwords') && $this->getOpt('words_pattern')) {
$res = preg_replace('/'.$this->getOpt('words_pattern').'/msu','¶¶¶$1¶¶¶',$res);
}
# Transformation des URLs automatiques
if ($this->getOpt('active_auto_urls'))
{
$active_urls = $this->getOpt('active_urls');
foreach ($tree as &$leaf) {
$leaf = preg_replace($this->getOpt('auto_url_pattern'),'[$1$2]',$leaf);
# Line break
if ($this->getOpt('active_br')) {
namespace Sheldon;
use Zend\Console\Getopt;
*
* Uses ZF Getopt class. Proxies unhandled method calls through to the underlying Getopt object.
/**
* @var Getopt
/**
* If your command accepts required parameters, define them here, formatted for the ZendFramework Getopt library.
* to retreive a specific value. If an option-key has aliases, eg, v|vbr|verbose it'll return the first "longopt"
* it encounters (vbr in this case) but that's fine b/c Getopt handles aliases how you'd expect it to.
/**
* Create a new Getopt object and validate the existence of any options defined in the $required property.
* @param null $argv An array or string of commandline arguments. If not provided, Getopt will default to using $_SERVER['argv']
*/
{
$this->cli = new Getopt(null);
$this->cli->addRules($this->required + $this->optional + $this->builtin);
'Archive_Tar-stable',
'Console_Getopt-stable',
print 'Bootstrapping: Console_Getopt.........';
$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_', substr(substr($tarball['Console_Getopt'], 15), 0, -4));
$url = "http://cvs.php.net/co.php/pear-core/Console/Getopt.php?p=1&r=$r";
mkdir('Console', 0700);
if (in_array('Getopt.php', $local_dir)) {
copy(dirname(__FILE__).'/go-pear-bundle/Getopt.php', 'Console/Getopt.php');
echo "(local) ";
} else {
download_url($url, 'Console/Getopt.php', $http_proxy);
public function getConfigString($variable, $defaultValue = ""){
$v = getopt("", array("$variable::"));
public function getConfigInt($variable, $defaultValue = 0){
$v = getopt("", array("$variable::"));
public function getConfigBoolean($variable, $defaultValue = false){
$v = getopt("", array("$variable::"));
// }}}
// {{{ getGetoptArgs()
/**
* Compiles arguments for getopt.
* @param string $command command to get optstring for
* @param string $short_args (reference) short getopt format
* @param array $long_args (reference) long getopt format
*
*/
function getGetoptArgs($command, &$short_args, &$long_args)
$obj = &PEAR_Command::getObject($command);
return $obj->getGetoptArgs($command, $short_args, $long_args);
protected function parseCliArguments() {
// Prepare for getopt(). Note that it supports "require value" for cli args,
// but we use our own format instead (see also php.net/getopt).
$getoptShort = '';
$getoptLong = array();
foreach ( $this->flags as $flagKey => $flagInfo ) {
case 'value':
$getoptShort .= $flagKey . '::';
case 'boolean':
$getoptShort .= $flagKey;
case 'value':
$getoptLong[] = $optionName . '::';
// Help or continue
if ( $this->getOption( 'help' ) ) {
protected function outRaw( $text ) {
if ( !$this->getOption( 'quiet' ) ) {
// }}}
// {{{ getGetoptArgs()
/**
* Compiles arguments for getopt.
* @param string $command command to get optstring for
* @param string $short_args (reference) short getopt format
* @param array $long_args (reference) long getopt format
*
*/
function getGetoptArgs($command, &$short_args, &$long_args)
$obj = &PEAR_Command::getObject($command);
return $obj->getGetoptArgs($command, $short_args, $long_args);
// }}}
// {{{ getGetoptArgs()
/**
* Compiles arguments for getopt.
* @param string $command command to get optstring for
* @param string $short_args (reference) short getopt format
* @param array $long_args (reference) long getopt format
*
*/
function getGetoptArgs($command, &$short_args, &$long_args)
$obj = &PEAR_Command::getObject($command);
return $obj->getGetoptArgs($command, $short_args, $long_args);
$longOptions = array('aggressive', 'timid', 'no-inheritance', 'help', 'ignore=', 'extensions=');
$options = $this->getopt($args, $shortOptions, $longOptions);
* @param array $args the array of arguments from the command line
* @param string $shortOpts short options as proscribed by PHP's getopt()
* @param string $longOpts long options as proscribed by PHP's getopt()
*/
protected function getopt($args, $shortOpts, $longOpts)
/**
* Helper function to {@link $this->getopt()}
/**
* Helper function to {@link $this->getopt()}
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
array (
'reserved' => '/^(cd|cp|rm|echo|printf|exit|cut|join|comm|fmt|grep|egrep|fgrep|sed|awk|yes|false|true|test|expr|tee|basename|dirname|pathchk|pwd|stty|tty|env|printenv|id|logname|whoami|groups|users|who|date|uname|hostname|chroot|nice|nohup|sleep|factor|seq|getopt|getopts|options|shift)$/',
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @version SVN: $Id: GetoptPlus.php 30 2007-07-23 16:46:42Z mcorne $
require_once 'Console/Getopt.php';
*/
class PHP_DocBlockGenerator_GetoptPlus
* keys if true, or leave them as returned by
* Console_Getopt::doGetopt(), default is true
* @param integer $version Console_Getopt::doGetopt version
* @return array the options and parameters
*/
public static function getopt($config = array(), $toLongNames = true, $asKeys = true, $version = 2)
{
$getopt = new self;
// silently ignore invalid configuration arrays, defaults the absent ones to empty arrays
$default = array_combine($getopt->configKeys, array_fill(0, count($getopt->configKeys), array()));