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; }
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')); }
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; }
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); }
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); }
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); } }
/** * 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; }
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; }
/** * 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; }
/** * 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; }
/** * 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; } } } }
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); } } }
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; } }
/** * 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) . ' × ' : '') . sprintf(_x('“%s”', '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)); }
/** * 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); }
function eventsList() { $current_user = wp_get_current_user(); if (isset($_GET['eventaction'])) { $event_action = (int) $_GET['eventaction']; if (is_numeric($_GET['eventid'])) { switch ($event_action) { case 0: EventDatabaseManager::signIn($current_user->ID, $_GET['eventid']); MailNotifications::sendSignInMail($current_user->user_email, EventDatabaseManager::getEvent($_GET['eventid'])); wp_redirect(wp_get_referer()); break; case 1: break; case 2: EventDatabaseManager::signOut($current_user->ID, $_GET['eventid']); MailNotifications::sendSignOutMail($current_user->user_email, EventDatabaseManager::getEvent($_GET['eventid'])); wp_redirect(wp_get_referer()); break; default: break; } } $events_custom = EventDatabaseManager::getAvailableEventsForUser($current_user->ID); return View::outputEventListForUser($_GET['page_id'], $_GET['page_id'], $current_user->ID, $events_custom); } elseif (isset($_GET['eventID'])) { $event = EventDatabaseManager::getEvent($_GET['eventID']); return eventsInfo($event); } else { $events_custom = EventDatabaseManager::getAvailableEventsForUser($current_user->ID); return View::outputEventListForUser($_GET['page_id'], $_GET['page_id'], $current_user->ID, $events_custom); } }
public function prepare_items() { $columns = $this->get_columns(); $hidden = $this->get_hidden_columns(); $sortable = $this->get_sortable_columns(); $table_class = $this->get_table_classes(); $data = $this->table_data(); if (isset($_REQUEST['s']) && '' != $_REQUEST['s'] && wp_get_referer()) { $s = sanitize_text_field($_REQUEST['s']); foreach ($data as $key => $value) { if (false === strpos($value->name, $s)) { unset($data[$key]); } } } function usort_reorder($a, $b) { $orderby = isset($_REQUEST['orderby']) && '' != $_REQUEST['orderby'] ? sanitize_key($_REQUEST['orderby']) : 'term_id'; $order = isset($_REQUEST['order']) && '' != $_REQUEST['order'] ? sanitize_key($_REQUEST['order']) : 'asc'; $result = strcmp($a->{$orderby}, $b->{$orderby}); if ('term_id' === $orderby || 'count' === $orderby) { $result = $b->{$orderby} - $a->{$orderby}; } return 'asc' === $order ? $result : -$result; } uasort($data, 'usort_reorder'); $per_page = $this->get_items_per_page('stt2extat_term_stats_per_page', 5); $current_page = $this->get_pagenum(); $total_items = count($data); $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page), 'orderby' => isset($_REQUEST['orderby']) ? sanitize_key($_REQUEST['orderby']) : 'term_id', 'order' => isset($_REQUEST['order']) ? sanitize_key($_REQUEST['order']) : 'asc')); $data = array_slice($data, ($current_page - 1) * $per_page, $per_page); $this->_column_headers = array($columns, $hidden, $sortable, $table_class); $this->items = $data; }
/** * Runs the appropriate callback handler * * @return void */ private static function runCallbacks() { // 0. get the action $wp_list_table = _get_list_table('WP_Posts_List_Table'); $action = $wp_list_table->current_action(); // 1. Get the custom action object $bulkAction = self::getCustomBulkAction($action); if ($bulkAction === null) { return; } // 2. security check check_admin_referer('bulk-posts'); // Get the post ids if (isset($_REQUEST['post'])) { $post_ids = array_map('intval', $_REQUEST['post']); } if (empty($post_ids)) { return; } // Run the callback $callback = $bulkAction->getCallback(); $callback($post_ids); // Build the redirect url. Add all id's to the query args $sendback = remove_query_arg(array('untrashed', 'deleted', 'ids'), wp_get_referer()); $sendback = add_query_arg(array('ids' => join(',', $post_ids)), $sendback); // 4. Redirect client wp_redirect($sendback); exit; }
function multivars_admin_save() { global $multivars_table_name, $multivars_variables, $wpdb; if ($_GET['page'] == 'multivars ') { if (!current_user_can('manage_network_options')) { wp_die(__('You do not have permission to access this page.')); } if ($_POST['action'] == 'multivars_save_variables') { $errors = array(); foreach ($_POST['sitevariables'] as $id => $variable) { // validate the values if ($multivars_variables->valid($variable)) { if (preg_match('/new/', $id)) { $wpdb->insert($multivars_table_name, $variable); } else { $wpdb->update($multivars_table_name, $variable, array('id' => $id)); } } else { array_push($errors, $variable); } } wp_redirect(add_query_arg(array('updated' => 'true'), wp_get_referer())); exit; } } }
public function recalculate_profit_callback() { $redirect = wp_get_referer() ? wp_get_referer() : admin_url('admin.php?page=wc-reports&tab=profit'); if (!isset($_REQUEST['token']) || !wp_verify_nonce($_REQUEST['token'], 'funkwoocost-recalculate-profit')) { wp_redirect(add_query_arg(array('status' => 'failed'), $redirect)); die; } global $wpdb; $order_items = $wpdb->get_results("\n SELECT order_items.order_item_id,\n meta_product_id.meta_value AS product_id,\n meta_variation_id.meta_value AS variation_id\n FROM {$wpdb->prefix}woocommerce_order_items AS order_items\n LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta_product_id ON order_items.order_item_id=meta_product_id.order_item_id AND meta_product_id.meta_key='_product_id'\n LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS meta_variation_id ON order_items.order_item_id=meta_variation_id.order_item_id AND meta_variation_id.meta_key='_variation_id'\n WHERE order_items.order_item_type='line_item'\n "); // echo "<pre>"; // print_r($order_items); // echo "</pre>"; // exit(); if (!empty($order_items)) { foreach ($order_items as $order_item) { $cost_of_good = !empty($order_item->variation_id) ? get_post_meta($order_item->variation_id, '_funkwoocost', true) : get_post_meta($order_item->product_id, '_funkwoocost', true); // echo $cost_of_good; exit(); $order_item_qty = wc_get_order_item_meta($order_item->order_item_id, '_qty', true); wc_update_order_item_meta($order_item->order_item_id, '_line_funkwoocost_order', wc_format_decimal($cost_of_good * $order_item_qty)); } } // clear transient delete_transient(strtolower('WooCost_Report_Profit_By_Date')); wp_redirect(add_query_arg(array('status' => 'success'), $redirect)); die; }
public function __construct() { WP_List_Table::__construct(array('plural' => 'purchase-logs')); if (defined('DOING_AJAX') && DOING_AJAX) { $_SERVER['REQUEST_URI'] = wp_get_referer(); } }
function photograph_feature() { if (!is_admin()) { die; } if (!current_user_can('edit_posts')) { wp_die(__('You do not have sufficient permissions to access this page.', 'colabsthemes')); } if (!check_admin_referer('photograph-feature')) { wp_die(__('You have taken too long. Please go back and retry.', 'colabsthemes')); } $post_id = isset($_GET['id']) && (int) $_GET['id'] ? (int) $_GET['id'] : ''; if (!$post_id) { die; } $post = get_post($post_id); if (!$post || $post->post_type !== 'photograph') { die; } $featured = get_post_meta($post->ID, 'colabs_feature_photograph', true); if ($featured == 'true') { update_post_meta($post->ID, 'colabs_feature_photograph', 'false'); } else { update_post_meta($post->ID, 'colabs_feature_photograph', 'true'); } wp_safe_redirect(remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer())); }
/** * Add settings for the RSS feed * + also regenerates the secret if requested */ public function add_settings() { //we register a setting to keep track of the RSS feed status (enabled/disabled) register_setting('simple_history_settings_group', 'simple_history_enable_rss_feed', array($this, 'update_rss_status')); /** * Start new section for RSS feed */ $settings_section_rss_id = "simple_history_settings_section_rss"; add_settings_section($settings_section_rss_id, _x("RSS feed", "rss settings headline", "simple-history"), array($this, "settings_section_output"), SimpleHistory::SETTINGS_MENU_SLUG); // Enable/Disabled RSS feed add_settings_field("simple_history_enable_rss_feed", __("Enable", "simple-history"), array($this, "settings_field_rss_enable"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id); //if RSS is activated we display other fields if ($this->is_rss_enabled()) { // RSS address add_settings_field("simple_history_rss_feed", __("Address", "simple-history"), array($this, "settings_field_rss"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id); // Regnerate address add_settings_field("simple_history_rss_feed_regenerate_secret", __("Regenerate", "simple-history"), array($this, "settings_field_rss_regenerate"), SimpleHistory::SETTINGS_MENU_SLUG, $settings_section_rss_id); } // Create new RSS secret $create_new_secret = false; $create_secret_nonce_name = "simple_history_rss_secret_regenerate_nonce"; if (isset($_GET[$create_secret_nonce_name]) && wp_verify_nonce($_GET[$create_secret_nonce_name], 'simple_history_rss_update_secret')) { $create_new_secret = true; $this->update_rss_secret(); // Add updated-message and store in transient and then redirect // This is the way options.php does it. $msg = __("Created new secret RSS address", 'simple-history'); add_settings_error("simple_history_rss_feed_regenerate_secret", "simple_history_rss_feed_regenerate_secret", $msg, "updated"); set_transient('settings_errors', get_settings_errors(), 30); $goback = esc_url_raw(add_query_arg('settings-updated', 'true', wp_get_referer())); wp_redirect($goback); exit; } }
/** * Catch and process Remove Friendship requests. * * @since 1.0.1 */ function friends_action_remove_friend() { if (!bp_is_friends_component() || !bp_is_current_action('remove-friend')) { return false; } if (!($potential_friend_id = (int) bp_action_variable(0))) { return false; } if ($potential_friend_id == bp_loggedin_user_id()) { return false; } $friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $potential_friend_id); if ('is_friend' == $friendship_status) { if (!check_admin_referer('friends_remove_friend')) { return false; } if (!friends_remove_friend(bp_loggedin_user_id(), $potential_friend_id)) { bp_core_add_message(__('Friendship could not be canceled.', 'buddypress'), 'error'); } else { bp_core_add_message(__('Friendship canceled', 'buddypress')); } } elseif ('is_friends' == $friendship_status) { bp_core_add_message(__('You are not yet friends with this user', 'buddypress'), 'error'); } else { bp_core_add_message(__('You have a pending friendship request with this user', 'buddypress'), 'error'); } bp_core_redirect(wp_get_referer()); return false; }
/** * Catch a "Mark as Spammer/Not Spammer" click from the toolbar. * * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu * this action will fire and mark or unmark the user and their blogs as spam. * Must be a site admin for this function to run. * * Note: no longer used in the current state. See the Settings component. * * @param int $user_id Optional. User ID to mark as spam. Defaults to displayed * user. */ function bp_core_action_set_spammer_status($user_id = 0) { // Only super admins can currently spam users (but they can't spam // themselves) if (!is_super_admin() || bp_is_my_profile()) { return; } // Use displayed user if it's not yourself if (empty($user_id)) { $user_id = bp_displayed_user_id(); } if (bp_is_current_component('admin') && in_array(bp_current_action(), array('mark-spammer', 'unmark-spammer'))) { // Check the nonce check_admin_referer('mark-unmark-spammer'); // To spam or not to spam $status = bp_is_current_action('mark-spammer') ? 'spam' : 'ham'; // The heavy lifting bp_core_process_spammer_status($user_id, $status); // Add feedback message. @todo - Error reporting if ('spam' == $status) { bp_core_add_message(__('User marked as spammer. Spam users are visible only to site admins.', 'buddypress')); } else { bp_core_add_message(__('User removed as spammer.', 'buddypress')); } // Deprecated. Use bp_core_process_spammer_status. $is_spam = 'spam' == $status; do_action('bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam); // Redirect back to where we came from bp_core_redirect(wp_get_referer()); } }
public function __construct($args = array()) { $args['plural'] = 'purchase-logs'; parent::__construct($args); if (defined('DOING_AJAX') && DOING_AJAX) { $_SERVER['REQUEST_URI'] = wp_get_referer(); } }
/** * Redirect to previous page. * * @param int $post_ID Optional. Post ID. */ function redirect_post($post_ID = '') { global $action; $referredby = ''; if (!empty($_POST['referredby'])) { $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); $referredby = remove_query_arg('_wp_original_http_referer', $referredby); } $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer()); if (!empty($_POST['mode']) && 'bookmarklet' == $_POST['mode']) { $location = $_POST['referredby']; } elseif (!empty($_POST['mode']) && 'sidebar' == $_POST['mode']) { if (isset($_POST['saveasdraft'])) { $location = 'sidebar.php?a=c'; } elseif (isset($_POST['publish'])) { $location = 'sidebar.php?a=b'; } } elseif ((isset($_POST['save']) || isset($_POST['publish'])) && (empty($referredby) || $referredby == $referer || 'redo' != $referredby)) { if (isset($_POST['_wp_original_http_referer']) && strpos($_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos($_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false) { $location = add_query_arg(array('_wp_original_http_referer' => urlencode(stripslashes($_POST['_wp_original_http_referer'])), 'message' => 1), get_edit_post_link($post_ID, 'url')); } else { if (isset($_POST['publish'])) { if ('pending' == get_post_status($post_ID)) { $location = add_query_arg('message', 8, get_edit_post_link($post_ID, 'url')); } else { $location = add_query_arg('message', 6, get_edit_post_link($post_ID, 'url')); } } else { $location = add_query_arg('message', 7, 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 (!empty($referredby) && $referredby != $referer) { $location = $_POST['referredby']; $location = remove_query_arg('_wp_original_http_referer', $location); if (false !== strpos($location, 'edit.php') || false !== strpos($location, 'edit-post-drafts.php')) { $location = add_query_arg('posted', $post_ID, $location); } elseif (false !== strpos($location, 'wp-admin')) { $location = "post-new.php?posted={$post_ID}"; } } elseif (isset($_POST['publish'])) { $location = "post-new.php?posted={$post_ID}"; } elseif ($action == 'editattachment') { $location = 'attachments.php'; } 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($location); }
public function __construct($args = array()) { $args['plural'] = 'purchase-logs'; $this->set_per_page($this->set_purchase_logs_per_page_by_user()); parent::__construct($args); if (defined('DOING_AJAX') && DOING_AJAX) { $_SERVER['REQUEST_URI'] = wp_get_referer(); } }
public function cookie_scripts() { global $deleteCookieUrlCheck; wp_register_style('basecss', plugins_url('css/style.css', __FILE__), false); wp_enqueue_style('basecss'); $eclData = array('autoBlock' => EU_Cookie_Law_Cacheable::get_option('autoblock'), 'expireTimer' => $this->get_expire_timer(), 'scrollConsent' => EU_Cookie_Law_Cacheable::get_option('scrollconsent'), 'networkShareURL' => $this->get_cookie_domain(), 'isCookiePage' => EU_Cookie_Law_Cacheable::get_option('boxlinkid') == get_the_ID(), 'isRefererWebsite' => EU_Cookie_Law_Cacheable::get_option('navigationconsent') && wp_get_referer()); wp_enqueue_script('eucookielaw-scripts', plugins_url('js/scripts.js', __FILE__), array('jquery'), '', true); wp_localize_script('eucookielaw-scripts', 'eucookielaw_data', $eclData); }
protected static function delegate_handling($action, $taxonomy, $term_ids) { if (empty($term_ids)) { return; } foreach (array_keys(self::get_actions($taxonomy)) as $key) { if ('bulk_' . $key == $action) { check_admin_referer('bulk-tags'); $r = call_user_func(array(__CLASS__, 'handle_' . $key), $term_ids, $taxonomy); break; } } if (!isset($r)) { return; } $referer = wp_get_referer(); if ($referer && false !== strpos($referer, 'edit-tags.php')) { $location = $referer; } else { $location = add_query_arg('taxonomy', $taxonomy, 'edit-tags.php'); } if (isset($_REQUEST['post_type']) && 'post' != $_REQUEST['post_type']) { $location = add_query_arg('post_type', $_REQUEST['post_type'], $location); } wp_redirect(add_query_arg('message', $r ? 'tmt-updated' : 'tmt-error', $location)); die; }