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


PHP entity::owned_or_borrowed_by方法代码示例

本文整理汇总了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;
			}
		}
开发者ID:natepixel,项目名称:reason_package,代码行数:55,代码来源:generic3.php


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