本文整理汇总了PHP中JHtmlString::abridge方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtmlString::abridge方法的具体用法?PHP JHtmlString::abridge怎么用?PHP JHtmlString::abridge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtmlString
的用法示例。
在下文中一共展示了JHtmlString::abridge方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAbridge
/**
* Tests the JHtmlString::abridge method.
*
* @param string $text The text to truncate.
* @param integer $length The maximum length of the text.
* @param integer $intro The maximum length of the intro text.
* @param string $expected The expected result.
*
* @return void
*
* @dataProvider getTestAbridgeData
* @since 11.3
*/
public function testAbridge($text, $length, $intro, $expected)
{
$this->assertThat(JHtmlString::abridge($text, $length, $intro), $this->equalTo($expected));
}
示例2: strtolower
?>
" />
<?php
}
?>
</div>
<div class="file-list-meta">
<a class="file-title" data-filename="<?php
echo StreamTemplate::escape($fullFilename);
?>
" href="<?php
echo JRoute::_('index.php?option=com_stream&view=system&task=download&file_id=' . $row->id);
?>
"><?php
echo StreamTemplate::escape(JHtmlString::abridge($row->filename, 32, 25));
?>
</a>
<span class="small">
<?php
$fext = strtolower(substr($row->filename, -4));
if ($jxConfig->isCrocodocsEnabled() || $jxConfig->isScribdEnabled()) {
if (in_array($fext, array('.doc', 'docx', '.pdf', '.ppt', 'pptx'))) {
echo ' <a href="javascript:void(0);" class="meta-preview small" data-message_id="' . $row->stream_id . '" data-filename="' . StreamTemplate::escape($row->filename) . '" data-file_id="' . $row->id . '" onclick="S.preview.show(this);">' . JText::_('COM_STREAM_LABEL_PREVIEW') . '</a>';
}
}
?>
(<?php
echo StreamMessage::formatBytes($row->filesize);
?>
)
示例3: testAbridge
/**
* Tests the JHtmlString::abridge method.
*
* @param string $text The text to truncate.
* @param integer $length The maximum length of the text.
* @param integer $intro The maximum length of the intro text.
* @param string $expected The expected result.
*
* @return void
*
* @since 3.1
* @dataProvider getTestAbridgeData
*/
public function testAbridge($text, $length, $intro, $expected)
{
$this->assertEquals($expected, JHtmlString::abridge($text, $length, $intro));
}
示例4: foreach
<ul id="edit-attachment-list" class="edit-attachment">
<!-- show attachement to allow file deletion -->
<?php
if (!empty($files)) {
foreach ($files as $file) {
?>
<li style="list-style: none outside none;margin-left:0px;padding-left: 8px;" class="qq-upload-success">
<div data-filename="<?php
echo $file->filename;
?>
" class="message-content-file" file_id="<?php
echo $file->id;
?>
">
<?php
echo StreamTemplate::escape(JHtmlString::abridge($file->filename, 24));
?>
<span class="small hint">(<?php
echo StreamMessage::formatBytes($file->filesize, 1);
?>
)</span>
<a file_id="<?php
echo $file->id;
?>
" href="#unlinkAttachment" class="meta-edit">Remove</a>
<input type="hidden" value="<?php
echo $file->id;
?>
" name="attachment[]">
</div>
</li>
示例5: getAttachmentHTML
/**
* Return attachment view for the given stream
*/
public static function getAttachmentHTML($stream)
{
$my = JXFactory::getUser();
$data = json_decode($stream->raw);
$html = '';
if (!function_exists('whoMakesAction')) {
/**
* Call this function to retrieve the item/message viewer
* @param JTable $stream the current StreamTable
* @param int $item_id the owner of the item (for example: id of the file or id of a message contains a link)
* @param String $type type of the item (since tracking is done by id, being specific is safer. eg: file_220, link_220)
*/
function whoMakesAction($stream, $item_id = 0, $type = NULL)
{
// get list of avatar who viewed the stream
$whoMakesAction = $stream->whoMakesAction($item_id, $type);
$avatarListWhoMakeAction = '';
if ($whoMakesAction && count($whoMakesAction) > 0) {
// Do rename the variable if its too long or easily mistyped
$avatarListWhoMakeAction .= '<div class="user-horizontal-list message-reader-list">';
if ($type == 'video') {
// change language from READ to SEEN if its a video
$avatarListWhoMakeAction .= '<span class="small">' . JText::_('COM_STREAM_LABEL_SEEN_BY') . ' ';
} else {
$avatarListWhoMakeAction .= '<span class="small">' . JText::_('COM_STREAM_LABEL_READ_BY') . ' ';
}
/* $avatarListWhoMakeAction .= count($whoMakesAction) . ' reader'; */
$avatarListWhoMakeAction .= '<a href="#showReaders" data-content="<ul>';
foreach ($whoMakesAction as $user_id) {
// there will be 0 as user which in return will load current user
if ($user_id != 0 && $user_id != NULL) {
$user = JXFactory::getUser($user_id);
$avatarListWhoMakeAction .= StreamTemplate::escape('<li><a href="' . $user->getURL() . '">' . $user->name . '</a></li>');
}
}
$avatarListWhoMakeAction .= '</ul>">';
$label = count($whoMakesAction) > 1 ? JText::_('COM_STREAM_LABEL_USERS') : JText::_('COM_STREAM_LABEL_USER');
$avatarListWhoMakeAction .= count($whoMakesAction) . " {$label}</a>";
$avatarListWhoMakeAction .= '</span></div>';
}
return $avatarListWhoMakeAction;
}
}
// Attachment
$jxConfig = new JXConfig();
$files = $stream->getFiles();
$hasPreview = false;
$numPreview = 0;
// Sort the files, photos at the bottom
usort($files, array('StreamMessage', 'sortAttachment'));
$imgHtml = '<div class="message-content-attachment">';
foreach ($files as $file) {
// only show if the file does exist
// @todo: templatize this ?
$dlLink = JRoute::_('index.php?option=com_stream&view=system&task=download&file_id=' . $file->id);
// Show file name only if preview doesn't exist
// Otherwise, just show the preview. People can click on the preview and download it from tehre
if (!$file->getParam('has_preview')) {
// Show preview link, of if the filename is doc, docx, pdf, ppt, pptx
$fext = strtolower(substr($file->filename, -4));
$html .= '<div data-filename="' . $file->filename . '" ' . 'data-message_id=' . $stream->id . ' class="message-content-file ">';
$html .= '<a title="Click to download" href="' . $dlLink . '">' . StreamTemplate::escape(JHtmlString::abridge($file->filename, 20, 13)) . '</a>';
$html .= ' <span class="small hint">(' . StreamMessage::formatBytes($file->filesize, 1) . ')</span>';
// append to file container only once
if ($jxConfig->isCrocodocsEnabled() || $jxConfig->isScribdEnabled()) {
if (in_array($fext, array('.doc', 'docx', '.pdf', '.ppt', 'pptx'))) {
$html .= ' <a href="#preview" class="meta-preview small" data-filename="' . StreamTemplate::escape($file->filename) . '" data-file_id="' . $file->id . '" onclick="return S.preview.show(this);">' . JText::_('COM_STREAM_LABEL_PREVIEW') . '</a>';
}
}
$html .= whoMakesAction($stream, $file->id, 'file');
$html .= '<div class="clear"></div>';
$html .= '</div>';
/*
// File can only be remove in 'edit' view
if( $my->authorise('stream.message.edit', $stream) ){
$html .= '<a class="meta-edit" href="#removeAttachment" file_id="'.$file->id.'">'. JText::_('COM_STREAM_LABEL_REMOVE').'</a>';
}
*/
}
if ($file->getParam('has_preview')) {
$randId = 'preview_' . rand(1000, 9999);
$path = str_replace(DS, '/', $file->getParam('thumb_path'));
$imgHtml .= '<div class="message-content-preview"><img rel="#' . $randId . '" src="' . JURI::root() . $path . '" /></div>';
// Attach overlay code
$width = $file->getParam('width');
$height = $file->getParam('height');
if (!empty($width) && !empty($height)) {
if ($width > 640) {
$height = 640 / $width * $height;
$width = 640;
}
if ($height > 640) {
$width = 640 / $height * $width;
$height = 640;
}
$viewLink = JRoute::_('index.php?option=com_stream&view=system&task=download&file_id=' . $file->id . '&display=1');
$dlLink = JRoute::_('index.php?option=com_stream&view=system&task=download&file_id=' . $file->id);
//.........这里部分代码省略.........
示例6: foreach
foreach ($readBy as $recipientId) {
$readByUsers[] = JXFactory::getUser($recipientId)->name;
}
echo implode(', ', $readByUsers);
?>
<?php
}
?>
</span>
</div>
</li>
<li class="inbox-delete">
<a href="" class="close">×</a>
</li>
<?php
if (!empty($attachments)) {
echo '<li style="border-top: 1px solid #EFEFEF; width: 540px; margin-left: 40px;">';
foreach ($attachments as $attachment) {
$dlLink = JRoute::_('index.php?option=com_messaging&task=download&file_id=' . $attachment->id);
$html = '<div class="message-content-file ">';
$html .= '<a title="Click to download" href="' . $dlLink . '">' . StreamTemplate::escape(JHtmlString::abridge($attachment->filename, 16)) . '</a>';
$html .= ' <span class="small hint">(' . StreamMessage::formatBytes($attachment->filesize, 1) . ')</span>';
$html .= '</div>';
echo $html;
}
echo '</li>';
}
?>
</ul>
</li>