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


PHP User_group::getUri方法代码示例

本文整理汇总了PHP中User_group::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP User_group::getUri方法的具体用法?PHP User_group::getUri怎么用?PHP User_group::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User_group的用法示例。


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

示例1: updateGroupUrls

function updateGroupUrls()
{
    printfnq("Updating group URLs...\n");
    $group = new User_group();
    if ($group->find()) {
        while ($group->fetch()) {
            try {
                printfv("Updating group {$group->nickname}...");
                $orig = User_group::getKV('id', $group->id);
                if (!empty($group->original_logo)) {
                    $group->original_logo = Avatar::url(basename($group->original_logo));
                    $group->homepage_logo = Avatar::url(basename($group->homepage_logo));
                    $group->stream_logo = Avatar::url(basename($group->stream_logo));
                    $group->mini_logo = Avatar::url(basename($group->mini_logo));
                }
                // XXX: this is a hack to see if a group is local or not
                $localUri = common_local_url('groupbyid', array('id' => $group->id));
                if ($group->getUri() != $localUri) {
                    $group->mainpage = common_local_url('showgroup', array('nickname' => $group->nickname));
                }
                $group->update($orig);
                printfv("DONE.");
            } catch (Exception $e) {
                echo "Can't update avatars for group " . $group->nickname . ": " . $e->getMessage();
            }
        }
    }
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:28,代码来源:updateurls.php

示例2: initLocalGroup

function initLocalGroup()
{
    printfnq("Ensuring all local user groups have a local_group...");
    $group = new User_group();
    $group->whereAdd('NOT EXISTS (select group_id from local_group where group_id = user_group.id)');
    $group->find();
    while ($group->fetch()) {
        try {
            // Hack to check for local groups
            if ($group->getUri() == common_local_url('groupbyid', array('id' => $group->id))) {
                $lg = new Local_group();
                $lg->group_id = $group->id;
                $lg->nickname = $group->nickname;
                $lg->created = $group->created;
                // XXX: common_sql_now() ?
                $lg->modified = $group->modified;
                $lg->insert();
            }
        } catch (Exception $e) {
            printfv("Error initializing local group for {$group->nickname}:" . $e->getMessage());
        }
    }
    printfnq("DONE.\n");
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:24,代码来源:upgrade.php

示例3: fromGroup

 static function fromGroup(User_group $group)
 {
     $object = new ActivityObject();
     if (Event::handle('StartActivityObjectFromGroup', array($group, &$object))) {
         $object->type = ActivityObject::GROUP;
         $object->id = $group->getUri();
         $object->title = $group->getBestName();
         $object->link = $group->getUri();
         $object->avatarLinks[] = AvatarLink::fromFilename($group->homepage_logo, AVATAR_PROFILE_SIZE);
         $object->avatarLinks[] = AvatarLink::fromFilename($group->stream_logo, AVATAR_STREAM_SIZE);
         $object->avatarLinks[] = AvatarLink::fromFilename($group->mini_logo, AVATAR_MINI_SIZE);
         $object->poco = PoCo::fromGroup($group);
         Event::handle('EndActivityObjectFromGroup', array($group, &$object));
     }
     return $object;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:16,代码来源:activityobject.php

示例4: array

// using the uri field, at which point we can clearly see it breaks stuff.
echo "Checking for leftover bogus user_group.uri entries obscuring local_group entries...\n";
$group = new User_group();
$group->joinAdd(array('id', 'local_group:group_id'), 'LEFT');
$group->whereAdd('group_id IS NULL');
$marker = mt_rand(31337, 31337000);
$groupTemplate = common_local_url('groupbyid', array('id' => $marker));
$encGroup = $group->escape($groupTemplate, true);
$encGroup = str_replace($marker, '%', $encGroup);
echo "  LIKE '{$encGroup}'\n";
$group->whereAdd("uri LIKE '{$encGroup}'");
$group->find();
$count = $group->N;
echo "Found {$count}...\n";
while ($group->fetch()) {
    $uri = $group->getUri();
    if (preg_match('!/group/(\\d+)/id!', $uri, $matches)) {
        $id = intval($matches[1]);
        $local = Local_group::getKV('group_id', $id);
        if ($local) {
            $nick = $local->nickname;
        } else {
            $nick = '<deleted>';
        }
        echo "local group {$id} ({$local->nickname}) hidden by {$uri} (bogus group id {$group->id})";
        if ($dry) {
            echo " - skipping\n";
        } else {
            echo " - removing bogus user_group entry...";
            $evil = User_group::getKV('id', $group->id);
            $evil->delete();
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:fixup-shadow.php


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