本文整理汇总了PHP中is_foreigner函数的典型用法代码示例。如果您正苦于以下问题:PHP is_foreigner函数的具体用法?PHP is_foreigner怎么用?PHP is_foreigner使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_foreigner函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_member
/**
* @brief Test whether a given identity is a member of the Hubzilla.
*
* @param string $s;
* xchan_hash of the identity in question
* @returns boolean true or false
*/
function is_member($s)
{
return is_foreigner($s) ? false : true;
}
示例2: theme_attachments
function theme_attachments(&$item)
{
$arr = json_decode_plus($item['attach']);
if (is_array($arr) && count($arr)) {
$attaches = array();
foreach ($arr as $r) {
$icon = '';
$icontype = substr($r['type'], 0, strpos($r['type'], '/'));
/**
* @FIXME This should probably be a giant "if" statement in the
* template so that we don't have icon names embedded in php code.
*/
switch ($icontype) {
case 'video':
$icon = 'icon-facetime-video';
break;
case 'audio':
$icon = 'icon-volume-up';
break;
case 'image':
$icon = 'icon-picture';
break;
case 'text':
$icon = 'icon-align-justify';
break;
default:
$icon = 'icon-question';
break;
}
$title = htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8');
if (!$title) {
$title = t('unknown.???');
}
$title .= ' ' . $r['length'] . ' ' . t('bytes');
require_once 'include/identity.php';
if (is_foreigner($item['author_xchan'])) {
$url = $r['href'];
} else {
$url = z_root() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision'];
}
$s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>';
$attaches[] = array('title' => $title, 'url' => $url, 'icon' => $icon);
}
}
$s = replace_macros(get_markup_template('item_attach.tpl'), array('$attaches' => $attaches));
return $s;
}
示例3: theme_attachments
function theme_attachments(&$item)
{
$arr = json_decode_plus($item['attach']);
if (is_array($arr) && count($arr)) {
$attaches = array();
foreach ($arr as $r) {
$icon = getIconFromType($r['type']);
$label = $r['title'] ? urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8')) : t('Unknown Attachment');
//some feeds provide an attachment where title an empty space
if ($label == ' ') {
$label = t('Unknown Attachment');
}
$title = t('Size') . ' ' . ($r['length'] ? userReadableSize($r['length']) : t('unknown'));
require_once 'include/identity.php';
if (is_foreigner($item['author_xchan'])) {
$url = $r['href'];
} else {
$url = z_root() . '/magic?f=&hash=' . $item['author_xchan'] . '&dest=' . $r['href'] . '/' . $r['revision'];
}
//$s .= '<a href="' . $url . '" title="' . $title . '" class="attachlink" >' . $icon . '</a>';
$attaches[] = array('label' => $label, 'url' => $url, 'icon' => $icon, 'title' => $title);
}
$s = replace_macros(get_markup_template('item_attach.tpl'), array('$attaches' => $attaches));
}
return $s;
}
示例4: scopes_sql
/**
* Remote visitors also need to be checked against the public_scope parameter if item_private is set.
* This function checks the various permutations of that field for any which apply to this observer.
*
*/
function scopes_sql($uid, $observer)
{
$str = " and ( public_policy = 'authenticated' ";
if (!is_foreigner($observer)) {
$str .= " or public_policy = 'network: red' ";
}
if (local_channel()) {
$str .= " or public_policy = 'site: " . App::get_hostname() . "' ";
}
$ab = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($observer), intval($uid));
if (!$ab) {
return $str . " ) ";
}
if ($ab[0]['abook_pending']) {
$str .= " or public_policy = 'any connections' ";
}
$str .= " or public_policy = 'contacts' ) ";
return $str;
}