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


PHP is_person函数代码示例

本文整理汇总了PHP中is_person函数的典型用法代码示例。如果您正苦于以下问题:PHP is_person函数的具体用法?PHP is_person怎么用?PHP is_person使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_person函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _afterEntityInstantiate

 /**
  * Initializes the options for an entity after being created
  *
  * @param 	object 	An optional KConfig object with configuration options.
  * @return 	void
  */
 protected function _afterEntityInstantiate(KConfig $config)
 {
     $data = $config->data;
     $data->append(array('subscribers' => array()));
     if ($data->object) {
         if (is($data->object, 'ComBaseDomainEntityComment')) {
             $data->comment = $data->object;
             $data->object = $data->comment->parent;
             $data->append(array('subscribers' => array($data->comment->author->id)));
         } elseif ($data->object->isModifiable() && !is($data->object, 'ComActorsDomainEntityActor')) {
             $data->append(array('subscribers' => array($data->object->author->id)));
         } elseif (is_person($data->object)) {
             $data->append(array('subscribers' => array($data->object->id)));
         }
         if ($data->object->isOwnable()) {
             $data->target = $data->object->owner;
         }
     }
     if ($data->target && $data->target->isNotifiable()) {
         $data->append(array('subscribers' => array($data->target->id)));
     }
     parent::_afterEntityInstantiate($config);
     if ($config->data->subscribers) {
         $this->setSubscribers($config->data->subscribers);
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:32,代码来源:notification.php

示例2: _actionAdd

 /**
  * Adds a new post
  * 
  * @param KCommandContext $context Context parameter         
  * 
  * @return void
  */
 protected function _actionAdd($context)
 {
     $data = $context->data;
     $entity = parent::_actionAdd($context);
     //if a person posting a message on his profile
     //or if a target is not actor then it can't be a private message
     if (get_viewer()->eql($this->actor) || !is_person($this->actor)) {
         unset($data->private);
     }
     //if a private message then
     //set the privacy to subject/target
     if ($data->private) {
         $entity->setAccess(array($this->actor->id, get_viewer()->id));
     }
     //create a notification for the subscribers and
     //the post owner as well
     if ($entity->owner->isSubscribable()) {
         //create a notification and pass the owner
         $notification = $this->createNotification(array('name' => 'note_add', 'object' => $entity, 'subscribers' => array($entity->owner->subscriberIds->toArray(), $entity->owner)))->setType('post', array('new_post' => true));
     }
     if (!empty($data['channels'])) {
         $this->shareObject(array('object' => $entity, 'sharers' => $data['channels']));
     }
     return $entity;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:32,代码来源:note.php

示例3: _authorizeAccess

 /**
  * Check if a medium authorizes acccess.
  *
  * @param KCommandContext $context Context parameter
  *
  * @return bool
  */
 protected function _authorizeAccess($context)
 {
     if (is_person($this->_viewer) && $this->_viewer->admin()) {
         return true;
     }
     if ($this->_entity->isPrivatable()) {
         return $this->_entity->allows($this->_viewer, 'access');
     }
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:16,代码来源:default.php

示例4: _beforeRepositoryFetch

 protected function _beforeRepositoryFetch($context)
 {
     if (KService::has('com:people.viewer') && is_person(get_viewer()) && get_viewer()->admin()) {
         return;
     }
     $query = $context->query;
     $config = pick($query->privacy, new KConfig());
     $config->append(array('viewer' => get_viewer()));
     $where = $this->buildCondition(get_viewer(), $config);
     $query->where($where);
 }
开发者ID:NicholasJohn16,项目名称:forums,代码行数:11,代码来源:privatable.php

示例5: _beforeRepositoryFetch

 /**
  * {@inheritdoc}
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     if (KService::has('com:people.viewer') && is_person(get_viewer()) && get_viewer()->admin()) {
         return;
     }
     $query = $context->query;
     $repository = $query->getRepository();
     $config = pick($query->privacy, new KConfig());
     $config->append(array('visible_to_leaders' => true, 'viewer' => get_viewer(), 'graph_check' => true));
     $where = $this->buildCondition('@col(id)', $config, '@col(access)');
     $query->where($where);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:15,代码来源:privatable.php

示例6: _beforeQuerySelect

 /**
  * {@inheritdoc}
  */
 protected function _beforeQuerySelect(KCommandContext $context)
 {
     if (KService::has('com:people.viewer') && is_person(get_viewer()) && get_viewer()->admin()) {
         return;
     }
     $query = $context->query;
     $repository = $query->getRepository();
     $config = pick($query->privacy, new KConfig());
     $config->append(array('visible_to_leaders' => true, 'viewer' => KService::get('com:people.viewer'), 'graph_check' => true));
     $query->getRepository()->addBehavior('ownable');
     //do a left join operation just in case an owner is missing
     $query->link('owner', array('type' => 'weak', 'bind_type' => false));
     $config->append(array('use_access_column' => '@col(access)'));
     $c1 = $this->buildCondition('@col(owner.id)', $config, '@col(owner.access)');
     $c2 = $this->buildCondition('@col(owner.id)', $config, $config->use_access_column);
     $where = "IF({$c1}, {$c2}, 0)";
     $query->where($where);
 }
开发者ID:LuccaCaldas,项目名称:anahita,代码行数:21,代码来源:privatable.php

示例7: onAfterDomainRepositoryFetch

 /**
  * Event Listener
  *
  * @param KEvent $event
  */
 public function onAfterDomainRepositoryFetch(KEvent $event)
 {
     $viewer = get_viewer();
     $query = $event->query;
     //if method is GET and reading actor.
     //that means we are in the actor profile page
     //redirect to the list of package if not allowed to see the actor
     //not seeing actor means not subscribed to any packages
     if ($query->access_changed && $event->data) {
         $entity = $event->data;
         if (is_person($entity)) {
             return;
         }
         $option = KRequest::get('get.option', 'cmd');
         $id = KRequest::get('get.id', 'cmd');
         if (!$entity->authorize('access') && $entity->id == $id && $entity->component == $option) {
             JFactory::getLanguage()->load('com_subscriptions');
             JFactory::getApplication()->redirect('index.php?option=com_subscriptions&view=packages', JText::_('COM-SUBSCRIPTIONS-ACCESS-PLG-NO-SUBS'));
         }
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:26,代码来源:access.php

示例8: name

 public function name($actor, $linked = true, $attr = array())
 {
     if (!is_person($actor)) {
         return parent::name($actor, $linked, $attr);
     }
     if (is_null($actor) || !isset($actor->id)) {
         $linked = false;
         $name = '<span class="actor-name">' . JText::_('LIB-AN-UNKOWN-PERSON') . '</span>';
     } else {
         $name = '<span class="actor-name" actorid="' . $actor->id . '">' . $actor->username . '</span>';
         if ($actor->verified) {
             $name = $name . ' <span class="icon icon-ok-sign"></span>';
         }
     }
     if (!$linked || !$actor->authorize('access')) {
         return (string) $name;
     }
     $url = JRoute::_($actor->getURL());
     if (is_person($actor)) {
         $attr['title'] = '@' . $actor->username;
     }
     $name = '<a class="actor-name" ' . $this->_buildAttribute($attr) . ' actorid="' . $actor->id . '" href="' . $url . '" >' . $name . '</a>';
     return $name;
 }
开发者ID:NicholasJohn16,项目名称:plg-username,代码行数:24,代码来源:story.php

示例9:

    echo $topic->COUNT_REPLY;
    ?>
 replies</span>
								</a><!--comment-->
							</div>
						</div><!--topic-->
							
						<?php 
}
?>
					</div>
				</div>
			</div><!--content-->
			<div class="col-md-3" id="sidebar">
				<?php 
if (is_person($person->PERSON_ID) || is_admin()) {
    ?>
				<a href="<?php 
    echo base_url();
    ?>
person/edit" type="button" class="create-btn btn btn-warning btn-lg btn-block">
					<span class="glyphicon glyphicon-pencil"></span>
					Edit Profile
				</a>
				<?php 
}
?>
				<a href="mailto:nuttt.p@gmail.com" type="button" class="create-btn btn btn-primary btn-lg btn-block">
					<span class="glyphicon glyphicon-envelope"></span>
					E-mail <?php 
echo $person->DISPLAY_NAME;
开发者ID:mikersu,项目名称:webboard,代码行数:31,代码来源:profile.php

示例10: is_admin

/**
 * Check if an actor is a person type and also is admin
 * 
 * @param ComActorsDomainEntityActor $actor Actor entity
 * 
 * @return boolean
 */
function is_admin($actor)
{
    return is_person($actor) && ($this->userType == 'Administrator' || $this->userType == 'Super Administrator');
}
开发者ID:walteraries,项目名称:anahita,代码行数:11,代码来源:functions.php

示例11: base_url

									<a href="<?php 
    echo base_url();
    ?>
person/profile/<?php 
    echo $reply->PERSON_ID;
    ?>
" class="name"><strong><?php 
    echo $reply->DISPLAY_NAME;
    ?>
</strong></a>
									<span class="date"><?php 
    echo $reply->TIME;
    ?>
</span>
									<?php 
    if (is_person($reply->PERSON_ID) || is_admin() || is_moderator($post->POST_ID)) {
        ?>
										<a href="edit_post.php" class="tag yellow"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
										<a href="" class="tag red"><span class="glyphicon glyphicon-trash"></span> Remove</a>
									<?php 
    }
    ?>
								</p>
							</div>
							<div class="col-xs-3 text-right">
								<a href="" class="btn btn-danger btn-xs vote vote-down">
									<span class="glyphicon glyphicon-thumbs-down"></span>
								</a><!--vote-->
								<span class="current-score">
									<?php 
    echo $reply->VOTE;
开发者ID:mikersu,项目名称:webboard,代码行数:31,代码来源:content.php

示例12: _fetchOwner

 /**
  * Fetches an entity
  *
  * @param KCommandContext $context
  * 
  * @return ComActorsDomainEntityActor
  */
 protected function _fetchOwner(KCommandContext $context)
 {
     $actor = pick($this->getActor(), $this->_default);
     $value = $this->{$this->getIdentifiableKey()};
     if ($value) {
         if ($value == 'viewer') {
             $actor = get_viewer();
         } elseif (!is_numeric($value)) {
             $actor = $this->getService('repos://site/people.person')->fetch(array('username' => $value));
         } else {
             $actor = $this->getService('repos://site/actors.actor')->fetch((int) $value);
         }
         //guest actor can never be a context actor
         if (is_person($actor) && $actor->guest()) {
             $actor = null;
         }
         //set the data owner to actor.
         $context->data['owner'] = $actor;
         if (!$actor) {
             throw new LibBaseControllerExceptionNotFound('Owner Not Found');
         }
     }
     $this->setActor($actor);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:31,代码来源:ownable.php

示例13: array

    echo @message(@text('COM-ACTORS-PROFILE-DISABLED-PROMPT'), array('type' => 'warning'));
    ?>
		<?php 
}
?>

		<?php 
echo @helper('ui.toolbar', array());
?>

		<h2 id="actor-name">
		<?php 
echo @name($item, false);
?>
		<?php 
if (is_person($item)) {
    ?>
		<small>@<?php 
    echo $item->username;
    ?>
</small>
		<?php 
}
?>
		</h2>

		<?php 
if (!empty($item->body)) {
    ?>
		<div id="actor-description">
		<?php 
开发者ID:LuccaCaldas,项目名称:anahita,代码行数:31,代码来源:default.php

示例14: _authorizeAccess

 /**
  * Check if a medium authorizes acccess
  * 
  * @param KCommandContext $context Context parameter
  * 
  * @return boolean
  */
 protected function _authorizeAccess($context)
 {
     if (is_person($this->_viewer) && $this->_viewer->admin()) {
         return true;
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:13,代码来源:default.php

示例15: toSerializableArray

 /**
  * {@inheritdoc}
  */
 public function toSerializableArray($entity)
 {
     $data = new KConfig();
     $viewer = KService::has('com:people.viewer') ? KService::get('com:people.viewer') : null;
     $data[$entity->getIdentityProperty()] = $entity->getIdentityId();
     $data['objectType'] = 'com.' . $entity->getIdentifier()->package . '.' . $entity->getIdentifier()->name;
     if ($entity->isDescribable()) {
         $data['name'] = $entity->name;
         $data['body'] = $entity->body;
         $data['alias'] = $entity->alias;
     }
     if ($entity->inherits('ComBaseDomainEntityComment')) {
         $data['body'] = $entity->body;
     }
     if ($entity->isPortraitable()) {
         $imageURL = array();
         if ($entity->portraitSet()) {
             $sizes = $entity->getPortraitSizes();
             foreach ($sizes as $name => $size) {
                 $url = null;
                 if ($entity->portraitSet()) {
                     $url = $entity->getPortraitURL($name);
                 }
                 $parts = explode('x', $size);
                 $width = 0;
                 $height = 0;
                 if (count($parts) == 0) {
                     continue;
                 } elseif (count($parts) == 1) {
                     $height = $width = $parts[0];
                 } else {
                     $width = $parts[0];
                     $height = $parts[1];
                     //hack to set the ratio based on the original
                     if ($height == 'auto' && isset($sizes['original'])) {
                         $original_size = explode('x', $sizes['original']);
                         $height = $width * $original_size[1] / $original_size[0];
                     }
                 }
                 $imageURL[$name] = array('size' => array('width' => (int) $width, 'height' => (int) $height), 'url' => $url);
             }
         }
         $data['imageURL'] = $imageURL;
     }
     // @todo check for $entity->isAuthorizer() and $entity->authorize('administration') scenarios later on
     if ($entity->isAdministrable()) {
         $data['administratorIds'] = array_values($entity->administratorIds->toArray());
         if ($viewer) {
             $data['isAdministrated'] = $viewer->administrator($entity);
         }
     }
     if ($viewer && !$viewer->eql($entity)) {
         if ($entity->isFollowable()) {
             $data['isLeader'] = $viewer->following($entity);
         }
         if ($entity->isLeadable()) {
             $data['isFollower'] = $viewer->leading($entity);
         }
     }
     if ($entity->isModifiable() && !is_person($entity)) {
         $data->append(array('author' => null, 'creationTime' => null, 'editor' => null, 'updateTime' => null));
         if (isset($entity->author)) {
             $data['author'] = $entity->author->toSerializableArray();
             $data['creationTime'] = $entity->creationTime->getDate();
         }
         if (isset($entity->editor)) {
             $data['editor'] = $entity->editor->toSerializableArray();
             $data['updateTime'] = $entity->updateTime->getDate();
         }
     }
     if ($entity->isCommentable()) {
         $data['openToComment'] = (bool) $entity->openToComment;
         $data['numOfComments'] = $entity->numOfComments;
         $data['lastCommentTime'] = $entity->lastCommentTime ? $entity->lastCommentTime->getDate() : null;
         $data['lastComment'] = null;
         $data['lastCommenter'] = null;
         if (isset($entity->lastComment)) {
             $data['lastComment'] = $entity->lastComment->toSerializableArray();
         }
         if (isset($entity->lastCommenter)) {
             $data['lastCommenter'] = $entity->lastCommenter->toSerializableArray();
         }
     }
     if ($entity->isFollowable()) {
         $data['followerCount'] = $entity->followerCount;
     }
     if ($entity->isLeadable()) {
         $data['leaderCount'] = $entity->leaderCount;
         $data['mutualCount'] = $entity->mutualCount;
     }
     if ($entity->isSubscribable()) {
         $data['subscriberCount'] = $entity->subscriberCount;
     }
     if ($entity->isVotable()) {
         $data['voteUpCount'] = $entity->voteUpCount;
     }
     if ($entity->isOwnable()) {
//.........这里部分代码省略.........
开发者ID:stonyyi,项目名称:anahita,代码行数:101,代码来源:default.php


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