本文整理汇总了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;
}
示例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);
}