本文整理汇总了PHP中wp_nonce_url函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_nonce_url函数的具体用法?PHP wp_nonce_url怎么用?PHP wp_nonce_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_nonce_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validate_form
protected function _validate_form()
{
$url = wp_nonce_url('admin.php?page=vimeography-my-themes');
if (false === ($creds = request_filesystem_credentials($url))) {
// if we get here, then we don't have credentials yet,
// but have just produced a form for the user to fill in,
// so stop processing for now
return true;
// stop the normal page form from displaying
}
// now we have some credentials, try to get the wp_filesystem running
if (!WP_Filesystem($creds)) {
// our credentials were no good, ask the user for them again
request_filesystem_credentials($url);
return true;
}
if (empty($_FILES)) {
return;
}
// if this fails, check_admin_referer() will automatically print a "failed" page and die.
if (!empty($_FILES) && check_admin_referer('vimeography-install-theme', 'vimeography-theme-verification')) {
$name = substr(wp_filter_nohtml_kses($_FILES['vimeography-theme']['name']), 0, -4);
if ($_FILES['vimeography-theme']['type'] != 'application/zip') {
$this->messages[] = array('type' => 'error', 'heading' => 'Ruh Roh.', 'message' => 'Make sure you are uploading the actual .zip file, not a subfolder or file.');
} else {
global $wp_filesystem;
if (!unzip_file($_FILES['vimeography-theme']['tmp_name'], VIMEOGRAPHY_THEME_PATH)) {
$this->messages[] = array('type' => 'error', 'heading' => 'Ruh Roh.', 'message' => 'The theme could not be installed.');
} else {
$this->messages[] = array('type' => 'success', 'heading' => 'Theme installed.', 'message' => 'You can now use the "' . $name . '" theme in your galleries.');
}
}
}
}
示例2: get_actions
/**
* @see CPAC_Column_Actions::get_actions()
* @since 2.4.7
*/
public function get_actions($id)
{
$actions = array();
$user_object = new WP_User($id);
$screen = get_current_screen();
if ('site-users-network' == $screen->id) {
$url = "site-users.php?id={$this->site_id}&";
} else {
$url = 'users.php?';
}
if (get_current_user_id() == $user_object->ID) {
$edit_link = 'profile.php';
} else {
$edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(stripslashes($_SERVER['REQUEST_URI'])), "user-edit.php?user_id={$user_object->ID}"));
}
if (current_user_can('edit_user', $user_object->ID)) {
$edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a></strong><br />";
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
} else {
$edit = "<strong>{$user_object->user_login}</strong><br />";
}
if (!is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID)) {
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&user={$user_object->ID}", 'bulk-users') . "'>" . __('Delete') . "</a>";
}
if (is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID)) {
$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url($url . "action=remove&user={$user_object->ID}", 'bulk-users') . "'>" . __('Remove') . "</a>";
}
return $actions;
}
示例3: get_return_url
/**
* Creates a nonce'd URL to redirect back to
* @param APP_Order $order Order being redirected back to
* @return string Return URL
*/
protected function get_return_url($order)
{
if (!$order instanceof APP_Order && !$order instanceof APP_Order_Receipt) {
trigger_error('Order must be an instance of APP_Order or APP_Order_Receipt', E_USER_WARNING);
}
return wp_nonce_url($order->get_return_url(), $this->identifier());
}
示例4: show_update_details
/**
* Show update link.
* Opens Thickbox with Changelog.
*/
public function show_update_details()
{
$update_data = $this->get_update_data();
// only show if an update is available
if ($update_data === false) {
return;
}
$update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($this->product->get_slug()), 'upgrade-theme_' . $this->product->get_slug());
$update_onclick = ' onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
?>
<div id="update-nag">
<?php
/* translators: %1$s expands to product name, %2$s expands to version, %3$s expands to changelog HTML link, %4$s expands to closing HTML link tag, %5$s expands to update HTML link */
printf(__('<strong>%1$s version %2$s</strong> is available. %3$sCheck out what\'s new%4$s or %5$supdate now%4$s.'), $this->product->get_item_name(), $update_data->new_version, '<a href="#TB_inline?width=640&inlineId=' . $this->product->get_slug() . '_changelog" class="thickbox" title="' . $this->get_item_name() . '">', '</a>', '<a href="' . $update_url . '" ' . $update_onclick . '>');
?>
</div>
<div id="<?php
echo $this->product->get_slug();
?>
_changelog" style="display: none;">
<?php
echo wpautop($update_data->sections['changelog']);
?>
</div>
<?php
}
示例5: pmpro_addon_pmpro_international_addresses_widget
function pmpro_addon_pmpro_international_addresses_widget($addon)
{
/* <img class="addon-thumb" src="<?php echo PMPRO_URL?>/adminpages/addons/images/pmpro-international-addresses.jpg" /> */
?>
<div class="info">
<p>Adds long form addresses to the PMPro checkout.</p>
<div class="actions">
<?php
if ($addon['enabled']) {
?>
<a href="https://github.com/strangerstudios/pmpro-international-addresses/" class="button">Enabled</a>
<?php
} elseif (file_exists(dirname(__FILE__) . "/../../../pmpro-international-addresses/pmpro-international-addresses.php")) {
?>
<a href="<?php
echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-international-addresses/pmpro-international-addresses.php'), 'activate-plugin_pmpro-international-addresses/pmpro-international-addresses.php');
?>
" class="button button-primary">Activate</a>
<?php
} else {
?>
<a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-international-addresses.zip" class="button button-primary">Download</a>
<?php
}
?>
</div>
</div> <!-- end info -->
<?php
}
示例6: bbp_format_buddypress_notifications
/**
* Format the BuddyBar/Toolbar notifications
*
* @since 2.5.0 bbPress (r5155)
*
* @package bbPress
*
* @param string $action The kind of notification being rendered
* @param int $item_id The primary item id
* @param int $secondary_item_id The secondary item id
* @param int $total_items The total number of messaging-related notifications waiting for the user
* @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
*/
function bbp_format_buddypress_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
// Bail if not the notification action we are looking for
if ('bbp_new_reply' !== $action) {
return $action;
}
// New reply notifications
$topic_id = bbp_get_reply_topic_id($item_id);
$topic_title = bbp_get_topic_title($topic_id);
$topic_link = wp_nonce_url(add_query_arg(array('action' => 'bbp_mark_read', 'topic_id' => $topic_id), bbp_get_reply_url($item_id)), 'bbp_mark_topic_' . $topic_id);
$title_attr = __('Topic Replies', 'bbpress');
if ((int) $total_items > 1) {
$text = sprintf(__('You have %d new replies', 'bbpress'), (int) $total_items);
$filter = 'bbp_multiple_new_subscription_notification';
} else {
if (!empty($secondary_item_id)) {
$text = sprintf(__('You have %d new reply to %2$s from %3$s', 'bbpress'), (int) $total_items, $topic_title, bp_core_get_user_displayname($secondary_item_id));
} else {
$text = sprintf(__('You have %d new reply to %s', 'bbpress'), (int) $total_items, $topic_title);
}
$filter = 'bbp_single_new_subscription_notification';
}
// WordPress Toolbar
if ('string' === $format) {
$return = apply_filters($filter, '<a href="' . esc_url($topic_link) . '" title="' . esc_attr($title_attr) . '">' . esc_html($text) . '</a>', (int) $total_items, $text, $topic_link);
// Deprecated BuddyBar
} else {
$return = apply_filters($filter, array('text' => $text, 'link' => $topic_link), $topic_link, (int) $total_items, $text, $topic_title);
}
do_action('bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items);
return $return;
}
示例7: upgrade_anchor
function upgrade_anchor($title = '')
{
//Assemble our url, nonce and all
$url = wp_nonce_url($this->admin_url() . '&' . $this->unique_prefix . '_admin_upgrade=true', $this->unique_prefix . '_admin_upgrade');
//Return a valid Undo anchor
return ' <a title="' . $title . '" href="' . $url . '">' . __('Migrate now.', $this->identifier) . '</a>';
}
示例8: getLicensingPageUrl
private function getLicensingPageUrl()
{
$url = add_query_arg('action', $this->getAjaxActionName(), admin_url('admin-ajax.php'));
$url = wp_nonce_url($url, 'show_license');
//Assumes the default license action = "show_license".
return $url;
}
示例9: pmpro_addon_pmpro_affiliates_widget
function pmpro_addon_pmpro_affiliates_widget($addon)
{
?>
<div class="info">
<p>Lightweight Affiliate system. Create affiliate accounts and codes; tracks checkouts by affiliate account.</p>
<div class="actions">
<?php
if ($addon['enabled']) {
?>
<a href="https://github.com/strangerstudios/pmpro-affiliates/blob/master/readme.txt" class="button">Enabled</a>
<?php
} elseif (file_exists(dirname(__FILE__) . "/../../../pmpro-affiliates/pmpro-affiliates.php")) {
?>
<a href="<?php
echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-affiliates/pmpro-affiliates.php'), 'activate-plugin_pmpro-affiliates/pmpro-affiliates.php');
?>
" class="button button-primary">Activate</a>
<?php
} else {
?>
<a href="https://github.com/strangerstudios/pmpro-affiliates/archive/master.zip" class="button button-primary">Download</a>
<?php
}
?>
</div>
</div> <!-- end info -->
<?php
}
示例10: column_title
function column_title($item)
{
$actions = array();
$view_link = add_query_arg(array('page' => 'cf7_storage', 'action' => 'view', 'post_id' => absint($item->ID)), wp_nonce_url('admin.php', 'bulk-posts'));
$actions['quick-preview'] = sprintf('<a href="#entry-preview-%d">%s</a>', $item->ID, __('Preview', 'cf7-storage'));
if ($this->is_trash) {
$actions['untrash'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'untrash', $view_link), __('Restore', 'cf7-storage'));
$actions['export'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'export', $view_link), __('Export as CSV', 'cf7-storage'));
$actions['delete'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'delete', $view_link), __('Delete Permanently', 'cf7-storage'));
} else {
$actions['view'] = sprintf('<a href="%s">%s</a>', $view_link, __('View', 'cf7-storage'));
$actions['export'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'export', $view_link), __('Export as CSV', 'cf7-storage'));
$actions['trash'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'trash', $view_link), __('Trash', 'cf7-storage'));
}
$cf7_edit_url = add_query_arg(array('page' => 'wpcf7', 'action' => 'view', 'post' => absint($item->post_parent)), admin_url('admin.php'));
return sprintf('<a class="row-entry-title" href="%s" title="%s">
<h3 class="entry-from">%s</h3>
<h4 class="entry-subject">%s</h4>
</a>
%s
<div id="entry-preview-%d" class="row-entry-preview">
<div class="entry-preview-wrap">
%s
</div>
</div>', $view_link, esc_attr(sprintf(__('View this submission from %s', 'cf7-storage'), $item->post_title)), esc_html($item->post_title), esc_html(get_post_meta($item->ID, 'mail_subject', true)), $this->row_actions($actions), esc_attr($item->ID), apply_filters('the_content', get_post_meta($item->ID, 'mail_body', true)));
}
示例11: widget
function widget()
{
if (!is_user_logged_in()) {
return;
}
$post = get_post();
switch ($this->post_type) {
case 'page':
if ($post->post_type !== 'page') {
return;
}
break;
default:
if ($post->post_type !== $this->post_type && !is_post_type_archive($this->post_type)) {
return;
}
break;
}
$watchlist = get_post_meta($post->ID, '_wporg_watchlist', true);
if ($watchlist && in_array(get_current_user_id(), $watchlist)) {
printf('<p>You are watching this page. <a href="%s">Unwatch</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&post_id=' . $post->ID), 'unwatch-' . $post->ID));
} else {
printf('<p><a href="%s">Watch this page</a></p>', wp_nonce_url(admin_url('admin-post.php?action=wporg_watchlist&watch=1&post_id=' . $post->ID), 'watch-' . $post->ID));
}
}
示例12: pmpro_addon_pmpro_register_helper_widget
function pmpro_addon_pmpro_register_helper_widget($addon)
{
?>
<img class="addon-thumb" src="<?php
echo PMPRO_URL;
?>
/adminpages/addons/images/pmpro-register-helper.gif" />
<div class="info">
<p>Add additional meta fields to your PMPro checkout page and/or "Your Profile" pages. Support for text, select, multi-select, textarea, hidden, and custom HTML. Loop into existing checkout/profile field sections or add new ones.</p>
<div class="actions">
<?php
if ($addon['enabled']) {
?>
<a href="https://github.com/strangerstudios/pmpro-register-helper/blob/master/readme.txt" class="button">Enabled</a>
<?php
} elseif (file_exists(dirname(__FILE__) . "/../../../pmpro-register-helper/pmpro-register-helper.php")) {
?>
<a href="<?php
echo wp_nonce_url(self_admin_url('plugins.php?action=activate&plugin=pmpro-register-helper/pmpro-register-helper.php'), 'activate-plugin_pmpro-register-helper/pmpro-register-helper.php');
?>
" class="button button-primary">Activate</a>
<?php
} else {
?>
<a href="http://www.paidmembershipspro.com/wp-content/uploads/plugins/pmpro-register-helper.zip" class="button button-primary">Download</a>
<?php
}
?>
</div>
</div> <!-- end info -->
<?php
}
示例13: add_admin_bar_purge
/**
* Adds a purge buttion in the admin bar menu
*
* @param $wp_admin_bar WP_Admin_Bar
* @since 2.2.1
*/
function add_admin_bar_purge($wp_admin_bar)
{
$args = array('id' => 'SG_CachePress_Supercacher_Purge', 'title' => 'Purge SG Cache', 'href' => wp_nonce_url(admin_url('admin-post.php?action=sg-cachepress-purge'), 'sg-cachepress-purge'), 'meta' => array('class' => 'sg-cachepress-admin-bar-purge'));
if (current_user_can('manage_options')) {
$wp_admin_bar->add_node($args);
}
}
示例14: post_submitbox_start
/**
* Display Purge from cache on Page/Post post.php.
*/
function post_submitbox_start()
{
if (current_user_can('manage_options')) {
global $post;
echo '<div>', sprintf('<a href="%s">' . __('Purge from cache', 'w3-total-cache') . '</a>', wp_nonce_url(sprintf('admin.php?page=w3tc_dashboard&w3tc_flush_pgcache_purge_page&post_id=%d', $post->ID), 'w3tc')), '</div>';
}
}
示例15: activate
/**
* Activate plugin action
*/
function activate()
{
require_once W3TC_INC_DIR . '/functions/activation.php';
if ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_generic') {
/**
* Disable enhanced mode if permalink structure is disabled
*/
$permalink_structure = get_option('permalink_structure');
if ($permalink_structure == '') {
$this->_config->set('pgcache.engine', 'file');
$this->_config->save();
} else {
if (w3_can_modify_rules(w3_get_pgcache_rules_core_path())) {
$this->write_rules_core();
}
if (w3_can_modify_rules(w3_get_pgcache_rules_cache_path())) {
$this->write_rules_cache();
}
}
}
if (!$this->locked()) {
if (!@copy(W3TC_INSTALL_FILE_ADVANCED_CACHE, W3TC_ADDIN_FILE_ADVANCED_CACHE)) {
w3_writable_error(W3TC_ADDIN_FILE_ADVANCED_CACHE);
}
if ((!defined('WP_CACHE') || !WP_CACHE) && !$this->enable_wp_cache()) {
$reactivate_url = wp_nonce_url('plugins.php?action=activate&plugin=' . W3TC_FILE, 'activate-plugin_' . W3TC_FILE);
$reactivate_button = sprintf('<input type="button" value="re-activate plugin" onclick="top.location.href = \'%s\'" />', addslashes($reactivate_url));
$error = sprintf('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'WP_CACHE\', true);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong><br />then %s.', ABSPATH, $reactivate_button);
w3_activate_error($error);
}
}
$this->schedule();
$this->schedule_prime();
}