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

PHP get_rel_link函数代码示例

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

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



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

示例1: get

 function get()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $channel = \App::get_channel();
     $is_owner = local_channel() && local_channel() == $channel['channel_id'];
     //check for updated items and remove them
     require_once 'include/sharedwithme.php';
     apply_updates();
     //drop single file - localuser
     if (argc() > 2 && argv(2) === 'drop') {
         $id = intval(argv(1));
         q("DELETE FROM item WHERE id = %d AND uid = %d", intval($id), intval(local_channel()));
         goaway(z_root() . '/sharedwithme');
     }
     //drop all files - localuser
     if (argc() > 1 && argv(1) === 'dropall') {
         q("DELETE FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()));
         goaway(z_root() . '/sharedwithme');
     }
     //list files
     $r = q("SELECT id, uid, object, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()), dbesc($channel['channel_hash']));
     $items = array();
     $ids = '';
     if ($r) {
         foreach ($r as $rr) {
             $object = json_decode($rr['object'], true);
             $item = array();
             $item['id'] = $rr['id'];
             $item['objfiletype'] = $object['filetype'];
             $item['objfiletypeclass'] = getIconFromType($object['filetype']);
             $item['objurl'] = rawurldecode(get_rel_link($object['link'], 'alternate')) . '?f=&zid=' . $channel['xchan_addr'];
             $item['objfilename'] = $object['filename'];
             $item['objfilesize'] = userReadableSize($object['filesize']);
             $item['objedited'] = $object['edited'];
             $item['unseen'] = $rr['item_unseen'];
             $items[] = $item;
             if ($item['unseen'] > 0) {
                 $ids .= " '" . $rr['id'] . "',";
             }
         }
     }
     if ($ids) {
         //remove trailing ,
         $ids = rtrim($ids, ",");
         q("UPDATE item SET item_unseen = 0 WHERE id IN ( {$ids} ) AND uid = %d", intval(local_channel()));
     }
     $o = profile_tabs($a, $is_owner, $channel['channel_address']);
     $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array('$header' => t('Files: shared with me'), '$name' => t('Name'), '$label_new' => t('NEW'), '$size' => t('Size'), '$lastmod' => t('Last Modified'), '$dropall' => t('Remove all files'), '$drop' => t('Remove this file'), '$items' => $items));
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:53,代码来源:Sharedwithme.php


示例2: remove_community_tag

/**
 * @brief
 *
 * @param array $sender an associative array with
 *   * \e string \b hash a xchan_hash
 * @param array $arr an associative array
 *   * \e int \b verb
 *   * \e int \b obj_type
 *   * \e int \b mid
 * @param int $uid
 */
function remove_community_tag($sender, $arr, $uid)
{
    if (!(activity_match($arr['verb'], ACTIVITY_TAG) && $arr['obj_type'] == ACTIVITY_OBJ_TAGTERM)) {
        return;
    }
    logger('remove_community_tag: invoked');
    if (!get_pconfig($uid, 'system', 'blocktags')) {
        logger('remove_community tag: permission denied.');
        return;
    }
    $r = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($arr['mid']), intval($uid));
    if (!$r) {
        logger('remove_community_tag: no item');
        return;
    }
    if ($sender['hash'] != $r[0]['owner_xchan'] && $sender['hash'] != $r[0]['author_xchan']) {
        logger('remove_community_tag: sender not authorised.');
        return;
    }
    $i = $r[0];
    if ($i['target']) {
        $i['target'] = json_decode_plus($i['target']);
    }
    if ($i['object']) {
        $i['object'] = json_decode_plus($i['object']);
    }
    if (!($i['target'] && $i['object'])) {
        logger('remove_community_tag: no target/object');
        return;
    }
    $message_id = $i['target']['id'];
    $r = q("select id from item where mid = '%s' and uid = %d limit 1", dbesc($message_id), intval($uid));
    if (!$r) {
        logger('remove_community_tag: no parent message');
        return;
    }
    q("delete from term where uid = %d and oid = %d and otype = %d and type = %d and term = '%s' and url = '%s'", intval($uid), intval($r[0]['id']), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc($i['object']['title']), dbesc(get_rel_link($i['object']['link'], 'alternate')));
}
开发者ID:23n,项目名称:hubzilla,代码行数:49,代码来源:zot.php


示例3: tag_deliver

/**
 * @brief Called when we deliver things that might be tagged in ways that require delivery processing.
 *
 * Handles community tagging of posts and also look for mention tags and sets up
 * a second delivery chain if appropriate.
 *
 * @param int $uid
 * @param int $item_id
 */
function tag_deliver($uid, $item_id)
{
    $mention = false;
    /*
     * Fetch stuff we need - a channel and an item
     */
    $u = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1", intval($uid));
    if (!$u) {
        return;
    }
    $i = q("select * from item where id = %d and uid = %d limit 1", intval($item_id), intval($uid));
    if (!$i) {
        return;
    }
    $i = fetch_post_tags($i);
    $item = $i[0];
    if ($item['source_xchan'] && $item['item_flags'] & ITEM_UPLINK && $item['item_flags'] & ITEM_THREAD_TOP && $item['edited'] != $item['created']) {
        // this is an update (edit) to a post which was already processed by us and has a second delivery chain
        // Just start the second delivery chain to deliver the updated post
        proc_run('php', 'include/notifier.php', 'tgroup', $item['id']);
        return;
    }
    /*
     * Seems like a good place to plug in a poke notification.
     */
    if (stristr($item['verb'], ACTIVITY_POKE)) {
        $poke_notify = true;
        if ($item['obj_type'] == "" || $item['obj_type'] !== ACTIVITY_OBJ_PERSON || !$item['object']) {
            $poke_notify = false;
        }
        $obj = json_decode_plus($item['object']);
        if ($obj) {
            if ($obj['id'] !== $u[0]['channel_hash']) {
                $poke_notify = false;
            }
        }
        if ($item['item_restrict'] & ITEM_DELETED) {
            $poke_notify = false;
        }
        $verb = urldecode(substr($item['verb'], strpos($item['verb'], '#') + 1));
        if ($poke_notify) {
            require_once 'include/enotify.php';
            notification(array('to_xchan' => $u[0]['channel_hash'], 'from_xchan' => $item['author_xchan'], 'type' => NOTIFY_POKE, 'item' => $item, 'link' => $i[0]['llink'], 'verb' => ACTIVITY_POKE, 'activity' => $verb, 'otype' => 'item'));
        }
    }
    /*
     * Do community tagging
     */
    if ($item['obj_type'] === ACTIVITY_OBJ_TAGTERM) {
        // We received a community tag activity for a post.
        // See if we are the owner of the parent item and have given permission to tag our posts.
        // If so tag the parent post.
        logger('tag_deliver: community tag activity received');
        if ($item['owner_xchan'] === $u[0]['channel_hash'] && !get_pconfig($u[0]['channel_id'], 'system', 'blocktags')) {
            logger('tag_deliver: community tag recipient: ' . $u[0]['channel_name']);
            $j_tgt = json_decode_plus($item['target']);
            if ($j_tgt && $j_tgt['id']) {
                $p = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($j_tgt['id']), intval($u[0]['channel_id']));
                if ($p) {
                    $j_obj = json_decode_plus($item['object']);
                    logger('tag_deliver: tag object: ' . print_r($j_obj, true), LOGGER_DATA);
                    if ($j_obj && $j_obj['id'] && $j_obj['title']) {
                        if (is_array($j_obj['link'])) {
                            $taglink = get_rel_link($j_obj['link'], 'alternate');
                        }
                        store_item_tag($u[0]['channel_id'], $p[0]['id'], TERM_OBJ_POST, TERM_HASHTAG, $j_obj['title'], $j_obj['id']);
                        $x = q("update item set edited = '%s', received = '%s', changed = '%s' where mid = '%s' and uid = %d", dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc($j_tgt['id']), intval($u[0]['channel_id']));
                        proc_run('php', 'include/notifier.php', 'edit_post', $p[0]['id']);
                    }
                }
            }
        } else {
            logger('tag_deliver: tag permission denied for ' . $u[0]['channel_address']);
        }
    }
    /*
     * A "union" is a message which our channel has sourced from another channel.
     * This sets up a second delivery chain just like forum tags do.
     * Find out if this is a source-able post.
     */
    $union = check_item_source($uid, $item);
    if ($union) {
        logger('check_item_source returns true');
    }
    // This might be a followup (e.g. comment) by the original post author to a tagged forum
    // If so setup a second delivery chain
    if (!($item['item_flags'] & ITEM_THREAD_TOP)) {
        $x = q("select * from item where id = parent and parent = %d and uid = %d limit 1", intval($item['parent']), intval($uid));
        if ($x && $x[0]['item_flags'] & ITEM_UPLINK) {
            start_delivery_chain($u[0], $item, $item_id, $x[0]);
        }
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:101,代码来源:items.php


示例4: localize_item

/**
 * Render actions localized
 */
function localize_item(&$item)
{
    if (activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE)) {
        if (!$item['object']) {
            return;
        }
        if ($item['item_flags'] & ITEM_THREAD_TOP) {
            return;
        }
        $obj = json_decode_plus($item['object']);
        if (!$obj && $item['object']) {
            logger('localize_item: failed to decode object: ' . print_r($item['object'], true));
        }
        if ($obj['author'] && $obj['author']['link']) {
            $author_link = get_rel_link($obj['author']['link'], 'alternate');
        } else {
            $author_link = '';
        }
        $author_name = $obj['author'] && $obj['author']['name'] ? $obj['author']['name'] : '';
        $item_url = get_rel_link($obj['link'], 'alternate');
        $Bphoto = '';
        switch ($obj['type']) {
            case ACTIVITY_OBJ_PHOTO:
                $post_type = t('photo');
                break;
            case ACTIVITY_OBJ_EVENT:
                $post_type = t('event');
                break;
            case ACTIVITY_OBJ_PERSON:
                $post_type = t('channel');
                $author_name = $obj['title'];
                if ($obj['link']) {
                    $author_link = get_rel_link($obj['link'], 'alternate');
                    $Bphoto = get_rel_link($obj['link'], 'photo');
                }
                break;
            case ACTIVITY_OBJ_THING:
                $post_type = $obj['title'];
                if ($obj['owner']) {
                    if (array_key_exists('name', $obj['owner'])) {
                        $obj['owner']['name'];
                    }
                    if (array_key_exists('link', $obj['owner'])) {
                        $author_link = get_rel_link($obj['owner']['link'], 'alternate');
                    }
                }
                if ($obj['link']) {
                    $Bphoto = get_rel_link($obj['link'], 'photo');
                }
                break;
            case ACTIVITY_OBJ_NOTE:
            default:
                $post_type = t('status');
                if ($obj['mid'] != $obj['parent_mid']) {
                    $post_type = t('comment');
                }
                break;
        }
        // If we couldn't parse something useful, don't bother translating.
        // We need something better than zid here, probably magic_link(), but it needs writing
        if ($author_link && $author_name && $item_url) {
            $author = '[zrl=' . chanlink_url($item['author']['xchan_url']) . ']' . $item['author']['xchan_name'] . '[/zrl]';
            $objauthor = '[zrl=' . chanlink_url($author_link) . ']' . $author_name . '[/zrl]';
            $plink = '[zrl=' . zid($item_url) . ']' . $post_type . '[/zrl]';
            if (activity_match($item['verb'], ACTIVITY_LIKE)) {
                $bodyverb = t('%1$s likes %2$s\'s %3$s');
            } elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
                $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s');
            }
            $item['body'] = $item['localize'] = sprintf($bodyverb, $author, $objauthor, $plink);
            if ($Bphoto != "") {
                $item['body'] .= "\n\n\n" . '[zrl=' . chanlink_url($author_link) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
            }
        } else {
            logger('localize_item like failed: link ' . $author_link . ' name ' . $author_name . ' url ' . $item_url);
        }
    }
    if (activity_match($item['verb'], ACTIVITY_FRIEND)) {
        if ($item['obj_type'] == "" || $item['obj_type'] !== ACTIVITY_OBJ_PERSON) {
            return;
        }
        $Aname = $item['author']['xchan_name'];
        $Alink = $item['author']['xchan_url'];
        $obj = json_decode_plus($item['object']);
        $Blink = $Bphoto = '';
        if ($obj['link']) {
            $Blink = get_rel_link($obj['link'], 'alternate');
            $Bphoto = get_rel_link($obj['link'], 'photo');
        }
        $Bname = $obj['title'];
        $A = '[zrl=' . chanlink_url($Alink) . ']' . $Aname . '[/zrl]';
        $B = '[zrl=' . chanlink_url($Blink) . ']' . $Bname . '[/zrl]';
        if ($Bphoto != "") {
            $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]';
        }
        $item['body'] = $item['localize'] = sprintf(t('%1$s is now connected with %2$s'), $A, $B);
        $item['body'] .= "\n\n\n" . $Bphoto;
//.........这里部分代码省略.........
开发者ID:redmatrix,项目名称:red,代码行数:101,代码来源:conversation.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_related_contexts_string函数代码示例发布时间:2022-05-15
下一篇:
PHP get_rel_item函数代码示例发布时间: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