本文整理汇总了PHP中l函数的典型用法代码示例。如果您正苦于以下问题:PHP l函数的具体用法?PHP l怎么用?PHP l使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了l函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fever_links__system_main_menu
function fever_links__system_main_menu($vars)
{
$class = implode($vars['attributes']['class'], ' ');
$html = '<ul class="' . $class . '">';
foreach ($vars['links'] as $key => $link) {
if (is_numeric($key)) {
$sub_menu = '';
$link_class = '';
$link_title = '<span>';
$link_title .= $link['#title'];
// Check for sub menu - note I've only checked this for 2 levels
// it might not work for 3 level menus.
if (!empty($link['#below'])) {
$link_class = ' class="dropdown"';
$link['#attributes']['class'][] = 'dropdown-toggle';
$link['#attributes']['data-toggle'][] = 'dropdown';
// And recurse.
$sub_menu = theme('links__system_main_menu', array('links' => $link['#below'], 'attributes' => array('class' => array('dropdown-menu'))));
}
$html .= '<li' . $link_class . '>' . l($link_title, $link['#href'], array('html' => 'true', 'attributes' => $link['#attributes'])) . '</span>' . $sub_menu . '</li>';
}
}
$html .= '</ul>';
return $html;
}
示例2: bootstrap_menu_link
/**
* Overrides theme_menu_link().
*/
function bootstrap_menu_link(array $variables)
{
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
$sub_menu = drupal_render($element['#below']);
} elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] >= 1) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
//$element['#title'] .= ' <span class="caret"></span>';
$element['#attributes']['class'][] = 'dropdown';
$element['#localized_options']['html'] = TRUE;
// Set dropdown trigger element to # to prevent inadvertant page loading
// when a submenu link is clicked.
//$element['#localized_options']['attributes']['data-target'] = '#';
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
//$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
}
}
// On primary navigation menu, class 'active' is not set on active menu item.
// @see https://drupal.org/node/1896674
if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && empty($element['#localized_options']['language'])) {
$element['#attributes']['class'][] = 'active';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
示例3: cmstheme_breadcrumb
/**
* Implemensts hook_breadcrumb().
*
* tth@bellcom.dk check if there is a better way to do this...
*/
function cmstheme_breadcrumb($variables)
{
$breadcrumb = $variables['breadcrumb'];
$nid = arg(1);
if (is_numeric($nid)) {
$node = node_load($nid);
}
if (!empty($breadcrumb)) {
$output = '<div class="breadcrumb you-are-here">' . t('Du er her: ') . '</div>';
$title = drupal_get_title();
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = '<a href="#" title="' . $title . '">' . $title . '</a>';
if ($title == 'Søg') {
unset($breadcrumb);
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = '<a href="#" title="Søgning">Søgning</a>';
}
if (isset($node) && is_object($node) && $node->type == 'meeting') {
unset($breadcrumb);
$breadcrumb[0] = l(t('Forside'), '<front>', array('attributes' => array('title' => 'Forside')));
$breadcrumb[] = l(t('Politik & planer'), 'politik-og-planer', array('attributes' => array('title' => 'Politik og planer')));
$breadcrumb[] = l(t('Søg i dagsordener og referater'), 'dagsorden-og-referat', array('attributes' => array('title' => 'Søg i dagsordner og referater')));
$breadcrumb[] = l(t($title), '#');
}
$output .= '<div class="breadcrumb">' . implode('<div class="bread-crumb"> > </div> ', $breadcrumb) . '</div>';
return $output;
}
}
示例4: gavias_laikafood_format_comma_field
function gavias_laikafood_format_comma_field($field_category, $node, $limit = NULL)
{
if (module_exists('i18n_taxonomy')) {
$language = i18n_language();
}
$category_arr = array();
$category = '';
$field = field_get_items('node', $node, $field_category);
if (!empty($field)) {
foreach ($field as $item) {
$term = taxonomy_term_load($item['tid']);
if ($term) {
if (module_exists('i18n_taxonomy')) {
$term_name = i18n_taxonomy_term_name($term, $language->language);
// $term_desc = tagclouds_i18n_taxonomy_term_description($term, $language->language);
} else {
$term_name = $term->name;
//$term_desc = $term->description;
}
$category_arr[] = l($term_name, 'taxonomy/term/' . $item['tid']);
}
if ($limit) {
if (count($category_arr) == $limit) {
$category = implode(', ', $category_arr);
return $category;
}
}
}
}
$category = implode(', ', $category_arr);
return $category;
}
示例5: foreverdelete
public function foreverdelete()
{
//彻底删除指定记录
$ajax = intval($_REQUEST['ajax']);
$id = $_REQUEST['id'];
if (isset($id)) {
$condition = array('id' => array('in', explode(',', $id)));
if (M("Deal")->where(array('deal_goods_type' => array('in', explode(',', $id))))->count() > 0) {
$this->error(l("GOODS_TYPE_EXIST_DEAL"));
}
$rel_data = M(MODULE_NAME)->where($condition)->findAll();
foreach ($rel_data as $data) {
$info[] = $data['name'];
}
if ($info) {
$info = implode(",", $info);
}
$list = M(MODULE_NAME)->where($condition)->delete();
if ($list !== false) {
M("GoodsTypeAttr")->where(array('goods_type_id' => array('in', explode(',', $id))))->delete();
save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
$this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
} else {
save_log($info . l("FOREVER_DELETE_FAILED"), 0);
$this->error(l("FOREVER_DELETE_FAILED"), $ajax);
}
} else {
$this->error(l("INVALID_OPERATION"), $ajax);
}
}
示例6: navigation
function navigation($section = '')
{
global $lang;
global $translation;
//$tr = $translation->navigation; // Removed 22 Sep 2011 --CR
$abo = array('About', 'Overview', 'People', 'Foundation');
$ref = array('Reference', 'Language', 'A-Z', 'Libraries', 'Tools', 'Environment');
$learn = array('Learning', 'Tutorials', 'Basics', 'Topics', '3D', 'Library', 'Books');
$html = "\t\t\t" . '<div id="navigation">' . "\n";
$id = in_array($section, $ref) || in_array($section, $learn) || in_array($section, $abo) ? 'mainnav' : 'mainnav_noSub';
$html .= "\t\t\t\t" . '<div class="navBar" id="' . $id . '">' . "\n";
$html .= "\t\t\t\t\t" . l('Cover', $section == 'Cover') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Download', $section == 'Download') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Exhibition', $section == 'Exhibition') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Reference', $section == 'Reference') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Libraries', $section == 'Libraries') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Tools', $section == 'Tools') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Environment', $section == 'Environment') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Tutorials', $section == 'Tutorials') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Examples', $section == 'Examples') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Books', $section == 'Books') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Overview', $section == 'Overview') . "<br> \n";
$html .= "\t\t\t\t\t" . l('People', $section == 'People') . "<br>\n";
$html .= "\t\t\t\t\t" . l('Foundation', $section == 'Foundation') . "<br><br>\n";
$html .= "\t\t\t\t\t" . l('Shop', $section == 'Shop') . "<br><br>\n";
$html .= "\t\t\t\t\t" . "<a href=\"http://forum.processing.org\"" . 'class="outward"' . "><span>»</span>Forum</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"https://github.com/processing\"" . 'class="outward"' . "><span>»</span>GitHub</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"https://github.com/processing/processing/issues?state=open\"" . 'class="outward"' . "><span>»</span>Issues</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"http://wiki.processing.org\"" . 'class="outward"' . "><span>»</span>Wiki</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"http://wiki.processing.org/w/FAQ\"" . 'class="outward"' . "><span>»</span>FAQ</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"https://twitter.com/processingOrg\"" . 'class="outward"' . "><span>»</span>Twitter</a><br> \n";
$html .= "\t\t\t\t\t" . "<a href=\"https://www.facebook.com/page.processing\"" . 'class="outward"' . "><span>»</span>Facebook</a><br> \n";
$html .= "\t\t\t\t</div>\n";
return $html . "\t\t\t</div>\n";
}
示例7: testIntegration
/**
* Tests the integration.
*/
public function testIntegration()
{
// Remove the watchdog entries added by the potential batch process.
$this->container->get('database')->truncate('watchdog')->execute();
$entries = array();
// Setup a watchdog entry without tokens.
$entries[] = array('message' => $this->randomMachineName(), 'variables' => array(), 'link' => l('Link', 'node/1'));
// Setup a watchdog entry with one token.
$entries[] = array('message' => '@token1', 'variables' => array('@token1' => $this->randomMachineName()), 'link' => l('Link', 'node/2'));
// Setup a watchdog entry with two tokens.
$entries[] = array('message' => '@token1 !token2', 'variables' => array('@token1' => $this->randomMachineName(), '!token2' => $this->randomMachineName()), 'link' => l('<object>Link</object>', 'node/2', array('html' => TRUE)));
foreach ($entries as $entry) {
$entry += array('type' => 'test-views', 'severity' => WATCHDOG_NOTICE);
watchdog($entry['type'], $entry['message'], $entry['variables'], $entry['severity'], $entry['link']);
}
$view = Views::getView('test_dblog');
$this->executeView($view);
$view->initStyle();
foreach ($entries as $index => $entry) {
$this->assertEqual($view->style_plugin->getField($index, 'message'), String::format($entry['message'], $entry['variables']));
$this->assertEqual($view->style_plugin->getField($index, 'link'), Xss::filterAdmin($entry['link']));
}
// Disable replacing variables and check that the tokens aren't replaced.
$view->destroy();
$view->initHandlers();
$this->executeView($view);
$view->initStyle();
$view->field['message']->options['replace_variables'] = FALSE;
foreach ($entries as $index => $entry) {
$this->assertEqual($view->style_plugin->getField($index, 'message'), $entry['message']);
}
}
示例8: insert
/**
* @param array $data
* @return bool|int|\Nette\Database\Table\IRow
* @throws EntityExistsException Pokud existuje článek se stejným nadpisem.
*/
public function insert(array $data)
{
$image = $data['image'];
if ($image->name == null) {
throw new ArgumentException('Nebyl vložen obrázek');
}
unset($data['image']);
unset($data['idArticle']);
$data['lang'] = $data['language'];
unset($data['language']);
$name = $this->imageName($image);
$data['image'] = $name;
try {
if ($data['translate'] != null) {
$data['idArticle'] = $data['translate'];
}
unset($data['translate']);
$result = parent::insert($data);
} catch (UniqueConstraintViolationException $ex) {
if ($ex->getCode() == 23000) {
throw new EntityExistsException('Článek s tímto nadpisem už existuje');
}
l($ex->getMessage());
}
$this->insertImage($image, $name);
return $result;
}
示例9: dms_breadcrumb
function dms_breadcrumb($breadcrumb)
{
if (!empty($breadcrumb)) {
$breadcrumb[] = l(drupal_get_title(), $_GET['q']);
return '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>';
}
}
示例10: headline
public function headline()
{
if (!$this->readonly) {
$fieldName = $this->name;
$blueprint = blueprint::find($this->page());
$fieldsets = $blueprint->fields()->{$fieldName}->fieldsets;
$addDropdownHtml = '<div class="drop-down">';
$addDropdownHtml .= '<a class="drop-down-toggle label-option"><i class="icon icon-left fa fa-chevron-circle-down"></i>' . l('fields.structure.add') . '</a>';
$addDropdownHtml .= '<ul>';
foreach ($fieldsets as $fieldsetName => $fieldsetFields) {
$addDropdownHtml .= '<li>';
$addDropdownHtml .= '<a href="#0" class="builder-add-button" data-fieldset="' . $fieldsetName . '"><i class="icon icon-left fa fa-plus-circle"></i>' . $fieldsetFields['label'] . '</a>';
$addDropdownHtml .= '</li>';
}
$addDropdownHtml .= '</ul>';
$addDropdownHtml .= '</div>';
} else {
$addButtons[] = null;
}
$label = parent::label();
$label->addClass('builder-label');
// foreach ($addButtons as $key => $value) {
// $label->append($add[$key]);
// }
$label->append($addDropdownHtml);
return $label;
}
示例11: user_last_login_by_day
/**
* Example function: creates a graph of user logins by day.
*/
function user_last_login_by_day($n = 40)
{
$query = db_select('users');
$query->addField('users', 'name');
$query->addField('users', 'uid');
$query->addField('users', 'created');
$query->condition('uid', 0, '>');
$query->orderBy('created', 'DESC');
$query->range(0, $n);
$result = $query->execute();
$g = graphapi_new_graph();
$now = time();
$days = array();
foreach ($result as $user) {
$uid = $user->uid;
$user_id = 'user_' . $uid;
$day = intval(($now - $user->created) / (24 * 60 * 60));
$day_id = 'data_' . $day;
graphapi_set_node_title($g, $user_id, l($user->name, "user/" . $uid));
graphapi_set_node_title($g, $day_id, "Day " . $day);
graphapi_set_link_data($g, $user_id, $day_id, array('color' => '#F0F'));
}
$options = array('width' => 400, 'height' => 400, 'item-width' => 50, 'engine' => 'graph_phyz');
return theme('graphapi_dispatch', array('graph' => $g, 'config' => $options));
}
示例12: foreverdelete
public function foreverdelete()
{
//彻底删除指定记录
$ajax = intval($_REQUEST['ajax']);
$id = $_REQUEST['id'];
if (isset($id)) {
$condition = array('id' => array('in', explode(',', $id)));
$rel_data = M(MODULE_NAME)->where($condition)->findAll();
foreach ($rel_data as $data) {
$info[] = $data['id'];
}
if ($info) {
$info = implode(",", $info);
}
$list = M(MODULE_NAME)->where($condition)->delete();
if ($list !== false) {
//将已返利的数字减一
foreach ($rel_data as $data) {
M("User")->setDec('referral_count', "id=" . $data['rel_user_id']);
// 用户返利次数减一
}
save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
$this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
} else {
save_log($info . l("FOREVER_DELETE_FAILED"), 0);
$this->error(l("FOREVER_DELETE_FAILED"), $ajax);
}
} else {
$this->error(l("INVALID_OPERATION"), $ajax);
}
}
示例13: theme_bootstrap_btn_dropdown
/**
* Implements theme_bootstrap_btn_dropdown().
*/
function theme_bootstrap_btn_dropdown($variables)
{
$type_class = '';
$sub_links = '';
$variables['attributes']['class'][] = 'btn-group';
// Type class.
if (isset($variables['type'])) {
$type_class .= ' btn-' . $variables['type'];
} else {
$type_class .= ' btn-default';
}
// Start markup.
$output = '<div' . drupal_attributes($variables['attributes']) . '>';
// Add as string if its not a link.
if (is_array($variables['label'])) {
$output .= l($variables['label']['title'], ${$variables}['label']['href'], $variables['label']);
}
$output .= '<a class="btn' . $type_class . ' dropdown-toggle" data-toggle="dropdown" href="#">';
// It is a link, create one.
if (is_string($variables['label'])) {
$output .= check_plain($variables['label']);
}
if (is_array($variables['links'])) {
$sub_links = theme('links', array('links' => $variables['links'], 'attributes' => array('class' => array('dropdown-menu'))));
}
// Finish markup.
$output .= '<span class="caret"></span></a>' . $sub_links . '</div>';
return $output;
}
示例14: update_debit
public function update_debit()
{
$borrow_amount_cfg = array();
foreach ($_REQUEST["borrow_amount_cfg"] as $k => $v) {
if ($v != "") {
$borrow_amount_cfg[] = htmlspecialchars(addslashes(trim($v)));
}
}
$data = array();
$data["borrow_amount_cfg"] = serialize($borrow_amount_cfg);
$data["loantype"] = intval($_REQUEST["loantype"]);
$data["services_fee"] = floatval($_REQUEST["services_fee"]);
$data["manage_fee"] = floatval($_REQUEST["manage_fee"]);
$data["manage_impose_fee_day1"] = strim($_REQUEST["manage_impose_fee_day1"]);
$data["manage_impose_fee_day2"] = strim($_REQUEST["manage_impose_fee_day2"]);
$data["impose_fee_day1"] = strim($_REQUEST["impose_fee_day1"]);
$data["impose_fee_day2"] = strim($_REQUEST["impose_fee_day2"]);
$data["rate_cfg"] = intval($_REQUEST["rate_cfg"]);
$data["enddate"] = intval($_REQUEST["enddate"]);
$data["first_relief"] = floatval($_REQUEST["first_relief"]);
$count = $GLOBALS["db"]->getOne("select count(*) from " . DB_PREFIX . "debit_conf");
if ($count == 0) {
$GLOBALS['db']->autoExecute(DB_PREFIX . "debit_conf", $data);
} else {
$GLOBALS['db']->autoExecute(DB_PREFIX . "debit_conf", $data, "UPDATE", " 1=1 ");
}
save_log(l("DEBIT_UPDATED"), 1);
$this->success(L("UPDATE_SUCCESS"));
}
示例15: add
public function add($id = '/')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$templates = $blueprint->pages()->template();
$options = array();
$back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
$form = app::form('pages.add');
$form->save = l('add');
$form->back = a::get($back, get('to'));
foreach ($templates as $template) {
$options[$template->name()] = $template->title();
}
$select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
if ($templates->count() == 1) {
$select->readonly = true;
$select->value = $templates->first()->name();
}
$form->fields()->append('template', $select);
if (api::maxPages($page, $blueprint->pages()->max())) {
$form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
$form->save = false;
$form->centered = true;
}
return view('pages/add', array('page' => $page, 'form' => $form));
}