本文整理匯總了PHP中entity::owned_or_borrowed_by方法的典型用法代碼示例。如果您正苦於以下問題:PHP entity::owned_or_borrowed_by方法的具體用法?PHP entity::owned_or_borrowed_by怎麽用?PHP entity::owned_or_borrowed_by使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類entity
的用法示例。
在下文中一共展示了entity::owned_or_borrowed_by方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: entity
/**
* Check a given id to see if it is OK to show
*
* Called upon by _show_item()
* Calls on further_checks_on_entity()
*
* @todo check to see if the order of the checking is appropriate... it seems a little wonky
* @param integer $id Reason Entity ID
* @return mixed false if not OK, the entity object if OK
*/
function check_id( $id )
{
// assume that if it's in the list it's OK
if(!empty($this->items[$id]))
return $this->items[$id];
$e = new entity ( $id );
if(in_array($id,$this->ok_ids))
{
return $e;
}
elseif(in_array($id, $this->not_ok_ids))
{
return false;
}
elseif( $e->get_values()
&& $e->get_value('type')
&& $e->get_value('type') == $this->type
&& $e->get_value('state') == 'Live'
&& ( !$this->params['limit_to_current_site'] || $e->owned_or_borrowed_by( $this->parent->site_id ) )
&& $this->further_checks_on_entity( $e )
)
{
$this->ok_ids[] = $id;
return $e;
}
elseif(array_key_exists($id,$this->ids))
{
$this->ok_ids[] = $id;
return $e;
}
else
{
$this->not_ok_ids[] = $id;
http_response_code(404);
// 404s, even internal ones, don't need to go into the error log ... commenting this out to reduce error log spam.
//if(!empty($_SERVER['HTTP_REFERER']))
//{
// $parts = parse_url($_SERVER['HTTP_REFERER']);
// if($parts['host'] == HTTP_HOST_NAME) // probably can't do anything about it if the link is offsite...
// trigger_error('ID given does not correspond to an appropriate entity. Referer: '.$_SERVER['HTTP_REFERER']);
//}
return false;
}
}