本文整理汇总了PHP中generate_url函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_url函数的具体用法?PHP generate_url怎么用?PHP generate_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: product_conversion
function product_conversion($products = array(), $isFullName = false)
{
$converted = array();
foreach ($products as $product) {
if ($product['description']) {
$product['description'] = preg_replace(array("/\r\n|\r|\n/"), array("<br/>"), $product['description']);
}
if ($product['specs']) {
$product['specs'] = preg_replace(array("/\r\n|\r|\n/"), array("<br/>"), $product['specs']);
}
if ($product['images']) {
$product['images'] = explode(",", $product['images']);
list($file, $ext) = explode(".", $product['images'][0]);
$filename = FCPATH . 'public/frontend/products/' . $file . '-thumbnail.' . $ext;
if (file_exists($filename)) {
$product['thumbnail'] = $file . '-thumbnail.' . $ext;
}
}
if (!isset($product['url']) || !$product['url']) {
$product['url'] = generate_url($product['name']) . '-' . $product['id'];
}
if (!$isFullName && strlen($product['name']) > 35) {
$product['name'] = substr($product['name'], 0, 33) . '...';
}
$converted[] = $product;
}
return $converted;
}
示例2: find_child
function find_child($components, $parent, $level)
{
global $vars;
foreach ($components as $id => $array) {
if ($array['qos-type'] == 3) {
continue;
}
if ($array['parent'] == $components[$parent]['sp-obj'] && $array['sp-id'] == $components[$parent]['sp-id']) {
echo "<ul>";
echo "<li>";
if ($array['qos-type'] == 1) {
// Its a policy, we need to make it a link.
$linkvars = array_merge($vars, array('policy' => $id));
unset($linkvars['class']);
echo '<a href="' . generate_url($linkvars) . '">' . $array['label'] . '</a>';
} elseif ($array['qos-type'] == 2) {
// Its a class, we need to make it a link.
echo '<a href="' . generate_url($vars, array('policy' => $parent, 'class' => $id)) . '">' . $array['label'] . '</a>';
} else {
// Unknown, no link
echo $array['label'];
}
if (isset($array['match'])) {
echo ' (' . $array['match'] . ')';
}
find_child($components, $id, $level + 1);
echo "</li>";
echo "</ul>";
}
}
}
示例3: redirect
public function redirect($controller = null, $action = "default", $params = null)
{
if ($controller == null) {
$controller = $this->getControllerName();
}
$redirecturl = generate_url($controller, $action, $params);
header("Location: {$redirecturl}");
$this->dontRender();
}
示例4: print_graph_row
function print_graph_row($graph_array)
{
global $config;
if ($_SESSION['widescreen']) {
if ($_SESSION['big_graphs']) {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "353";
}
$periods = array('sixhour', 'week', 'month', 'year');
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "215";
}
$periods = array('sixhour', 'day', 'week', 'month', 'year', 'twoyear');
}
} else {
if ($_SESSION['big_graphs']) {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "323";
}
$periods = array('day', 'week', 'month');
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "228";
}
$periods = array('day', 'week', 'month', 'year');
}
}
if ($graph_array['shrink']) {
$graph_array['width'] = $graph_array['width'] - $graph_array['shrink'];
}
$graph_array['to'] = $config['time']['now'];
foreach ($periods as $period) {
$graph_array['from'] = $config['time'][$period];
$graph_array_zoom = $graph_array;
$graph_array_zoom['height'] = "175";
$graph_array_zoom['width'] = "600";
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
echo overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
}
}
示例5: debug_url
function debug_url()
{
$DEBUG_OUTPUT = DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'url.txt';
$fh = fopen($DEBUG_OUTPUT, 'a');
$v = var_export($_GET, TRUE);
fwrite($fh, str_replace(NEWLINE, BLANK, $v) . NEWLINE);
fwrite($fh, generate_url() . NEWLINE);
fclose($fh);
return 0;
}
示例6: generate_page_url
function generate_page_url($page, $subpage = false, $suffix = false, $return = false)
{
$append = $subpage !== false ? '&subpage=' . $subpage : '';
$append .= $suffix !== false ? $suffix : '';
$url = generate_url('adm/index.php?page=' . $page . $append);
if ($return) {
return $url;
}
echo $url;
}
示例7: logout
public function logout($redirect = '')
{
global $config, $db;
// Kill session
$sql = 'DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_id = ' . $db->quote($this->sid);
$db->query($sql);
if (empty($redirect)) {
$redirect = generate_url('', '');
}
redirect($redirect);
}
示例8: smarty_url_tag
function smarty_url_tag($params, $smarty)
{
global $controller;
$ctrl = empty($params["controller"]) ? $controller : $params["controller"];
$act = empty($params["action"]) ? "default" : $params["action"];
$pars = array();
foreach ($params as $key => $value) {
if ($key != "controller" && $key != "action") {
$pars[$key] = $value;
}
}
return generate_url($ctrl, $act, $pars);
}
示例9: replaceReferenceWithLink
private function replaceReferenceWithLink($ref)
{
$delim = strpos($ref, "|");
$title = $delim !== false ? substr($ref, 0, $delim) : $ref;
$text = $delim !== false ? substr($ref, $delim + 1) : $title;
$cm = new \Manager\CardsManager();
$card = $cm->findByTitle($title);
if ($card == null) {
return '<a class="createlink" href="' . generate_url("cards", "add", array("title" => $title)) . "\">{$text}</a>";
} else {
return '<a href="' . generate_url("cards", "show", array("cardId" => $card->getId())) . "\">{$text}</a>";
}
}
示例10: atualizar_url_filhos
/**
* Executado apos atualizar uma página
*/
function atualizar_url_filhos($parent_id, $parent_url)
{
$filhos = $this->db->select('id, titulo, url')->from($this->table_name)->where('parent_id', $parent_id)->get()->result_array();
if (!is_array($filhos) || count($filhos) == 0) {
foreach ($filhos as $pagina) {
if (strpos($pagina['url'], $parent_url) !== 0) {
$alias = generate_url($pagina['titulo']);
$separator = $parent_url != '' ? '/' : '';
$new_url = $parent_url . $separator . $alias;
$this->db->update($this->table_name, array('url' => $new_url), array('id' => $pagina['id']));
$this->atualizar_url_filhos($pagina['id'], $new_url);
}
}
}
}
示例11: humanize_port
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
$port['device_id'] = $device['device_id'];
$port['hostname'] = $device['hostname'];
// Process port properties and generate printable values
humanize_port($port);
if (!isset($ports_has_ext['ports_adsl']) || in_array($port['port_id'], $ports_has_ext['ports_adsl'])) {
$port_adsl = dbFetchRow("SELECT * FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id']));
}
if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
$port['tags'] .= generate_port_link($port, '<span class="label label-important">Errors</span>', 'port_errors');
}
if ($port['deleted'] == '1') {
$port['tags'] .= '<a href="' . generate_url(array('page' => 'deleted-ports')) . '"><span class="label label-important">Deleted</span></a>';
}
if (isset($ports_has_ext['ports_cbqos'])) {
if (in_array($port['port_id'], $ports_has_ext['ports_cbqos'])) {
$port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
}
} else {
if (dbFetchCell("SELECT COUNT(*) FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']))) {
$port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
}
}
if (isset($ports_has_ext['mac_accounting'])) {
if (in_array($port['port_id'], $ports_has_ext['mac_accounting'])) {
$port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
}
} else {
示例12: nicecase
if (is_file($app_filename)) {
// Include app code to output data
include $app_filename;
// If an $app_sections array has been returned, build a menu
if (isset($app_sections) && is_array($app_sections)) {
$navbar['brand'] = nicecase($vars['app']);
$navbar['class'] = "navbar-narrow";
foreach ($app_sections as $app_section => $text) {
// Set the chosen app to be this one if it's not already set.
if (!$vars['app_section']) {
$vars['app_section'] = $app_section;
}
if ($vars['app_section'] == $app_section) {
$navbar['options'][$app_section]['class'] = "active";
}
$navbar['options'][$app_section]['url'] = generate_url($vars, array('app_section' => $app_section));
$navbar['options'][$app_section]['text'] = $text;
}
print_navbar($navbar);
unset($navbar);
} else {
// It appears this app doesn't have multiple sections. We set app_section to default here.
$vars['app_section'] = 'default';
}
// If a matching app_section array exists within app_graphs, print the graphs.
if (isset($app_graphs[$vars['app_section']]) && is_array($app_graphs[$vars['app_section']])) {
echo generate_box_open();
echo '<table class="table table-striped table-hover table-condensed">';
foreach ($app_graphs[$vars['app_section']] as $key => $text) {
$graph_type = $key;
$graph_array['to'] = $config['time']['now'];
示例13: print_status
/**
* Display status alerts.
*
* Display pages with alerts about device troubles.
* Examples:
* print_status(array('devices' => TRUE)) - display for devices down
*
* Another statuses:
* devices, uptime, ports, errors, services, bgp
*
* @param array $status
* @return none
*
*/
function print_status($status)
{
global $config;
$max_interval = filter_var($status['max']['interval'], FILTER_VALIDATE_INT, array('options' => array('default' => 24, 'min_range' => 1)));
$max_count = filter_var($status['max']['count'], FILTER_VALIDATE_INT, array('options' => array('default' => 200, 'min_range' => 1)));
$string = '<table class="table table-bordered table-striped table-hover table-condensed">' . PHP_EOL;
$string .= ' <thead>' . PHP_EOL;
$string .= ' <tr>' . PHP_EOL;
$string .= ' <th>Device</th>' . PHP_EOL;
$string .= ' <th>Type</th>' . PHP_EOL;
$string .= ' <th>Status</th>' . PHP_EOL;
$string .= ' <th>Entity</th>' . PHP_EOL;
$string .= ' <th>Location</th>' . PHP_EOL;
$string .= ' <th>Time Since / Information</th>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
$string .= ' </thead>' . PHP_EOL;
$string .= ' <tbody>' . PHP_EOL;
$query_device_permitted = generate_query_permitted(array('device'), array('device_table' => 'D'));
$query_port_permitted = generate_query_permitted(array('port'), array('port_table' => 'I'));
// Show Device Status
if ($status['devices']) {
$query = 'SELECT * FROM `devices` AS D';
$query .= ' WHERE D.`status` = 0' . $query_device_permitted;
$query .= ' ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
foreach ($entries as $device) {
$string .= ' <tr>' . PHP_EOL;
$string .= ' <td class="entity">' . generate_device_link($device, short_hostname($device['hostname'])) . '</td>' . PHP_EOL;
$string .= ' <td><span class="badge badge-inverse">Device</span></td>' . PHP_EOL;
$string .= ' <td><span class="label label-important">Device Down</span></td>' . PHP_EOL;
$string .= ' <td>-</td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap">' . htmlspecialchars(truncate($device['location'], 30)) . '</td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap">' . deviceUptime($device, 'short') . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
}
// Uptime
if ($status['uptime']) {
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0) {
$query = 'SELECT * FROM `devices` AS D';
$query .= ' WHERE D.`status` = 1 AND D.`uptime` > 0 AND D.`uptime` < ' . $config['uptime_warning'];
$query .= $query_device_permitted;
$query .= 'ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
foreach ($entries as $device) {
$string .= ' <tr>' . PHP_EOL;
$string .= ' <td class="entity">' . generate_device_link($device, short_hostname($device['hostname'])) . '</td>' . PHP_EOL;
$string .= ' <td><span class="badge badge-inverse">Device</span></td>' . PHP_EOL;
$string .= ' <td><span class="label label-success">Device Rebooted</span></td>' . PHP_EOL;
$string .= ' <td>-</td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap">' . htmlspecialchars(truncate($device['location'], 30)) . '</td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap">Uptime ' . formatUptime($device['uptime'], 'short') . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
}
}
// Ports Down
if ($status['ports'] || $status['links']) {
// warning about deprecated option: $config['warn']['ifdown']
if (isset($config['warn']['ifdown']) && !$config['warn']['ifdown']) {
print_warning("<strong>Config option obsolete</strong>\n Please note that config option <strong>\$config['warn']['ifdown']</strong> is now obsolete.\n Use options: <strong>\$config['frontpage']['device_status']['ports']</strong> and <strong>\$config['frontpage']['device_status']['errors']</strong>\n To remove this message, delete <strong>\$config['warn']['ifdown']</strong> from configuration file.");
}
$query = 'SELECT * FROM `ports` AS I ';
if ($status['links'] && !$status['ports']) {
$query .= 'INNER JOIN `links` AS L ON I.`port_id` = L.`local_port_id` ';
}
$query .= 'LEFT JOIN `devices` AS D ON I.`device_id` = D.`device_id` ';
$query .= "WHERE I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up' ";
if ($status['links'] && !$status['ports']) {
$query .= ' AND L.`active` = 1 ';
}
$query .= $query_port_permitted;
$query .= ' AND I.`ifLastChange` >= DATE_SUB(NOW(), INTERVAL ' . $max_interval . ' HOUR) ';
$query .= 'ORDER BY I.`ifLastChange` DESC, D.`hostname` ASC, I.`ifDescr` * 1 ASC ';
$entries = dbFetchRows($query);
$i = 1;
foreach ($entries as $port) {
if ($i > $max_count) {
$string .= ' <tr><td></td><td><span class="badge badge-info">Port</span></td>';
$string .= '<td><span class="label label-important">Port Down</span></td>';
$string .= '<td colspan=3>Too many ports down. See <strong><a href="' . generate_url(array('page' => 'ports'), array('state' => 'down')) . '">All DOWN ports</a></strong>.</td></tr>' . PHP_EOL;
break;
}
humanize_port($port);
$string .= ' <tr>' . PHP_EOL;
$string .= ' <td class="entity">' . generate_device_link($port, short_hostname($port['hostname'])) . '</td>' . PHP_EOL;
//.........这里部分代码省略.........
示例14: dbFetchCell
</li><!-- End 4 columns container -->
<?php
}
$packages = dbFetchCell("SELECT COUNT(pkg_id) from `packages`");
if ($packages) {
?>
<li class="dropdown">
<a href="<?php
echo generate_url(array('page' => 'packages'));
?>
" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/box.png" border="0" align="absmiddle" /> Packages<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?php
echo generate_url(array('page' => 'packages'));
?>
"><img src="images/16/box.png" border="0" align="absmiddle" /> All Packages</a></li>
</ul>
</li>
<?php
}
# if ($packages)
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"> Plugins<b class="caret"></b></a>
<ul class="dropdown-menu">
<?php
Plugins::call('menu');
?>
示例15: array
$width_div = 438;
} else {
$width_div = 393;
}
$graph_array = array();
$graph_array['height'] = 100;
$graph_array['width'] = 210;
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $port['port_id'];
$graph_array['type'] = $graph_type;
$graph_array['from'] = $config['time']['day'];
$graph_array['legend'] = 'no';
$link_array = $graph_array;
$link_array['page'] = 'graphs';
unset($link_array['height'], $link_array['width'], $link_array['legend']);
$link = generate_url($link_array);
$overlib_content = generate_overlib_content($graph_array, $port['hostname'] . ' - ' . $port['label']);
$graph_array['title'] = 'yes';
$graph_array['width'] = $width;
$graph_array['height'] = 119;
$graph = generate_lazy_graph_tag($graph_array);
echo "<div style='display: block; padding: 1px; margin: 2px; min-width: " . $width_div . 'px; max-width:' . $width_div . "px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>";
echo overlib_link($link, $graph, $overlib_content);
echo '</div>';
// echo("<div style='display: block; padding: 1px; margin: 2px; min-width: 393px; max-width:393px; min-height:180px; max-height:180px; text-align: center; float: left; background-color: #f5f5f5;'>
// <a href='".generate_port_url($port)."/' onmouseover=\"return overlib('\
// <div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
// <img src=\'graph.php?type=$graph_type&id=".$port['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=450&height=150&title=yes\'>\
// ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
// "<img src='graph.php?type=$graph_type&id=".$port['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=315&height=110&legend=no&title=yes'>
// </a>