本文整理匯總了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;
}