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


PHP parse_urls函数代码示例

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


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

示例1: shoutout_get_view_page

function shoutout_get_view_page($guid)
{
    elgg_extend_view('forms/comments/add', 'shoutout/add_river_flag');
    $title = elgg_echo('shoutout:view_title');
    $shoutout = get_entity($guid);
    if (elgg_instanceof($shoutout, 'object', 'shoutout')) {
        $content = '<div class="shoutout-view-wrapper">' . parse_urls($shoutout->description) . '</div>';
        $content .= shoutout_get_attachment_listing($shoutout);
        $list = shoutout_list_attached_entities($shoutout);
        if ($list) {
            $content .= '<br />' . $list;
        }
        $content .= elgg_view_comments($shoutout);
    } else {
        $content = elgg_echo('shoutout:bad_shoutout');
    }
    elgg_push_breadcrumb(elgg_echo('shoutout:listing_title'), 'shoutout/activity');
    $params = array('title' => $title, 'content' => $content, 'filter' => '');
    $body = elgg_view_layout("content", $params);
    return elgg_view_page($title, $body);
}
开发者ID:Twizanex,项目名称:shoutout,代码行数:21,代码来源:model.php

示例2: elgg_extract

<?php

/**
 * Elgg display long text
 * Displays a large amount of text, with new lines converted to line breaks
 *
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['value'] The text to display
 * @uses $vars['parse_urls'] Whether to turn urls into links. Default is true.
 * @uses $vars['class']
 */
$class = 'elgg-output';
$additional_class = elgg_extract('class', $vars, '');
if ($additional_class) {
    $vars['class'] = "{$class} {$additional_class}";
} else {
    $vars['class'] = $class;
}
$parse_urls = elgg_extract('parse_urls', $vars, true);
unset($vars['parse_urls']);
$text = $vars['value'];
unset($vars['value']);
if ($parse_urls) {
    $text = parse_urls($text);
}
$text = filter_tags($text);
$text = elgg_autop($text);
$attributes = elgg_format_attributes($vars);
echo "<div {$attributes}>{$text}</div>";
开发者ID:ibou77,项目名称:elgg,代码行数:31,代码来源:longtext.php

示例3: get_user

if ($vars['entity']->title) {
    $title = $vars['entity']->title;
} else {
    if ($vars['entity']->name) {
        $title = $vars['entity']->name;
    }
}
if ($title) {
    $title = "<h3><a href='{$vars['entity']->getURL()}'>{$title}</a></h3>";
}
$owner = get_user($vars['entity']->owner_guid);
$time = elgg_view_friendly_time($vars['entity']->time_created);
$owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = "<a href='{$vars['url']}profile/{$owner->username}/'>{$owner->name}</a>";
$desc = $vars['entity']->description;
// If entity has an excerpt (blogs)
if ($vars['entity']->excerpt) {
    $desc = $vars['entity']->excerpt;
}
$desc = parse_urls($desc);
// Strip out hashtags
$regex = '/#([A-Aa-z0-9_-]+)/is';
$desc = preg_replace($regex, '', $desc);
$list_body = <<<HTML
\t{$title}
\t<div class=\\"elgg-list-content\\">{$desc}</div>
\t<span style='display: block' class='elgg-subtext'>
\t\tby {$owner_link} {$time}
\t</span>
HTML;
echo elgg_view_image_block($owner_icon, $list_body);
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:simple.php

示例4: elgg_load_library

<?php

/**
 * Shoutout river view.
 */
// TODO: add video view
elgg_load_library('elgg:shoutout');
$object = $vars['item']->getObjectEntity();
$excerpt = parse_urls(elgg_get_excerpt($object->description));
if (substr($excerpt, strlen($excerpt) - 3) == '...') {
    $more_bit = ' <a href="' . $object->getURL() . '">' . elgg_echo('shoutout:more') . '</a>';
    $excerpt .= $more_bit;
}
$excerpt .= shoutout_get_attachment_listing($object);
$excerpt .= shoutout_get_video_display($object);
echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'message' => $excerpt));
echo shoutout_list_attached_entities($object);
开发者ID:Twizanex,项目名称:shoutout,代码行数:17,代码来源:create.php

示例5: getLink

 /**
  * Get the html for a link
  *
  * @param string $address URL
  * @return string
  */
 protected function getLink($address)
 {
     return parse_urls($address);
 }
开发者ID:ibou77,项目名称:elgg,代码行数:10,代码来源:regex.php

示例6: thewire_filter

/**
 * Replace urls, hash tags, and @'s by links
 * 
 * @param string $text The text of a post
 * @return string
 */
function thewire_filter($text)
{
    global $CONFIG;
    $text = ' ' . $text;
    // email addresses
    $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text);
    // links
    $text = parse_urls($text);
    // usernames
    $text = preg_replace('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text);
    // hashtags
    $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/tag/$2">#$2</a>', $text);
    $text = trim($text);
    return $text;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:21,代码来源:start.php

示例7: test_parse_urls

 /**
  * Test #5369 -- parse_urls()
  * https://github.com/Elgg/Elgg/issues/5369
  */
 public function test_parse_urls()
 {
     $cases = array('no.link.here' => 'no.link.here', 'simple link http://example.org test' => 'simple link <a href="http://example.org" rel="nofollow">http:/<wbr />/<wbr />example.org</a> test', 'non-ascii http://ñew.org/ test' => 'non-ascii <a href="http://ñew.org/" rel="nofollow">http:/<wbr />/<wbr />ñew.org/<wbr /></a> test', 'percent encoded http://example.org/a%20b test' => 'percent encoded <a href="http://example.org/a%20b" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a%20b</a> test', 'reserved characters http://example.org/:/?#[]@!$&*+,;= test' => 'reserved characters <a href="http://example.org/:/?#[]@!$&*+,;=" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />:/<wbr />?#[]@!$&*+,;=</a> test', 'unreserved characters http://example.org/a1-._~ test' => 'unreserved characters <a href="http://example.org/a1-._~" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a1-._~</a> test', 'parameters http://example.org/?val[]=1&val[]=2 test' => 'parameters <a href="http://example.org/?val[]=1&val[]=2" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />?val[]=1&val[]=2</a> test', 'port http://example.org:80/ test' => 'port <a href="http://example.org:80/" rel="nofollow">http:/<wbr />/<wbr />example.org:80/<wbr /></a> test', 'parentheses (http://www.google.com) test' => 'parentheses (<a href="http://www.google.com" rel="nofollow">http:/<wbr />/<wbr />www.google.com</a>) test', 'comma http://elgg.org, test' => 'comma <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>, test', 'period http://elgg.org. test' => 'period <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>. test', 'exclamation http://elgg.org! test' => 'exclamation <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>! test', 'already anchor <a href="http://twitter.com/">twitter</a> test' => 'already anchor <a href="http://twitter.com/">twitter</a> test', 'ssl https://example.org/ test' => 'ssl <a href="https://example.org/" rel="nofollow">https:/<wbr />/<wbr />example.org/<wbr /></a> test', 'ftp ftp://example.org/ test' => 'ftp <a href="ftp://example.org/" rel="nofollow">ftp:/<wbr />/<wbr />example.org/<wbr /></a> test');
     foreach ($cases as $input => $output) {
         $this->assertEqual($output, parse_urls($input));
     }
 }
开发者ID:duanhv,项目名称:mdg-social,代码行数:11,代码来源:trac_bugs.php

示例8: elgg_view

    // if comment owner, group owner, or site admin - display edit and delete options
    if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
        echo "<div class='entity_metadata'>";
        echo "<span class='delete_button'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</span>";
        echo "<a class='link' onclick=\"elgg_slide_toggle(this,'.topic','.edit_comment');\">" . elgg_echo('edit') . "</a>";
        echo "</div>";
    }
    echo "<p class='entity_title'>" . $post_owner->name . "</p>";
} else {
    echo "<div class='entity_listing_icon'><img src=\"" . elgg_view('icon/user/default/tiny') . "\" /></div>";
    echo "<div class='entity_listing_info'><p class='entity_title'>" . elgg_echo('profile:deleteduser') . "</p>";
}
//display the date of the comment
echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>";
//display the actual message posted
echo parse_urls(elgg_view("output/longtext", array("value" => $vars['entity']->value)));
// if comment owner, group owner, or site admin - display edit-form
if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
    //get the edit form and details
    $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
    $text_textarea = elgg_view('input/longtext', array('internalname' => 'postComment' . $vars['entity']->id, 'value' => $vars['entity']->value));
    $post = elgg_view('input/hidden', array('internalname' => 'post', 'value' => $vars['entity']->id));
    $field = elgg_view('input/hidden', array('internalname' => 'field_num', 'value' => $vars['entity']->id));
    $topic = elgg_view('input/hidden', array('internalname' => 'topic', 'value' => get_input('topic')));
    $group = elgg_view('input/hidden', array('internalname' => 'group', 'value' => get_input('group_guid')));
    $form_body = <<<EOT
\t\t
\t\t<p class='longtext_editarea'>{$text_textarea}</p>
\t\t{$post}
\t\t{$topic}
\t\t{$group}
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:topicposts.php

示例9: thewire_tools_filter

/**
 * Replace urls, hash tags, and @'s by links
 *
 * @see thewire_filter()
 *
 * @param string $text The text of a post
 *
 * @return string
 */
function thewire_tools_filter($text)
{
    static $mention_display;
    $site_url = elgg_get_site_url();
    if (!isset($mention_display)) {
        $mention_display = "username";
        if (elgg_get_plugin_setting("mention_display", "thewire_tools") == "displayname") {
            $mention_display = "displayname";
        }
    }
    $text = ' ' . $text;
    // email addresses
    $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text);
    // links
    $text = parse_urls($text);
    // usernames
    if ($mention_display == "displayname") {
        $matches = array();
        $match_count = preg_match_all('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', $text, $matches, PREG_SET_ORDER);
        if ($match_count > 0) {
            $proccessed_usernames = array();
            foreach ($matches as $set) {
                $replaces = 0;
                if (in_array($set[2], $proccessed_usernames)) {
                    continue;
                }
                $user = get_user_by_username($set[2]);
                if (empty($user)) {
                    continue;
                }
                $replace = " " . elgg_view("output/url", array("text" => "@" . $user->name, "href" => "thewire/owner/" . $user->username, "is_trusted" => true));
                $text = str_ireplace($set[0], $replace, $text, $replaces);
                if ($replaces > 0) {
                    $proccessed_usernames[] = $set[2];
                }
            }
        }
    } else {
        $text = preg_replace('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', '$1<a href="' . $site_url . 'thewire/owner/$2">@$2</a>', $text);
    }
    // hashtags
    $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $site_url . 'thewire/tag/$2">#$2</a>', $text);
    $text = trim($text);
    return $text;
}
开发者ID:Twizanex,项目名称:thewire_tools,代码行数:54,代码来源:functions.php

示例10: elgg_view

 $obs_img = elgg_view('output/img', array('src' => "market/image/{$post->guid}/1/large/{$tu}", 'class' => 'elgg-photo', 'alt' => $post->guid));
 $images = unserialize($post->images);
 if (is_array($images)) {
     $post_images = '';
     foreach ($images as $key => $value) {
         if ($value) {
             $post_img = elgg_view('output/img', array('src' => "market/image/{$post->guid}/{$key}/small/{$tu}.jpg", 'class' => 'elgg-photo', 'alt' => $post->guid));
             $post_images .= elgg_view('output/url', array('href' => "market/image/{$post->guid}/{$key}/master/{$tu}.jpg", 'text' => $post_img, 'class' => "elgg-lightbox-photo market-thumbnail", 'rel' => 'market-gallery', 'data-colorboxOpts' => "{slideshow: true, rel: 'group'}"));
         }
     }
 }
 if ($post_images) {
     $post_body .= "<div>{$post_images}</div>";
 }
 if (elgg_get_plugin_setting('market_allowhtml', 'market') != 'yes') {
     $post_body .= elgg_autop(parse_urls(strip_tags($post->description)));
 } else {
     $post_body .= elgg_view('output/longtext', array('value' => $post->description));
 }
 if (elgg_get_plugin_setting('market_pmbutton', 'market') == 'yes') {
     if ($owner->guid != elgg_get_logged_in_user_guid()) {
         $post_body .= elgg_view('output/url', array('class' => 'elgg-button elgg-button-action mtm', 'href' => "messages/compose?send_to={$owner->guid}", 'text' => elgg_echo('market:pmbuttontext')));
     }
 }
 $marketpost = elgg_view_image_block($img, $post_body, array('class' => 'market-image-block'));
 $subtitle = "{$author_text} {$date} {$comments_link}";
 $subtitle .= "<br>{$category}<br>{$type}{$custom}{$location}";
 $params = array('entity' => $post, 'header' => $header, 'metadata' => $metadata, 'subtitle' => $subtitle, 'tags' => $tags);
 $params = $params + $vars;
 $list_body = elgg_view('object/elements/summary', $params);
 $owner_icon = elgg_view_entity_icon($owner, 'small');
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:market.php

示例11: get_post_meta

    ?>
</div><div class="info event_language"><?php 
    echo get_post_meta(get_the_ID(), 'event_language', true);
    ?>
</div><div class="clearfix"></div></div>
							<?php 
}
?>
							<?php 
if (get_post_meta(get_the_ID(), 'event_official_sites', true) != '') {
    ?>
								<div class="event_list_item icon-link"><div class="title right"><?php 
    _e('Official sites:', 'vh');
    ?>
</div><div class="info event_official_sites"><?php 
    echo parse_urls(get_post_meta(get_the_ID(), 'event_official_sites', true));
    ?>
</div><div class="clearfix"></div></div>
							<?php 
}
?>
					</div>
					<div class="clearfix"></div>
				</div><!--end of overview-container-->
				<div class="event_buttons">
					<div class="button_red"><a href="#" class="vh_button red icon-ticket hover_right"><?php 
_e('Rezervasyon', 'vh');
?>
</a></div>
					<?php 
$youtube = explode('=', get_post_meta(get_post()->ID, 'event_trailer', true));
开发者ID:vurusarakolenler,项目名称:fethiyespor,代码行数:31,代码来源:content-movies+-+Kopya.php

示例12: thewire_tools_filter

/**
 * Replace urls, hash tags, and @'s by links
 *
 * @see thewire_filter()
 *
 * @param string $text The text of a post
 *
 * @return string
 */
function thewire_tools_filter($text)
{
    static $mention_display;
    $site_url = elgg_get_site_url();
    if (!isset($mention_display)) {
        $mention_display = 'username';
        if (elgg_get_plugin_setting('mention_display', 'thewire_tools') == 'displayname') {
            $mention_display = 'displayname';
        }
    }
    $text = ' ' . $text;
    // email addresses
    $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text);
    // links
    $text = parse_urls($text);
    $click_url = 'thewire/owner/';
    if (elgg_is_active_plugin('profile')) {
        $click_url = 'profile/';
    }
    // usernames
    $matches = [];
    $match_count = preg_match_all('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', $text, $matches, PREG_SET_ORDER);
    if ($match_count > 0) {
        $proccessed_usernames = [];
        foreach ($matches as $set) {
            $replaces = 0;
            if (in_array($set[2], $proccessed_usernames)) {
                continue;
            }
            $user = get_user_by_username($set[2]);
            if (empty($user)) {
                continue;
            }
            if ($mention_display == 'displayname') {
                $user_text = $user->name;
            } else {
                $user_text = $user->username;
            }
            $replace = ' ' . elgg_view('output/url', ['text' => '@' . $user_text, 'href' => $click_url . $user->username, 'is_trusted' => true]);
            $text = str_ireplace($set[0], $replace, $text, $replaces);
            if ($replaces > 0) {
                $proccessed_usernames[] = $set[2];
            }
        }
    }
    // hashtags
    $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $site_url . 'thewire/tag/$2">#$2</a>', $text);
    $text = trim($text);
    return $text;
}
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:59,代码来源:functions.php

示例13: trim

<?php

/**
 * Elgg display long text, no_p
 * Displays a large amount of text, with new lines converted to line breaks
 * 
 * This version modified to remove paragraph wrapper and replace internal 
 * paragraph tags with <br /><br />
 * 
 * @package Elgg
 * @subpackage Core
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.org/
 * 
 * @uses $vars['text'] The text to display
 * 
 */
global $CONFIG;
$value = trim(autop(parse_urls(filter_tags($vars['value']))));
// strip off last </p> if any
if (substr($value, strlen($value) - 4, 4) == '</p>') {
    $value = substr($value, 0, strlen($value) - 4);
}
// eliminate <p> tags
$value = str_replace('<p>', '', $value);
// replace </p> tags with <br /><br />
$value = str_replace('</p>', '<br /><br />', $value);
echo $value;
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:30,代码来源:longtext_no_p.php

示例14: thewire_filter

/**
 * Replace urls, hash tags, and @'s by links
 * 
 * @param string $text The text of a post
 * @return string
 */
function thewire_filter($text)
{
    global $CONFIG;
    $text = ' ' . $text;
    // email addresses
    $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text);
    // links
    $text = parse_urls($text);
    //echo $text."<br>";
    $usernameStart = strpos($text, '@', $usernameStart);
    $usernameStart += 1;
    //echo "<br>string length= ".strlen($text);
    $usernameMiddle = strpos($text, ' ', $usernameStart);
    $usernameEnd = strpos($text, ' ', $usernameMiddle + 1);
    $fullname = substr($text, $usernameStart, $usernameEnd - $usernameStart);
    $text1 = explode(' ', $fullname);
    $username = $text1[1] . substr($text1[0], 0, 1);
    $replaceString = '<a href="' . $CONFIG->wwwroot . 'thewire/owner/ongarde_' . $username . '">@' . $fullname . '</a>';
    $usernameStart += strlen($replaceString);
    $text = str_replace('@' . $fullname, $replaceString, $text);
    // usernames
    //$text = preg_replace(
    //			'/(^|[^\w])@([\p{L}\p{Nd}._]+)/u',
    //			'$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/ognarde_'.$username.'">@'.$fullname.'</a>',
    //			$text);
    // hashtags
    $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/tag/$2">#$2</a>', $text);
    $text = trim($text);
    $text = nl2br($text);
    return $text;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:37,代码来源:start.php

示例15: get_entity

<?php

$performed_by = get_entity($vars['item']->subject_guid);
// $statement->getSubject();
$object = get_entity($vars['item']->object_guid);
$url = $object->getURL();
$string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}:</a> ";
$desc .= $object->description;
$desc = preg_replace('/\\@([A-Za-z0-9\\_\\.\\-]*)/i', '@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>', $desc);
$string .= parse_urls($desc);
$string .= " <span class='entity_subtext'>" . friendly_time($object->time_created) . "</span> <a href=\"{$vars['url']}mod/thewire/add.php?wire_username={$object->getOwnerEntity()->username}\" class='reply_link'>" . elgg_echo('thewire:reply') . "</a>";
?>

<?php 
echo $string;
开发者ID:adamboardman,项目名称:Elgg,代码行数:15,代码来源:create.php


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