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


PHP op_truncate函数代码示例

本文整理汇总了PHP中op_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP op_truncate函数的具体用法?PHP op_truncate怎么用?PHP op_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: hookEventCreate

 public static function hookEventCreate($event)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'opUtil'));
     $uri = sfContext::getInstance()->getConfiguration()->generateAppUrl('pc_frontend', array('sf_route' => 'communityEvent_show', 'id' => $event->id), true);
     $title = op_truncate($event->name, 140 - 23 - 4 - 2);
     self::api()->post('statuses/update', array('status' => sprintf('[イベント] %s %s', $title, $uri)));
 }
开发者ID:upsilon,项目名称:opWebHookPlugin,代码行数:7,代码来源:opWebHookTwitter.class.php

示例2: op_api_diary

function op_api_diary($diary)
{
    if ($diary) {
        $body = preg_replace(array('/<op:.*?>/', '/<\\/op:.*?>/'), '', $diary->getBody());
        $body = preg_replace('/http.:\\/\\/maps\\.google\\.co[[:graph:]]*/', '', $body);
        $bodyShort = op_truncate($body, 60);
        $body = op_auto_link_text($body);
        return array('id' => $diary->getId(), 'member' => op_api_member($diary->getMember()), 'title' => $diary->getTitle(), 'body' => nl2br(op_api_diary_convert_emoji($body)), 'body_short' => nl2br(op_api_diary_convert_emoji($bodyShort)), 'public_flag' => $diary->getPublicFlag(), 'ago' => op_format_activity_time(strtotime($diary->getCreatedAt())), 'created_at' => $diary->getCreatedAt());
    }
}
开发者ID:meruto,项目名称:opDiaryPlugin,代码行数:10,代码来源:opDiaryHelper.php

示例3: countTestData

 protected function countTestData($namespace, $name, $isEscaped, $truncateOption = array())
 {
     if ($isEscaped) {
         $string = $this->getEscapedTestData($namespace, $name);
     } else {
         $string = $this->getRawTestData($namespace, $name);
     }
     if ($truncateOption) {
         if (!is_array($truncateOption)) {
             $truncateOption = array();
         }
         $width = isset($truncateOption['width']) ? $truncateOption['width'] : 80;
         $etc = isset($truncateOption['etc']) ? $truncateOption['etc'] : '';
         $rows = isset($truncateOption['rows']) ? $truncateOption['rows'] : 1;
         $string = op_truncate($string, $width, $etc, $rows);
     }
     return substr_count($this->response->getContent(), $string);
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:18,代码来源:opTesterHtmlEscape.class.php

示例4: output

 function output($section_name, $config, $op, $return = false)
 {
     global $post;
     $defaults = array('before' => '', 'after' => '', 'ulclass' => '', 'post_id' => 0);
     $config = wp_parse_args($config, $defaults);
     extract($config);
     $ulclass = $ulclass == '' ? '' : ' class="' . $ulclass . '"';
     $post_id = $post_id > 0 ? $post_id : $post->ID;
     if ($post_tags = get_the_tags($post_id)) {
         $tmp_post = $post;
         $tags = array();
         foreach ($post_tags as $tag) {
             $tags[] = $tag->term_id;
         }
         $related_posts = get_posts(array('tag__in' => $tags, 'numberposts' => 4, 'exclude' => $post_id));
         $html = '';
         foreach ($related_posts as $related) {
             if ($related->ID == $post_id) {
                 continue;
             }
             $url = get_permalink($related->ID);
             $cn = get_comments_number($related->ID);
             $title = get_the_title($related->ID);
             $comments = sprintf(_n('1 Comment', '%1$s Comments', $cn, OP_SN), number_format_i18n($cn));
             $atag = ' href="' . $url . '" rel="bookmark" title="' . sprintf(esc_attr__('Permalink to %s', OP_SN), esc_attr($title)) . '"';
             $img = '';
             $class = '';
             if (has_post_thumbnail($related->ID)) {
                 $img = '<a' . $atag . ' class="thumbnail">' . get_the_post_thumbnail($related->ID, 'small-image') . '</a>';
             } else {
                 $class = ' class="no-thumbnail"';
             }
             $html .= '<li' . $class . '>' . $img . '<h4><a' . $atag . '>' . op_truncate($title) . '</a></h4><a href="' . get_comments_link($related->ID) . '">' . $comments . '</a></li>';
         }
         if (!empty($html)) {
             $html = $before . '<ul' . $ulclass . '>' . $html . '</ul>' . $after;
         }
         $post = $tmp_post;
         if ($return) {
             return $html;
         }
         echo $html;
     }
 }
开发者ID:denis-chmel,项目名称:wordpress,代码行数:44,代码来源:related_posts.php

示例5: op_api_message

function op_api_message($messageList, $member, $useIsReadFlag = false)
{
    $message = $messageList->getSendMessageData();
    $body = preg_replace(array('/&lt;op:.*?&gt;/', '/&lt;\\/op:.*?&gt;/'), '', $message->getBody());
    $body = preg_replace('/http.:\\/\\/maps\\.google\\.co[[:graph:]]*/', '', $body);
    $body = op_auto_link_text($body);
    $imagePath = null;
    $imageTag = null;
    $image = $message->getMessageFile();
    if (0 < count($image)) {
        $imageTag = image_tag_sf_image($image[0]->getFile(), array('size' => '76x76'));
        $imagePath = sf_image_path($image[0]->getFile());
    }
    $data = array('id' => $message->getId(), 'member' => op_api_member($member), 'subject' => $message->getSubject(), 'body' => nl2br($body), 'summary' => op_truncate(op_decoration($body, true), 25, '...'), 'image_path' => $imagePath, 'image_tag' => $imageTag, 'created_at' => $message->getCreatedAt(), 'formatted_date' => get_formatted_date($message->getCreatedAt()));
    if ($useIsReadFlag) {
        $data['is_read'] = $messageList->isSelf() ? (bool) $messageList->getIsRead() : null;
    }
    return $data;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:19,代码来源:opMessageHelper.php

示例6: op_api_diary

function op_api_diary($diary, $option = null)
{
    if ($diary) {
        //モデルクラス内でsns_termの値が取れずgetPublicFlagLabelでコケるため,緊急処置(see #3502, #3503)
        Doctrine::getTable('SnsTerm')->configure('ja_JP', 'pc_frontend');
        $data = array('id' => $diary->id, 'member' => op_api_member($diary->getMember()), 'title' => $diary->title, 'public_flag' => $diary->getPublicFlagLabel(), 'created_at' => $diary->created_at);
        if ('short' == $option) {
            $bodyShort = op_truncate(op_decoration($diary->body, true), 60);
            if (mb_strlen($diary->body) >= 60) {
                $bodyShort .= '&hellip;';
            }
            $data['body_short'] = op_api_diary_convert_emoji($bodyShort);
        } else {
            $body = op_auto_link_text(op_decoration($diary->body));
            $data['body'] = nl2br(op_api_diary_convert_emoji($body));
            $images = $diary->getDiaryImages();
            foreach ($images as $image) {
                $data['images'][] = op_api_diary_image($image);
            }
        }
        return $data;
    }
}
开发者ID:te-koyama,项目名称:openpne,代码行数:23,代码来源:opDiaryHelper.php

示例7: __

</td>
</tr><tr>
<th><?php 
        echo __('Title');
        ?>
</th><td><?php 
        echo op_diary_get_title_and_count($diary);
        echo op_diary_image_icon($diary);
        ?>
</td>
</tr><tr>
<th><?php 
        echo __('Body');
        ?>
</th><td><?php 
        echo op_truncate(op_decoration($diary->body, true), 36, '', 3);
        ?>
</td>
</tr><tr class="operation">
<th><?php 
        echo __('Created at');
        ?>
</th><td><span class="text"><?php 
        echo op_format_date($diary->created_at, 'XDateTimeJa');
        ?>
</span> <span class="moreInfo"><?php 
        echo link_to(__('View this diary'), 'diary_show', $diary);
        ?>
</span></td>
</tr></tbody></table></div></div>
<?php 
开发者ID:kawahara,项目名称:opDiaryPlugin,代码行数:31,代码来源:listSuccess.php

示例8: op_mobile_page_title

op_mobile_page_title(__('Recently Posted %Community% Events'));
?>

<?php 
if ($pager->getNbResults()) {
    use_helper('Date');
    ?>

<center>
<?php 
    echo pager_total($pager);
    ?>
</center>

<?php 
    $list = array();
    foreach ($pager->getResults() as $event) {
        $list[] = sprintf("%s<br>%s (%s)", op_format_date($event->getUpdatedAt(), 'XDateTime'), link_to(sprintf("%s(%d)", op_truncate($event->getName(), 28), $event->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $event->getId()), op_truncate($event->getCommunity()->getName(), 28));
    }
    $options = array('border' => true);
    op_include_list('communityList', $list, $options);
    ?>

<?php 
    if ($pager->haveToPaginate()) {
        op_include_pager_navigation($pager, '@communityEvent_recently_event_list?page=%d', array('is_total' => false));
    }
    ?>

<?php 
}
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:recentlyEventListSuccess.php

示例9: use_helper

<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br>
<?php 
echo sprintf('%s (%s)', link_to(op_truncate($message->getSubject(), 28), '@readDustMessage?id=' . $message->getViewMessageId()), op_message_link_to_member($message->getSendFromOrTo()));
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:_dustListRecord.php

示例10: use_helper

<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br> 
<?php 
echo sprintf('%s (%s)', link_to(op_truncate($message->getSubject(), 28), '@readSendMessage?id=' . $message->getId()), op_message_link_to_member($message->getSendTo()));
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:_sendListRecord.php

示例11: array

<?php

$acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember()));
?>

<?php 
if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')) {
    use_helper('Date');
    $list = array();
    foreach ($communityEvents as $communityEvent) {
        $list[] = sprintf("[%s] %s", op_format_date($communityEvent->getUpdatedAt(), 'XShortDate'), link_to(sprintf("%s(%d)", op_truncate($communityEvent->getName(), 28), $communityEvent->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $communityEvent->getId()));
    }
    $moreInfo = array();
    if (count($communityEvents)) {
        $moreInfo[] = link_to(__('More'), '@communityEvent_list_community?id=' . $community->getId());
    }
    if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')) {
        $moreInfo[] = link_to(__('Create a new event'), '@communityEvent_new?id=' . $community->getId());
    }
    $option = array('title' => __('Recently Posted This %Community% Events'), 'border' => true, 'moreInfo' => $moreInfo);
    op_include_list('communityEvent', $list, $option);
}
开发者ID:te-koyama,项目名称:openpne,代码行数:22,代码来源:_communityEventList.php

示例12: op_bbs_get_title_and_count

function op_bbs_get_title_and_count($bbs, $space = true, $width = 36)
{
    return sprintf('%s%s(%d)', op_truncate($bbs->getTitle(), $width), $space ? ' ' : '', $bbs->countBbsComments());
}
开发者ID:uzura8,项目名称:opSimpleBbsPlugin,代码行数:4,代码来源:opSimpleBbsHelper.php

示例13: pager_total

if ($pager->getNbResults()) {
    ?>

<center>
<?php 
    echo pager_total($pager);
    ?>
</center>
<?php 
    $list = array();
    foreach ($pager->getResults() as $topic) {
        $list_str = op_format_date($topic->getUpdatedAt(), 'XDateTime');
        if ($topic->isEditable($sf_user->getMemberId())) {
            $list_str .= sprintf('&nbsp;[%s]', link_to(__('Edit'), '@communityTopic_edit?id=' . $topic->getId()));
        }
        $list_str .= '<br>' . link_to(sprintf("%s(%d)", op_truncate($topic->getName(), 28), $topic->getCommunityTopicComment()->count()), '@communityTopic_show?id=' . $topic->getId());
        $list[] = $list_str;
    }
    $options = array('border' => true);
    op_include_list('communityTopicList', $list, $options);
    ?>

<?php 
    if ($pager->haveToPaginate()) {
        op_include_pager_navigation($pager, 'communityTopic/listCommunity?id=' . $community->getId() . '&page=%d', array('is_total' => false));
    }
    ?>

<?php 
} else {
    ?>
开发者ID:te-koyama,项目名称:openpne,代码行数:31,代码来源:listCommunitySuccess.php

示例14: use_helper

<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br>
<?php 
echo sprintf('%s (%s)', $message->getSendTo()->getId() ? link_to(op_truncate($message->getSubject(), 28), 'message/edit?id=' . $message->getId()) : op_truncate($message->getSubject(), 28), op_message_link_to_member($message->getSendTo()));
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:_draftListRecord.php

示例15: foreach

</th>
<td>
<?php 
    if ($count = count($communityEvents)) {
        ?>
<ul class="articleList">
<?php 
        foreach ($communityEvents as $key => $communityEvent) {
            ?>
<li>
<span class="date"><?php 
            echo op_format_date($communityEvent->getUpdatedAt(), 'XShortDateJa');
            ?>
</span>
<?php 
            echo link_to(sprintf('%s(%d)', op_truncate($communityEvent->getName(), 36), $communityEvent->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $communityEvent->getId());
            ?>
</li>
<?php 
        }
        ?>
</ul>
<?php 
    }
    ?>
<div class="moreInfo">
<ul class="moreInfo">
<?php 
    if ($count) {
        ?>
<li><?php 
开发者ID:kiwpon,项目名称:opCommunityTopicPlugin,代码行数:31,代码来源:_communityEventList.php


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