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


PHP load_contact_links函数代码示例

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


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

示例1: init

 function init()
 {
     if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
         return;
     }
     if (local_channel()) {
         load_contact_links(local_channel());
     }
     $dirmode = intval(get_config('system', 'directory_mode'));
     $x = find_upstream_directory($dirmode);
     if ($x) {
         $url = $x['url'];
     }
     $poco_rating = get_config('system', 'poco_rating_enable');
     // if unset default to enabled
     if ($poco_rating === false) {
         $poco_rating = true;
     }
     if (!$poco_rating) {
         return;
     }
     if (argc() > 1) {
         $hash = argv(1);
     }
     if (!$hash) {
         notice('Must supply a channel identififier.');
         return;
     }
     $results = false;
     $x = z_fetch_url($url . '/ratingsearch/' . urlencode($hash));
     if ($x['success']) {
         $results = json_decode($x['body'], true);
     }
     if (!$results || !$results['success']) {
         notice('No results.');
         return;
     }
     if (array_key_exists('xchan_hash', $results['target'])) {
         \App::$poi = $results['target'];
     }
     $friends = array();
     $others = array();
     if ($results['ratings']) {
         foreach ($results['ratings'] as $n) {
             if (is_array(\App::$contacts) && array_key_exists($n['xchan_hash'], \App::$contacts)) {
                 $friends[] = $n;
             } else {
                 $others[] = $n;
             }
         }
     }
     \App::$data = array('target' => $results['target'], 'results' => array_merge($friends, $others));
     if (!\App::$data['results']) {
         notice(t('No ratings') . EOL);
     }
     return;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:57,代码来源:Ratings.php

示例2: api_call

function api_call(&$a)
{
    global $API, $called_api;
    // preset
    $type = "json";
    foreach ($API as $p => $info) {
        if (strpos($a->query_string, $p) === 0) {
            $called_api = explode("/", $p);
            //unset($_SERVER['PHP_AUTH_USER']);
            if ($info['auth'] === true && api_user() === false) {
                api_login($a);
            }
            load_contact_links(api_user());
            $channel = $a->get_channel();
            logger('API call for ' . $channel['channel_name'] . ': ' . $a->query_string);
            logger('API parameters: ' . print_r($_REQUEST, true));
            $type = "json";
            if (strpos($a->query_string, ".xml") > 0) {
                $type = "xml";
            }
            if (strpos($a->query_string, ".json") > 0) {
                $type = "json";
            }
            if (strpos($a->query_string, ".rss") > 0) {
                $type = "rss";
            }
            if (strpos($a->query_string, ".atom") > 0) {
                $type = "atom";
            }
            if (strpos($a->query_string, ".as") > 0) {
                $type = "as";
            }
            $r = call_user_func($info['func'], $a, $type);
            if ($r === false) {
                return;
            }
            switch ($type) {
                case "xml":
                    $r = mb_convert_encoding($r, "UTF-8", mb_detect_encoding($r));
                    header("Content-Type: text/xml");
                    return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                    break;
                case "json":
                    header("Content-Type: application/json");
                    foreach ($r as $rr) {
                        $json = json_encode($rr);
                    }
                    if ($_GET['callback']) {
                        $json = $_GET['callback'] . "(" . $json . ")";
                    }
                    return $json;
                    break;
                case "rss":
                    header("Content-Type: application/rss+xml");
                    return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                    break;
                case "atom":
                    header("Content-Type: application/atom+xml");
                    return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                    break;
                case "as":
                    //header ("Content-Type: application/json");
                    //foreach($r as $rr)
                    //    return json_encode($rr);
                    return json_encode($r);
                    break;
            }
            //echo "<pre>"; var_dump($r); die();
        }
    }
    header("HTTP/1.1 404 Not Found");
    logger('API call not implemented: ' . $a->query_string . " - " . print_r($_REQUEST, true));
    $r = '<status><error>not implemented</error></status>';
    switch ($type) {
        case "xml":
            header("Content-Type: text/xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
        case "json":
            header("Content-Type: application/json");
            return json_encode(array('error' => 'not implemented'));
            break;
        case "rss":
            header("Content-Type: application/rss+xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
        case "atom":
            header("Content-Type: application/atom+xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
    }
}
开发者ID:msooon,项目名称:hubzilla,代码行数:92,代码来源:api.php

示例3: item_photo_menu

 function item_photo_menu($item)
 {
     $a = get_app();
     $ssl_state = false;
     if (local_user()) {
         $ssl_state = true;
         if (!count($a->contacts)) {
             load_contact_links(local_user());
         }
     }
     $sub_link = "";
     $poke_link = "";
     $contact_url = "";
     $pm_url = "";
     $status_link = "";
     $photos_link = "";
     $posts_link = "";
     if (local_user() && local_user() == $item['uid'] && $item['parent'] == $item['id'] && !$item['self']) {
         $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
     }
     $sparkle = false;
     $profile_link = best_link_url($item, $sparkle, $ssl_state);
     if ($profile_link === 'mailbox') {
         $profile_link = '';
     }
     if ($sparkle) {
         $cid = intval(basename($profile_link));
         $status_link = $profile_link . "?url=status";
         $photos_link = $profile_link . "?url=photos";
         $profile_link = $profile_link . "?url=profile";
         $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
         $zurl = '';
     } else {
         $profile_link = zrl($profile_link);
         if (local_user() && local_user() == $item['uid'] && link_compare($item['url'], $item['author-link'])) {
             $cid = $item['contact-id'];
         } else {
             $cid = 0;
         }
     }
     if ($cid && !$item['self']) {
         $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid;
         $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
         $posts_link = $a->get_baseurl($ssl_state) . '/network/0?nets=all&cid=' . $cid;
         $clean_url = normalise_link($item['author-link']);
         if (local_user() && local_user() == $item['uid']) {
             if (isset($a->contacts) && x($a->contacts, $clean_url)) {
                 if ($a->contacts[$clean_url]['network'] === NETWORK_DIASPORA) {
                     $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
                 }
             }
         }
     }
     $menu = array(t("Follow Thread") => $sub_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, t("Network Posts") => $posts_link, t("Edit Contact") => $contact_url, t("Send PM") => $pm_url, t("Poke") => $poke_link);
     $args = array('item' => $item, 'menu' => $menu);
     call_hooks('item_photo_menu', $args);
     $menu = $args['menu'];
     $o = "";
     foreach ($menu as $k => $v) {
         if (strpos($v, 'javascript:') === 0) {
             $v = substr($v, 11);
             $o .= "<li><a href=\"#\" onclick=\"{$v}\">{$k}</a></li>\n";
         } elseif ($v != "") {
             $o .= "<li><a href=\"{$v}\">{$k}</a></li>\n";
         }
     }
     return $o;
 }
开发者ID:jzacman,项目名称:friendica,代码行数:68,代码来源:conversation.php

示例4: item_photo_menu

function item_photo_menu($item)
{
    $a = get_app();
    $contact = null;
    $ssl_state = false;
    $sub_link = "";
    $poke_link = "";
    $contact_url = "";
    $pm_url = "";
    $vsrc_link = "";
    $follow_url = "";
    $local_channel = local_channel();
    if ($local_channel) {
        $ssl_state = true;
        if (!count($a->contacts)) {
            load_contact_links($local_channel);
        }
        $channel = $a->get_channel();
        $channel_hash = $channel ? $channel['channel_hash'] : '';
    }
    if ($local_channel && $local_channel == $item['uid']) {
        $vsrc_link = 'javascript:viewsrc(' . $item['id'] . '); return false;';
        if ($item['parent'] == $item['id'] && $channel && $channel_hash != $item['author_xchan']) {
            $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
        }
    }
    $profile_link = chanlink_hash($item['author_xchan']);
    if ($item['uid'] > 0) {
        $pm_url = $a->get_baseurl($ssl_state) . '/mail/new/?f=&hash=' . $item['author_xchan'];
    }
    if ($a->contacts && array_key_exists($item['author_xchan'], $a->contacts)) {
        $contact = $a->contacts[$item['author_xchan']];
    } else {
        if ($local_channel && $item['author']['xchan_addr']) {
            $follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
        }
    }
    if ($contact) {
        $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $contact['abook_id'];
        if (!($contact['abook_flags'] & ABOOK_FLAG_SELF)) {
            $contact_url = $a->get_baseurl($ssl_state) . '/connedit/' . $contact['abook_id'];
        }
        $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $contact['abook_id'];
        $clean_url = normalise_link($item['author-link']);
    }
    $menu = array(t("View Source") => $vsrc_link, t("Follow Thread") => $sub_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, t("Matrix Activity") => $posts_link, t("Connect") => $follow_url, t("Edit Contact") => $contact_url, t("Send PM") => $pm_url, t("Poke") => $poke_link);
    $args = array('item' => $item, 'menu' => $menu);
    call_hooks('item_photo_menu', $args);
    $menu = $args['menu'];
    $o = "";
    foreach ($menu as $k => $v) {
        if (strpos($v, 'javascript:') === 0) {
            $v = substr($v, 11);
            $o .= "<li><a href=\"#\" onclick=\"{$v}\">{$k}</a></li>\n";
        } elseif ($v != "") {
            $o .= "<li><a href=\"{$v}\">{$k}</a></li>\n";
        }
    }
    return $o;
}
开发者ID:redmatrix,项目名称:red,代码行数:60,代码来源:conversation.php

示例5: item_photo_menu

 function item_photo_menu($item)
 {
     $a = get_app();
     if (local_user() && !count($a->contacts)) {
         load_contact_links(local_user());
     }
     $contact_url = "";
     $pm_url = "";
     $status_link = "";
     $photos_link = "";
     $posts_link = "";
     $sparkle = false;
     $profile_link = best_link_url($item, $sparkle);
     if ($profile_link === 'mailbox') {
         $profile_link = '';
     }
     if ($sparkle) {
         $cid = intval(basename($profile_link));
         $status_link = $profile_link . "?url=status";
         $photos_link = $profile_link . "?url=photos";
         $profile_link = $profile_link . "?url=profile";
         $pm_url = $a->get_baseurl() . '/message/new/' . $cid;
     } else {
         if (local_user() && local_user() == $item['uid'] && link_compare($item['url'], $item['author-link'])) {
             $cid = $item['contact-id'];
         } else {
             $cid = 0;
         }
     }
     if ($cid && !$item['self']) {
         $contact_url = $a->get_baseurl() . '/contacts/' . $cid;
         $posts_link = $a->get_baseurl() . '/network/?cid=' . $cid;
     }
     $menu = array(t("View status") => $status_link, t("View profile") => $profile_link, t("View photos") => $photos_link, t("View recent") => $posts_link, t("Edit contact") => $contact_url, t("Send PM") => $pm_url);
     $args = array($item, &$menu);
     call_hooks('item_photo_menu', $args);
     $o = "";
     foreach ($menu as $k => $v) {
         if ($v != "") {
             $o .= "<li><a href='{$v}'>{$k}</a></li>\n";
         }
     }
     return $o;
 }
开发者ID:nphyx,项目名称:friendica,代码行数:44,代码来源:conversation.php

示例6: render_content

function render_content(&$a, $items, $mode, $update, $preview = false)
{
    require_once 'include/bbcode.php';
    require_once 'mod/proxy.php';
    $ssl_state = local_user() ? true : false;
    $profile_owner = 0;
    $page_writeable = false;
    $previewing = $preview ? ' preview ' : '';
    if ($mode === 'network') {
        $profile_owner = local_user();
        $page_writeable = true;
    }
    if ($mode === 'profile') {
        $profile_owner = $a->profile['profile_uid'];
        $page_writeable = can_write_wall($a, $profile_owner);
    }
    if ($mode === 'notes') {
        $profile_owner = local_user();
        $page_writeable = true;
    }
    if ($mode === 'display') {
        $profile_owner = $a->profile['uid'];
        $page_writeable = can_write_wall($a, $profile_owner);
    }
    if ($mode === 'community') {
        $profile_owner = 0;
        $page_writeable = false;
    }
    if ($update) {
        $return_url = $_SESSION['return_url'];
    } else {
        $return_url = $_SESSION['return_url'] = $a->query_string;
    }
    load_contact_links(local_user());
    $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
    call_hooks('conversation_start', $cb);
    $items = $cb['items'];
    $cmnt_tpl = get_markup_template('comment_item.tpl');
    $tpl = 'wall_item.tpl';
    $wallwall = 'wallwall_item.tpl';
    $hide_comments_tpl = get_markup_template('hide_comments.tpl');
    $alike = array();
    $dlike = array();
    // array with html for each thread (parent+comments)
    $threads = array();
    $threadsid = -1;
    if ($items && count($items)) {
        if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
            // "New Item View" on network page or search page results
            // - just loop through the items and format them minimally for display
            //$tpl = get_markup_template('search_item.tpl');
            $tpl = 'search_item.tpl';
            foreach ($items as $item) {
                $threadsid++;
                $comment = '';
                $owner_url = '';
                $owner_photo = '';
                $owner_name = '';
                $sparkle = '';
                if ($mode === 'search' || $mode === 'community') {
                    if ((activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE)) && $item['id'] != $item['parent']) {
                        continue;
                    }
                    $nickname = $item['nickname'];
                } else {
                    $nickname = $a->user['nickname'];
                }
                // prevent private email from leaking.
                if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
                    continue;
                }
                $profile_name = strlen($item['author-name']) ? $item['author-name'] : $item['name'];
                if ($item['author-link'] && !$item['author-name']) {
                    $profile_name = $item['author-link'];
                }
                $sp = false;
                $profile_link = best_link_url($item, $sp);
                if ($profile_link === 'mailbox') {
                    $profile_link = '';
                }
                if ($sp) {
                    $sparkle = ' sparkle';
                } else {
                    $profile_link = zrl($profile_link);
                }
                $normalised = normalise_link(strlen($item['author-link']) ? $item['author-link'] : $item['url']);
                if ($normalised != 'mailbox' && x($a->contacts[$normalised])) {
                    $profile_avatar = $a->contacts[$normalised]['thumb'];
                } else {
                    $profile_avatar = strlen($item['author-avatar']) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb'];
                }
                $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
                call_hooks('render_location', $locate);
                $location = strlen($locate['html']) ? $locate['html'] : render_location_dummy($locate);
                localize_item($item);
                if ($mode === 'network-new') {
                    $dropping = true;
                } else {
                    $dropping = false;
                }
//.........这里部分代码省略.........
开发者ID:ZerGabriel,项目名称:friendica,代码行数:101,代码来源:content.php

示例7: item_photo_menu

function item_photo_menu($item)
{
    $contact = null;
    $ssl_state = false;
    $sub_link = "";
    $poke_link = "";
    $contact_url = "";
    $pm_url = "";
    $vsrc_link = "";
    $follow_url = "";
    $local_channel = local_channel();
    if ($local_channel) {
        $ssl_state = true;
        if (!count(App::$contacts)) {
            load_contact_links($local_channel);
        }
        $channel = App::get_channel();
        $channel_hash = $channel ? $channel['channel_hash'] : '';
    }
    if ($local_channel && $local_channel == $item['uid']) {
        $vsrc_link = 'javascript:viewsrc(' . $item['id'] . '); return false;';
        if ($item['parent'] == $item['id'] && $channel && $channel_hash != $item['author_xchan']) {
            $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
        }
        if ($channel) {
            $unsub_link = 'javascript:dounsubthread(' . $item['id'] . '); return false;';
        }
    }
    $profile_link = chanlink_hash($item['author_xchan']);
    if ($item['uid'] > 0) {
        $pm_url = z_root() . '/mail/new/?f=&hash=' . $item['author_xchan'];
    }
    if (App::$contacts && array_key_exists($item['author_xchan'], App::$contacts)) {
        $contact = App::$contacts[$item['author_xchan']];
    } else {
        if ($local_channel && $item['author']['xchan_addr']) {
            $follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
        }
    }
    if ($contact) {
        $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
        if (!intval($contact['abook_self'])) {
            $contact_url = z_root() . '/connedit/' . $contact['abook_id'];
        }
        $posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
        $clean_url = normalise_link($item['author-link']);
    }
    $poco_rating = get_config('system', 'poco_rating_enable');
    // if unset default to enabled
    if ($poco_rating === false) {
        $poco_rating = true;
    }
    $ratings_url = $poco_rating ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '';
    $post_menu = array(t("View Source") => $vsrc_link, t("Follow Thread") => $sub_link, t("Unfollow Thread") => $unsub_link);
    $author_menu = array(t("View Profile") => $profile_link, t("Activity/Posts") => $posts_link, t("Connect") => $follow_url, t("Edit Connection") => $contact_url, t("Message") => $pm_url, t('Ratings') => $ratings_url, t("Poke") => $poke_link);
    $args = array('item' => $item, 'post_menu' => $post_menu, 'author_menu' => $author_menu);
    call_hooks('item_photo_menu', $args);
    $menu = array_merge($args['post_menu'], $args['author_menu']);
    $o = "";
    foreach ($menu as $k => $v) {
        if (strpos($v, 'javascript:') === 0) {
            $v = substr($v, 11);
            $o .= "<li><a href=\"#\" onclick=\"{$v}\">{$k}</a></li>\n";
        } elseif ($v != "") {
            $o .= "<li><a href=\"{$v}\">{$k}</a></li>\n";
        }
    }
    return $o;
}
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:69,代码来源:conversation.php

示例8: api_call

function api_call()
{
    $p = App::$cmd;
    $type = null;
    if (strrpos($p, '.')) {
        $type = substr($p, strrpos($p, '.') + 1);
        if (strpos($type, '/') === false) {
            $p = substr($p, 0, strrpos($p, '.'));
            // recalculate App argc,argv since we just extracted the type from it
            App::$argv = explode('/', $p);
            App::$argc = count(App::$argv);
        }
    }
    if (!$type || !in_array($type, ['json', 'xml', 'rss', 'as', 'atom'])) {
        $type = 'json';
    }
    $info = \Zotlabs\Lib\Api_router::find($p);
    logger('info: ' . $p . ' type: ' . $type . ' ' . print_r($info, true));
    if ($info) {
        if ($info['auth'] === true && api_user() === false) {
            api_login($a);
        }
        load_contact_links(api_user());
        $channel = App::get_channel();
        logger('API call for ' . $channel['channel_name'] . ': ' . App::$query_string);
        logger('API parameters: ' . print_r($_REQUEST, true));
        $r = call_user_func($info['func'], $type);
        if ($r === false) {
            return;
        }
        switch ($type) {
            case "xml":
                $r = mb_convert_encoding($r, "UTF-8", mb_detect_encoding($r));
                header("Content-Type: text/xml");
                return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                break;
            case "json":
                header("Content-Type: application/json");
                if ($r) {
                    foreach ($r as $rv) {
                        $json = json_encode($rv);
                    }
                }
                // Lookup JSONP to understand these lines. They provide cross-domain AJAX ability.
                if ($_GET['callback']) {
                    $json = $_GET['callback'] . '(' . $json . ')';
                }
                return $json;
                break;
            case "rss":
                header("Content-Type: application/rss+xml");
                return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                break;
            case "atom":
                header("Content-Type: application/atom+xml");
                return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
                break;
            case "as":
                if ($r) {
                    foreach ($r as $rv) {
                        $json = json_encode($rv);
                    }
                }
                return $json;
                break;
        }
    }
    header("HTTP/1.1 404 Not Found");
    logger('API call not implemented: ' . App::$query_string . ' - ' . print_r($_REQUEST, true));
    $r = '<status><error>not implemented</error></status>';
    switch ($type) {
        case "xml":
            header("Content-Type: text/xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
        case "json":
            header("Content-Type: application/json");
            return json_encode(array('error' => 'not implemented'));
            break;
        case "rss":
            header("Content-Type: application/rss+xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
        case "atom":
            header("Content-Type: application/atom+xml");
            return '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $r;
            break;
    }
}
开发者ID:phellmes,项目名称:hubzilla,代码行数:89,代码来源:api.php

示例9: item_photo_menu

 function item_photo_menu($item)
 {
     $a = get_app();
     $ssl_state = false;
     if (local_user()) {
         $ssl_state = true;
         if (!count($a->contacts)) {
             load_contact_links(local_user());
         }
     }
     $sub_link = "";
     $poke_link = "";
     $contact_url = "";
     $pm_url = "";
     $status_link = "";
     $photos_link = "";
     $posts_link = "";
     if (local_user() && local_user() == $item['uid'] && $item['parent'] == $item['id'] && !$item['self']) {
         $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
     }
     $sparkle = false;
     $profile_link = best_link_url($item, $sparkle, $ssl_state);
     if ($profile_link === 'mailbox') {
         $profile_link = '';
     }
     if ($sparkle) {
         $cid = intval(basename($profile_link));
         $status_link = $profile_link . "?url=status";
         $photos_link = $profile_link . "?url=photos";
         $profile_link = $profile_link . "?url=profile";
         $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
         $zurl = '';
     } else {
         $profile_link = zrl($profile_link);
         if (local_user() && local_user() == $item['uid'] && link_compare($item['url'], $item['author-link'])) {
             $cid = $item['contact-id'];
         } else {
             $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1", intval(local_user()), dbesc(normalise_link($item['author-link'])));
             if ($r) {
                 $cid = $r[0]["id"];
                 if ($r[0]["network"] == NETWORK_DIASPORA) {
                     $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
                 }
             } else {
                 $cid = 0;
             }
         }
     }
     if ($cid && !$item['self']) {
         $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid;
         $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid;
         $posts_link = $a->get_baseurl($ssl_state) . '/contacts/' . $cid . '/posts';
         $clean_url = normalise_link($item['author-link']);
         if (local_user() && local_user() == $item['uid']) {
             if (isset($a->contacts) && x($a->contacts, $clean_url)) {
                 if ($a->contacts[$clean_url]['network'] === NETWORK_DIASPORA) {
                     $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
                 }
             }
         }
     }
     if (local_user()) {
         $menu = array(t("Follow Thread") => $sub_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, t("Network Posts") => $posts_link, t("Edit Contact") => $contact_url, t("Send PM") => $pm_url);
         if ($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
             $menu[t("Poke")] = $poke_link;
         }
         if (($cid == 0 or $a->contacts[$clean_url]['rel'] == CONTACT_IS_FOLLOWER) and in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
             $menu[t("Connect/Follow")] = $a->get_baseurl($ssl_state) . "/follow?url=" . urlencode($item['author-link']);
         }
     } else {
         $menu = array(t("View Profile") => $item['author-link']);
     }
     $args = array('item' => $item, 'menu' => $menu);
     call_hooks('item_photo_menu', $args);
     $menu = $args['menu'];
     $o = "";
     foreach ($menu as $k => $v) {
         if (strpos($v, 'javascript:') === 0) {
             $v = substr($v, 11);
             $o .= "<li role=\"menuitem\"><a onclick=\"{$v}\">{$k}</a></li>\n";
         } elseif ($v != "") {
             $o .= "<li role=\"menuitem\"><a href=\"{$v}\">{$k}</a></li>\n";
         }
     }
     return $o;
 }
开发者ID:vinzv,项目名称:friendica,代码行数:86,代码来源:conversation.php


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