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


PHP op_auto_link_text函数代码示例

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


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

示例1: op_activity_body_filter

/**
 * op_activity_body_filter
 *
 * @param Activity $activity
 * @param boolean  $is_auto_link
 * @return string
 */
function op_activity_body_filter($activity, $is_auto_link = true)
{
    $body = $activity->getBody();
    if ($activity->getTemplate()) {
        $config = $activity->getTable()->getTemplateConfig();
        if (!isset($config[$activity->getTemplate()])) {
            return '';
        }
        $params = array();
        foreach ($activity->getTemplateParam() as $key => $value) {
            $params[$key] = $value;
        }
        $body = __($config[$activity->getTemplate()], $params);
        $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.template.filter_body'), $body);
        $body = $event->getReturnValue();
    }
    $event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.filter_body'), $body);
    $body = $event->getReturnValue();
    if (false === strpos($body, '<a') && $activity->getUri()) {
        return link_to($body, $activity->getUri());
    }
    if ($is_auto_link) {
        if ('mobile_frontend' === sfConfig::get('sf_app')) {
            return op_auto_link_text_for_mobile($body);
        }
        return op_auto_link_text($body);
    }
    return $body;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:36,代码来源:opActivityHelper.php

示例2: op_api_diary

function op_api_diary($diary)
{
    if ($diary) {
        $body = preg_replace(array('/&lt;op:.*?&gt;/', '/&lt;\\/op:.*?&gt;/'), '', $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: getListJson

 public function getListJson($controller, $contents)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Helper', 'Tag', 'Escaping', 'opUtil'));
     $result = array();
     foreach ($contents as $content) {
         $data = array('number' => $content->number, 'member_url' => $controller->genUrl('@obj_member_profile?id=' . $content->member_id), 'member_name' => $content->Member->name, 'command' => $content->command, 'body' => $content->body, 'created_at' => $content->created_at);
         foreach ($data as &$d) {
             $d = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $d);
         }
         $data['body'] = op_auto_link_text($data['body']);
         $result[] = $data;
     }
     return json_encode($result);
 }
开发者ID:kawahara,项目名称:opChatPlugin,代码行数:14,代码来源:PluginChatContentTable.class.php

示例4: 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

示例5: foreach

<?php

foreach ($chatlist as $chat) {
    ?>
<dt>
<span class="number"><?php 
    echo $chat->number;
    ?>
</span>: 
<?php 
    echo link_to($chat->Member->name, '@obj_member_profile?id=' . $chat->member_id, array('popup' => true));
    ?>
 
<?php 
    echo $chat->created_at;
    ?>
</dt>
<dd class="<?php 
    echo $chat->command;
    ?>
">
<?php 
    echo op_auto_link_text(op_decoration(nl2br($chat->body)));
    ?>
</dd>
<?php 
}
开发者ID:upsilon,项目名称:opChatPlugin,代码行数:27,代码来源:_chatview.php

示例6: foreach

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

<div class="comments">
<?php 
    foreach ($pager->getResults() as $comment) {
        ?>
<div class="comment" style="padding: 1px 0px 4px 0px; border-bottom: 1px solid #b3ceef;">

<div class="body">
<?php 
        echo op_link_to_member($comment->getMemberId());
        ?>
&nbsp;
<?php 
        echo op_auto_link_text($comment->body);
        ?>

<div class="info">
<small style="color: rgb(85, 85, 85);"><?php 
        echo op_format_activity_time(strtotime($comment->getCreatedAt()));
        ?>
</small>
</div>

<?php 
        if ($authorId === $sf_user->getMemberId() || $comment->member_id === $sf_user->getMemberId()) {
            ?>
<div class="operation">
<small>
<?php 
开发者ID:balibali,项目名称:opAlbumPlugin,代码行数:31,代码来源:_listComment.php

示例7: link_to

//------------------------------------------------------------
$t->diag('op_link_to_member()');
$t->is(op_link_to_member(1), link_to('A', '@obj_member_profile?id=1'), 'link to member 1');
$t->is(op_link_to_member(1, array(), '@obj_friend_unlink'), link_to('A', '@obj_friend_unlink?id=1'), 'link to unlink member 1');
$t->is(op_link_to_member(1, array('link_target' => 'tetetete'), '@obj_member_profile'), link_to('tetetete', '@obj_member_profile?id=1'), 'link to member 1 (free text)');
$member2 = Doctrine::getTable('Member')->find(2);
$t->is(op_link_to_member($member2), link_to($member2->getName(), 'obj_member_profile', $member2), 'set Member object');
$t->is(op_link_to_member(9999), '-', 'set undefine member');
$t->is(op_link_to_member(null), '-', 'set null member');
Doctrine::getTable('SnsConfig')->set('nickname_of_member_who_does_not_have_credentials', 'I am a pen.');
$t->is(op_link_to_member(null), 'I am a pen.', 'set nickname_of_member_who_does_not_have_credentials original setting');
//------------------------------------------------------------
$t->diag('op_auto_link_text()');
$t->is(op_auto_link_text('http://example.com/'), '<a href="http://example.com/" target="_blank">http://example.com/</a>');
$t->is(op_auto_link_text('https://example.com/'), '<a href="https://example.com/" target="_blank">https://example.com/</a>', 'protocol');
$t->is(op_auto_link_text('http://sub.example.com/'), '<a href="http://sub.example.com/" target="_blank">http://sub.example.com/</a>', 'subdomain');
$t->is(op_auto_link_text('http://example.com/hoge'), '<a href="http://example.com/hoge" target="_blank">http://example.com/hoge</a>', 'path');
$t->is(op_auto_link_text('http://example.com:8080/'), '<a href="http://example.com:8080/" target="_blank">http://example.com:8080/</a>', 'port');
$t->is(op_auto_link_text('http://example.com/#foo'), '<a href="http://example.com/#foo" target="_blank">http://example.com/#foo</a>', 'anchor');
$t->is(op_auto_link_text('http://example.com/?foo=1&bar=0'), '<a href="http://example.com/?foo=1&bar=0" target="_blank">http://example.com/?foo=1&bar=0</a>', 'query');
$t->is(op_auto_link_text('https://sub.example.com:8080/hoge?foo=1&bar=0#foo'), '<a href="https://sub.example.com:8080/hoge?foo=1&bar=0#foo" target="_blank">https://sub.example.com:8080/hoge?foo=1&bar=0#foo</a>');
$t->is(op_auto_link_text('http://example.com'), '<a href="http://example.com" target="_blank">http://example.com</a>');
$t->is(op_auto_link_text('www.example.com'), '<a href="http://www.example.com" target="_blank">www.example.com</a>');
// see https://trac.openpne.jp/ticket/3553
$t->is(op_auto_link_text('http://example.com/#comment:1'), '<a href="http://example.com/#comment:1" target="_blank">http://example.com/#comment:1</a>');
// see https://redmine.openpne.jp/issues/3289
$t->is(op_auto_link_text('http://example.com/テキスト'), '<a href="http://example.com/" target="_blank">http://example.com/</a>テキスト');
$t->is(op_auto_link_text('http://example.com/hogeテキスト'), '<a href="http://example.com/hoge" target="_blank">http://example.com/hoge</a>テキスト');
$t->is(op_auto_link_text('http://example.comテキスト'), '<a href="http://example.com" target="_blank">http://example.com</a>テキスト');
$t->is(op_auto_link_text('http://example.com:8080/'), '<a href="http://example.com:" target="_blank">http://example.com:</a>8080/');
// http://example.com:/ is valid URI.
开发者ID:upsilon,项目名称:OpenPNE3,代码行数:31,代码来源:opUtilHelperTest.php

示例8: _op_url_cmd

function _op_url_cmd($matches)
{
    $url = $matches[2] . $matches[3];
    $cmd = '';
    if ($matches[2] == 'www.') {
        $cmd .= 'www.';
        $url = 'http://www.' . $url;
    }
    if (preg_match('/([a-zA-Z0-9\\-.]+)\\/?(?:[a-zA-Z0-9_\\-\\/.,:;\\~\\?@&=+$%#!()])*/', $matches[3], $pmatch)) {
        $cmd .= $pmatch[1];
    }
    $file = $cmd . '.js';
    $path = './cmd/' . $file;
    if (preg_match('/<a/', $matches[1]) || !is_readable($path)) {
        return op_auto_link_text($matches[0]);
    }
    sfContext::getInstance()->getResponse()->addJavascript('util');
    $googlemapsUrl = url_for('@google_maps');
    $public_path = _compute_public_path($file, 'cmd', 'js');
    $result = <<<EOD
<script type="text/javascript" src="{$public_path}"></script>
<script type="text/javascript">
<!--
url2cmd('{$url}', '{$googlemapsUrl}');
//-->
</script>
EOD;
    return $result . $matches[4];
}
开发者ID:shotaatago,项目名称:OpenPNE3,代码行数:29,代码来源:opUtilHelper.php

示例9: __

        $ageValue .= ' (' . __('Only Open to %my_friend%', array('%my_friend%' => $op_term['my_friend']->titleize()->pluralize())) . ')';
    }
    $list[__('Age')] = $ageValue;
}
foreach ($member->getProfiles(true) as $profile) {
    $caption = $profile->getProfile()->getCaption();
    if ($profile->getProfile()->isPreset()) {
        $presetConfig = $profile->getProfile()->getPresetConfig();
        $caption = __($presetConfig['Caption']);
    }
    $profileValue = (string) $profile;
    if ('' === $profileValue) {
        continue;
    }
    if ('textarea' == $profile->getFormType()) {
        $profileValue = op_auto_link_text(nl2br($profileValue));
    }
    if ($profile->getProfile()->isPreset()) {
        if ('country_select' === $profile->getFormType()) {
            $profileValue = $culture->getCountry($profileValue);
        } elseif ('op_preset_birthday' === $profile->getName()) {
            $profileValue = op_format_date($profileValue, 'XShortDateJa');
        }
        $profileValue = __($profileValue);
    }
    if ($member->getId() == $sf_user->getMemberId()) {
        if ($profile->getPublicFlag() == ProfileTable::PUBLIC_FLAG_FRIEND) {
            $profileValue .= ' (' . __('Only Open to %my_friend%', array('%my_friend%' => $op_term['my_friend']->titleize()->pluralize())) . ')';
        } elseif ($profile->getPublicFlag() == ProfileTable::PUBLIC_FLAG_WEB && $profile->Profile->is_public_web) {
            $profileValue .= ' (' . __('All Users on the Web') . ')';
        }
开发者ID:nise-nabe,项目名称:ppcon-sns,代码行数:31,代码来源:_profileListBox.php

示例10: op_activity_linkification

function op_activity_linkification($body, $options = array())
{
    $body = op_auto_link_text($body);
    return preg_replace_callback('/(@+)([-._0-9A-Za-z]+)/', 'op_activity_linkification_callback', $body);
}
开发者ID:te-koyama,项目名称:openpne,代码行数:5,代码来源:opJsonApiHelper.php

示例11: include_customizes

<?php 
include_customizes('menu', 'top');
?>
<hr color="<?php 
echo $op_color["core_color_11"];
?>
" size="3">
</td></tr>

<?php 
$list = array(__('%community% Name') => $community->getName(), __('Community Category', array(), 'form_community') => $community->getCommunityCategory(), __('Date Created') => op_format_date($community->getCreatedAt(), 'D'), __('Administrator') => link_to($community_admin->getName(), 'member/profile?id=' . $community_admin->getId()), __('Count of Members') => $community->countCommunityMembers());
foreach ($community->getConfigs() as $key => $config) {
    $list[__($key, array(), 'form_community')] = $config;
}
$list[__('Register poricy', array(), 'form_community')] = __($sf_data->getRaw('community')->getRegisterPoricy());
$list[__('Description', array(), 'form_community')] = op_auto_link_text(nl2br($community->getConfig('description')));
foreach ($list as $key => $value) {
    ?>
<font color="<?php 
    echo $op_color["core_color_19"];
    ?>
"><?php 
    echo $key;
    ?>
:</font><br>
<?php 
    echo $value;
    ?>
<br>
<?php 
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:31,代码来源:detailSuccess.php

示例12: __

?>
<br>
</td>
</tr>

<tr>
<td colspan="2">
<font color="<?php 
echo $op_color["core_color_19"];
?>
"><?php 
echo __('Description');
?>
:</font><br>
<?php 
echo op_auto_link_text(nl2br(mb_substr($community->getConfig('description'), 0, 54)));
?>
<br>
</td>
<tr>
<td align="right" colspan="2">
<font color="<?php 
echo $op_color["core_color_20"];
?>
">⇒</font><?php 
echo link_to(__('More'), 'community/detail?id=' . $community->getId());
?>
<br>
</td>
</tr>
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:30,代码来源:homeSuccess.php

示例13: end_slot

end_slot();
?>

<?php 
$list = array(__('%community% Name', array('%community%' => $op_term['community']->titleize())) => $community->getName(), __('%community% Category', array('%community%' => $op_term['community']->titleize())) => $community->getCommunityCategory(), __('Date Created') => op_format_date($community->getCreatedAt(), 'D'), __('Administrator') => link_to($communityAdmin->getName(), '@member_profile?id=' . $communityAdmin->getId()));
$subAdminCaption = '';
foreach ($communitySubAdmins as $m) {
    $subAdminCaption .= "<li>" . link_to($m->getName(), '@member_profile?id=' . $m->getId()) . "</li>\n";
}
if ($subAdminCaption) {
    $list[__('Sub Administrator')] = '<ul>' . $subAdminCaption . '</ul>';
}
$list[__('Count of Members')] = $community->countCommunityMembers();
foreach ($community->getConfigs() as $key => $config) {
    if ('Description' === $key) {
        $list[__('%community% Description', array('%community%' => $op_term['community']->titleize()), 'form_community')] = op_auto_link_text(nl2br($community->getConfig('description')));
    } else {
        $list[__($key, array(), 'form_community')] = $config;
    }
}
$list[__('Register poricy', array(), 'form_community')] = __($community->getRawValue()->getRegisterPoricy());
$options = array('title' => __('%community%', array('%community%' => $op_term['community']->titleize())), 'list' => $list);
op_include_parts('listBox', 'communityHome', $options);
?>

<ul>
<?php 
if ($isEditCommunity) {
    ?>
<li><?php 
    echo link_to(__('Edit this %community%'), 'community/edit?id=' . $community->getId());
开发者ID:phenom,项目名称:OpenPNE3,代码行数:31,代码来源:homeSuccess.php

示例14: op_api_diary_comment

function op_api_diary_comment($comment)
{
    if ($comment) {
        $images = array();
        if ($comment->getHasImages()) {
            foreach ($comment->getDiaryCommentImages() as $image) {
                $images[] = op_api_diary_image($image);
            }
        }
        return array('id' => $comment->getId(), 'diary_id' => $comment->getDiaryId(), 'number' => $comment->getNumber(), 'member' => op_api_member($comment->getMember()), 'body' => nl2br(op_auto_link_text($comment->getBody())), 'ago' => op_format_activity_time(strtotime($comment->getCreatedAt())), 'created_at' => $comment->getCreatedAt(), 'images' => $images);
    }
}
开发者ID:te-koyama,项目名称:openpne,代码行数:12,代码来源:opDiaryHelper.php

示例15: image_tag

        } else {
            echo image_tag($images[$i]->getUri(), array('width' => 76, 'height' => 76));
        }
    }
    ?>
<br />
<?php 
}
echo link_to($activity->getMember()->getName(), '@obj_member_profile?id=' . $activity->getMemberId());
?>
&nbsp;
<?php 
if ($activity->getUri()) {
    echo link_to($activity->getBody(), $activity->getUri());
} else {
    echo op_auto_link_text($activity->getBody());
}
?>
<div class="info">
<span class="time"><?php 
echo op_format_activity_time(strtotime($activity->getCreatedAt()));
if ($activity->getSource()) {
    ?>
 from <?php 
    echo link_to_if($activity->getSourceUri(), $activity->getSource(), $activity->getSourceUri());
}
?>
</span>
<?php 
if ($activity->getPublicFlag() != ActivityDataTable::PUBLIC_FLAG_SNS) {
    ?>
开发者ID:phenom,项目名称:OpenPNE3,代码行数:31,代码来源:_activityRecord.php


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