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


PHP CStringHelper::converttagtolink方法代码示例

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


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

示例1: ajaxAddReply


//.........这里部分代码省略.........
     }
     if (empty($messageRecipient)) {
         $json = array('error' => JText::_('COM_COMMUNITY_INBOX_MESSAGE_CANNOT_FIND_RECIPIENT'));
         die(json_encode($json));
     }
     // make sure we can only reply to message that belogn to current user
     if (!$model->canReply($my->id, $msgId)) {
         $json = array('error' => JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'));
         die(json_encode($json));
     }
     if (in_array($messageRecipient[0], $bannedList)) {
         $json = array('error' => JText::_('COM_COMMUNITY_USER_BANNED'));
         die(json_encode($json));
     }
     $date = JFactory::getDate();
     //get the time without any offset!
     $obj = new stdClass();
     $obj->id = null;
     $obj->from = $my->id;
     $obj->posted_on = $date->toSql();
     $obj->from_name = $my->name;
     $obj->subject = 'RE:' . $message->subject;
     $obj->body = $reply;
     $body = new JRegistry();
     $body->set('content', $obj->body);
     // photo attachment
     if ($photoId > 0) {
         //lets check if the photo belongs to the uploader
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($photoId);
         if ($photo->creator == $my->id && $photo->albumid == '-1') {
             $body->set('attached_photo_id', $photoId);
             //sets the status to ready so that it wont be deleted on cron run
             $photo->status = 'ready';
             $photo->store();
         }
     }
     /**
      * @since 3.2.1
      * Message URL fetching
      */
     if (preg_match("/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i", $obj->body)) {
         $graphObject = CParsers::linkFetch($obj->body);
         if ($graphObject) {
             $graphObject->merge($body);
             $obj->body = $graphObject->toString();
         }
     } else {
         $obj->body = $body->toString();
     }
     $model->sendReply($obj, $msgId);
     $deleteLink = CRoute::_('index.php?option=com_community&view=inbox&task=remove&msgid=' . $obj->id);
     $authorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
     //add user points
     CUserPoints::assignPoint('inbox.message.reply');
     // Add notification
     foreach ($messageRecipient as $row) {
         $params = new CParameter('');
         $params->set('message', $reply);
         $params->set('title', $obj->subject);
         $params->set('url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgId);
         $params->set('msg_url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgId);
         $params->set('msg', JText::_('COM_COMMUNITY_PRIVATE_MESSAGE'));
         $params->set('msg', JText::_('COM_COMMUNITY_PRIVATE_MESSAGE'));
         CNotificationLibrary::add('inbox_create_message', $my->id, $row, JText::_('COM_COMMUNITY_SENT_YOU_MESSAGE'), '', 'inbox.sent', $params);
     }
     // onMessageDisplay Event trigger
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $args = array();
     $args[] = $obj;
     $appsLib->triggerEvent('onMessageDisplay', $args);
     $params = new JRegistry($obj->body);
     // Escape content
     $content = $originalContent = $params->get('content');
     $content = CTemplate::escape($content);
     $content = CStringHelper::autoLink($content);
     $content = nl2br($content);
     $content = CStringHelper::getEmoticon($content);
     $content = CStringHelper::converttagtolink($content);
     //get thumbnail if available
     $photoThumbnail = '';
     if ($params->get('attached_photo_id')) {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($params->get('attached_photo_id'));
         $photoThumbnail = $photo->getThumbURI();
     }
     $tmpl = new CTemplate();
     $tmpl->set('user', CFactory::getUser($obj->from));
     $tmpl->set('msg', $obj);
     $tmpl->set('originalContent', $originalContent);
     $tmpl->set('content', $content);
     $tmpl->set('params', $params);
     $tmpl->set('removeLink', $deleteLink);
     $tmpl->set('authorLink', $authorLink);
     $tmpl->set('photoThumbnail', $photoThumbnail);
     $html = $tmpl->fetch('inbox.message');
     $json = array('success' => true, 'html' => $html);
     die(json_encode($json));
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:inbox.php

示例2: formatComment


//.........这里部分代码省略.........
     }
     $commentsHTML .= '</span>';
     $commentsHTML .= '</div>';
     $editHTML = '';
     if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) {
         $editHTML .= '<a href="javascript:" class="joms-button--edit">';
         $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>';
         $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>';
         $editHTML .= '</a>';
     }
     $removeHTML = '';
     if ($allowRemove) {
         $removeHTML .= '<a href="javascript:" class="joms-button--remove">';
         $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>';
         $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>';
         $removeHTML .= '</a>';
     }
     $removeTagHTML = '';
     if (CActivitiesHelper::hasTag($my->id, $wall->comment)) {
         $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>';
     }
     /* user deleted */
     if ($user->guest == 1) {
         $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> ';
     } else {
         $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> ';
     }
     $params = $wall->params;
     $paramsHTML = '';
     $image = (array) $params->get('image');
     $photoThumbnail = false;
     if ($params->get('attached_photo_id') > 0) {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($params->get('attached_photo_id'));
         $photoThumbnail = $photo->getThumbURI();
         $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>';
     } else {
         if ($params->get('title')) {
             $video = self::detectVideo($params->get('url'));
             if (is_object($video)) {
                 $paramsHTML .= '<div class="joms-media--video joms-js--video"';
                 $paramsHTML .= ' data-type="' . $video->type . '"';
                 $paramsHTML .= ' data-id="' . $video->id . '"';
                 $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"';
                 $paramsHTML .= ' style="margin-top:10px;">';
                 $paramsHTML .= '<div class="joms-media__thumbnail">';
                 $paramsHTML .= '<img src="' . $video->getThumbnail() . '">';
                 $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">';
                 $paramsHTML .= '<div class="mejs-overlay-button"></div>';
                 $paramsHTML .= '</a>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '</div>';
             } else {
                 $paramsHTML .= '<div class="joms-gap"></div>';
                 $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">';
                 if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) {
                     $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>';
                 }
                 if ($params->get('image')) {
                     $paramsHTML .= $params->get('link');
                     $paramsHTML .= '<div class="joms-media__thumbnail">';
                     $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">';
                     $paramsHTML .= '<img src="' . array_shift($image) . '" />';
                     $paramsHTML .= '</a>';
                     $paramsHTML .= '</div>';
                 }
                 $url = $params->get('url') ? $params->get('url') : '#';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<a href="' . $url . '">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>';
                 if ($params->get('link')) {
                     $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>';
                 }
                 $paramsHTML .= '</a></div></div>';
             }
         }
     }
     if (!$params->get('title') && $params->get('url')) {
         $paramsHTML .= '<div class="joms-gap"></div>';
         $paramsHTML .= '<div class="joms-media--album">';
         $paramsHTML .= '<a href="' . $params->get('url') . '">';
         $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />';
         $paramsHTML .= '</a>';
         $paramsHTML .= '</div>';
     }
     $wall->comment = nl2br($wall->comment);
     $wall->comment = CUserHelper::replaceAliasURL($wall->comment);
     $wall->comment = CStringHelper::getEmoticon($wall->comment);
     $wall->comment = CStringHelper::converttagtolink($wall->comment);
     // convert to hashtag
     $template = new CTemplate();
     $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML);
     $commentsHTML = $template->fetch('stream/single-comment');
     return $commentsHTML;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:wall.php

示例3: ajaxUpdateWall

 public function ajaxUpdateWall($wallId, $message, $editableFunc, $photoId = 0)
 {
     $filter = JFilterInput::getInstance();
     $wallId = $filter->clean($wallId, 'int');
     $editableFunc = $filter->clean($editableFunc, 'string');
     $wall = JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     $objResponse = new JAXresponse();
     $json = array();
     if (empty($message)) {
         $json['error'] = JText::_('COM_COMMUNITY_EMPTY_MESSAGE');
         die(json_encode($json));
     }
     $isEditable = CWall::isEditable($editableFunc, $wall->id);
     if (!$isEditable) {
         $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT');
         die(json_encode($json));
     }
     // We don't want to touch the comments data.
     $comments = CComment::getRawCommentsData($wall->comment);
     $wall->comment = $message;
     $wall->comment .= $comments;
     $my = CFactory::getUser();
     $data = CWallLibrary::saveWall($wall->contentid, $wall->comment, $wall->type, $my, false, $editableFunc, 'wall/content', $wall->id, $photoId);
     $wall->originalComment = $wall->comment;
     $CComment = new CComment();
     $wall->comment = $CComment->stripCommentData($wall->comment);
     $wall->comment = CStringHelper::autoLink($wall->comment);
     $wall->comment = nl2br($wall->comment);
     $wall->comment = CUserHelper::replaceAliasURL($wall->comment);
     $wall->comment = CStringHelper::getEmoticon($wall->comment);
     $wall->comment = CStringHelper::converttagtolink($wall->comment);
     // convert to hashtag
     $json['success'] = true;
     $json['comment'] = $wall->comment;
     $json['originalComment'] = $wall->originalComment;
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:38,代码来源:system.php

示例4: read

 /**
  * Show the message reading window
  */
 public function read($data)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $config = CFactory::getConfig();
     if (!$config->get('enablepm')) {
         echo JText::_('COM_COMMUNITY_PRIVATE_MESSAGING_DISABLED');
         return;
     }
     //page title
     $document = JFactory::getDocument();
     $inboxModel = CFactory::getModel('inbox');
     $my = CFactory::getUser();
     $msgid = $jinput->request->get('msgid', 0, 'INT');
     if (!$inboxModel->canRead($my->id, $msgid)) {
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'), 'error');
         return;
     }
     $pathway = $mainframe->getPathway();
     $pathway->addItem($this->escape(JText::_('COM_COMMUNITY_INBOX_TITLE')), CRoute::_('index.php?option=com_community&view=inbox'));
     $parentData = '';
     $html = '';
     $messageHeading = '';
     $recipient = array();
     $parentData = $inboxModel->getMessage($msgid);
     if (!empty($data->messages)) {
         $document = JFactory::getDocument();
         $pathway->addItem($this->escape(htmlspecialchars_decode($parentData->subject)));
         $document->setTitle(htmlspecialchars_decode($parentData->subject));
         require_once COMMUNITY_COM_PATH . '/libraries/apps.php';
         $appsLib = CAppPlugins::getInstance();
         $appsLib->loadApplications();
         $config = CFactory::getConfig();
         $pagination = intval($config->get('stream_default_comments', 5));
         $count = count($data->messages);
         $hide = true;
         foreach ($data->messages as $row) {
             $count--;
             if ($count < $pagination) {
                 $hide = false;
             }
             // onMessageDisplay Event trigger
             $args = array();
             $originalBodyContent = $row->body;
             $row->body = new JRegistry($row->body);
             if ($row->body == '{}') {
                 //backward compatibility, save the old data into content parameter if needed
                 $newParam = new CParameter();
                 $newParam->set('content', $originalBodyContent);
                 $table = JTable::getInstance('Message', 'CTable');
                 $table->load($row->id);
                 $table->body = $newParam->toString();
                 $table->store();
                 $row->body = new CParameter($table->body);
             }
             // Escape content
             $content = $originalContent = $row->body->get('content');
             $content = CTemplate::escape($content);
             $content = CStringHelper::autoLink($content);
             $content = nl2br($content);
             $content = CStringHelper::getEmoticon($content);
             $content = CStringHelper::converttagtolink($content);
             $content = CUserHelper::replaceAliasURL($content);
             $params = $row->body;
             $args[] = $row;
             $appsLib->triggerEvent('onMessageDisplay', $args);
             $user = CFactory::getUser($row->from);
             //construct the delete link
             $deleteLink = CRoute::_('index.php?option=com_community&view=inbox&task=remove&msgid=' . $row->id);
             $authorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
             //get thumbnail if available
             $photoThumbnail = '';
             if ($params->get('attached_photo_id')) {
                 $photo = JTable::getInstance('Photo', 'CTable');
                 $photo->load($params->get('attached_photo_id'));
                 $photoThumbnail = $photo->getThumbURI();
             }
             $tmpl = new CTemplate();
             $html .= $tmpl->set('user', $user)->set('msg', $row)->set('hide', $hide)->set('originalContent', $originalContent)->set('content', $content)->set('params', $params)->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('removeLink', $deleteLink)->set('authorLink', $authorLink)->set('photoThumbnail', $photoThumbnail)->fetch('inbox.message');
         }
         $myLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
         $recipient = $inboxModel->getRecepientMessage($msgid);
         $recepientCount = count($recipient);
         $textOther = $recepientCount > 1 ? 'COM_COMMUNITY_MSG_OTHER' : 'COM_COMMUNITY_MSG_OTHER_SINGULAR';
         $messageHeading = JText::sprintf('COM_COMMUNITY_MSG_BETWEEN_YOU_AND_USER', $myLink, '#', JText::sprintf($textOther, $recepientCount));
     } else {
         $html = '<div class="text">' . JText::_('COM_COMMUNITY_INBOX_MESSAGE_EMPTY') . '</div>';
     }
     //end if
     $tmplMain = new CTemplate();
     echo $tmplMain->set('messageHeading', $messageHeading)->set('recipient', $recipient)->set('limit', $pagination)->set('messages', $data->messages)->set('parentData', $parentData)->set('htmlContent', $html)->set('my', $my)->set('submenu', $this->showSubmenu(false))->fetch('inbox.read');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:98,代码来源:view.html.php

示例5: nl2br

						<small>
							<?php 
        echo $discussion['created_interval'];
        ?>
						</small>
					</span>
				</div>
			</div>
			<div class="joms-stream__body">
				<?php 
        // Escape content
        $discussion['comment'] = CTemplate::escape($discussion['comment']);
        $discussion['comment'] = CStringHelper::autoLink($discussion['comment']);
        $discussion['comment'] = nl2br($discussion['comment']);
        $discussion['comment'] = CStringHelper::getEmoticon($discussion['comment']);
        $discussion['comment'] = CStringHelper::converttagtolink($discussion['comment']);
        $discussion['comment'] = CUserHelper::replaceAliasURL($discussion['comment']);
        echo substr($discussion['comment'], 0, 250);
        if (strlen($discussion['comment']) > 250) {
            echo ' ...';
        }
        // @TODO: DRY
        $video = JTable::getInstance('Video', 'CTable');
        if ($video->init($params->get('url'))) {
            $video->isValid();
        } else {
            $video = false;
        }
        if (is_object($video)) {
            ?>
                    <div class="joms-media--video joms-js--video"
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:groups.discussion.updates.php

示例6: format

 /**
  * General purpose stream formatting function
  */
 public static function format($str, $mood = null)
 {
     // Some database actually already stored some URL already linked! Such as @mention format
     // To handle this, we strip to to the base format. and apply the linking later
     $str = preg_replace('|@<a href="(.*?)".*>(.*)</a>|', '@${2}', $str);
     //Strip html href tag
     $str = preg_replace('|<a href="(.*?)".*>(.*)</a>|', '${1}', $str);
     // Escape it first
     $str = CStringHelper::escape(rtrim(str_replace('&nbsp;', '', $str)));
     $str = str_replace('&amp;quot;', '"', $str);
     // Autolink url
     $str = CStringHelper::autoLink($str);
     // Nl2Br
     $str = nl2br($str);
     // Autolinked username
     $str = CUserHelper::replaceAliasURL($str);
     $str = CStringHelper::getEmoticon($str);
     $str = CStringHelper::getMood($str, $mood);
     $str = CStringHelper::converttagtolink($str);
     return $str;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:24,代码来源:activities.php

示例7: format

 /**
  * General purpose stream formatting function
  */
 public static function format($str, $mood = null)
 {
     // Some database actually already stored some URL already linked! Such as @mention format
     // To handle this, we strip to to the base format. and apply the linking later
     $str = preg_replace('|@<a href="(.*?)".*>(.*)</a>|', '@${2}', $str);
     //Strip html href tag
     $str = preg_replace('|<a href="(.*?)".*>(.*)</a>|', '${1}', $str);
     // Escape it first
     $str = CStringHelper::escape(rtrim(str_replace('&nbsp;', '', $str)));
     $str = str_replace('&amp;quot;', '"', $str);
     // Autolink url
     $str = CStringHelper::autoLink($str);
     // Nl2Br
     $str = nl2br($str);
     // Autolinked username
     $str = CUserHelper::replaceAliasURL($str);
     $str = CStringHelper::getEmoticon($str);
     $str = CStringHelper::getMood($str, $mood);
     $str = CStringHelper::converttagtolink($str);
     //onstream comment filter
     // onMessageDisplay Event trigger
     if ($str) {
         $appsLib = CAppPlugins::getInstance();
         $appsLib->loadApplications();
         $strObj = new stdClass();
         $strObj->body = $str;
         $arg[] = $strObj;
         $appsLib->triggerEvent('onFormatConversion', $arg);
         $str = $arg[0]->body;
         // reassign back to string
     }
     return $str;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:36,代码来源:activities.php


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