本文整理汇总了PHP中get_current_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_url函数的具体用法?PHP get_current_url怎么用?PHP get_current_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: echo_form
function echo_form()
{
echo '<form name="doit" method="post" action="' . get_current_url() . '" />';
echo '<input type="submit" name="verify" value="Run" />';
echo '<input type="submit" name="verify" value="Test" />';
echo '</form>';
}
示例2: run
function run()
{
if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
return;
}
if (!empty($this->admin_page->request['error_reporting_state'])) {
switch ($this->admin_page->request['error_reporting_state']) {
case 'on':
override_developer_status(true);
break;
case 'off':
override_developer_status(false);
break;
}
}
$status = is_developer();
echo '<form method="post" action="' . htmlspecialchars(get_current_url()) . '">';
if ($status) {
echo '<h3>In-page error reporting is currently ON.</h3>' . "\n";
echo '<input type="submit" value="Turn Error Reporting Off" /><input type="hidden" name="error_reporting_state" value="off" />';
} else {
echo '<h3>In-page error reporting is currently OFF.</h3>' . "\n";
echo '<input type="submit" value="Turn Error Reporting On" /><input type="hidden" name="error_reporting_state" value="on" />';
}
echo '</form>';
echo '<p>Note: changes made via this form only last for the duration of the current session.</p>';
}
示例3: echo_form2
function echo_form2()
{
echo '<p>This phase of the script will <strong>RESET ALL EXISTING RELATIONSHIP SORT ORDER DATA FOR THE minisite_page_to_text_blurb ALLOWABLE RELATIONSHIP</strong> - so do not run it unless ';
echo 'this is what you actually intend to do. If you have never run this script before on this reason instance, you should run it in order to preserve the previous sort order of text blurbs on pages.</p>';
echo '<form name="doit" method="post" action="' . get_current_url() . '" />';
echo '<input type="submit" name="verify2" value="Run" />';
echo '<input type="submit" name="verify2" value="Test" />';
echo '</form>';
}
示例4: secure_failtoban_validate_login_form
/**
* called to validate WP login form
*/
function secure_failtoban_validate_login_form($args)
{
if (isset($_POST['log']) && isset($_POST['pwd'])) {
if (secure_is_failtoban()) {
header('Location: ' . get_current_url(true));
exit;
}
}
}
示例5: init
function init($args = array())
{
if ($this->params['force_secure'] && HTTPS_AVAILABLE && !on_secure_page()) {
header('Location: ' . get_current_url(securest_available_protocol()));
exit(0);
}
// Check for an existing database connection so we can restore it when we're done
$this->db_conn = get_current_db_connection_name();
}
示例6: get_demo_url
function get_demo_url($page, $hash = null)
{
$index = settings('interface_filename');
$req = get_current_url();
if (substr($req, -1) != '/') {
$req = dirname($req);
}
return $req . '/' . $index . '?page=' . $page . (!is_null($hash) ? '#' . $hash : '');
}
示例7: authenticate
public function authenticate()
{
nocache_headers();
$is_allowed = $this->isAllowed();
if (!is_user_logged_in() && !$is_allowed) {
$current_url = get_current_url();
wp_redirect(add_query_arg('redirect_to', urlencode($current_url), $this->settings['logout_redirect']));
exit;
}
}
示例8: show_navigation
function show_navigation($start_with)
{
start_form("", "get");
if ($start_with > 0) {
echo get_href("<p>Previous", set_var(get_current_url(), "start", max(0, $start_with - SHOW_ITEMS)));
} else {
echo "Previous";
}
echo " ";
echo get_href("Next", set_var(get_current_url(), "start", $start_with + SHOW_ITEMS));
end_form();
}
示例9: force_login_to_site
function force_login_to_site($redirect_url = NULL, $whitelist = array())
{
// https://github.com/kevinvess/wp-force-login
add_action('init', function () use($redirect_url, $whitelist) {
if (!is_user_logged_in()) {
$url = get_current_url();
if (preg_replace('/\\?.*/', '', $url) != preg_replace('/\\?.*/', '', wp_login_url()) && !in_array($url, $whitelist)) {
wp_safe_redirect(wp_login_url($redirect_url ? $redirect_url : $url), 302);
exit;
}
}
});
}
示例10: secure_captcha_validate_login_form
/**
* called to validate WP login form
*/
function secure_captcha_validate_login_form($args)
{
if (isset($_POST['log']) && isset($_POST['pwd'])) {
if (!secure_captcha_validate_result(SECURE_CAPTCHA_FIELD . '-login')) {
$redirect_to = "";
if (isset($_REQUEST['redirect_to'])) {
$redirect_to = $_REQUEST['redirect_to'];
}
header('Location: ' . get_current_url() . "?redirect_to=" . urlencode($redirect_to));
exit;
}
}
}
示例11: init
public static function init($token = false, $secret = false)
{
if (!$token || !$secret) {
$_SESSION['TwitterRedirect'] = get_current_url();
Controller::redirect('?q=twitter/request_auth');
return false;
} else {
self::$auth_token = $token;
self::$auth_secret = $secret;
self::$started = true;
self::$oauth = OAuth::getInstance('twitter');
return true;
}
}
示例12: template_redirect
public static function template_redirect()
{
if (!self::is_page()) {
return false;
}
if (theme_cache::is_user_logged_in()) {
$account_navs = apply_filters('account_navs', []);
if (!isset($account_navs[get_query_var('tab')])) {
wp_redirect(add_query_arg('tab', 'dashboard', self::get_url()));
}
} else {
wp_redirect(theme_custom_sign::get_tabs('login', get_current_url())['url']);
die;
}
}
示例13: init
function init($args = array())
{
parent::init($args);
if (!$this->get_authentication()) {
$extra_params = '';
if (!empty($this->msg_uname)) {
$extra_params .= '&msg_uname=' . $this->msg_uname;
}
if (!empty($this->redir_link_text)) {
$extra_params .= '&redir_link_text=' . $this->redir_link_text;
}
$dest_page = urlencode(get_current_url());
header('Location: ' . REASON_LOGIN_URL . '?dest_page=' . $dest_page . $extra_params);
exit;
}
}
示例14: private_template_include
/**
* template_include filter (allow to override template hierarchy)
* @return template path
*/
function private_template_include($template)
{
$post_id = get_the_id();
if (is_home()) {
$post_id = get_option('page_for_posts');
}
if (tool_private_is_private_post($post_id) && !is_user_logged_in()) {
$private_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . PRIVATE_TOOL_NAME . '/templates/tool-private-template.php');
if (!empty($private_template)) {
$template = $private_template;
} else {
wp_redirect(wp_login_url(get_current_url(true)));
}
}
return $template;
}
示例15: get_queried_page
function get_queried_page($depth = 0)
{
$curr_url = get_current_url();
if ($depth != -1) {
$curr_url = strtok($curr_url, '?');
}
$curr_uri = str_replace(get_bloginfo('url'), '', $curr_url);
if ($depth) {
$curr_uri_ary = array_filter(explode('/', $curr_uri));
$curr_uri = trailingslashit(implode('/', array_splice($curr_uri_ary, 0, $depth)));
}
$page = get_page_by_path($curr_uri);
if ($page) {
return $page;
}
return null;
}