예제 #1
0
파일: fbcmd.php 프로젝트: harleypig/fbcmd
function ValidateParamCount($a, $b = null)
{
    global $fbcmdParams;
    global $fbcmdCommand;
    $num = ParamCount();
    $showHelp = false;
    if (is_array($a)) {
        if (!in_array($num, $a)) {
            $showHelp = true;
        }
    } else {
        if ($b == null) {
            if ($num != $a) {
                $showHelp = true;
            }
        } else {
            if ($num < $a || $num > $b) {
                $showHelp = true;
            }
        }
    }
    if ($showHelp) {
        print "\n";
        FbcmdWarning("[{$fbcmdCommand}] Invalid number of parameters");
        print "\n";
        print "try:        [fbcmd help " . strtolower($fbcmdCommand) . "]\nto launch:  http://fbcmd.dtompkins.com/commands/" . strtolower($fbcmdCommand) . "\n\nbasic help:\n\n";
        ShowUsageCmd($fbcmdCommand);
        exit;
    }
}
예제 #2
0
파일: fbcmd.php 프로젝트: adamkundrat/fbcmd
function ValidateParamCount($a, $b = null)
{
    global $fbcmdParams;
    global $fbcmdCommand;
    $num = ParamCount();
    $showHelp = false;
    if (is_array($a)) {
        if (!in_array($num, $a)) {
            $showHelp = true;
        }
    } else {
        if ($b == null) {
            if ($num != $a) {
                $showHelp = true;
            }
        } else {
            if ($num < $a || $num > $b) {
                $showHelp = true;
            }
        }
    }
    if ($showHelp) {
        FbcmdFatalError("[{$fbcmdCommand}] Invalid number of parameters: try fbcmd HELP\n      visit http://fbcmd.dtompkins.com/commands/" . strtolower($fbcmdCommand) . " for more information");
    }
}