当前位置: 首页>>代码示例>>PHP>>正文


PHP printHelp函数代码示例

本文整理汇总了PHP中printHelp函数的典型用法代码示例。如果您正苦于以下问题:PHP printHelp函数的具体用法?PHP printHelp怎么用?PHP printHelp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了printHelp函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkForArgument

function checkForArgument($inArgv, $inIndex)
{
    if (!array_key_exists($inIndex, $inArgv)) {
        printHelp();
        exit(0);
    }
}
开发者ID:stevencoulter,项目名称:cricket,代码行数:7,代码来源:cricket.php

示例2: setup

function setup($argc, $argv)
{
    if ($argc == 1 || loadOptions($argv) === false) {
        printHelp();
    }
    retrieveArgs($argv);
    loadConfigFiles();
    setupAutoload();
}
开发者ID:nsierra-,项目名称:Barebone,代码行数:9,代码来源:internals.php

示例3: createAction

function createAction($params)
{
    if (count($params) < 2) {
        printHelp();
    } else {
        list($actionType, $actionName) = explode(':', $params[0], 0);
        // expected to be "type:name", e.g. "f:save"
        if ($actionName == '') {
            printHelp();
        } else {
            // second parameter is expected to be a module name
            $moduleName = $params[1];
            if (count($params) == 2) {
                $g = new AppGenerator(__DIR__);
            } else {
                // third parameter (if given) is an app name
                $appName = $params[2];
                $g = new AppGenerator(dirname(__DIR__) . '/' . $appName);
            }
            $g->createAction($moduleName, $actionName, array('type' => $actionType));
        }
    }
}
开发者ID:barcodex,项目名称:kashevar,代码行数:23,代码来源:generator.php

示例4: getFacebookAuthorization

function getFacebookAuthorization($a = 1)
{
    global $fbo, $key, $urlAccess, $urlAuth;
    if ($a == 1) {
        printHelp("You must give your athorization code.\nVisit http://www.facebook.com/code_gen.php?v=1.0&api_key={$key} to get one for php_batch_uploader.\n\n");
        die;
    }
    try {
        $auth = $fbo->do_get_session($a);
        if (empty($auth)) {
            throw new Exception('Empty Code.');
        }
        $fbReturn = $fbo->api_client->users_getInfo($fbo->api_client->users_getLoggedInUser(), array('name'));
        $name = $fbReturn[0]["name"];
    } catch (Exception $e) {
        disp("Invalid auth code or could not authorize session.\nPlease check your auth code or generate a new one at: {$urlAuth}\n\nIf you removed php_batch_uploader from your privacy settings, you will need to reauthoize it at {$urlAccess}", 1);
    }
    disp("Executed facebook authorization.", 5);
    // Store authorization code in authentication array
    $auth['code'] = $a;
    // Save to users home directory
    file_put_contents(getenv('HOME') . "/.facebook_auth", serialize($auth));
    disp("You are now authenticated {$name}! Re-run php_batch_uploader with a list of directories you would like uploaded to facebook.", 1);
}
开发者ID:jedediahfrey,项目名称:Facebook-PHP-Batch-Picture-Uploader,代码行数:24,代码来源:facebook.inc.php

示例5: array

 /* Map short options to long options. */
 $shortOptMap = array('-h' => '--help', '-o' => '--out-dir', '-s' => '--stdout');
 if (array_key_exists($a, $shortOptMap)) {
     $a = $shortOptMap[$a];
 }
 switch ($a) {
     case '--validate-fingerprint':
         if ($v === NULL || strlen($v) === 0) {
             echo 'The --validate-fingerprint option requires an parameter.' . "\n";
             echo 'Please run `' . $progName . ' --help` for usage information.' . "\n";
             exit(1);
         }
         $validateFingerprint = $v;
         break;
     case '--help':
         printHelp();
         exit(0);
     case '--out-dir':
         if ($v === NULL || strlen($v) === 0) {
             echo 'The --out-dir option requires an parameter.' . "\n";
             echo 'Please run `' . $progName . ' --help` for usage information.' . "\n";
             exit(1);
         }
         $outputDir = $baseDir . ($v[0] == '/' ? $v : '/' . $v);
         break;
     case '--stdout':
         $toStdOut = TRUE;
         break;
     default:
         echo 'Unknown option: ' . $a . "\n";
         echo 'Please run `' . $progName . ' --help` for usage information.' . "\n";
开发者ID:danielkjfrog,项目名称:docker,代码行数:31,代码来源:metarefresh.php

示例6: parseArguments

/**
 * Parses (and checks some) command line arguments
 */
function parseArguments()
{
    global $checkOptions, $cmdargs, $checksEnabled, $periods, $periodsEnabled, $argc, $argv;
    if ($argc == 1) {
        printUsage(true);
        exit(STATUS_UNKNOWN);
    }
    $i = 1;
    while ($i < $argc) {
        if ($argv[$i][0] != '-') {
            $i++;
            continue;
        }
        switch ($argv[$i][1]) {
            case 'V':
                printVersion();
                exit(STATUS_OK);
                break;
            case 'v':
                $cmdargs['log_level'] = LOG__VERBOSE;
                $i++;
                break;
            case 'd':
                $cmdargs['log_level'] = LOG__DEBUG;
                $i++;
                break;
            case 'c':
                $cmdargs['community'] = $argv[$i + 1];
                $i++;
                break;
            case 'h':
                $cmdargs['host'] = $argv[$i + 1];
                $i++;
                break;
            case 'p':
                $cmdargs['port'] = $argv[$i + 1];
                $i++;
                break;
            case '?':
                printHelp();
                exit(STATUS_OK);
                break;
            default:
                if (!isset($argv[$i + 1]) || substr($argv[$i + 1], 0, 1) == '-') {
                    $cmdargs[substr($argv[$i], 2)] = true;
                } else {
                    $cmdargs[substr($argv[$i], 2)] = $argv[$i + 1];
                }
                $i++;
                break;
        }
    }
}
开发者ID:sdouce,项目名称:nagios-plugins,代码行数:56,代码来源:check_chassis_brocade.php

示例7: printHelp

        echo <<<EOF
It looks like this is the first time you have run php_batch_uploader on this machine.

If you have not already authorized php_batch_uploader access to your facebook account you must do that first at:
{$urlAccess}

You must then generate a one-time code at 
{$urlAuth} 

And run php_batch_uploader with the '-a' switch using the generated code.


EOF;
    } else {
        // Display Help.
        printHelp("php_batch_uploader http://github.com/jedediahfrey/Facebook-PHP-Batch-Picture-Uploader\nCopyright: Copyright (C) 2011 Jedediah Frey <php_batch_uploader@exstatic.org>\n\n");
        die;
    }
} elseif (array_key_exists("m", $options) && $options['m'] == "h") {
    // If the user asks for mode help.
    printModeHelp();
    die;
}
//// Set defaults
// Set verbosity - Default 2.
$verbosity = array_key_exists("v", $options) ? intval($options["v"]) : 2;
// Set the upload mode - Default 1.
$mode = array_key_exists("m", $options) ? $options["m"] : 1;
$albumName = array_key_exists("n", $options) ? $options["n"] : NULL;
$location = array_key_exists("l", $options) ? $options["l"] : NULL;
$description = array_key_exists("d", $options) ? $options["d"] : NULL;
开发者ID:jedediahfrey,项目名称:Facebook-PHP-Batch-Picture-Uploader,代码行数:31,代码来源:php_batch_uploader.php

示例8: translateCommandArgs

function translateCommandArgs($args)
{
    $paths = $args[1];
    foreach ($paths as $path) {
        if (!is_dir($path) && !is_file($path)) {
            die("Entered path is invalid: " . $path);
        }
    }
    foreach ($args[0] as $arg) {
        if (!isset($arg[0])) {
            continue;
        }
        switch ($arg[0]) {
            case '--noarchive':
                $GLOBALS['noarchive'] = true;
                break;
            case '--help':
                printHelp();
                die;
                break;
            case '--maxdepth':
                $GLOBALS['maxdepth'] = intval($arg[1]);
                break;
            case '--nohidden':
                $GLOBALS['nohidden'] = true;
                break;
            case '--nosystem':
                $GLOBALS['nosystem'] = true;
                break;
            case '--nodotfiles':
                $GLOBALS['nodotfiles'] = true;
                break;
            case '--excluderegex':
                $GLOBALS['excluderegex'] = $arg[1];
                break;
            case '--eofnewline':
                $GLOBALS['eofnewline'] = true;
                break;
            case '--eofstripwhite':
                $GLOBALS['eofstripwhite'] = true;
                break;
            case '--eolstripwhite':
                $GLOBALS['eolstripwhite'] = true;
                break;
        }
    }
    return $paths;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:48,代码来源:fixlineends.php

示例9: isset

#!/usr/bin/php
<?php 
$bootstrapFile = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : null;
if (!file_exists($bootstrapFile)) {
    printHelp('オートロード設定をするためのブートストラップファイルが見つかりません。');
}
$dir = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : null;
if (!is_dir($dir)) {
    printHelp('Validationクラスを配置したディレクトリが見つかりません。');
}
// カラーが表示できない場合は、$GLOBALS['ricegrain-validator-colorize'] = false; を
// ブートストラップファイルに記入して下さい。
$GLOBALS['ricegrain-validator-colorize'] = true;
define('COLOR_BLACK', 30);
define('COLOR_RED', 31);
define('COLOR_GREEN', 32);
define('COLOR_YELLOW', 33);
define('COLOR_BLUE', 34);
define('COLOR_PURPLE', 35);
define('COLOR_LIGHT_BLUE', 36);
define('COLOR_WHITE', 37);
require $bootstrapFile;
$fileList = findFile($dir);
foreach ($fileList as $file) {
    $classString = file_get_contents($file);
    if (preg_match('!namespace\\s+([^;]+);!', $classString, $matches)) {
        $namespace = $matches[1];
        if (preg_match('!class\\s+([a-zA-Z0-9]+)\\s+extends\\s+([^ ]*Validation)!', file_get_contents($file), $matches)) {
            $className = $namespace . '\\' . $matches[1];
            if ($matches[2] != 'Validation' && $matches[2] != 'RiceGrain\\Validation\\Validation') {
                continue;
开发者ID:ricegrain,项目名称:ricegrain-validator,代码行数:31,代码来源:validation-config-viewer.php

示例10: exit

 */
echo "This will install the Aether PHP framework on this computer\n";
echo "Type install path or default [/home/aether] will be used:\n";
if (!empty($argv[1]) and $argv[1] != '--help' and $argv[1] != '-h') {
    $path = $argv[1];
} else {
    exit(printHelp());
}
$arg = $argv[1];
// See if install or update is wanted
if (preg_match('/(--prefix|-p)=\\/[a-z-_.\\/]+/i', $arg)) {
    install($arg);
} elseif (preg_match('/--update|-u/', $arg)) {
    update();
} else {
    exit(printHelp());
}
/**
 * Install Aether using path found in $arg
 *
 * @return void
 */
function install($arg)
{
    if (preg_match('/^--prefix|-p=(\\/{1}[a-z-_.\\/]+[a-z-_.]+)$/i', $arg, $m)) {
        $path = $m[1];
        echo "Trying to install to {$path}/aether\n";
        // Path must exist(?)
        // Check permissions
        if (file_exists($path) and is_writable($path)) {
            $user = $_SERVER['USER'];
开发者ID:M4R7iNP,项目名称:aether,代码行数:31,代码来源:install.php

示例11: parseArguments

/**
 * Parses (and checks some) command line arguments
 */
function parseArguments()
{
    global $checkOptions, $cmdargs, $checksEnabled, $periods, $periodsEnabled, $argc, $argv;
    if ($argc == 1) {
        printUsage(true);
        exit(STATUS_UNKNOWN);
    }
    $i = 1;
    while ($i < $argc) {
        if ($argv[$i][0] != '-') {
            $i++;
            continue;
        }
        //disabling or enabling checks
        if (substr($argv[$i], 2, 8) == 'disable-' || substr($argv[$i], 2, 7) == 'enable-') {
            $op = substr($argv[$i], 2, 7) == "disable" ? 0 : 1;
            $check = $op ? substr($argv[$i], 9) : substr($argv[$i], 10);
            if ($check == "all") {
                foreach ($checkOptions as $key => $check) {
                    $checksEnabled[$key] = $op;
                }
            } else {
                if (in_array($check, $checkOptions)) {
                    $checksEnabled[$checkOptions[$check]] = $op;
                } else {
                    _log(sprintf("ERR: Unknown option %s. Use help for more details.", $argv[$i]), LOG__ERROR);
                    exit(STATUS_UNKNOWN);
                }
            }
            $i++;
            continue;
        }
        if (substr($argv[$i], 2) == "help") {
            $argv[$i] = '-h';
        }
        switch ($argv[$i][1]) {
            case 'V':
                printVersion();
                exit(STATUS_OK);
                break;
            case 'v':
                $cmdargs['log_level'] = LOG__VERBOSE;
                $i++;
                break;
            case 'd':
                $cmdargs['log_level'] = LOG__DEBUG;
                $i++;
                break;
            case 'c':
                $cmdargs['configFile'] = $argv[$i + 1];
                if (isset($argv[$i + 2])) {
                    $periodsEnabled = array();
                    while (isset($argv[$i + 2])) {
                        if (in_array($argv[$i + 2], $periods)) {
                            $periodsEnabled[] = $argv[$i + 2];
                            $i++;
                        } else {
                            if ($argv[$i + 2][0] != "-") {
                                _log("Bad period provided. Use help for more details.", LOG__ERROR);
                                exit(STATUS_UNKNOWN);
                            } else {
                                break;
                            }
                        }
                    }
                }
                $i++;
                break;
            case 'h':
            case '?':
                printHelp();
                exit(STATUS_OK);
                break;
            default:
                $i++;
        }
    }
    //check the configuration file
    if (!file_exists($cmdargs['configFile']) || !is_readable($cmdargs['configFile'])) {
        _log(sprintf("Configuration file [%s] does not exist or cannot be read.", $cmdargs['configFile']), LOG__ERROR);
        exit(STATUS_UNKNOWN);
    }
}
开发者ID:sdouce,项目名称:nagios-plugins,代码行数:86,代码来源:check_rsnapshot.php

示例12: define

<?php

define('TWITTERBOT', 1);
require_once 'config.php';
require_once 'twitterbot.php';
require_once 'action.php';
require_once OAUTH . 'twitteroauth.php';
// which args are present?
if (count($argv) > 2 || in_array('-h', $argv) || in_array('--help', $argv)) {
    die(printHelp());
}
if (in_array('--stop', $argv)) {
    // stop has been set! try to kill it
    echo "\n" . '==SHUTTING DOWN TWITTERBOT==' . "\n";
    halt();
    exit;
}
if (in_array('--tests-only', $argv)) {
    test();
    exit;
}
if (!in_array('--tests-skip', $argv)) {
    test();
}
echo "\n" . '==POWERING UP TWITTERBOT==' . "\n";
// gain the lockfile
$fp = @fopen(TWITTERBOT_LOCKFILE, "a");
if (!$fp || !flock($fp, LOCK_EX | LOCK_NB)) {
    die("Failed to acquire lock. Twitterbot may already be running.\n");
}
// this bit guarantees that the process is 1) detached, and 2) independent
开发者ID:carriercomm,项目名称:Twitterbot,代码行数:31,代码来源:run.php

示例13: header

}
// end func printSeperator
if (!isset($argc) || !isset($argv)) {
    // redirect to the web gui
    // or maybe die("This is the command line interface, use php -f cli.php to run it! Open index.php for the web interface."); ?
    header('Location: GUI/index.php');
    exit(0);
}
list($options, $error) = parseOptions($argc, $argv);
if (!is_null($error) || empty($options) || isset($options['help'])) {
    // some sort of trouble or help output requested
    if (!is_null($error)) {
        printf("\n");
        printf("Error: %s\n", $error);
    }
    printHelp($argv);
} else {
    print "\n";
    if (!empty($options['files'])) {
        foreach ($options['files'] as $k => $file) {
            convertFile($file, isset($options['verbose']), isset($options['quiet']), isset($options['update']), isset($options['backup']), isset($options['warnings']));
        }
    }
    if (!empty($options['directories'])) {
        $conv = new MySQLConverterTool_Converter();
        foreach ($options['directories'] as $k => $directory) {
            $files = $conv->getFilesOfDirectory($directory, isset($options['pattern']) ? $options['pattern'] : '');
            if (empty($files)) {
                printSeperator(sprintf('No files found in "%s"', $directory), '*');
                print "\n";
                continue;
开发者ID:josenobile,项目名称:MySQLConverterTool,代码行数:31,代码来源:cli.php


注:本文中的printHelp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。