• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP have_option函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: clear_jabber

function clear_jabber($id)
{
    $user = User::getKV('id', $id);
    if ($user && $user->jabber) {
        echo "clearing user {$id}'s user.jabber, was: {$user->jabber}";
        if (have_option('dry-run')) {
            echo " (SKIPPING)";
        } else {
            $original = clone $user;
            $user->jabber = null;
            try {
                $user->updateWithKeys($original);
            } catch (Exception $e) {
                echo "WARNING: user update failed (setting jabber to null): " . $e->getMessage() . "\n";
            }
        }
        echo "\n";
    } else {
        if (!$user) {
            echo "Missing user for {$id}\n";
        } else {
            echo "Cleared jabber already for {$id}\n";
        }
    }
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:clear_jabber.php


示例2: sphinx_base

function sphinx_base()
{
    if (have_option('base')) {
        return get_option_value('base');
    } else {
        return "/usr/local/sphinx";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:8,代码来源:sphinx-utils.php


示例3: sphinx_index_update

function sphinx_index_update($sn)
{
    $base = sphinx_base();
    $baseIndexes = array('notice', 'profile');
    $params = array();
    if (have_option('rotate')) {
        $params[] = '--rotate';
    }
    foreach ($baseIndexes as $index) {
        $params[] = "{$sn->dbname}_{$index}";
    }
    $params = implode(' ', $params);
    $cmd = "{$base}/bin/indexer --config {$base}/etc/sphinx.conf {$params}";
    print "{$cmd}\n";
    system($cmd);
}
开发者ID:microcosmx,项目名称:experiments,代码行数:16,代码来源:index_update.php


示例4: importActivityStream

function importActivityStream($user, $doc)
{
    $feed = $doc->documentElement;
    $entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
    for ($i = $entries->length - 1; $i >= 0; $i--) {
        $entry = $entries->item($i);
        $activity = new Activity($entry, $feed);
        $object = $activity->objects[0];
        if (!have_option('q', 'quiet')) {
            print $activity->content . "\n";
        }
        $html = getTweetHtml($object->link);
        $config = array('safe' => 1, 'deny_attribute' => 'class,rel,id,style,on*');
        $html = htmLawed($html, $config);
        $content = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
        $notice = Notice::saveNew($user->id, $content, 'importtwitter', array('uri' => $object->id, 'url' => $object->link, 'rendered' => $html, 'created' => common_sql_date($activity->time), 'replies' => array(), 'groups' => array()));
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:18,代码来源:importtwitteratom.php


示例5: updateProfileURL

function updateProfileURL($user)
{
    $profile = $user->getProfile();
    if (empty($profile)) {
        throw new Exception("Can't find profile for user {$user->nickname} ({$user->id})");
    }
    $orig = clone $profile;
    $profile->profileurl = common_profile_url($user->nickname);
    if (!have_option('q', 'quiet')) {
        print "Updating profile url for {$user->nickname} ({$user->id}) " . "from {$orig->profileurl} to {$profile->profileurl}...";
    }
    $result = $profile->update($orig);
    if (!$result) {
        print "FAIL.\n";
        common_log_db_error($profile, 'UPDATE', __FILE__);
        throw new Exception("Can't update profile for user {$user->nickname} ({$user->id})");
    }
    common_broadcast_profile($profile);
    print "OK.\n";
}
开发者ID:microcosmx,项目名称:experiments,代码行数:20,代码来源:updateprofileurl.php


示例6: clear_jabber

function clear_jabber($id)
{
    $user = User::staticGet('id', $id);
    if ($user && $user->jabber) {
        echo "clearing user {$id}'s user.jabber, was: {$user->jabber}";
        if (have_option('dry-run')) {
            echo " (SKIPPING)";
        } else {
            $original = clone $user;
            $user->jabber = null;
            $result = $user->updateKeys($original);
        }
        echo "\n";
    } else {
        if (!$user) {
            echo "Missing user for {$id}\n";
        } else {
            echo "Cleared jabber already for {$id}\n";
        }
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:21,代码来源:clear_jabber.php


示例7: siteStreamForOwner

function siteStreamForOwner(User $user)
{
    // The user we auth as must be the owner of the application.
    $auth = twitterAuthForUser($user);
    if (have_option('apiroot')) {
        $stream = new TwitterSiteStream($auth, get_option_value('apiroot'));
    } else {
        $stream = new TwitterSiteStream($auth);
    }
    // Pull Twitter user IDs for all users we want to pull data for
    $userIds = array();
    $flink = new Foreign_link();
    $flink->service = TWITTER_SERVICE;
    $flink->find();
    while ($flink->fetch()) {
        if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) {
            $userIds[] = $flink->foreign_id;
        }
    }
    $stream->followUsers($userIds);
    return $stream;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:22,代码来源:streamtest.php


示例8: MagicEnvelope

print "\n\n";
echo "== Testing local verification ==\n\n";
$magic_env = new MagicEnvelope($envxml);
$activity = new Activity($magic_env->getPayload()->documentElement);
$actprofile = Profile::fromUri($activity->actor->id);
$ok = $magic_env->verify($actprofile);
if ($ok) {
    print "OK\n\n";
} else {
    print "FAIL\n\n";
}
if (have_option('--verify')) {
    $url = 'http://www.madebymonsieur.com/ostatus_discovery/magic_env/validate/';
    echo "== Testing remote verification ==\n\n";
    print "Sending for verification to {$url} ...\n";
    $client = new HTTPClient();
    $response = $client->post($url, array(), array('magic_env' => $envxml));
    print $response->getStatus() . "\n\n";
    print $response->getBody() . "\n\n";
}
if (have_option('--slap')) {
    $url = get_option_value('--slap');
    echo "== Remote salmon slap ==\n\n";
    print "Sending signed Salmon slap to {$url} ...\n";
    $ok = Salmon::post($url, $entry, $profile->getUser());
    if ($ok) {
        print "OK\n\n";
    } else {
        print "FAIL\n\n";
    }
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:slap.php


示例9: array

$shortoptions = 'i:n:f:a:j';
$longoptions = array('id=', 'nickname=', 'file=', 'after=', 'json');
$helptext = <<<END_OF_EXPORTACTIVITYSTREAM_HELP
exportactivitystream.php [options]
Export a StatusNet user history to a file

  -i --id       ID of user to export
  -n --nickname nickname of the user to export
  -j --json     Output JSON (default Atom)
  -a --after    Only activities after the given date

END_OF_EXPORTACTIVITYSTREAM_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
try {
    $user = getUser();
    if (have_option('a', 'after')) {
        $afterStr = get_option_value('a', 'after');
        $after = strtotime($afterStr);
        $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW, $after);
    } else {
        $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW);
    }
    if (have_option('j', 'json')) {
        $actstr->writeJSON(STDOUT);
    } else {
        print $actstr->getString();
    }
} catch (Exception $e) {
    print $e->getMessage() . "\n";
    exit(1);
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:backupuser.php


示例10: printfv

                        if ($e > $st && $e <= $jt) {
                            printfv("{$i} Making a new group join\n");
                            newJoin($n, $g);
                        } else {
                            printfv("No event for {$i}!");
                        }
                    }
                }
            }
        }
    }
}
$usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100;
$groupcount = have_option('g', 'groups') ? get_option_value('g', 'groups') : 20;
$noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100;
$subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10);
$joinsavg = have_option('j', 'joins') ? get_option_value('j', 'joins') : 5;
$tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000;
$userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser';
$groupprefix = have_option('z', 'groupprefix') ? get_option_value('z', 'groupprefix') : 'testgroup';
$wordsfile = have_option('w', 'words') ? get_option_value('w', 'words') : '/usr/share/dict/words';
if (is_readable($wordsfile)) {
    $words = file($wordsfile);
} else {
    $words = null;
}
try {
    main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax);
} catch (Exception $e) {
    printfv("Got an exception: " . $e->getMessage());
}
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:31,代码来源:createsim.php


示例11: exit

    exit(0);
}
$tag = $args[1];
$i = array_search($tag, $tags);
if ($i !== false) {
    if (have_option('d', 'delete')) {
        // Delete
        unset($tags[$i]);
        $result = $sn->setTags($tags);
        if (!$result) {
            print "Couldn't update.\n";
            exit(-1);
        }
    } else {
        print "Already set.\n";
        exit(-1);
    }
} else {
    if (have_option('d', 'delete')) {
        // Delete
        print "No such tag.\n";
        exit(-1);
    } else {
        $tags[] = $tag;
        $result = $sn->setTags($tags);
        if (!$result) {
            print "Couldn't update.\n";
            exit(-1);
        }
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:31,代码来源:settag.php


示例12: main

    $from->free();
    $to->free();
}
function main($usercount, $noticeavg, $subsavg, $tagmax)
{
    global $config;
    $config['site']['dupelimit'] = -1;
    $n = 1;
    newUser(0);
    // # registrations + # notices + # subs
    $events = $usercount + $usercount * ($noticeavg + $subsavg);
    for ($i = 0; $i < $events; $i++) {
        $e = rand(0, 1 + $noticeavg + $subsavg);
        if ($e == 0) {
            newUser($n);
            $n++;
        } else {
            if ($e < $noticeavg + 1) {
                newNotice($n, $tagmax);
            } else {
                newSub($n);
            }
        }
    }
}
$usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100;
$noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100;
$subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10);
$tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000;
$userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser';
main($usercount, $noticeavg, $subsavg, $tagmax);
开发者ID:microcosmx,项目名称:experiments,代码行数:31,代码来源:createsim.php


示例13: array

$longoptions = array('oauth_token=', 'token_secret=');
$helptext = <<<END_OF_VERIFY_HELP
  verifycreds.php [options]
  Use an access token to verify credentials thru the api

    -o --oauth_token       access token
    -s --token_secret      access token secret

END_OF_VERIFY_HELP;
$token = null;
$token_secret = null;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('o', 'oauth_token')) {
    $token = get_option_value('oauth_token');
}
if (have_option('s', 'token_secret')) {
    $token_secret = get_option_value('s', 'token_secret');
}
if (empty($token)) {
    print "Please specify an access token.\n";
    exit(1);
}
if (empty($token_secret)) {
    print "Please specify an access token secret.\n";
    exit(1);
}
$ini = parse_ini_file("oauth.ini");
$test_consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
$endpoint = $ini['apiroot'] . '/account/verify_credentials.xml';
print "{$endpoint}\n";
$at = new OAuthToken($token, $token_secret);
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:31,代码来源:verifycreds.php


示例14: common_log

                        Subscription::start($profile, $friend_profile);
                        common_log(LOG_INFO, $this->name() . ' - Subscribed ' . "{$friend_profile->nickname} to {$profile->nickname}.");
                    } catch (Exception $e) {
                        common_debug($this->name() . ' - Tried and failed subscribing ' . "{$friend_profile->nickname} to {$profile->nickname} - " . $e->getMessage());
                    }
                }
            }
        }
        return true;
    }
}
$id = null;
$debug = null;
if (have_option('i')) {
    $id = get_option_value('i');
} else {
    if (have_option('--id')) {
        $id = get_option_value('--id');
    } else {
        if (count($args) > 0) {
            $id = $args[0];
        } else {
            $id = null;
        }
    }
}
if (have_option('d') || have_option('debug')) {
    $debug = true;
}
$syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug);
$syncer->runOnce();
开发者ID:phpsource,项目名称:gnu-social,代码行数:31,代码来源:synctwitterfriends.php


示例15: exit

Pull an Atom feed and run items in it as though they were live PuSH updates.
Mainly intended for testing funky feed formats.

     --skip=N   Ignore the first N items in the feed.
     --count=N  Only process up to N items from the feed, after skipping.


END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (empty($args[0]) || !Validate::uri($args[0])) {
    print "{$helptext}";
    exit(1);
}
$feedurl = $args[0];
$skip = have_option('skip') ? intval(get_option_value('skip')) : 0;
$count = have_option('count') ? intval(get_option_value('count')) : 0;
$sub = FeedSub::staticGet('topic', $feedurl);
if (!$sub) {
    print "Feed {$feedurl} is not subscribed.\n";
    exit(1);
}
$xml = file_get_contents($feedurl);
if ($xml === false) {
    print "Bad fetch.\n";
    exit(1);
}
$feed = new DOMDocument();
if (!$feed->loadXML($xml)) {
    print "Bad XML.\n";
    exit(1);
}
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:31,代码来源:testfeed.php


示例16: updateGroupUri

function updateGroupUri($group)
{
    if (!have_option('q', 'quiet')) {
        print "Updating URI for group '" . $group->nickname . "' (" . $group->id . ")...";
    }
    if (empty($group->uri)) {
        // Using clone here was screwing up the group->find() iteration
        $orig = User_group::staticGet('id', $group->id);
        $group->uri = $group->getUri();
        if (have_option('dry_run')) {
            echo " would have set {$group->uri} ";
        } else {
            if (!$group->update($orig)) {
                throw new Exception("Can't update uri for group " . $group->nickname . ".");
            }
            echo " set {$group->uri} ";
        }
    } else {
        print " already set, keeping {$group->uri} ";
    }
    if (have_option('v', 'verbose')) {
        print "DONE.";
    }
    if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
        print "\n";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:27,代码来源:fixup_group_uri.php


示例17: array

$longoptions = array('dry-run');
$helptext = <<<END_OF_HELP
rm_bad_feedsubs.php [options]
Deletes feedsub records that are in the inconsistent state of "subscribe"
and are older than one hour. If the hub hasn't answered back in an hour
the hub is probably either broken or doesn't exist.'

      Options:

    -d --dry-run look but don't mess with it


END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$dry = false;
if (have_option('d') || have_option('dry-run')) {
    $dry = true;
}
echo "Looking for feed subscriptions with dirty no good huburis...\n";
$feedsub = new FeedSub();
$feedsub->sub_state = 'subscribe';
$feedsub->whereAdd('created < DATE_SUB(NOW(), INTERVAL 1 HOUR)');
$feedsub->find();
$cnt = 0;
while ($feedsub->fetch()) {
    echo "----------------------------------------------------------------------------------------\n";
    echo '           feed: ' . $feedsub->uri . "\n" . '        hub uri: ' . $feedsub->huburi . "\n" . ' subscribe date: ' . date('r', strtotime($feedsub->created)) . "\n";
    if (!$dry) {
        $feedsub->delete();
        echo "                 (DELETED)\n";
    } else {
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:rm_bad_feedsubs.php


示例18: define

 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
$shortoptions = 'i:n:au';
$longoptions = array('id=', 'nickname=', 'all', 'universe');
$helptext = <<<END_OF_SENDEMAILSUMMARY_HELP
sendemailsummary.php [options]
Send an email summary of the inbox to users

 -i --id       ID of user to send summary to
 -n --nickname nickname of the user to send summary to
 -a --all      send summary to all users
 -u --universe send summary to all users on all sites

END_OF_SENDEMAILSUMMARY_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('u', 'universe')) {
    $sn = new Status_network();
    if ($sn->find()) {
        while ($sn->fetch()) {
            $server = $sn->getServerName();
            StatusNet::init($server);
            // Different queue manager, maybe!
            $qm = QueueManager::get();
            $qm->enqueue(1, 'sitesum');
        }
    }
} else {
    $qm = QueueManager::get();
    // enqueue summary for user or all users
    try {
        $user = getUser();
开发者ID:Grasia,项目名称:bolotweet,代码行数:31,代码来源:sendemailsummary.php


示例19: showProfileInfo

    }
    echo "After:\n";
    showProfileInfo($oprofile);
    return true;
}
$ok = true;
$validate = new Validate();
if (have_option('all')) {
    $oprofile = new Ostatus_profile();
    $oprofile->find();
    echo "Found {$oprofile->N} profiles:\n\n";
    while ($oprofile->fetch()) {
        $ok = fixProfile($oprofile->uri) && $ok;
    }
} else {
    if (have_option('suspicious')) {
        $oprofile = new Ostatus_profile();
        $oprofile->joinAdd(array('profile_id', 'profile:id'));
        $oprofile->whereAdd("nickname rlike '^[0-9]\$'");
        $oprofile->find();
        echo "Found {$oprofile->N} matching profiles:\n\n";
        while ($oprofile->fetch()) {
            $ok = fixProfile($oprofile->uri) && $ok;
        }
    } else {
        if (!empty($args[0]) && $validate->uri($args[0])) {
            $uri = $args[0];
            $ok = fixProfile($uri);
        } else {
            print "{$helptext}";
            $ok = false;
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:update-profile-data.php


示例20: get_option_value

    $id = get_option_value('i', 'id');
    $user = User::staticGet('id', $id);
    if (empty($user)) {
        print "Can't find user with ID {$id}\n";
        exit(1);
    }
} else {
    if (have_option('n', 'nickname')) {
        $nickname = get_option_value('n', 'nickname');
        $user = User::staticGet('nickname', $nickname);
        if (empty($user)) {
            print "Can't find user with nickname '{$nickname}'\n";
            exit(1);
        }
    } else {
        if (have_option('o', 'owner')) {
            $user = User::siteOwner();
            if (empty($user)) {
                print "Site has no owner.\n";
                exit(1);
            }
        } else {
            print "You must provide either an ID or a nickname.\n\n";
            print $helptext;
            exit(1);
        }
    }
}
// @todo refactor the interactive console in console.php and use
// that to optionally make an interactive test console here too.
// Would be good to help people test commands when XMPP or email
开发者ID:microcosmx,项目名称:experiments,代码行数:31,代码来源:command.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP have_posts函数代码示例发布时间:2022-05-15
下一篇:
PHP have_comments函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap