本文整理汇总了PHP中FD::string方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::string方法的具体用法?PHP FD::string怎么用?PHP FD::string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
*
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute($item)
{
// Get the owner of the stream item since we need to notify the person
$stream = FD::table('Stream');
$stream->load($item->uid);
// Get comment participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Include the actor of the stream item as the recipient
$users = array_merge(array($item->actor_id), $users);
// Ensure that the values are unique
$users = array_unique($users);
$users = array_values($users);
// Exclude myself from the list of users.
$index = array_search(FD::user()->id, $users);
if ($index !== false) {
unset($users[$index]);
$users = array_values($users);
}
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : 'SINGULAR';
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($stream->actor_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_PROFILES_USER_LIKES_YOUR_PROFILE_UPDATES' . $plurality, $names);
return $item;
}
if ($stream->actor_id == $item->actor_id && count($users)) {
$item->title = JText::sprintf('APP_USER_PROFILES_OWNER_LIKES_PROFILE_UPDATE' . FD::user($stream->actor_id)->getGenderLang(), $names);
}
// This is for 3rd party viewers
$item->title = JText::sprintf('APP_USER_PROFILES_USER_LIKES_USER_PROFILE_UPDATES' . $plurality, $names, FD::user($stream->actor_id)->getName());
return $item;
}
示例2: execute
public function execute($item)
{
// Get comment participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
list($element, $group, $verb) = explode('.', $item->context_type);
$event = FD::event($item->uid);
$owner = FD::user($item->getParams()->get('owner_id'));
// Verbs
// makeadmin
// going
// notgoing
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_PLURAL
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
return $item;
}
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
return $item;
}
示例3: execute
/**
*
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute($item)
{
// Get the badge
$badge = FD::table('Badge');
$badge->load($item->uid);
// Break the namespace
list($element, $group, $verb, $owner) = explode('.', $item->context_type);
// Get the permalink of the achievement item which is the stream item
$streamItem = FD::table('StreamItem');
$streamItem->load(array('context_type' => $element, 'verb' => $verb, 'actor_type' => $group, 'actor_id' => $owner));
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// Get the badge image
$item->image = $badge->getAvatar();
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($owner == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_YOUR_ACHIEVEMENT' . $plurality, $names, $badge->get('title'));
return $item;
}
if ($owner == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_BADGES_OWNER_COMMENTED_ON_ACHIEVEMENT' . FD::user($owner)->getGenderLang(), $names, $badge->get('title'));
return $item;
}
// This is for 3rd party viewers
$item->title = JText::sprintf('APP_USER_BADGES_USER_COMMENTED_ON_USERS_ACHIEVEMENT' . $plurality, $names, FD::user($stream->actor_id)->getName(), $badge->get('title'));
return $item;
}
示例4: execute
/**
* Processes likes notifications
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute(&$item)
{
// Get likes participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// When someone likes on the photo that you have uploaded in a event
if ($item->context_type == 'news.event.create') {
// We do not want to display any content if the person likes a event announcement
$item->content = '';
// Get the news object
$news = FD::table('EventNews');
$news->load($item->uid);
// Get the event from the stream
$event = FD::event($news->cluster_id);
// Set the content
if ($event) {
$item->image = $event->getAvatar();
}
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($news->created_by == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$langString = FD::string()->computeNoun('APP_EVENT_NEWS_USER_LIKES_YOUR_ANNOUNCEMENT', count($users));
$item->title = JText::sprintf($langString, $names, $event->getName());
return $item;
}
// This is for 3rd party viewers
$langString = FD::string()->computeNoun('APP_EVENT_NEWS_USER_LIKES_USER_ANNOUNCEMENT', count($users));
$item->title = JText::sprintf($langString, $names, FD::user($news->created_by)->getName(), $event->getName());
return;
}
return;
}
示例5: execute
public function execute($item)
{
$contexts = explode('.', $item->context_type);
$streamItem = FD::table('StreamItem');
$streamItem->load(array('context_id' => $item->uid, 'context_type' => $contexts[0], 'verb' => $contexts[2]));
$stream = FD::table('Stream');
$stream->load($streamItem->uid);
// Get likes participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Include the notification actor
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
if ($stream->actor_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_RELATIONSHIP_USER_COMMENTED_ON_YOUR_RELATIONSHIP_STATUS' . $plurality, $names);
return $item;
}
if ($stream->actor_id == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_RELATIONSHIP_OWNER_COMMENTED_ON_RELATIONSHIP_STATUS' . FD::user($stream->actor_id)->getGenderLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_RELATIONSHIP_USER_COMMENTED_ON_USER_RELATIONSHIP_STATUS' . $plurality, $names, FD::user($stream->actor_id)->getName());
return $item;
}
示例6: execute
public function execute($item)
{
$model = FD::model('comments');
$users = $model->getParticipants($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
$content = '';
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');
}
}
$item->content = $content;
list($element, $group, $verb) = explode('.', $item->context_type);
$streamItem = FD::table('streamitem');
$state = $streamItem->load(array('context_type' => $element, 'actor_type' => $group, 'verb' => $verb, 'context_id' => $item->uid));
if (!$state) {
return;
}
$owner = $streamItem->actor_id;
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner) {
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_COMMENTED_ON_YOUR_ITEM' . $plurality, $names);
return $item;
}
if ($item->actor_id == $owner && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_ARTICLE_OWNER_COMMENTED_ON_ITEM' . FD::user($owner)->getGenderLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_COMMENTED_ON_USER_ITEM' . $plurality, $names, FD::user($owner)->getName());
return $item;
}
示例7: execute
public function execute(&$item)
{
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// When someone likes on the photo that you have uploaded in a event
if ($item->context_type == 'files.event.uploaded') {
$file = FD::table('File');
$file->load($item->uid);
// Get the event
$event = FD::event($file->uid);
// Set the content
if ($file->hasPreview()) {
$item->image = $file->getPreviewURI();
}
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($file->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_EVENT_FILES_USER_COMMENTED_ON_YOUR_FILE', count($users)), $names);
return $item;
}
// This is for 3rd party viewers
$item->title = JText::sprintf(FD::string()->computeNoun('APP_EVENT_FILES_USER_COMMENTED_ON_USERS_FILE', count($users)), $names, FD::user($file->user_id)->getName());
return;
}
return;
}
示例8: execute
public function execute($item)
{
$model = FD::model('likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
$users[] = $item->actor_id;
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
list($element, $group, $verb) = explode('.', $item->context_type);
$streamItem = FD::table('streamitem');
$state = $streamItem->load(array('context_type' => $element, 'actor_type' => $group, 'verb' => $verb, 'context_id' => $item->uid));
if (!$state) {
return;
}
$owner = $streamItem->actor_id;
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner) {
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_YOUR_ITEM' . $plurality, $names);
return $item;
}
if ($item->actor_id == $owner && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_ARTICLE_OWNER_LIKES_ITEM' . FD::user($owner)->getGenderLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_ARTICLE_USER_LIKES_USER_ITEM' . $plurality, $names, FD::user($owner)->getName());
return $item;
}
示例9: execute
public function execute($item, $calendar)
{
$model = FD::model('comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Include the notification actor
$users[] = $item->actor_id;
// Exclude the current user
$users = array_values(array_unique(array_diff($users, array(FD::user()->id))));
$names = FD::string()->namesToNotifications($users);
$plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
$content = '';
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');
}
}
$item->content = $content;
if ($calendar->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_YOUR_EVENT' . $plurality, $names);
return $item;
}
if ($calendar->user_id == $item->actor_id && count($users) == 1) {
$item->title = JText::sprintf('APP_USER_CALENDAR_OWNER_COMMENTED_ON_EVENT' . FD::user($calendar->user_id)->getGendarLang(), $names);
return $item;
}
$item->title = JText::sprintf('APP_USER_CALENDAR_USER_COMMENTED_ON_USER_EVENT' . $plurality, $names, FD::user($calendar->user_id)->getName());
return $item;
}
示例10: formatContent
public function formatContent($content)
{
if (empty($this->item->tags)) {
return $content;
}
$content = FD::string()->processTags($this->item->tags, $content);
return $content;
}
示例11: _
/**
* Alias to JText::_
*
* @since 1.3
* @access public
* @param string
* @return
*/
public static function _($string, $escape = false)
{
$string = JText::_($string);
if ($escape) {
$string = FD::string()->escape($string);
}
return $string;
}
示例12: send
/**
* Sends a new share to a user.
*
* @since 1.0
* @access public
*/
public function send()
{
FD::checkToken();
$token = JRequest::getString('token', '');
$recipients = JRequest::getVar('recipients', array());
$content = JRequest::getVar('content', '');
// Get the current view.
$view = $this->getCurrentView();
// Cleaning
if (is_string($recipients)) {
$recipients = explode(',', FD::string()->escape($recipients));
}
if (is_array($recipients)) {
foreach ($recipients as &$recipient) {
$recipient = FD::string()->escape($recipient);
if (!JMailHelper::isEmailAddress($recipient)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_RECIPIENT'));
}
}
}
$content = FD::string()->escape($content);
// Check for valid data
if (empty($recipients)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_NO_RECIPIENTS'));
}
if (empty($token)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_TOKEN'));
}
$session = JFactory::getSession();
$config = FD::config();
$limit = $config->get('sharing.email.limit', 0);
$now = FD::date()->toUnix();
$time = $session->get('easysocial.sharing.email.time');
$count = $session->get('easysocial.sharing.email.count');
if (is_null($time)) {
$session->set('easysocial.sharing.email.time', $now);
$time = $now;
}
if (is_null($count)) {
$session->set('easysocial.sharing.email.count', 0);
}
$diff = $now - $time;
if ($diff <= 3600) {
if ($limit > 0 && $count >= $limit) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_SHARING_LIMIT_MAXED'));
}
$count++;
$session->set('easysocial.sharing.email.count', $count);
} else {
$session->set('easysocial.sharing.email.time', $now);
$session->set('easysocial.sharing.email.count', 1);
}
$library = FD::get('Sharing');
$library->sendLink($recipients, $token, $content);
$view->call(__FUNCTION__, true);
}
示例13: getContent
/**
* Formats the content of a note
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function getContent()
{
// Apply e-mail replacements
$content = FD::string()->replaceEmails($this->content);
// Apply hyperlinks
$content = FD::string()->replaceHyperlinks($content);
// Apply bbcode
$content = FD::string()->parseBBCode($content, array('code' => true, 'escape' => false));
return $content;
}
示例14: render
private function render($text)
{
$string = FD::string();
if ($this->params->get('bbcode')) {
// Don't allow html codes here
$text = strip_tags($text);
$text = $string->parseBBCode($text);
} else {
$text = $string->escape($text);
}
$this->set('text', $text);
return $this->display();
}
示例15: execute
public function execute($item)
{
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// By default content is always empty;
$content = '';
// Only show the content when there is only 1 item
if (count($users) == 1) {
// Legacy fix for prior to 1.2 as there is no content stored.
if (!empty($item->content)) {
$content = JString::substr(strip_tags($item->content), 0, 30);
if (JString::strlen($item->content) > 30) {
$content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
}
}
}
list($element, $group, $verb) = explode('.', $item->context_type);
$item->content = $content;
$guest = FD::table('EventGuest');
$guest->load($item->uid);
$event = FD::event($guest->cluster_id);
$owner = FD::user($item->getParams()->get('owner_id'));
// Verbs
// makeadmin
// going
// notgoing
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_NOTGOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_NOTGOING_PLURAL
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
return $item;
}
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
return $item;
}