本文整理汇总了PHP中_l函数的典型用法代码示例。如果您正苦于以下问题:PHP _l函数的具体用法?PHP _l怎么用?PHP _l使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_l函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: echoMenu
public function echoMenu($items)
{
foreach ($items as $key => $item) {
if (!array_key_exists($item->id, $this->echoed)) {
$this->countLevel($item);
$this->echoed[$item->id] = $this->level;
echo '<tr><td>';
for ($i = 0; $i < $this->echoed[$item->id]; $i++) {
echo "--";
}
echo " " . $item->id . '</td>
<td>' . __(dots($item->title, 90)) . '</td>
<td><a class="btn btn-primary" href="' . _l(URL::action('MenuController@getItemEdit') . '/' . $item->id) . '">' . __(Lang::get('admin.edit')) . '</a></td>
<td><a href="#" data-toggle="modal" data-target="#confirm-delete" class="btn btn-danger" data-href="' . URL::action('MenuController@getItemDestroy') . '/' . $item->id . '">' . __(Lang::get('admin.delete')) . '</a></td>
</tr>';
}
if ($item->children()->count() > 0) {
$this->echoMenu($item->children);
}
}
}
示例2: edit_note
function edit_note($id)
{
if ((string) (int) $id != $id) {
_die("Invalid ID");
}
include "lib/tags.php";
$post_data =& $_POST;
foreach (array('ID', 'title', 'contents', 'tags', 'time', 'slug') as $key) {
$post_data[$key] = pg_escape_string(@$post_data[$key]);
}
$post_data['tags'] = clean_tags($post_data['tags']);
if (trim($post_data['slug']) == '') {
$post_data['slug'] = make_slug($post_data['title']);
}
if (!($time = strtotime(@$post_data['time']))) {
$time = date("Y-m-d H:i:s O", time());
} else {
$time = date("Y-m-d H:i:s O", $time);
}
$result = db("UPDATE public.\"notes\" SET \"title\" = '{$post_data['title']}',\n\t\t\t\"contents\" ='{$post_data['contents']}', \"tags\" = '{$post_data['tags']}',\n\t\t\t\"slug\" ='{$post_data['slug']}'\n\t\t\tWHERE \"ID\" = " . pg_escape_string($id));
if ($result) {
if (!rebuild_tags()) {
_die("There was an error rebuilding the tag cloud data.\n\t\t\t\t<a href=\"" . _l("/edit/{$id}") . "\">Go back →");
}
_die("Edit successfull. <a href=\"" . _l("/edit/{$id}") . "\">continue editing →");
} else {
_die("There was an unexpected error.");
}
}
示例3: tags_linked
function tags_linked($str)
{
$tags = explode(' ', $str);
foreach ($tags as $tag) {
echo " <a href=\"" . _l("/tag/{$tag}") . "\">{$tag}</a>";
}
}
示例4: show
public function show($segments)
{
extract($_POST);
if (!isset($username)) {
$username = $segments[1];
}
$entry = DB::query('select id,username,title,location,bio,avatar from users where username = \'' . $username . '\'', 1);
$entry['activity'] = DB::query('select count(*) as activity from feed where user_id = \'' . $entry['id'] . '\'', 2, 'activity');
if (!is_file(PATH_UPLOAD . 'profile/' . $entry['avatar'])) {
$entry['avatar'] = 'default.png';
}
$feed = array();
$feedraw = DB::query('select * from feed where user_id = ' . $entry['id'] . ' and privacy_id = 1 order by id desc limit 20', 0);
foreach ($feedraw as $i => $row) {
$feed[$i] = $row;
$feed[$i]['status'] = Feed::parse_status($row['status']);
$feed[$i]['files'] = Feed::get_files($row['id'], 'th');
if (isset($row['created_ts'])) {
$feed[$i]['timespan'] = timespan($row['created_ts']);
}
}
$follow_btn = "";
if ($entry['id'] != $_SESSION['user_id']) {
$following = DB::query('select id from follows where user_id = ' . $_SESSION['user_id'] . ' and user2_id = ' . $entry['id'], 1);
if ($following) {
$follow_btn = '<button class="btn btn-success follow" data-id="' . $entry['id'] . '"><i class="ion-checkmark-round"></i> ' . _l('Following') . ' </button>';
} else {
$follow_btn = '<button class="btn btn-info follow" data-id="' . $entry['id'] . '"><i class="ion-ios-bolt"></i> ' . _l('Follow') . ' </button>';
}
}
return array('view' => "account", 'follow_btn' => $follow_btn, 'entry' => $entry, 'feed' => $feed);
}
示例5: render
/**
* {@inheritdoc}
*/
public function render(ResultRow $values)
{
$value = $this->getValue($values);
if (!empty($this->options['display_as_link'])) {
return _l($this->sanitizeValue($value), $value, array('html' => TRUE));
} else {
return $this->sanitizeValue($value, 'url');
}
}
示例6: testSecurityUpdateAvailable
/**
* Tests the Update Manager module when a security update is available.
*/
function testSecurityUpdateAvailable()
{
$this->setSystemInfo7_0();
$this->refreshUpdateStatus(array('drupal' => '2-sec'));
$this->standardTests();
$this->assertNoText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertText(t('Security update required!'));
$this->assertRaw(_l('7.2', 'http://example.com/drupal-7-2-release'), 'Link to release appears.');
$this->assertRaw(_l(t('Download'), 'http://example.com/drupal-7-2.tar.gz'), 'Link to download appears.');
$this->assertRaw(_l(t('Release notes'), 'http://example.com/drupal-7-2-release'), 'Link to release notes appears.');
}
示例7: set_error
function set_error($message)
{
if (!isset($_SESSION['_errors'])) {
$_SESSION['_errors'] = array();
}
foreach ($_SESSION['_errors'] as $existing_error) {
if ($existing_error == _l($message)) {
return false;
}
}
$_SESSION['_errors'][] = _l($message);
return true;
}
示例8: testFieldUrl
public function testFieldUrl()
{
$view = Views::getView('test_view');
$view->setDisplay();
$view->displayHandlers->get('default')->overrideOption('fields', array('name' => array('id' => 'name', 'table' => 'views_test_data', 'field' => 'name', 'relationship' => 'none', 'display_as_link' => FALSE)));
$this->executeView($view);
$this->assertEqual('John', $view->field['name']->advancedRender($view->result[0]));
// Make the url a link.
$view->destroy();
$view->setDisplay();
$view->displayHandlers->get('default')->overrideOption('fields', array('name' => array('id' => 'name', 'table' => 'views_test_data', 'field' => 'name', 'relationship' => 'none')));
$this->executeView($view);
$this->assertEqual(_l('John', 'John'), $view->field['name']->advancedRender($view->result[0]));
}
示例9: query
function query($sql, $debug_message = '')
{
if (class_exists('module_db', false) && is_callable('module_db::query')) {
return module_db::query($sql, $debug_message);
}
//echo ''.$sql.'<br>';
if (_DEBUG_MODE && defined('_DEBUG_SQL') && _DEBUG_SQL) {
static $past_queries = array();
if (!isset($past_queries[$sql])) {
$past_queries[$sql] = 0;
} else {
$past_queries[$sql]++;
}
$sql_debug = $sql;
if (strlen($sql_debug) > 60) {
$sql_debug = htmlspecialchars(substr($sql_debug, 0, 60)) . '<a href="#" onclick="$(this).hide(); $(\'span\',$(this).parent()).show(); return false;">....</a><span style="display:none">' . htmlspecialchars(substr($sql, 60)) . '</span>';
} else {
$sql_debug = htmlspecialchars($sql);
}
if (class_exists('module_debug', false)) {
module_debug::log(array('title' => 'SQL Query', 'file' => 'includes/database.php', 'data' => '(' . ($past_queries[$sql] > 0 ? '<span style="color:#FF0000; font-weight:bold;">' . $past_queries[$sql] . '</span>' : $past_queries[$sql]) . ') ' . $debug_message . $sql_debug, 'important' => $past_queries[$sql] > 0));
}
}
$res = mysql_query($sql);
//or die(mysql_error() . $sql);
if (mysql_errno()) {
set_error(_l('SQL Error: %s', mysql_error() . ' ' . $sql));
set_error(_l('Try clicking the "Run Manual Upgrades" button to resolve SQL Errors.'));
return false;
}
return $res;
}
示例10: getDirLinks
function getDirLinks($url_params, $path, $getvar, $home)
{
$ret = '';
$dirs = explode('/', $path);
$dirpath = '';
$ret .= _l($home, $url_params, array($getvar => ''));
foreach ($dirs as $dirname) {
if ($dirname) {
$ret .= ' » ' . _l($dirname, $url_params, array($getvar => '/' . $dirpath . $dirname));
$dirpath .= $dirname . '/';
}
}
return $ret;
}
示例11: process
public function process()
{
if ('save_extra_default' == $_REQUEST['_process']) {
if (!module_config::can_i('edit', 'Settings')) {
die('No perms to save extra field settings.');
}
if (isset($_REQUEST['butt_del'])) {
if (module_form::confirm_delete('extra_default_id', _l("Really delete this extra field and ALL extra data linked to this field?"), $_SERVER['REQUEST_URI'])) {
$extra_default = module_extra::get_extra_default($_REQUEST['extra_default_id']);
if ($extra_default && $extra_default['extra_default_id'] == $_REQUEST['extra_default_id'] && $extra_default['owner_table'] && $extra_default['extra_key']) {
$extra_values = get_multiple('extra', array('owner_table' => $extra_default['owner_table'], 'extra_key' => $extra_default['extra_key']), 'extra_id', 'exact', 'owner_id');
if ($extra_values) {
foreach ($extra_values as $extra_value) {
if ($extra_value['owner_table'] == $extra_default['owner_table'] && $extra_value['extra_key'] == $extra_default['extra_key']) {
delete_from_db('extra', 'extra_id', $extra_value['extra_id']);
}
}
}
}
delete_from_db('extra_default', 'extra_default_id', $_REQUEST['extra_default_id']);
set_message('Extra field deleted successfully.');
redirect_browser(str_replace('extra_default_id', 'extra_default_id_deleted', $_SERVER['REQUEST_URI']));
}
}
if ((int) $_REQUEST['extra_default_id'] > 0) {
$extra_default = module_extra::get_extra_default($_REQUEST['extra_default_id']);
if ($extra_default && $extra_default['extra_default_id'] == $_REQUEST['extra_default_id'] && $extra_default['owner_table'] && $extra_default['extra_key']) {
if (isset($_POST['extra_key']) && !empty($_POST['extra_key']) && $_POST['extra_key'] != $extra_default['extra_key']) {
// they have renamed the key, rename all the existing ones in the system.
$extra_values = get_multiple('extra', array('owner_table' => $extra_default['owner_table'], 'extra_key' => $extra_default['extra_key']), 'extra_id', 'exact', 'owner_id');
if ($extra_values) {
foreach ($extra_values as $extra_value) {
if ($extra_value['owner_table'] == $extra_default['owner_table'] && $extra_value['extra_key'] == $extra_default['extra_key']) {
update_insert('extra_id', $extra_value['extra_id'], 'extra', array('extra_key' => $_POST['extra_key']));
}
}
}
}
}
}
$data = $_POST;
if (isset($data['options']) && is_array($data['options'])) {
$data['options'] = json_encode($data['options']);
}
update_insert('extra_default_id', $_REQUEST['extra_default_id'], 'extra_default', $data);
set_message('Extra field saved successfully');
redirect_browser($_SERVER['REQUEST_URI']);
}
}
示例12: print_list
function print_list($result)
{
?>
<ul class="archives">
<?php
while ($row = pg_fetch_assoc($result)) {
$time = strtotime($row['time']);
$slug_time = date("y-m-d", $time);
$title_time = date("D, m/d h:m:a", $time);
echo "\t<li><a title='{$title_time}' href='" . _l("/date/{$slug_time}#{$row['slug']}") . "'>{$row['title']}</a></li>";
}
?>
</ul>
<?php
}
示例13: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
if (Session::get('user_level') < Config::get('cms.shopManager')) {
return Redirect::to(_l(URL::action('AdminHomeController@getIndex')));
}
$this->setLayout();
if (Input::get('q')) {
$products = Product::where(function ($query) {
$query->where('title', 'LIKE', '%' . Input::get('q') . '%')->orwhere('long_content', 'LIKE', '%' . Input::get('q') . '%')->orwhere('short_content', 'LIKE', '%' . Input::get('q') . '%');
})->orderBy('created_at', 'desc')->paginate(20);
} else {
$products = News::orderBy('created_at', 'desc')->paginate(20);
}
View::share('title', __(Lang::get('shop.products')));
View::share('products', $products);
$this->layout->content = View::make('backend.shop.product.index');
}
示例14: login
function login()
{
$username = $this->security->xss_clean($this->input->post('username'));
$password = md5($this->input->post('password'));
$result = $this->NodCMS_admin_sign_model->check_login($username, $password);
$tam = $result->result_array();
if ($result->num_rows() > 0 && ($tam[0]['group_id'] == 1 || $tam[0]['group_id'] == 2)) {
foreach ($result->result_array() as $row) {
$data = array('fullname' => $row['firstname'] . " " . $row['firstname'], 'username' => $row['username'], 'user_id' => $row['user_id'], 'group' => $row['group_id'], 'avatar' => $row['avatar'], 'email' => $row['email'], 'logged_in_status' => true);
}
$this->session->set_userdata($data);
$_SESSION['Session_Admin'] = $data['user_id'];
redirect(base_url() . 'admin/');
} else {
$this->session->set_flashdata('message', _l('Oopsie, Username or password is incorrect', $this));
redirect(base_url() . 'admin-sign');
}
}
示例15: adminOverview
/**
* Displays the path administration overview page.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* The request object.
*
* @return array
* A render array as expected by drupal_render().
*/
public function adminOverview(Request $request)
{
$keys = $request->query->get('search');
// Add the filter form above the overview table.
$build['path_admin_filter_form'] = $this->formBuilder()->getForm('Drupal\\path\\Form\\PathFilterForm', $keys);
// Enable language column if language.module is enabled or if we have any
// alias with a language.
$multilanguage = $this->moduleHandler()->moduleExists('language') || $this->aliasStorage->languageAliasExists();
$header = array();
$header[] = array('data' => $this->t('Alias'), 'field' => 'alias', 'sort' => 'asc');
$header[] = array('data' => $this->t('System'), 'field' => 'source');
if ($multilanguage) {
$header[] = array('data' => $this->t('Language'), 'field' => 'langcode');
}
$header[] = $this->t('Operations');
$rows = array();
$destination = drupal_get_destination();
foreach ($this->aliasStorage->getAliasesForAdminListing($header, $keys) as $data) {
$row = array();
$row['data']['alias'] = _l(truncate_utf8($data->alias, 50, FALSE, TRUE), $data->source, array('attributes' => array('title' => $data->alias)));
$row['data']['source'] = _l(truncate_utf8($data->source, 50, FALSE, TRUE), $data->source, array('alias' => TRUE, 'attributes' => array('title' => $data->source)));
if ($multilanguage) {
$row['data']['language_name'] = $this->languageManager()->getLanguageName($data->langcode);
}
$operations = array();
$operations['edit'] = array('title' => $this->t('Edit'), 'url' => Url::fromRoute('path.admin_edit', ['pid' => $data->pid], ['query' => $destination]));
$operations['delete'] = array('title' => $this->t('Delete'), 'url' => Url::fromRoute('path.delete', ['pid' => $data->pid], ['query' => $destination]));
$row['data']['operations'] = array('data' => array('#type' => 'operations', '#links' => $operations));
// If the system path maps to a different URL alias, highlight this table
// row to let the user know of old aliases.
if ($data->alias != $this->aliasManager->getAliasByPath($data->source, $data->langcode)) {
$row['class'] = array('warning');
}
$rows[] = $row;
}
$build['path_table'] = array('#type' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => $this->t('No URL aliases available. <a href="@link">Add URL alias</a>.', array('@link' => $this->url('path.admin_add'))));
$build['path_pager'] = array('#theme' => 'pager');
return $build;
}