本文整理匯總了PHP中ElggEntity::getOwnerGUID方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElggEntity::getOwnerGUID方法的具體用法?PHP ElggEntity::getOwnerGUID怎麽用?PHP ElggEntity::getOwnerGUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ElggEntity
的用法示例。
在下文中一共展示了ElggEntity::getOwnerGUID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSimpleGetters
public function testSimpleGetters()
{
$this->obj->type = 'foo';
$this->obj->subtype = 'subtype';
$this->obj->owner_guid = 77;
$this->obj->access_id = 2;
$this->obj->time_created = 123456789;
$this->assertEquals($this->obj->getGUID(), $this->obj->guid);
$this->assertEquals($this->obj->getType(), $this->obj->type);
// Note: before save() subtype returns string, int after
// see https://github.com/Elgg/Elgg/issues/5920#issuecomment-25246298
$this->assertEquals($this->obj->getSubtype(), $this->obj->subtype);
$this->assertEquals($this->obj->getOwnerGUID(), $this->obj->owner_guid);
$this->assertEquals($this->obj->getAccessID(), $this->obj->access_id);
$this->assertEquals($this->obj->getTimeCreated(), $this->obj->time_created);
$this->assertEquals($this->obj->getTimeUpdated(), $this->obj->time_updated);
}
示例2: testSimpleGetters
/**
* @requires PHP 5.3.2
*/
public function testSimpleGetters()
{
$this->obj->type = 'foo';
$this->obj->subtype = 'subtype';
$this->obj->owner_guid = 77;
$this->obj->access_id = 2;
$this->obj->time_created = 123456789;
$this->assertEquals($this->obj->getGUID(), $this->obj->guid);
$this->assertEquals($this->obj->getType(), $this->obj->type);
$this->assertEquals($this->obj->getSubtype(), $this->obj->subtype);
$this->assertEquals($this->obj->getOwnerGUID(), $this->obj->owner_guid);
$this->assertEquals($this->obj->getAccessID(), $this->obj->access_id);
$this->assertEquals($this->obj->getTimeCreated(), $this->obj->time_created);
$this->assertEquals($this->obj->getTimeUpdated(), $this->obj->time_updated);
}
示例3: entity_view_counter_is_counted
function entity_view_counter_is_counted(ElggEntity $entity)
{
if (php_sapi_name() === 'cli') {
return true;
}
if (!entity_view_counter_is_configured_entity_type($entity->getType(), $entity->getSubtype())) {
return true;
}
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER["HTTP_USER_AGENT"])) {
return true;
}
$user = elgg_get_logged_in_user_entity();
if ($user && $user->getGUID() == $entity->getOwnerGUID()) {
return true;
}
if (is_memcache_available()) {
$cache = new ElggMemcache('entity_view_counter');
$key = "view_" . session_id() . "_" . $entity->guid;
if ($cache->load($key)) {
return true;
}
}
if (entity_view_counter_ignore_ip()) {
return true;
}
return false;
}
示例4: content_subscriptions_can_subscribe
/**
* Checks if a user can subscribe to a content item
*
* @param ElggEntity $entity the entity to check
* @param int $user_guid the user to check (default: current user)
*
* @return bool
*/
function content_subscriptions_can_subscribe(ElggEntity $entity, $user_guid = 0)
{
$user_guid = sanitise_int($user_guid, false);
if (empty($user_guid)) {
$user_guid = elgg_get_logged_in_user_guid();
}
if (empty($user_guid) || !$entity instanceof ElggEntity) {
return false;
}
if ($entity->getOwnerGUID() === $user_guid) {
// owner cant subscribe to own content
return false;
}
$supported_entity_types = content_subscriptions_get_supported_entity_types();
if (empty($supported_entity_types)) {
return false;
}
$type = $entity->getType();
if (!isset($supported_entity_types[$type])) {
return false;
}
$subtype = $entity->getSubtype();
if (!empty($subtype)) {
return in_array($subtype, $supported_entity_types[$type]);
}
return true;
}