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


PHP Foundry::string方法代码示例

本文整理汇总了PHP中Foundry::string方法的典型用法代码示例。如果您正苦于以下问题:PHP Foundry::string方法的具体用法?PHP Foundry::string怎么用?PHP Foundry::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Foundry的用法示例。


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

示例1: execute

 /**
  *
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function execute($item)
 {
     // Get comment participants
     $model = FD::model('Comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     // Include the actor of the stream item as the recipient
     // Exclude myself from the list of users.
     // Ensure that the values are unique
     $users[] = $item->actor_id;
     $users = array_values(array_unique(array_diff($users, array(Foundry::user()->id))));
     // Convert the names to stream-ish
     $names = Foundry::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     // By default content is always empty;
     $content = '';
     // Only show the content when there is only 1 item
     if (count($users) == 1 && !empty($item->content)) {
         $content = JString::substr(strip_tags($item->content), 0, 30);
         if (JString::strlen($item->content) > 30) {
             $content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
         }
     }
     // Load the milestone
     $milestone = FD::table('Milestone');
     $state = $milestone->load($item->uid);
     if (!$state) {
         return;
     }
     // We need to generate the notification message differently for the author of the item and the recipients of the item.
     if ($milestone->owner_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_YOUR_MILESTONE', $names);
         return $item;
     }
     if ($milestone->owner_id == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_THEIR_MILESTONE', $names);
         return $item;
     }
     // This is for 3rd party viewers
     $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_USERS_MILESTONE', $names, Foundry::user($milestone->owner_id)->getName());
     return $item;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:49,代码来源:notification.comments.php

示例2: pluralize

 /**
  * Pluralize the string if necessary.
  *
  * @since   1.2
  * @access  public
  * @param   string
  * @return  
  */
 public static function pluralize($languageKey, $count)
 {
     return Foundry::string()->computeNoun($languageKey, $count);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:12,代码来源:string.php


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