本文整理汇总了PHP中Text::auto_p方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::auto_p方法的具体用法?PHP Text::auto_p怎么用?PHP Text::auto_p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::auto_p方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$foursquare = $this->venue->foursquare();
if (!$foursquare) {
echo new View_Alert(__('This venue has not been linked to Foursquare yet.'), null, View_Alert::INFO);
} else {
// Homepage
echo HTML::anchor(Arr::path($foursquare, 'short_url'), HTML::image(Arr::path($foursquare, 'primarycategory.iconurl'), array('alt' => HTML::chars(Arr::path($foursquare, 'primarycategory.nodename')), 'title' => HTML::chars(Arr::path($foursquare, 'primarycategory.nodename')))) . ' ' . HTML::chars(Arr::path($foursquare, 'primarycategory.nodename'))), '<br />';
// Mayor
if ($mayor = Arr::path($foursquare, 'stats.mayor.user')) {
echo __('Mayor: :mayor, :city', array(':mayor' => HTML::anchor('http://foursquare.com/user/' . Arr::get($mayor, 'id'), HTML::chars(Arr::get($mayor, 'firstname')) . ' ' . HTML::chars(Arr::get($mayor, 'lastname'))), ':city' => HTML::chars($mayor['homecity']))), '<br />';
}
// Checkins
echo __('Check-ins: :checkins', array(':checkins' => '<var>' . Arr::path($foursquare, 'stats.checkins') . '</var>')), '<br />';
// Here now
echo __('Here now: :herenow', array(':herenow' => '<var>' . Arr::path($foursquare, 'stats.herenow') . '</var>')), '<br />';
// Tips
if ($tips = Arr::path($foursquare, 'tips')) {
echo '<h5>', __('Tips (:tips)', array(':tips' => '<var>' . count($tips) . '</var>')), '</h5><dl>';
foreach (array_slice($tips, 0, 5) as $tip) {
echo '<dt>', HTML::anchor('http://foursquare.com/user/' . Arr::path($tip, 'user.id'), HTML::chars(Arr::path($tip, 'user.firstname')) . ' ' . HTML::chars(Arr::path($tip, 'user.lastname'))), ', ', HTML::chars(Arr::path($tip, 'user.homecity')), ':</dt>';
echo '<dd>', Text::auto_p(HTML::chars(Arr::path($tip, 'text'))), '</dd>';
}
echo '</dl>';
}
}
// Admin controls
if (Permission::has($this->venue, Model_Venue::PERMISSION_UPDATE)) {
echo HTML::anchor('#map', __('Link to Foursquare'), array('class' => 'action', 'id' => 'link-foursquare'));
echo $this->form();
}
return ob_get_clean();
}
示例2: content
/**
* Render content.
*
* @return string
*/
public function content()
{
ob_start();
if ($this->track->description) {
echo BB::factory($this->track->description)->render();
}
if ($this->track->tracklist) {
echo '<h3>Tracklist</h3>';
echo Text::auto_p(HTML::chars($this->track->tracklist));
}
return ob_get_clean();
}
示例3: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
// Line-up
if ($this->event->dj) {
?>
<p class="dj">
<h3><?php
echo __('Line-up');
?>
</h3>
<?php
echo Text::auto_p(HTML::chars($this->event->dj));
?>
</p>
<?php
}
echo HTML::anchor(Route::url('galleries', array('action' => 'upload')) . '?from=' . $this->event->id, __('Continue'), array('class' => 'action'));
return ob_get_clean();
}
示例4: content
/**
* Render content.
*
* @return string
*/
public function content()
{
ob_start();
if ($this->event->dj) {
?>
<div class="dj">
<h3><?php
echo __('Line-up');
?>
</h3>
<?php
echo Text::auto_p(HTML::chars($this->event->dj));
?>
</div>
<?php
}
if ($this->event->info) {
?>
<div class="extra-info">
<h3><?php
echo __('Extra info');
?>
</h3>
<?php
echo BB::factory($this->event->info)->render();
?>
</div>
<?php
}
return ob_get_clean();
}
示例5: render
public function render()
{
$this->template->errors = FALSE;
$this->template->body = FALSE;
$this->template->author = FALSE;
$this->template->email = FALSE;
$this->template->limited = FALSE;
$this->template->user = Auth::instance()->get_user();
$page = $this->request->query('model');
$this->template->page = $page;
$request = Request::initial();
if ($request->method() == 'POST') {
if ($request->post('action') == 'delete') {
if (Auth::instance()->logged_in('admin')) {
$id = $request->post('id');
$comment = ORM::factory('comment', $id);
$comment->delete();
$page->decrement_comments_count();
} else {
throw new HTTP_Exception_403('You are not allowed to proceed this action');
}
} elseif ($request->post('action') == 'edit') {
if (Auth::instance()->logged_in('admin')) {
$id = $request->post('id');
$body = strip_tags($request->post('value'));
$comment = ORM::factory('comment', $id);
$comment->body = $body;
$comment->update();
$this->template = NULL;
$body = Text::auto_p($body);
// FIX: злобный хак, нужно как-нибудь исправить
echo $body;
die;
} else {
throw new HTTP_Exception_403('You are not allowed to proceed this action');
}
} elseif ($request->post('hello_bots') != '') {
$comment = ORM::factory('comment');
$hash = $request->post('hello_bots');
if (Security::check($hash)) {
if ($user = Auth::instance()->get_user()) {
$comment->user = $user;
$comment->email = $user->email;
} else {
$comment->email = $request->post('email');
}
$comment->body = $request->post('body');
$comment->author = $request->post('author');
$comment->topic = $request->post('comment_subscribe');
$comment->ip = ip2long(Request::$client_ip);
$comment->page = $page;
try {
$comment->save();
$page->comments_count = $page->comments_count + 1;
$page->update();
$subscribers = $page->comments->subscribers($page->id);
foreach ($subscribers as $subscriber) {
$data = array('sub_email' => $subscriber->email, 'sub_name' => $subscriber->author, 'page_url' => substr(URL::base('http'), 0, -1) . $this->template->uri($page), 'page_title' => $page->title, 'com_body' => $comment->body, 'com_name' => $comment->author);
Queue::instance()->add('comment', $data);
}
} catch (ORM_Validation_Exception $exception) {
$this->template->errors = $exception->errors('validation');
$this->template->body = $comment->body;
$this->template->author = $comment->author;
$this->template->email = $comment->email;
}
}
}
$this->template->hello_bots = Security::token(TRUE);
} else {
$this->template->hello_bots = Security::token(FALSE);
}
$per_page = $this->_per_page;
$comment_page = $request->param('comment_page', 1);
list($count, $comments) = $page->comments->fetch($comment_page, $comment_page, $per_page);
$this->template->count = $count;
$this->template->comments = $comments;
$pagination_config = array('current_page' => array('source' => 'route', 'key' => 'comment_page'), 'items_per_page' => $per_page, 'total_items' => $count, 'view' => 'floating');
$_request = clone Request::$current;
Request::$current = clone Request::$initial;
$this->template->pager = Pagination::factory($pagination_config)->render();
Request::$current = clone $_request;
unset($_request);
}
示例6:
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
if (!empty($codebench['description'])) {
?>
<?php
echo Text::auto_p(Text::auto_link($codebench['description']), FALSE);
?>
<?php
}
?>
<?php
// echo '<h2>Raw output:</h2>', Kohana::debug($codebench)
?>
<?php
}
?>
<p id="footer">
Page executed in <strong><?php
示例7:
<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/>
<pre>
<?php
echo "Simple:<br/>";
echo Text::bytes(5500), "\n";
echo Text::bytes(17139812000), "\n\n";
// Maximum unit
echo "Max units in MB:\n";
echo Text::bytes(81620000000, 'MB'), "\n\n";
// 4 decimal accuracy
echo "4 decimals:\n";
echo Text::bytes(91711816100, null, '%01.4f %s', TRUE), "\n\n";
示例8: auto_p
public static function auto_p($string, $br = TRUE)
{
return Text::auto_p($string, $br = TRUE);
}
示例9: action_index
//.........这里部分代码省略.........
Notice::add(Notice::VALIDATION, Kohana::message('general', 'create_failed'), NULL, $e->errors('validation'));
} catch (Exception $e) {
// Database rollback
Database::instance()->rollback();
// Add error notice
Notice::add(Notice::ERROR);
}
}
// </editor-fold>
/*
* Get items
*/
// <editor-fold defaultstate="collapsed" desc="Get items">
// authority is edit
if ($this->logged_in_user->role == 'edit') {
// Get all items
$all_items = Tbl::factory('items')->select('items.*')->select('users.username')->join('users', 'LEFT')->on('items.user_id', '=', 'users.id')->where('division_id', '=', $division->id)->where('users.id', '=', $this->logged_in_user->id)->order_by($order_column, $order_direction)->read()->as_array();
} elseif ($this->logged_in_user->role == 'direct' or $this->logged_in_user->role == 'admin') {
// Get all items
$all_items = Tbl::factory('items')->select('items.*')->select('users.username')->join('users', 'LEFT')->on('items.user_id', '=', 'users.id')->where('division_id', '=', $division->id)->order_by($order_column, $order_direction)->read()->as_array();
} else {
$all_items = array();
}
// Pagenate
$pagenate = Pgn::factory(array('total_items' => count($all_items), 'items_per_page' => $this->settings->pagenate_items_per_page_for_items, 'follow' => $this->settings->pagenate_items_follow_for_items));
// Paginated items
$items = array_slice($all_items, $pagenate->offset, $pagenate->items_per_page);
foreach ($items as $item) {
// Get division
$division = Tbl::factory('divisions')->where('id', '=', $item->division_id)->read(1);
// Get main image
$item->main_image = Tbl::factory('images')->where('id', '=', $item->image_id)->read(1);
if ($item->main_image) {
$item->main_image->path = URL::site("imagefly", 'http') . '/item/' . $division->segment . '/' . $item->segment . '/';
$item->main_image->file = '/' . $item->main_image->segment . $item->main_image->ext;
}
// Get categories
$item->categories = Tbl::factory('categories')->select('categories.*')->join('items_categories')->on('categories.id', '=', 'items_categories.category_id')->where('items_categories.item_id', '=', $item->id)->read()->as_array();
// Get received comments
$item->received_commnets_count = count(Tbl::factory('received_comments')->where('item_id', '=', $item->id)->read()->as_array(NULL, 'id'));
// Set to item
$item->issued = $item->issued ? Date::formatted_time($item->issued, 'Y-n-j h:i') : $item->issued;
$item->created = $item->created ? Date::formatted_time($item->created, 'Y-n-j h:i') : $item->created;
$item->summary = Text::auto_p($item->summary);
$item->edit_url = URL::site("{$this->settings->backend_name}/items/{$division->segment}/edit/{$item->id}", 'http');
$item->delete_url = URL::site("{$this->settings->backend_name}/items/{$division->segment}/delete/{$item->id}", 'http');
}
// </editor-fold>
/**
* If post update
*/
// <editor-fold defaultstate="collapsed" desc="If post update">
if ($this->request->post('update')) {
$post = $this->request->post();
// Set post to item
foreach ($items as $item) {
$item->order = isset($post['order'][$item->id]) ? $post['order'][$item->id] : 0;
$item->is_active = isset($post['is_active'][$item->id]) ? $post['is_active'][$item->id] : 0;
$item->send_comment_is_on = isset($post['send_comment_is_on'][$item->id]) ? $post['send_comment_is_on'][$item->id] : 0;
}
// Database transaction start
Database::instance()->begin();
// Try
try {
// Update
foreach ($items as $item) {
Tbl::factory('items')->get($item->id)->update(array('order' => isset($post['order'][$item->id]) ? $post['order'][$item->id] : 0, 'is_active' => isset($post['is_active'][$item->id]) ? $post['is_active'][$item->id] : 0, 'send_comment_is_on' => isset($post['send_comment_is_on'][$item->id]) ? $post['send_comment_is_on'][$item->id] : 0));
}
// Database commit
Database::instance()->commit();
// Add success notice
Notice::add(Notice::SUCCESS, Kohana::message('general', 'update_success'));
// Todo::1 取得しなおし?
$this->redirect(URL::site("{$this->settings->backend_name}/items/{$division->segment}", 'http'));
} catch (HTTP_Exception_302 $e) {
$this->redirect($e->location());
} catch (Validation_Exception $e) {
// Database rollback
Database::instance()->rollback();
// Add validation notice
Notice::add(Notice::VALIDATION, Kohana::message('general', 'update_success'), NULL, $e->errors('validation'));
} catch (Exception $e) {
// Database rollback
Database::instance()->rollback();
// Add error notice
Notice::add(Notice::ERROR, $e->getMessage());
}
}
// </editor-fold>
// local_menusの修正
$this->local_menus = array($this->local_menus['index']);
/**
* View
*/
// <editor-fold defaultstate="collapsed" desc="View">
$this->partials['pagenate'] = Tpl::get_file('pagenate', $this->settings->back_tpl_dir);
$content_file = Tpl::get_file('index', $this->settings->back_tpl_dir . '/items', $this->partials);
$this->content = Tpl::factory($content_file)->set('division', $division)->set('columns', $columns)->set('items', $items)->set('create', $create)->set('pagenate', $pagenate);
// </editor-fold>
}
示例10: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
/**
* Event info
*
* @package Galleries
* @author Antti Qvickström
* @copyright (c) 2010 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
if (!isset($event) || !$event->loaded()) {
echo __('No event selected.');
return;
}
?>
<?php
if ($event->dj) {
?>
<article class="dj">
<?php
echo Text::auto_p(HTML::chars($event->dj));
?>
</article>
<?php
}
?>
<?php
echo HTML::anchor(Route::get('galleries')->uri(array('action' => 'upload')) . '?from=' . $event->id, __('Continue'), array('class' => 'action'));
示例11:
<p>
<a href="#reply" class="reply-button right"><img src="/i/reply_button.png" alt="Ответить" /></a>
<?php
echo Helper::filter($comment->get_user_link(), Helper::COMMENT);
?>
—
<span class="comment_time small gray"><?php
echo Date::formatted_time($comment->date, 'd/m/Y, H:i');
?>
</span>
<div class="clear"></div>
</p>
<div class="comment-body">
<?php
echo Text::auto_p(Helper::filter($comment->body, Helper::COMMENT));
?>
</div>
</div>
<div class="clear"></div>
</li>
<?php
}
?>
</ul>
<div id="pager">
<?php
echo $this->pager;
?>
</div>
示例12:
<div class="meedlegray">Интересы:</div>
<?php
echo Text::auto_p(Helper::escape($this->user->user_interests, Helper::BODY));
?>
</div>
<?php
}
?>
<?php
if ($this->user->user_brands) {
?>
<div class="unit size1of2">
<div class="meedlegray">Бренды:</div>
<?php
echo Text::auto_p(Helper::escape($this->user->user_brands, Helper::BODY));
?>
</div>
<?php
}
?>
</div>
<div class="clear"></div>
<span class="bottom_span"></span>
</div></div>
<div class="clear"></div>
</div>
<!--Конец с фоткой-->
<!--1-я с табом-->
示例13:
<div class="title_n">
<h5><?php
echo HTML::date($news['date_pub']);
?>
</h5>
<h2><?php
echo $news['title'];
?>
</h2>
</div>
<div class="text">
<img src="<?php
echo URL::base();
?>
public/content/news/<?php
echo $news['image'];
?>
.png" class="image_news" >
<?php
echo Text::auto_p($news['text']);
?>
</div>
示例14: render
/**
* Return BBCode parsed to HTML
*
* @param string $text
* @param boolean $plain
* @return string
*/
public function render($text = null, $plain = false)
{
if ($text) {
$this->text = $text;
}
if (is_null($this->text)) {
return '';
}
// Convert old system tags to BBCode
$text = str_replace(array('[link', '[/link]', '[q]', '[/q]'), array('[url', '[/url]', '[quote]', '[/quote]'), $this->text);
// Parse BBCode
if ($plain) {
$this->SetPlainMode();
$parsed = Text::auto_p($this->Parse($text));
$this->SetPlainMode(false);
} else {
// Convert orphan media links to tags
$text = $this->embed($text);
$parsed = $this->Parse($text);
}
return $parsed;
//$this->GetPlainMode() ? $parsed : Text::auto_p($parsed);
}
示例15: foreach
<div class="project list">
<p><?php
echo HTML::anchor(Route::get('project/crud')->uri(array('action' => 'create')), 'New Project');
?>
</p>
<dl>
<?php
foreach ($projects as $project) {
?>
<dt><?php
echo HTML::anchor(Route::get('project')->uri(array('name' => $project->name)), $project->name);
?>
</dt>
<dd><?php
echo Text::auto_p(Text::auto_link($project->description));
?>
</dd>
<?php
}
?>
</dl>
</div>