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


PHP Text::auto_link_urls方法代码示例

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


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

示例1: content

    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        $shouts = array();
        foreach (Model_Shout::find_latest($this->limit) as $shout) {
            $shouts[] = array('created' => $shout->created, 'user_id' => $shout->author_id, 'shout' => $shout->shout);
        }
        if ($shouts) {
            ob_start();
            ?>

<ul class="list-unstyled">

	<?php 
            foreach (array_reverse($shouts) as $shout) {
                ?>
	<li>
		<?php 
                echo HTML::time(Date::format('HHMM', $shout['created']), array('datetime' => $shout['created'], 'class' => 'muted'));
                ?>
		<?php 
                echo HTML::user($shout['user_id']);
                ?>
:
		<?php 
                echo Text::smileys(Text::auto_link_urls(HTML::chars($shout['shout'])));
                ?>
	</li>
	<?php 
            }
            ?>

</ul>

<?php 
            if ($this->_can_shout) {
                ?>
<form <?php 
                echo $this->aside ? 'class="ajaxify"' : '';
                ?>
 action="<?php 
                echo Route::url('shouts', array('action' => 'shout'));
                ?>
" method="post">
	<input class="form-control" type="text" name="shout" maxlength="300" placeholder="<?php 
                echo __('Shout, and ye shall be heard..');
                ?>
" />
	<?php 
                echo Form::CSRF();
                ?>
</form>
<?php 
            }
            return ob_get_clean();
        }
        return '';
    }
开发者ID:anqh,项目名称:anqh,代码行数:62,代码来源:shouts.php

示例2: get

 /**
  * Get notification as HTML.
  *
  * @static
  * @param   Model_Notification
  * @return  string
  */
 public static function get(Model_Notification $notification)
 {
     $text = '';
     switch ($notification->type) {
         case self::TYPE_IMAGE_COMMENT:
             $user = Model_User::find_user($notification->user_id);
             $image = Model_Image::factory($notification->data_id);
             if ($user->loaded() && $image->loaded()) {
                 $gallery = $image->gallery();
                 $text = __(':user commented your :photo: <em>:comment</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':comment' => Text::smileys(Text::auto_link_urls(HTML::chars($notification->text)))));
             } else {
                 $notification->delete();
             }
             break;
         case self::TYPE_IMAGE_NOTE:
             $user = Model_User::find_user($notification->user_id);
             $image = Model_Image::factory($notification->data_id);
             if ($user->loaded() && $image->loaded()) {
                 $gallery = $image->gallery();
                 $text = __(':user tagged you to a :photo', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable'))));
             } else {
                 $notification->delete();
             }
             break;
         case self::TYPE_IMAGE_REPORT:
             $user = Model_User::find_user($notification->user_id);
             $image = Model_Image::factory($notification->data_id);
             if ($user->loaded() && $image->loaded()) {
                 $gallery = $image->gallery();
                 $text = __(':user reported a :photo: <em>:reason</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':reason' => $notification->text ? HTML::chars($notification->text) : __('No reason')));
             } else {
                 $notification->delete();
             }
             break;
     }
     return $text;
 }
开发者ID:anqh,项目名称:anqh,代码行数:44,代码来源:galleries.php

示例3: test_auto_link

 /**
  * Tests Text::auto_link()
  *
  * @test
  * @dataProvider provider_auto_link
  */
 public function test_auto_link($text, $urls = array(), $emails = array())
 {
     $linked_text = Text::auto_link($text);
     if ($urls === FALSE) {
         $this->assertNotContains('http://', $linked_text);
     } elseif (count($urls)) {
         foreach ($urls as $url) {
             // Assert that all the urls have been caught by text auto_link_urls()
             $this->assertContains(Text::auto_link_urls($url), $linked_text);
         }
     }
     foreach ($emails as $email) {
         $this->assertContains('&#109;&#097;&#105;&#108;&#116;&#111;&#058;' . $email, $linked_text);
     }
 }
开发者ID:lz1988,项目名称:stourwebcms,代码行数:21,代码来源:TextTest.php

示例4: auto_link

 /**
  * Converts text email addresses and anchors into links.
  *
  * @param   string   text to auto link
  * @return  string
  */
 public static function auto_link($text)
 {
     // Auto link emails first to prevent problems with "www.domain.com@example.com"
     return Text::auto_link_urls(Text::auto_link_emails($text));
 }
开发者ID:Normull,项目名称:core,代码行数:11,代码来源:text.php

示例5: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Comment form
        echo $this->form();
        // Pagination
        if ($this->pagination) {
            echo $this->pagination->render();
        }
        ?>

<ul class="media-list">

<?php 
        $new_comments = isset($new_comments) ? (int) $new_comments : 0;
        foreach ($this->comments as $comment) {
            /** @var  Model_Comment  $comment */
            $author = $comment->author();
            // Ignore
            if (Visitor::$user && Visitor::$user->is_ignored($author)) {
                continue;
            }
            $classes = array('media');
            // Private comment?
            if ($comment->private) {
                $classes[] = 'private';
            }
            // Viewer's post
            if (Visitor::$user && $author['id'] == Visitor::$user->id) {
                $classes[] = 'my';
            }
            // Topic author's post
            if ($author['id'] == $comment->user_id) {
                $classes[] = 'owner';
            }
            // New comment?
            if ($new_comments-- > 0) {
                $classes[] = 'new';
            }
            ?>

	<li class="<?php 
            echo implode(' ', $classes);
            ?>
" id="comment-<?php 
            echo $comment->id;
            ?>
">
		<div class="pull-left">
			<?php 
            echo HTML::avatar($author['avatar'], $author['username']);
            ?>
		</div>
		<div class="arrow"></div>
		<div class="media-body">
			<small class="pull-right">
				<?php 
            if (Visitor::$user && $comment->user_id == Visitor::$user->id || in_array('my', $classes)) {
                if ($this->private && !$comment->private) {
                    echo HTML::anchor(sprintf($this->private, $comment->id), __('Set as private'), array('class' => 'comment-private')) . ' &bull; ';
                }
                if ($this->delete) {
                    echo HTML::anchor(sprintf($this->delete, $comment->id), __('Delete'), array('class' => 'comment-delete')) . ' &bull; ';
                }
            }
            ?>

				<?php 
            echo in_array('new', $classes) ? __('New') : '';
            ?>
 <?php 
            echo HTML::time(Date::short_span($comment->created, true, true), $comment->created);
            ?>
			</small>
			<?php 
            echo HTML::user($author);
            ?>
<br />
			<?php 
            echo $comment->private ? '<span class="label label-special" title="' . __('Private comment') . '">' . __('Priv') . '</span>: ' : '';
            ?>
			<?php 
            echo Text::smileys(Text::auto_link_urls(HTML::chars($comment->comment)));
            ?>
		</div>
	</li>

	<?php 
        }
        ?>

</ul>

<?php 
        // Pagination
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:anqh,代码行数:101,代码来源:comments.php

示例6: __

        ?>
	<nav class="actions inline">
		<?php 
        if ($private && !$comment->private) {
            ?>
		<?php 
            echo HTML::anchor(sprintf($private, $comment->id), __('Set as private'), array('class' => 'action small comment-private'));
            ?>
		<?php 
        }
        ?>
		<?php 
        echo HTML::anchor(sprintf($delete, $comment->id), __('Delete'), array('class' => 'action small comment-delete'));
        ?>
	</nav>
	<?php 
    }
    ?>

	<p>
		<?php 
    echo $comment->private ? '<abbr title="' . __('Private comment') . '">' . __('Priv') . '</abbr>: ' : '';
    ?>
		<?php 
    echo Text::smileys(Text::auto_link_urls(HTML::chars($comment->comment)));
    ?>
	</p>
</article>

<?php 
}
开发者ID:anqh,项目名称:core,代码行数:31,代码来源:comments.php

示例7:

<br/>

<?php 
echo Text::similar(array('Help', 'Helium', 'Herman'));
?>

<br>

<?php 
echo Text::auto_link('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
?>
<br>

<?php 
echo Text::auto_link_urls('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
?>
<br>

<?php 
echo Text::auto_link_emails('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
?>

<br/>

<?php 
$string = "This is a block of\ntext that has\n\nSome line breaks in it.";
echo Text::auto_p($string);
?>

<br/>
开发者ID:ChangLeoplod,项目名称:kohana-demo,代码行数:30,代码来源:text.php

示例8: auto_link_urls

 public static function auto_link_urls($string)
 {
     return Text::auto_link_urls($string);
 }
开发者ID:deraemons,项目名称:deraemon-cms,代码行数:4,代码来源:Functions.php


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