当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_get_referer函数代码示例

本文整理汇总了PHP中wp_get_referer函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_referer函数的具体用法?PHP wp_get_referer怎么用?PHP wp_get_referer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_get_referer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_qs_add_to_cart_url

 public function update_qs_add_to_cart_url($cart_url)
 {
     $ref_url = wp_get_referer();
     $ref_url = remove_query_arg(array('added-to-cart', 'add-to-cart'), $ref_url);
     $ref_url = add_query_arg(array('add-to-cart' => $this->id), $ref_url);
     return $ref_url;
 }
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:7,代码来源:wd_quickshop.php

示例2: create_admin_menu_entry

 function create_admin_menu_entry()
 {
     if (@$_POST && isset($_POST['option_page'])) {
         $changed = false;
         if ('wdcab_options' == @$_POST['option_page']) {
             if (isset($_POST['wdcab']['links']['_last_'])) {
                 $last = $_POST['wdcab']['links']['_last_'];
                 unset($_POST['wdcab']['links']['_last_']);
                 if (@$last['url'] && @$last['title']) {
                     $_POST['wdcab']['links'][] = $last;
                 }
             }
             if (isset($_POST['wdcab']['links'])) {
                 $_POST['wdcab']['links'] = array_filter($_POST['wdcab']['links']);
             }
             ub_update_option('wdcab', $_POST['wdcab']);
             $changed = true;
         }
         if ($changed) {
             $goback = add_query_arg('settings-updated', 'true', wp_get_referer());
             wp_redirect($goback);
             die;
         }
     }
     $page = is_multisite() ? 'settings.php' : 'options-general.php';
     $perms = is_multisite() ? 'manage_network_options' : 'manage_options';
     add_submenu_page($page, __('Custom Admin Bar', 'ub'), __('Custom Admin Bar', 'ub'), $perms, 'wdcab', array($this, 'create_admin_page'));
 }
开发者ID:hscale,项目名称:webento,代码行数:28,代码来源:class_wdcab_admin_pages.php

示例3: is_password_protected

 static function is_password_protected()
 {
     global $post;
     $private_post = array('allowed' => false, 'error' => '');
     if (isset($_POST['submit_password'])) {
         // when we have a submision check the password and its submision
         if (isset($_POST['submit_password_nonce']) && wp_verify_nonce($_POST['submit_password_nonce'], 'password_protection')) {
             if (isset($_POST['post_password']) && !empty($_POST['post_password'])) {
                 // some simple checks on password
                 // finally test if the password submitted is correct
                 if ($post->post_password === $_POST['post_password']) {
                     $private_post['allowed'] = true;
                     // ok if we have a correct password we should inform wordpress too
                     // otherwise the mad dog will put the password form again in the_content() and other filters
                     global $wp_hasher;
                     if (empty($wp_hasher)) {
                         require_once ABSPATH . 'wp-includes/class-phpass.php';
                         $wp_hasher = new PasswordHash(8, true);
                     }
                     setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['post_password'])), 0, COOKIEPATH);
                 } else {
                     $private_post['error'] = '<h4 class="text--error">Wrong Password</h4>';
                 }
             }
         }
     }
     if (isset($_COOKIE['wp-postpass_' . COOKIEHASH]) && get_permalink() == wp_get_referer()) {
         $private_post['error'] = '<h4 class="text--error">Wrong Password</h4>';
     }
     return $private_post;
 }
开发者ID:qhuit,项目名称:Tournesol,代码行数:31,代码来源:rosa.php

示例4: filter_add_to_cart_url

 function filter_add_to_cart_url()
 {
     $ref_url = wp_get_referer();
     $ref_url = remove_query_arg(array('added-to-cart', 'add-to-cart'), $ref_url);
     $ref_url = add_query_arg(array('add-to-cart' => $this->id), $ref_url);
     return esc_url($ref_url);
 }
开发者ID:ericsoncardosoweb,项目名称:dallia,代码行数:7,代码来源:quickshop.php

示例5: pop_handle_save

 function pop_handle_save()
 {
     if (!isset($_POST[$this->id . '_options'])) {
         return;
     }
     if (!current_user_can($this->capability)) {
         return;
     }
     $options = explode(',', stripslashes($_POST['page_' . $this->id]));
     if ($options) {
         $existing_options = $this->get_options();
         foreach ($options as $option) {
             $option = trim($option);
             $value = null;
             if (isset($_POST[$option])) {
                 $value = $_POST[$option];
             }
             if (!is_array($value)) {
                 $value = trim($value);
             }
             $value = stripslashes_deep($value);
             $existing_options[$option] = $value;
         }
         update_option($this->options_varname, $existing_options);
     }
     do_action('pop_handle_save', $this);
     //------------------------------
     $goback = add_query_arg('updated', 'true', wp_get_referer());
     if (isset($_REQUEST['tabs_selected_tab']) && $_REQUEST['tabs_selected_tab'] != '') {
         $goback = add_query_arg('tabs_selected_tab', $_REQUEST['tabs_selected_tab'], $goback);
     }
     wp_redirect($goback);
 }
开发者ID:ashray-velapanur,项目名称:grind-members,代码行数:33,代码来源:class.PluginOptionsPanel.php

示例6: route_action

 function route_action()
 {
     $nonce_action = $_REQUEST['bpmod-action'];
     $action = $_REQUEST['bpmod-action'];
     if ('bulk_contents' == $_REQUEST['bpmod-action'] || 'bulk_users' == $_REQUEST['bpmod-action']) {
         $action .= '_' . $_REQUEST['bulk-action'];
     }
     $in_ajax = defined('DOING_AJAX');
     if ($in_ajax) {
         check_ajax_referer($nonce_action);
         $response_func = array(&$this, 'ajax_' . $action);
     } else {
         check_admin_referer($nonce_action);
         $response_func = array(&$this, 'action_' . $action);
         $this->redir = remove_query_arg(array('err_ids', 'marked_spammer', 'unmarked_spammer', 'content_ignored', 'content_moderated', 'content_deleted'), wp_get_referer());
     }
     $handle_func = array(&$this, 'handle_' . $action);
     $response_func = array(&$this, ($in_ajax ? 'ajax_' : 'action_') . $action);
     if (is_callable($handle_func)) {
         $result = (array) call_user_func($handle_func);
         if ($result && is_callable($response_func)) {
             call_user_func_array($response_func, $result);
         }
     }
     //fallback if nothing has been called
     if ($in_ajax) {
         die(-1);
     } else {
         bp_core_redirect($this->redir);
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:bpModBackendActions.php

示例7: redirect_post

/**
 * Redirect to previous page.
 *
 * @param int $post_id Optional. Post ID.
 */
function redirect_post($post_id = '')
{
    if (isset($_POST['save']) || isset($_POST['publish'])) {
        $status = get_post_status($post_id);
        if (isset($_POST['publish'])) {
            switch ($status) {
                case 'pending':
                    $message = 8;
                    break;
                case 'future':
                    $message = 9;
                    break;
                default:
                    $message = 6;
            }
        } else {
            $message = 'draft' == $status ? 10 : 1;
        }
        $location = add_query_arg('message', $message, get_edit_post_link($post_id, 'url'));
    } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
        $location = add_query_arg('message', 2, wp_get_referer());
        $location = explode('#', $location);
        $location = $location[0] . '#postcustom';
    } elseif (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
        $location = add_query_arg('message', 3, wp_get_referer());
        $location = explode('#', $location);
        $location = $location[0] . '#postcustom';
    } elseif ('post-quickpress-save-cont' == $_POST['action']) {
        $location = "post.php?action=edit&post={$post_id}&message=7";
    } else {
        $location = add_query_arg('message', 4, get_edit_post_link($post_id, 'url'));
    }
    wp_redirect(apply_filters('redirect_post_location', $location, $post_id));
    exit;
}
开发者ID:fka2004,项目名称:webkit,代码行数:40,代码来源:post.php

示例8: callback_login

 private function callback_login()
 {
     if (empty($_COOKIE[TEST_COOKIE])) {
         $this->message_collection->add(__("Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to log in to your account.", 'wp-e-commerce'), 'error');
     }
     $form_args = wpsc_get_login_form_args();
     $validation = wpsc_validate_form($form_args);
     if (is_wp_error($validation)) {
         wpsc_set_validation_errors($validation);
         return;
     }
     $user = wp_signon(array('user_login' => $_POST['username'], 'user_password' => $_POST['password'], 'rememberme' => !empty($_POST['rememberme'])));
     if (is_wp_error($user)) {
         $this->message_collection->add(__('We do not recognize the login information you entered. Please try again.', 'wp-e-commerce'), 'error');
         return;
     }
     $redirect_to = wp_get_referer();
     if (wpsc_get_customer_meta('checkout_after_login')) {
         $redirect_to = wpsc_get_checkout_url();
         wpsc_delete_customer_meta('checkout_after_login');
     }
     if (!$redirect_to || trim(str_replace(home_url(), '', $redirect_to), '/') == trim($_SERVER['REQUEST_URI'], '/')) {
         $redirect_to = wpsc_get_store_url();
     }
     wp_redirect($redirect_to);
     exit;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:27,代码来源:login.php

示例9: error

 /**
  * do the error
  * @author Lukas Juhas
  * @date   2016-02-05
  * @param  [type]     $message [description]
  * @return [type]              [description]
  */
 private function error($message = false)
 {
     // redirect back
     // TODO: probably add some error message - added attribute already
     wp_safe_redirect(wp_get_referer());
     exit;
 }
开发者ID:benchmarkstudios,项目名称:wc-category-locker,代码行数:14,代码来源:wc-category-locker.php

示例10: mdjm_pay_event_employees_action

/**
 * Pay event employees.
 *
 * @since	1.3
 * @param	arr		$data	Form data from the $_GET super global.
 * @return	void
 */
function mdjm_pay_event_employees_action($data)
{
    if (!wp_verify_nonce($data['mdjm_nonce'], 'pay_event_employees')) {
        $message = 'nonce_fail';
    } elseif (!isset($data['event_id'])) {
        $message = 'payment_event_missing';
    } else {
        // Process the payment action
        $employee_id = !empty($data['employee_id']) ? $data['employee_id'] : 0;
        $event_id = $data['event_id'];
        $payments = mdjm_pay_event_employees($event_id, $employee_id);
        if (!empty($employee_id) && $payments) {
            $message = 'pay_employee_success';
        } elseif (!empty($employee_id) && !$payments) {
            $message = 'pay_employee_failed';
        } elseif (empty($employee_id) && !empty($payments['success']) && empty($payments['failed'])) {
            $message = 'pay_all_employees_success';
        } elseif (empty($employee_id) && !empty($payments['success']) && !empty($payments['failed'])) {
            $message = 'pay_all_employees_some_success';
        } elseif (empty($employee_id) && empty($payments['success']) && !empty($payments['failed'])) {
            $message = 'pay_all_employees_failed';
        }
    }
    $url = remove_query_arg(array('mdjm_nonce', 'mdjm-action', 'employee_id', 'mdjm-message', 'event_id'), wp_get_referer());
    wp_redirect(add_query_arg(array('mdjm-message' => $message), $url));
    die;
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:34,代码来源:txn-actions.php

示例11: process_request

 /**
  * Detect any GET/POST variables and determine what CRUD option to do based on that
  * @since 0.1
  */
 public function process_request()
 {
     // Set $this->_model->instance, the default is 0 which is the new instance form
     $this->_model->instance = isset($_GET['_instance']) ? (int) $_GET['_instance'] : 0;
     // if $this->_model->instance
     if (empty($this->_model->option[$this->_model->instance])) {
         wp_die("Oops, this page doesn't exist.", "Page does not exist", array('response' => 403));
     }
     // Check to see if the 'Delete' link was clicked
     if (isset($_GET['delete_instance']) && isset($_GET['_instance']) && check_admin_referer('delete_instance')) {
         PW_Alerts::add('updated', '<p><strong>' . $this->_model->singular_title . ' Instance Deleted</strong></p>');
         // make a copy of the option, then unsetting the index and update with the copy
         $option = $this->_model->option;
         unset($option[(int) $_GET['_instance']]);
         update_option($this->_model->name, $option);
         // redirect the page and remove _instance' and 'delete_instance' from the URL
         wp_redirect(remove_query_arg(array('_instance', 'delete_instance'), wp_get_referer()));
         exit;
     }
     // If the POST data is set and the nonce checks out, validate and save any submitted data
     if (isset($_POST[$this->_model->name]) && isset($_POST['_instance']) && check_admin_referer($this->_model->name . '-options')) {
         // get the options from $_POST
         $this->_model->input = stripslashes_deep($_POST[$this->_model->name]);
         // save the options
         if ($this->_model->save($this->_model->input, $_POST['_instance'])) {
             if ($_POST['_instance'] == 0) {
                 wp_redirect(add_query_arg('_instance', $this->_model->option['auto_id'] - 1, wp_get_referer()));
                 exit;
             }
         }
     }
 }
开发者ID:rspindel,项目名称:PW_Framework,代码行数:36,代码来源:PW_MultiModelController.php

示例12: handle_import

 function handle_import()
 {
     $handle_import = str_replace("-", "_", 'pop_import_file_' . $this->plugin_id);
     if (isset($_REQUEST[$handle_import]) && current_user_can($this->capability)) {
         if (isset($_FILES['pop_import_file']) && $_FILES['pop_import_file']['error'] == 0) {
             $data = unserialize(base64_decode(gzuncompress(file_get_contents($_FILES['pop_import_file']['tmp_name']))));
             //----
             if (property_exists($data, 'id') && property_exists($data, 'name') && property_exists($data, 'options')) {
                 if ($data->id == $this->plugin_id) {
                     $backup = isset($_REQUEST['pop-backup-on-import']) && $_REQUEST['pop-backup-on-import'] == '1' ? true : false;
                     if ($backup) {
                         $saved_options = $this->get_saved_options();
                         $saved_options[] = (object) array('name' => __('Automatic settings backup', 'pop'), 'date' => date('Y-m-d H:i:s'), 'options' => $this->get_options());
                         $var = $this->options_varname . '_saved';
                         if (update_option($var, $saved_options)) {
                         }
                     }
                     $new_options = $data->options;
                     $new_options = is_array($new_options) ? $new_options : array();
                     if ($this->import_option($new_options, true)) {
                     }
                 } else {
                 }
             } else {
             }
             //------
             $goback = add_query_arg('updated', 'true', wp_get_referer());
             $goback = add_query_arg('pop_open_tabs', isset($_REQUEST['pop_open_tabs']) ? $_REQUEST['pop_open_tabs'] : '', $goback);
             wp_redirect($goback);
         }
     }
 }
开发者ID:JDjimenezdelgado,项目名称:old-mmexperience,代码行数:32,代码来源:class.pop_import_export.php

示例13: handle_bulk_rename_form_submit

 function handle_bulk_rename_form_submit()
 {
     if (array_search('rename', $_REQUEST) !== FALSE || array_search('rename_retitle', $_REQUEST) !== FALSE) {
         wp_redirect(add_query_arg(array('renamed' => 1), wp_get_referer()));
         exit;
     }
 }
开发者ID:ryan2407,项目名称:Vision,代码行数:7,代码来源:class-media-rename.php

示例14: wc_add_to_cart_message

/**
 * Add to cart messages.
 *
 * @access public
 * @param int|array $products
 * @param bool $show_qty Should qty's be shown? Added in 2.6.0
 */
function wc_add_to_cart_message($products, $show_qty = false)
{
    $titles = array();
    $count = 0;
    if (!is_array($products)) {
        $products = array($products);
        $show_qty = false;
    }
    if (!$show_qty) {
        $products = array_fill_keys(array_values($products), 1);
    }
    foreach ($products as $product_id => $qty) {
        $titles[] = ($qty > 1 ? absint($qty) . ' &times; ' : '') . sprintf(_x('&ldquo;%s&rdquo;', 'Item name in quotes', 'woocommerce'), strip_tags(get_the_title($product_id)));
        $count += $qty;
    }
    $titles = array_filter($titles);
    $added_text = sprintf(_n('%s has been added to your cart.', '%s have been added to your cart.', $count, 'woocommerce'), wc_format_list_of_items($titles));
    // Output success messages
    if ('yes' === get_option('woocommerce_cart_redirect_after_add')) {
        $return_to = apply_filters('woocommerce_continue_shopping_redirect', wp_get_referer() ? wp_get_referer() : home_url());
        $message = sprintf('<a href="%s" class="button wc-forward">%s</a> %s', esc_url($return_to), esc_html__('Continue Shopping', 'woocommerce'), esc_html($added_text));
    } else {
        $message = sprintf('<a href="%s" class="button wc-forward">%s</a> %s', esc_url(wc_get_page_permalink('cart')), esc_html__('View Cart', 'woocommerce'), esc_html($added_text));
    }
    wc_add_notice(apply_filters('wc_add_to_cart_message', $message, $product_id));
}
开发者ID:unfulvio,项目名称:woocommerce,代码行数:33,代码来源:wc-cart-functions.php

示例15: bp_core_referrer

/**
 * Return the referrer URL without the http(s)://
 *
 * @deprecated 2.3.0
 *
 * @return string The referrer URL.
 */
function bp_core_referrer()
{
    _deprecated_function(__FUNCTION__, '2.3.0', 'bp_get_referer_path()');
    $referer = explode('/', wp_get_referer());
    unset($referer[0], $referer[1], $referer[2]);
    return implode('/', $referer);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:14,代码来源:2.3.php


注:本文中的wp_get_referer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。