本文整理汇总了PHP中http::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP http::getHost方法的具体用法?PHP http::getHost怎么用?PHP http::getHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::getHost方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayMenu
public static function displayMenu($class = '', $id = '', $description = '')
{
global $core;
$ret = '';
if (!(bool) $core->blog->settings->system->simpleMenu_active) {
return $ret;
}
$menu = $GLOBALS['core']->blog->settings->system->get('simpleMenu');
$menu = @unserialize($menu);
if (is_array($menu)) {
// Current relative URL
$url = $_SERVER['REQUEST_URI'];
$abs_url = http::getHost() . $url;
// Home recognition var
$home_url = html::stripHostURL($GLOBALS['core']->blog->url);
$home_directory = dirname($home_url);
if ($home_directory != '/') {
$home_directory = $home_directory . '/';
}
// Menu items loop
foreach ($menu as $i => $m) {
# $href = lien de l'item de menu
$href = $m['url'];
$href = html::escapeHTML($href);
# Active item test
$active = false;
if ($url == $href || $abs_url == $href || $_SERVER['URL_REQUEST_PART'] == $href || $_SERVER['URL_REQUEST_PART'] == '' && ($href == $home_url || $href == $home_directory)) {
$active = true;
}
$title = $span = '';
if ($m['descr']) {
if ($description == 'title' || $description == 'both') {
$title = ' title="' . html::escapeHTML(__($m['descr'])) . '"';
}
if ($description == 'span' || $description == 'both') {
$span = ' <span>' . html::escapeHTML(__($m['descr'])) . '</span>';
}
}
$label = html::escapeHTML(__($m['label']));
$item = new ArrayObject(array('url' => $href, 'label' => $label, 'title' => $title, 'span' => $span, 'active' => $active, 'class' => ''));
# --BEHAVIOR-- publicSimpleMenuItem
$core->callBehavior('publicSimpleMenuItem', $i, $item);
$ret .= '<li class="li' . ($i + 1) . ($item['active'] ? ' active' : '') . ($i == 0 ? ' li-first' : '') . ($i == count($menu) - 1 ? ' li-last' : '') . ($item['class'] ? $item['class'] : '') . '">' . '<a href="' . $href . '"' . $item['title'] . '>' . $item['label'] . $item['span'] . '</a>' . '</li>';
}
// Final rendering
if ($ret) {
$ret = '<nav role="navigation"><ul ' . ($id ? 'id="' . $id . '"' : '') . ' class="simple-menu' . ($class ? ' ' . $class : '') . '">' . "\n" . $ret . "\n" . '</ul></nav>';
}
}
return $ret;
}
示例2: T_
<div id="BP_page" class="page">
<div class="inpage">
<div id="flash-log" style="display:none;">
<div id="flash-msg"><!-- spanner --></div>
</div>
<fieldset><legend><?php
echo T_('Manage user permissions');
?>
</legend>
<div class="message">
<p><?php
echo T_('Check user statuses and configure their permissions');
?>
</p>
</div>
<div id="users-list"></div>
</fieldset>
<script type="text/javascript" src="meta/js/manage-permissions.js"></script>
<script type="text/javascript" src="meta/js/jquery.boxy.js"></script>
<?php
include dirname(__FILE__) . '/footer.php';
} else {
$page_url = urlencode(http::getHost() . $_SERVER['REQUEST_URI']);
http::redirect('../auth.php?came_from=' . $page_url);
}
示例3: getPingURL
private function getPingURL($url)
{
if (strpos($url, '/') === 0) {
$url = http::getHost() . $url;
}
try {
$http = self::initHttp($url, $path);
$http->get($path);
$page_content = $http->getContent();
$pb_url = $http->getHeader('x-pingback');
} catch (Exception $e) {
return false;
}
# If we've got a X-Pingback header and it's a valid URL, it will be enough
if ($pb_url && filter_var($pb_url, FILTER_VALIDATE_URL) && preg_match('!^https?:!', $pb_url)) {
return $pb_url . '|' . $url;
}
# No X-Pingback header. A link rel=pingback, maybe ?
$pattern_pingback = '!<link rel="pingback" href="(.*?)"( /)?>!msi';
if (preg_match($pattern_pingback, $page_content, $m)) {
$pb_url = $m[1];
if (filter_var($pb_url, FILTER_VALIDATE_URL) && preg_match('!^https?:!', $pb_url)) {
return $pb_url . '|' . $url;
}
}
# No pingback ? OK, let's check for a trackback data chunk...
$pattern_rdf = '/<rdf:RDF.*?>.*?' . '<rdf:Description\\s+(.*?)\\/>' . '.*?<\\/rdf:RDF>' . '/msi';
preg_match_all($pattern_rdf, $page_content, $rdf_all, PREG_SET_ORDER);
$url_path = parse_url($url, PHP_URL_PATH);
$sanitized_url = str_replace($url_path, html::sanitizeURL($url_path), $url);
for ($i = 0; $i < count($rdf_all); $i++) {
$rdf = $rdf_all[$i][1];
if (preg_match('/dc:identifier="' . preg_quote($url, '/') . '"/msi', $rdf) || preg_match('/dc:identifier="' . preg_quote($sanitized_url, '/') . '"/msi', $rdf)) {
if (preg_match('/trackback:ping="(.*?)"/msi', $rdf, $tb_link)) {
return $tb_link[1];
}
}
}
return null;
}
示例4: dirname
#
# -- END LICENSE BLOCK -----------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
# If we have a session cookie, go to index.php
if (isset($_SESSION['sess_user_id'])) {
$core->adminurl->redirect('admin.home');
}
# Loading locales for detected language
# That's a tricky hack but it works ;)
$dlang = http::getAcceptLanguage();
$dlang = $dlang == '' ? 'en' : $dlang;
if ($dlang != 'en' && preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $dlang)) {
l10n::lang($dlang);
l10n::set(dirname(__FILE__) . '/../locales/' . $dlang . '/main');
}
$page_url = http::getHost() . $_SERVER['REQUEST_URI'];
$change_pwd = $core->auth->allowPassChange() && isset($_POST['new_pwd']) && isset($_POST['new_pwd_c']) && isset($_POST['login_data']);
$login_data = !empty($_POST['login_data']) ? html::escapeHTML($_POST['login_data']) : null;
$recover = $core->auth->allowPassChange() && !empty($_REQUEST['recover']);
$safe_mode = !empty($_REQUEST['safe_mode']);
$akey = $core->auth->allowPassChange() && !empty($_GET['akey']) ? $_GET['akey'] : null;
$user_id = $user_pwd = $user_key = $user_email = null;
$err = $msg = null;
# Auto upgrade
if (empty($_GET) && empty($_POST)) {
require dirname(__FILE__) . '/../inc/dbschema/upgrade.php';
try {
if (($changes = dotclearUpgrade($core)) !== false) {
$msg = __('Dotclear has been upgraded.') . '<!-- ' . $changes . ' -->';
}
} catch (Exception $e) {
示例5: Exception
throw new Exception(sprintf(__('File %s does not exist.'), $config_in));
}
# Can we write config.php
if (!is_writable(dirname(DC_RC_PATH))) {
throw new Exception(sprintf(__('Cannot write %s file.'), DC_RC_PATH));
}
# Creates config.php file
$full_conf = file_get_contents($config_in);
writeConfigValue('DC_DBDRIVER', $DBDRIVER, $full_conf);
writeConfigValue('DC_DBHOST', $DBHOST, $full_conf);
writeConfigValue('DC_DBUSER', $DBUSER, $full_conf);
writeConfigValue('DC_DBPASSWORD', $DBPASSWORD, $full_conf);
writeConfigValue('DC_DBNAME', $DBNAME, $full_conf);
writeConfigValue('DC_DBPREFIX', $DBPREFIX, $full_conf);
$admin_url = preg_replace('%install/wizard.php$%', '', $_SERVER['REQUEST_URI']);
writeConfigValue('DC_ADMIN_URL', http::getHost() . $admin_url, $full_conf);
writeConfigValue('DC_ADMIN_MAILFROM', 'dotclear@' . $_SERVER['HTTP_HOST'], $full_conf);
writeConfigValue('DC_MASTER_KEY', md5(uniqid()), $full_conf);
$fp = @fopen(DC_RC_PATH, 'wb');
if ($fp === false) {
throw new Exception(sprintf(__('Cannot write %s file.'), DC_RC_PATH));
}
fwrite($fp, $full_conf);
fclose($fp);
chmod(DC_RC_PATH, 0666);
$con->close();
http::redirect('index.php?wiz=1');
} catch (Exception $e) {
$err = $e->getMessage();
}
}
示例6: Date
$(this).val(this.value.replace(login_re,''));
});
$('#u_login').parent().after($('<input type="hidden" name="u_date" value="' + Date().toLocaleString() + '" />'));
});
//]]>
</script>
</head>
<body id="dotclear-admin" class="install">
<div id="content">
<?php
echo '<h1>' . __('Dotclear installation') . '</h1>';
if (!is_writable(DC_TPL_CACHE)) {
echo '<div class="error"><p>' . sprintf(__('Cache directory %s is not writable.'), DC_TPL_CACHE) . '</p></div>';
}
if (!empty($err)) {
echo '<div class="error"><p><strong>' . __('Errors:') . '</strong></p>' . $err . '</div>';
}
if (!empty($_GET['wiz'])) {
echo '<p class="message">' . __('Configuration file has been successfully created.') . '</p>';
}
if ($can_install && $step == 0) {
echo '<h2>' . __('User information') . '</h2>' . '<p>' . __('Please provide the following information needed to create the first user.') . '</p>' . '<form action="index.php" method="post">' . '<fieldset><legend>' . __('User information') . '</legend>' . '<p><label>' . __('First Name:') . ' ' . form::field('u_firstname', 30, 255, html::escapeHTML($u_firstname)) . '</label></p>' . '<p><label>' . __('Last Name:') . ' ' . form::field('u_name', 30, 255, html::escapeHTML($u_name)) . '</label></p>' . '<p><label>' . __('Email:') . ' ' . form::field('u_email', 30, 255, html::escapeHTML($u_email)) . '</label></p>' . '</fieldset>' . '<fieldset><legend>' . __('Username and password') . '</legend>' . '<p><label class="required" title="' . __('Required field') . '">' . __('Username:') . ' ' . form::field('u_login', 30, 32, html::escapeHTML($u_login)) . '</label></p>' . '<p><label class="required" title="' . __('Required field') . '">' . __('Password:') . ' ' . form::password('u_pwd', 30, 255) . '</label></p>' . '<p><label class="required" title="' . __('Required field') . '">' . __('Confirm password:') . ' ' . form::password('u_pwd2', 30, 255) . '</label></p>' . '</fieldset>' . '<p><input type="submit" value="' . __('save') . '" /></p>' . '</form>';
} elseif ($can_install && $step == 1) {
echo '<h2>' . __('All done!') . '</h2>' . '<p>' . __('Dotclear has been successfully installed. Here is some useful information you should keep.') . '</p>' . '<h3>' . __('Your account') . '</h3>' . '<ul>' . '<li>' . __('Username:') . ' <strong>' . html::escapeHTML($u_login) . '</strong></li>' . '<li>' . __('Password:') . ' <strong>' . html::escapeHTML($u_pwd) . '</strong></li>' . '</ul>' . '<h3>' . __('Your blog') . '</h3>' . '<ul>' . '<li>' . __('Blog address:') . ' <strong>' . html::escapeHTML(http::getHost() . $root_url) . '/index.php?</strong></li>' . '<li>' . __('Administration interface:') . ' <strong>' . html::escapeHTML(http::getHost() . $admin_url) . '</strong></li>' . '</ul>' . '<form action="../auth.php" method="post">' . '<p><input type="submit" value="' . __('Manage your blog now') . '" />' . form::hidden(array('user_id'), html::escapeHTML($u_login)) . form::hidden(array('user_pwd'), html::escapeHTML($u_pwd)) . '</p>' . '</form>';
}
?>
</div>
</body>
</html>
示例7: getLinksList
private static function getLinksList($links, $block = '<ul>%s</ul>', $item = '<li>%s</li>', $style_theme = array())
{
# Current relative URL
$url = $_SERVER['REQUEST_URI'];
$abs_url = http::getHost() . $url;
# First level Count
$first_level_count = self::firstLevelCount();
$level = $first_level_number = 0;
$old_level = $child_level = 1;
$style = $list = '';
# For detect if home
$home_url = html::stripHostURL($GLOBALS['core']->blog->url);
$home_directory = dirname($home_url);
if ($home_directory != '/') {
$home_directory = $home_directory . '/';
}
foreach ($links->rows() as $k => $v) {
$_parent = $style_actv_sm = $close = '';
$id = $v['link_id'];
$title = $v['link_title'];
$href = $v['link_href'];
$level = $v['link_level'];
$desc = $v['link_desc'];
$lang = $v['link_lang'];
$class = $v['link_class'];
$href = html::escapeHTML($href);
# Detect if active item ( or if homepage on home item : because should have two url )
if ($url == $href || $abs_url == $href || $_SERVER['URL_REQUEST_PART'] == '' && ($href == $home_url || $href == $home_directory)) {
$style = '_actv';
# Parent when active link?
if ($style_theme['li_actv_sm'] != '') {
if ($level > 1) {
$style_actv_sm = '_sm';
$goto_parent = 1;
$child_level = $level;
} elseif (!empty($goto_parent)) {
$_parent = '_prnt';
$goto_parent = 0;
$child_level = $level;
}
}
} else {
$style = '';
if ($style_theme['li_actv_sm'] != '') {
# Parent when not active link?
if (!empty($goto_parent)) {
if ($level < $child_level) {
$_parent = $level == 1 ? '_prnt' : '_smprnt';
if ($level == 1) {
$goto_parent = 0;
}
$child_level = $level;
}
} else {
$child_level = 1;
}
}
}
# Position
if ($level == 1) {
$first_level_number++;
if ($first_level_number == $first_level_count) {
$style .= '_frst';
} elseif ($first_level_number == 1) {
$style .= '_lst';
}
}
# Link generator
################### modif
$style_a = "";
$a_span = $style_theme['a_span'];
if ($level < $old_level) {
$style_a = $style_theme['li_a' . $style];
$a_span = $style_theme['a_span'] . "<span class='caret'>";
}
$link = '<a href="' . html::escapeHTML($href) . '"' . stripslashes($style_a) . (!$lang ? '' : ' hreflang="' . html::escapeHTML($lang) . '"') . (!$desc ? '' : ' title="' . html::escapeHTML($desc) . '"') . '>' . sprintf(stripslashes($a_span), html::escapeHTML($title)) . '</a>';
#####################
# add class to each link :
if ($class == '') {
$class = 'menu-item-' . $id;
}
# Level's menu generator
$item = '<li' . sprintf(stripslashes($style_theme['li' . $style . $_parent . $style_actv_sm]), $class) . '>%s';
if ($level == $old_level) {
$close = '</li>';
} elseif ($level < $old_level) {
$close = '<ul' . stripslashes($style_theme['ul_sm']) . '>';
} else {
$diff_level = $level - $old_level;
while ($diff_level != 0) {
$close .= '</li></ul>';
$diff_level--;
}
$close .= '</li>';
}
$list = sprintf($item . $close, $link) . $list;
$old_level = $level;
}
return sprintf(stripslashes($style_theme['block']), $list) . "\n";
}
示例8: Exception
if (!dcSystemCheck($con, $_e)) {
$can_install = false;
throw new Exception('<p>' . T_('The Bilboplanet could not be installed.') . '</p><ul><li>' . implode('</li><li>', $_e) . '</li></ul>');
}
# Does config.php.default exist?
$config_in = dirname(__FILE__) . '/../../inc/config.php.default';
if (!is_file($config_in)) {
throw new Exception(sprintf(T_('File %s does not exist.'), $config_in));
}
# Can we write config.php
if (!is_writable(dirname(BP_CONFIG_PATH))) {
throw new Exception(sprintf(T_('Cannot write %s file.'), BP_CONFIG_PATH));
}
# Creates config.php file
$root_url = preg_replace('%/admin/install/wizard.php$%', '', $_SERVER['REQUEST_URI']);
$planet_url = http::getHost() . $root_url;
$full_conf = file_get_contents($config_in);
writeConfigValue('BP_DBHOST', $DBHOST, $full_conf);
writeConfigValue('BP_DBUSER', $DBUSER, $full_conf);
writeConfigValue('BP_DBPASSWORD', $DBPASSWORD, $full_conf);
writeConfigValue('BP_DBNAME', $DBNAME, $full_conf);
writeConfigValue('BP_DBPREFIX', strtolower($DBPREFIX), $full_conf);
writeConfigValue('BP_DBENCRYPTED_PASSWORD', '1', $full_conf);
writeConfigValue('BP_PLANET_URL', $planet_url, $full_conf);
$fp = @fopen(BP_CONFIG_PATH, 'wb');
if ($fp === false) {
throw new Exception(sprintf(T_('Cannot write %s file.'), BP_CONFIG_PATH));
}
fwrite($fp, $full_conf);
fclose($fp);
chmod(BP_CONFIG_PATH, 0775);
示例9: _e
</label>
<?php
echo form::textarea('p_meta_keywords', 57, 5, html::escapeHTML($p_meta_keywords));
?>
</p>
</div><!-- #tab_seo -->
<div id="tab_advanced">
<h3><?php
_e('c_a_config_advanced');
?>
</h3>
<p><label for="p_app_path"><?php
printf(__('c_a_config_advanced_app_path'), http::getHost());
?>
</label>
<?php
echo form::text('p_app_path', 40, 255, html::escapeHTML($p_app_path));
?>
</p>
<p class="field"><label for="p_domain"><?php
_e('c_a_config_advanced_domain');
?>
</label>
http://<?php
echo form::text('p_domain', 60, 255, html::escapeHTML($p_domain));
?>
</p>
示例10: loadConfig
/**
* Chargement de la configuration du site.
*
* @return void
*/
public function loadConfig()
{
$this->config = $this->newConfig('conf_site');
$this->config->app_host = http::getHost();
$this->config->app_url = $this->config->app_host . $this->config->app_path;
$this->config->self_uri = $this->config->app_host . $_SERVER['REQUEST_URI'];
}