本文整理汇总了PHP中Text::plain方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::plain方法的具体用法?PHP Text::plain怎么用?PHP Text::plain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::plain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_tag
/**
* Retrieve a JSON object containing autocomplete suggestions for existing users.
*/
public function action_tag()
{
$string = $this->request->param('string', FALSE);
$type = $this->request->param('type', 'blog');
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
$tags_typed = Tags::explode($string);
$tag_last = UTF8::strtolower(array_pop($tags_typed));
$matches = array();
if (!empty($tag_last)) {
$query = DB::select('name')->from('tags')->where('name', 'LIKE', $tag_last . '%')->where('type', '=', $type);
// Do not select already entered terms.
if (!empty($tags_typed)) {
$query->where('name', 'NOT IN', $tags_typed);
}
$result = $query->limit('10')->execute();
$prefix = count($tags_typed) ? implode(', ', $tags_typed) . ', ' : '';
foreach ($result as $tag) {
$n = $tag['name'];
// Tag names containing commas or quotes must be wrapped in quotes.
if (strpos($tag['name'], ',') !== FALSE or strpos($tag['name'], '"') !== FALSE) {
$n = '"' . str_replace('"', '""', $tag['name']) . '"';
} else {
$matches[$prefix . $n] = Text::plain($tag['name']);
}
}
}
$this->response->body(JSON::encode($matches));
}
示例2: load_themes
/**
* Load the active theme.
*
* This is called at bootstrap time.
* We will only ever have one theme active for any given request.
*
* @uses Kohana::modules
*/
public static function load_themes()
{
$config = Config::load('site');
self::$themes = self::available(FALSE);
//set admin theme based on path info
$path = ltrim(Request::detect_uri(), '/');
Theme::$is_admin = $path == "admin" || !strncmp($path, "admin/", 6);
if (Theme::$is_admin) {
// Load the admin theme
Theme::$active = $config->get('admin_theme', 'cerber');
} else {
// Load the site theme
Theme::$active = $config->get('theme', 'cerber');
}
//Set mobile theme, if enabled and mobile request
if (Request::is_mobile() and $config->get('mobile_theme', FALSE)) {
// Load the mobile theme
Theme::$active = $config->get('mobile_theme', 'cerber');
}
// Admins can override the site theme, temporarily. This lets us preview themes.
if (User::is_admin() and isset($_GET['theme']) and $override = Text::plain($_GET['theme'])) {
Theme::$active = $override;
}
//Finally set the active theme
Theme::set_theme();
}
示例3: action_links
/**
* Retrieve a JSON object containing autocomplete suggestions for existing aliases
*
* @uses ACL::required
* @uses DB::select
* @uses Text::plain
* @uses JSON::encode
*/
public function action_links()
{
ACL::required('administer menu');
$string = $this->request->param('string', FALSE);
$matches = array();
if ($string) {
$result = DB::select('alias')->from('paths')->where('alias', 'LIKE', $string . '%')->limit('10')->execute();
foreach ($result as $link) {
$matches[$link['alias']] = Text::plain($link['alias']);
}
}
$this->response->body(JSON::encode($matches));
}
示例4: get
/**
* doctestを取得
* @param string $src doctestを含む文字列
* @param string $self_class 定義されているクラス名
* @param string $class_package 定義されているパッケージ名
* @param integer $offset 開始行
* @return self{}
*/
public static function get($src, $self_class, $class_package, $offset = 0)
{
$doctest = array();
if (preg_match_all("/\\/\\*\\*\\*.+?\\*\\//s", $src, $comments, PREG_OFFSET_CAPTURE)) {
foreach ($comments[0] as $value) {
if (isset($value[0][5]) && $value[0][5] != "*") {
$test_block = str_replace(array("self::", "new self("), array($self_class . "::", "new " . $self_class . "("), preg_replace("/^[\\s]*\\*[\\s]{0,1}/m", "", str_replace(array("/" . "***", "*" . "/"), "", $value[0])));
$test_object = new self(preg_match("/^[\\s]*#(.+)/", $test_block, $match) ? trim($match[1]) : null, $class_package);
$test_object->test(Text::plain($test_block));
$doctest[$offset + substr_count(substr($src, 0, $value[1]), "\n")] = $test_object;
}
}
}
return $doctest;
}
示例5: action_list
/**
* List tags
*
* @uses Request::is_datatables
* @uses ORM::dataTables
* @uses Text::plain
* @uses HTML::icon
* @uses Route::url
* @uses Route::get
* @uses Assets::popup
*/
public function action_list()
{
Assets::popup();
$is_datatables = Request::is_datatables();
if ($is_datatables) {
$tags = ORM::factory('tag');
$this->_datatables = $tags->dataTables(array('name', 'id', 'type'));
foreach ($this->_datatables->result() as $tag) {
$this->_datatables->add_row(array(Text::plain($tag->name), HTML::anchor($tag->url, $tag->url), Text::plain($tag->type), HTML::icon($tag->edit_url, 'fa-edit', array('class' => 'btn btn-sm btn-default action-edit', 'title' => __('Edit Tag'))) . ' ' . HTML::icon($tag->delete_url, 'fa-trash-o', array('class' => 'btn btn-sm btn-default action-delete', 'title' => __('Delete Tag'), 'data-toggle' => 'popup', 'data-table' => '#admin-list-tags'))));
}
}
$this->title = __('Tags');
$url = Route::url('admin/tag', array('action' => 'list'), TRUE);
$view = View::factory('admin/tag/list')->bind('datatables', $this->_datatables)->set('is_datatables', $is_datatables)->set('url', $url);
$this->response->body($view);
}
示例6: action_list
/**
* List user roles
*
* @uses Request::is_datatables
* @uses ORM::dataTables
*/
public function action_list()
{
$is_datatables = Request::is_datatables();
if ($is_datatables) {
$roles = ORM::factory('role');
$this->_datatables = $roles->dataTables(array('name', 'description', 'special'));
foreach ($this->_datatables->result() as $role) {
$this->_datatables->add_row(array(Text::plain($role->name), Text::plain($role->description), $role->special ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-ban"></i>', $role->special ? HTML::icon($role->perm_url, 'fa-lock', array('title' => __('Edit Permissions'))) : HTML::icon($role->edit_url, 'fa-edit', array('title' => __('Edit Role'))) . ' ' . HTML::icon($role->delete_url, 'fa-trash-o', array('title' => __('Delete Role'))) . ' ' . HTML::icon($role->perm_url, 'fa-lock', array('title' => __('Edit Permissions')))));
}
}
$this->title = __('Roles');
$add_url = Route::get('admin/role')->uri(array('action' => 'add'));
$url = Route::url('admin/role', array('action' => 'list'), TRUE);
$view = View::factory('admin/role/list')->bind('datatables', $this->_datatables)->set('is_datatables', $is_datatables)->set('add_url', $add_url)->set('url', $url);
$this->response->body($view);
}
示例7: action_list
/**
* Displays a list of all users
*
* @uses Request::is_datatables
* @uses ORM::dataTables
* @uses Text::plain
* @uses Text::auto_link
* @uses User::roles
* @uses HTML::anchor
* @uses HTML::icon
* @uses Route::get
* @uses Route::url
* @uses Date::formatted_time
* @uses Assets::popup
*/
public function action_list()
{
$is_datatables = Request::is_datatables();
if ($is_datatables) {
$users = ORM::factory('user');
// @todo fix dummy id column for roles to match the column order
$this->_datatables = $users->dataTables(array('name', 'mail', 'created', 'login', 'id', 'status'));
foreach ($this->_datatables->result() as $user) {
$this->_datatables->add_row(array(HTML::anchor($user->url, Text::plain($user->nick)), Text::auto_link($user->mail), Date::formatted_time($user->created, 'M d, Y'), $user->login > 0 ? Date::formatted_time($user->login, 'M d, Y') : __('Never'), User::roles($user), $user->status == 1 ? '<span class="status-active"><i class="fa fa-check-circle"></i></span>' : '<span class="status-blocked"><i class="fa fa-ban"></i></span>', HTML::icon(Route::get('admin/user')->uri(array('action' => 'edit', 'id' => $user->id)), 'fa-edit', array('class' => 'action-edit', 'title' => __('Edit User'))) . ' ' . HTML::icon(Route::get('admin/permission')->uri(array('action' => 'user', 'id' => $user->id)), 'fa-key', array('class' => '', 'title' => __('Edit Permission'))) . ' ' . HTML::icon($user->delete_url, 'fa-trash-o', array('class' => 'action-delete', 'title' => __('Delete User'), 'data-toggle' => 'popup', 'data-table' => '#admin-list-users'))));
}
}
Assets::popup();
$this->title = __('Users');
$url = Route::url('admin/user', array('action' => 'list'), TRUE);
$view = View::factory('admin/user/list')->bind('datatables', $this->_datatables)->set('is_datatables', $is_datatables)->set('url', $url);
$this->response->body($view);
}
示例8: action_list
/**
* List menus
*
* @uses ORM::reset
* @uses ORM::dataTables
* @uses Route::get
* @uses Route::uri
* @uses Route::url
* @uses Assets::popup
* @uses Request::is_datatables
* @uses Text::plain
* @uses HTML::icon
*/
public function action_list()
{
Assets::popup();
$is_datatables = Request::is_datatables();
$menus = ORM::factory('menu')->where('lft', '=', 1);
if ($is_datatables) {
$this->_datatables = $menus->dataTables(array('title', 'descp'));
foreach ($this->_datatables->result() as $menu) {
$this->_datatables->add_row(array(Text::plain($menu->title) . '<div class="description">' . Text::plain($menu->descp) . '</div>', HTML::icon($menu->list_items_url, 'fa-th-list', array('class' => 'action-list', 'title' => __('List Links'))), HTML::icon($menu->add_item_url, 'fa-plus', array('class' => 'action-add', 'title' => __('Add Link'))), HTML::icon($menu->edit_url, 'fa-edit', array('class' => 'action-edit', 'title' => __('Edit Menu'))), HTML::icon($menu->delete_url, 'fa-trash-o', array('class' => 'action-delete', 'title' => __('Delete Menu'), 'data-toggle' => 'popup', 'data-table' => '#admin-list-menus'))));
}
}
$this->title = __('Menus');
$add_url = Route::get('admin/menu')->uri(array('action' => 'add'));
$url = Route::url('admin/menu', array('action' => 'list'), TRUE);
$view = View::factory('admin/menu/list')->bind('datatables', $this->_datatables)->set('is_datatables', $is_datatables)->set('add_url', $add_url)->set('url', $url);
$this->response->body($view);
}
示例9: action_list
/**
* List Category Groups
*
* @uses Assets::popup
* @uses Request::is_datatables
* @uses Text::plain
* @uses HTML::icon
* @uses Route::get
* @uses Route::uri
* @uses Route::url
*/
public function action_list()
{
Assets::popup();
$is_datatables = Request::is_datatables();
$terms = ORM::factory('term')->where('lft', '=', 1);
if ($is_datatables) {
$this->_datatables = $terms->dataTables(array('name', 'description'));
foreach ($this->_datatables->result() as $term) {
$this->_datatables->add_row(array(Text::plain($term->name) . '<div class="description">' . Text::plain($term->description) . '</div>', HTML::icon(Route::get('admin/term')->uri(array('action' => 'list', 'id' => $term->id)), 'fa-th-list', array('class' => 'action-list', 'title' => __('List Categories'))), HTML::icon(Route::get('admin/term')->uri(array('action' => 'add', 'id' => $term->id)), 'fa-plus', array('class' => 'action-add', 'title' => __('Add Category'))), HTML::icon(Route::get('admin/taxonomy')->uri(array('action' => 'edit', 'id' => $term->id)), 'fa-edit', array('class' => 'action-edit', 'title' => __('Edit Group'))), HTML::icon(Route::get('admin/taxonomy')->uri(array('action' => 'delete', 'id' => $term->id)), 'fa-trash-o', array('class' => 'action-delete', 'title' => __('Delete Group'), 'data-toggle' => 'popup', 'data-table' => '#admin-list-vocabs'))));
}
}
$this->title = __('Category Groups');
$add_url = Route::get('admin/taxonomy')->uri(array('action' => 'add'));
$url = Route::url('admin/taxonomy', array('action' => 'list'), TRUE);
$view = View::factory('admin/taxonomy/list')->bind('datatables', $this->_datatables)->set('is_datatables', $is_datatables)->set('add_url', $add_url)->set('url', $url);
$this->response->body($view);
}
示例10: action_mail
/**
* Sending mails
*
* @since 1.0.0 First time this method was introduced
* @since 1.1.0 Added jQuery Textarea Characters Counter Plugin
*
* @link http://roy-jin.appspot.com/jsp/textareaCounter.jsp
*
* @uses Request::query
* @uses Route::get
* @uses Route::uri
* @uses URL::query
* @uses URL::site
* @uses Validation::rule
* @uses Config::get
* @uses Config::load
* @uses Assets::js
*/
public function action_mail()
{
$this->title = __('Contact us');
$config = Config::load('contact');
Assets::js('textareaCounter', 'media/js/jquery.textareaCounter.plugin.js', array('jquery'), FALSE, array('weight' => 10));
Assets::js('greet/form', 'media/js/greet.form.js', array('textareaCounter'), FALSE, array('weight' => 15));
//Add schema.org support
$this->schemaType = 'ContactPage';
// Set form destination
$destination = !is_null($this->request->query('destination')) ? array('destination' => $this->request->query('destination')) : array();
// Set form action
$action = Route::get('contact')->uri(array('action' => $this->request->action())) . URL::query($destination);
// Get user
$user = User::active_user();
// Set mail types
$types = $config->get('types', array());
$view = View::factory('contact/form')->set('destination', $destination)->set('action', $action)->set('config', $config)->set('types', $types)->set('user', $user)->bind('post', $post)->bind('errors', $this->_errors);
// Initiate Captcha
if ($config->get('use_captcha', FALSE) and !$this->_auth->logged_in()) {
$captcha = Captcha::instance();
$view->set('captcha', $captcha);
}
if ($this->valid_post('contact')) {
$post = Validation_Contact::factory($this->request->post());
if ($post->check()) {
// Create the email subject
$subject = __('[:category] :subject', array(':category' => $types[$post['category']], ':subject' => Text::plain($post['subject'])));
// Create the email body
$body = View::factory('email/contact')->set('name', $post['name'])->set('body', $post['body'])->set('config', Config::load('site'))->render();
// Create an email message
$email = Email::factory()->to(Text::plain($this->_config->get('site_email', 'webmaster@gleezcms.org')), __('Webmaster :site', array(':site' => Template::getSiteName())))->subject($subject)->from($post['email'], Text::plain($post['name']))->message($body, 'text/html');
// @todo message type should be configurable
// Send the message
$email->send();
Log::info(':name sent an e-mail regarding :cat', array(':name' => Text::plain($post['name']), ':cat' => $types[$post['category']]));
Message::success(__('Your message has been sent.'));
// Always redirect after a successful POST to prevent refresh warnings
$this->request->redirect(Route::get('contact')->uri(), 200);
} else {
$this->_errors = $post->errors('contact', TRUE);
}
}
$this->response->body($view);
}
示例11: __get
/**
* Reading data from inaccessible properties
*
* @param string $field
* @return mixed
*
* @uses Text::plain
* @uses Text::markup
* @uses Route::get
* @uses Route::uri
*/
public function __get($field)
{
switch ($field) {
case 'subject':
return Text::plain(parent::__get('subject'));
case 'body':
return Text::markup($this->rawbody, $this->format);
case 'rawsubject':
// Raw fields without markup. Usage: during edit or etc!
return parent::__get('subject');
case 'rawbody':
// Raw fields without markup. Usage: during edit or etc!
return parent::__get('body');
case 'url':
return Route::get('user/message')->uri(array('id' => $this->id, 'action' => 'view'));
case 'delete_url':
return Route::get('user/message')->uri(array('id' => $this->id, 'action' => 'delete'));
default:
return parent::__get($field);
}
}
示例12: __get
/**
* Reading data from inaccessible properties
*
* @param string $field
* @return mixed
*
* @uses Text::plain
* @uses Text::markup
* @uses HTML::links
* @uses Path::load
* @uses Route::get
* @uses Route::uri
*/
public function __get($field)
{
switch ($field) {
case 'title':
return Text::plain(parent::__get('title'));
break;
case 'teaser':
return Text::markup($this->rawteaser, $this->format);
break;
case 'body':
return Text::markup($this->rawbody, $this->format);
break;
case 'terms_form':
return $this->terms->find()->id;
break;
case 'tags_form':
return $this->tags->find_all()->as_array('id', 'name');
break;
case 'taxonomy':
return HTML::links($this->terms->find_all(), array('class' => 'nav nav-pills pull-right'));
break;
case 'tagcloud':
return HTML::links($this->tags->find_all(), array('class' => 'nav nav-pills'));
break;
case 'links':
return HTML::links($this->links(), array('class' => 'links inline'));
break;
case 'rawtitle':
// Raw fields without markup. Usage: during edit or etc!
return parent::__get('title');
break;
case 'rawteaser':
// Raw fields without markup. Usage: during edit or etc!
return parent::__get('teaser');
break;
case 'rawbody':
// Raw fields without markup. Usage: during edit or etc!
return parent::__get('body');
break;
case 'rawurl':
return Route::get($this->type)->uri(array('id' => $this->id, 'action' => 'view'));
break;
case 'rawimage':
// Raw fields without path. Usage: during edit or etc!
return parent::__get('image');
break;
case 'url':
// Model specific links; view, edit, delete url's
return ($path = Path::load($this->rawurl)) ? $path['alias'] : $this->rawurl;
break;
case 'edit_url':
return Route::get($this->type)->uri(array('id' => $this->id, 'action' => 'edit'));
break;
case 'delete_url':
return Route::get($this->type)->uri(array('id' => $this->id, 'action' => 'delete'));
break;
case 'image':
return $this->rawimage ? $this->_image_url . $this->rawimage : NULL;
break;
case 'count_comments':
return (int) DB::select(array(DB::expr('COUNT(*)'), 'mycount'))->from('comments')->where('status', '=', 'publish')->where('post_id', '=', $this->id)->execute()->get('mycount');
break;
}
return parent::__get($field);
}
示例13: render
/**
* Renders the HTML output for the menu
*
* @param array $attributes Associative array of html attributes [Optional]
* @param array $items The parent item's array, only used internally [Optional]
*
* @return string HTML unordered list
*/
public function render(array $attributes = NULL, array $items = NULL)
{
static $i;
$items = empty($items) ? $this->items : $items;
$attributes = empty($attributes) ? $this->attributes : $attributes;
if (empty($items)) {
return;
}
$i++;
//This attribute detects we're in nav or widget for styling
$is_widget = isset($attributes['widget']);
if ($is_widget) {
unset($attributes['widget']);
}
$attributes['class'] = empty($attributes['class']) ? 'level-' . $i : $attributes['class'] . ' level-' . $i;
$menu = '<ul' . HTML::attributes($attributes) . '>';
$num_items = count($items);
$_i = 1;
foreach ($items as $key => $item) {
$has_children = count($item['children']);
$classes = NULL;
$attributes = array();
$caret = NULL;
// Add first, last and parent classes to the list of links to help out themers.
if ($_i == 1) {
$classes[] = 'first';
}
if ($_i == $num_items) {
$classes[] = 'last';
}
if ($has_children) {
$classes[] = 'parent dropdown';
$attributes[] = 'dropdown-toggle collapsed';
if ($i == 2) {
$classes[] = 'dropdown-submenu';
}
}
// Check if the menu item URI is or contains the current URI
if (HTML::is_active($item['url'])) {
$classes[] = 'active';
$attributes[] = 'active';
}
if (!empty($classes)) {
$classes = HTML::attributes(array('class' => implode(' ', $classes)));
}
if (!empty($attributes)) {
$attributes = array('class' => implode(' ', $attributes));
}
$id = HTML::attributes(array('id' => 'menu-' . $key));
//Twitter bootstrap attributes
if ($has_children) {
$attributes['data-toggle'] = 'dropdown';
$item['url'] = '#';
$caret = $i == 2 ? '' : '<b class="caret"></b>';
$class = 'dropdown-menu';
}
//Twitter bootstrap use collapse for widget menu chlidren
if ($has_children && $is_widget) {
$attributes['data-toggle'] = 'collapse';
$attributes['data-parent'] = '#menu-' . $key;
$item['url'] = '#collapse-' . $key;
$class = 'panel-collapse collapse';
$caret = $i == 2 ? '' : '<i class="fa fa-chevron-down submenu"></i>';
}
//set title
$title = isset($item['image']) ? '<i class="fa fa-fw ' . $item['image'] . '"></i>' : '';
// localize item menu
$title .= '<span>' . Text::plain(__($item['title'])) . $caret . '</span>';
if ($item['descp'] && !empty($item['descp'])) {
// localize item desc
$title .= '<span class="menu-descp">' . Text::plain(__($item['descp'])) . '</span>';
}
$menu .= '<li' . $classes . ' ' . $id . '>' . HTML::anchor($item['url'], $title, $attributes);
if ($has_children) {
$menu .= $this->render(array('class' => $class, 'id' => 'collapse-' . $key), $item['children']);
}
$_i++;
$menu .= '</li> ';
}
$menu .= '</ul>';
$i--;
return $menu;
}
示例14: __
echo __('Warning! Give to trusted roles only; this permission has security implications.');
?>
</cite>
<?php
}
?>
</div>
</div>
</td>
<?php
foreach ($roles as $i => $role) {
?>
<td class="role-checkbox">
<?php
echo Form::checkbox("roles[{$role->id}][{$key}{$perm}{$i}][name]", Text::plain($perm), isset($role_perms[$role->id][$perm]));
?>
<?php
echo Form::hidden("roles[{$role->id}][{$key}{$perm}{$i}][module]", $key);
?>
<?php
echo Form::hidden("roles[{$role->id}][{$key}{$perm}{$i}][id]", $role->id);
?>
</td>
<?php
}
?>
</tr>
<?php
}
示例15: __
<td class="module-description-column">
<div class="module-title-column">
<strong><?php
echo Text::plain($module_info->title);
?>
</strong>
</div>
<div class="module-description">
<p><?php
echo __($module_info->description);
?>
</p>
</div>
<div class="module-version">
<?php
echo __('Version: %ver | By: :author', array('%ver' => Text::plain($module_info->version), ':author' => HTML::anchor($module_info->authorURL, __($module_info->author))));
?>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
echo Form::submit('modules', __('Save'), array('class' => 'btn btn-success pull-right'));
?>
<?php
echo Form::close();
?>