本文整理匯總了PHP中wp_reset_vars函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_reset_vars函數的具體用法?PHP wp_reset_vars怎麽用?PHP wp_reset_vars使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了wp_reset_vars函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: hack_template_save
public static function hack_template_save()
{
wp_reset_vars(array('action'));
if (isset($_GET['post'])) {
$post_id = $post_ID = (int) $_GET['post'];
} elseif (isset($_POST['post_ID'])) {
$post_id = $post_ID = (int) $_POST['post_ID'];
} else {
$post_id = $post_ID = 0;
}
$post = $post_type = $post_type_object = null;
if ($post_id) {
$post = get_post($post_id);
}
$post_type = $post ? $post->post_type : (isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : false);
if (!$post_type) {
return;
}
if ($post_type !== 'page') {
return;
}
if (!isset($_REQUEST['page_template'])) {
return;
}
update_post_meta($post->ID, '_wp_page_template', $_REQUEST['page_template']);
unset($_REQUEST['page_template']);
}
示例2: prepare_items
function prepare_items()
{
global $status, $totals, $page, $orderby, $order, $s, $m, $mode;
wp_reset_vars(array('orderby', 'order', 's', 'm'));
$q = $where = array();
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'list';
$order = $order == 'asc' ? 'ASC' : 'DESC';
$screen = get_current_screen();
$totals = wowslider_get('totals');
$this->items = array();
$sliders_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id . '_per_page'), 10);
if ($orderby && !in_array($orderby, array('name', 'code', 'author', 'date'))) {
$orderby = '';
}
$q['sort'] = $orderby ? ($orderby == 'code' ? 'ID' : 'slider_' . $orderby) . ' ' . $order : 'ID DESC';
$q['page'] = (int) $page;
$q['count'] = $sliders_per_page;
if (isset($_GET['author'])) {
$where[] = 'slider_author = ' . (int) $_GET['author'];
}
if (trim($s)) {
$q['search'] = trim($s);
}
if (strlen($m) == 6) {
$q['year'] = (int) substr($m, 0, 4);
$q['month'] = (int) substr($m, 4, 2);
}
$where[] = 'slider_public = ' . ($status == 'published' ? 1 : 0);
if ($where) {
$q['where'] = implode(' AND ', $where);
}
$this->items = wowslider_get($q);
$this->set_pagination_args(array('total_items' => wowslider_get('count'), 'per_page' => $sliders_per_page));
}
示例3: management_page_load
function management_page_load()
{
require_once WP_POLLDADDY__POLLDADDY_CLIENT_PATH;
$is_POST = 'post' == strtolower($_SERVER['REQUEST_METHOD']);
wp_reset_vars(array('action', 'page'));
global $action, $page;
$this->set_api_user_code();
if ($page == 'polls') {
switch ($action) {
case 'update-options':
if (!$is_POST) {
return;
}
if ($this->is_admin) {
check_admin_referer('polldaddy-account');
$polldaddy = $this->get_client(WP_POLLDADDY__PARTNERGUID, $this->user_code);
$polldaddy->reset();
$polldaddy_sync_account = 0;
$polldaddy_multiple_accounts = 0;
$polldaddy_load_poll_inline = 0;
if (isset($_POST['polldaddy-sync-account'])) {
$polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
}
if ($polldaddy_sync_account > 0) {
$this->log('management_page_load: sync usercode');
$this->rating_user_code = '';
update_option('pd-rating-usercode', '');
$this->set_api_user_code();
}
if (isset($_POST['polldaddy-multiple-accounts'])) {
$polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
}
if (isset($_POST['polldaddy-load-poll-inline'])) {
$polldaddy_load_poll_inline = (int) $_POST['polldaddy-load-poll-inline'];
}
$partner = array('role' => $polldaddy_multiple_accounts);
$polldaddy->update_partner_account($partner);
update_option('polldaddy_multiple_accounts', $polldaddy_multiple_accounts);
update_option('polldaddy_load_poll_inline', $polldaddy_load_poll_inline);
$rating_title_filter = '';
if (isset($_POST['polldaddy-ratings-title-filter'])) {
$rating_title_filter = sanitize_text_field($_POST['polldaddy-ratings-title-filter']);
}
update_option('pd-rating-title-filter', $rating_title_filter);
}
break;
}
//end switch
}
global $parent_file, $submenu_file, $typenow;
//need to set this to make sure that menus behave properly
if (in_array($action, array('options', 'update-rating'))) {
$parent_file = 'options-general.php';
$submenu_file = $page . '&action=options';
} else {
add_filter('admin_title', array(&$this, 'admin_title'));
$submenu_file = $page;
}
parent::management_page_load();
}
示例4: get_user
function get_user()
{
global $user_id;
wp_reset_vars(array('user_id'));
//get ID of user being edited if not editing own profile
return isset($user_id) && $user_id > 0 ? new WP_User((int) $user_id) : wp_get_current_user();
}
示例5: prepare_items
function prepare_items()
{
include ABSPATH . 'wp-admin/includes/plugin-install.php';
global $tabs, $tab, $paged, $type, $term;
wp_reset_vars(array('tab'));
$paged = $this->get_pagenum();
$per_page = 30;
// These are the tabs which are shown on the page
$tabs = array();
$tabs['dashboard'] = __('Search');
if ('search' == $tab) {
$tabs['search'] = __('Search Results');
}
$tabs['featured'] = _x('Featured', 'Plugin Installer');
$tabs['popular'] = _x('Popular', 'Plugin Installer');
$tabs['new'] = _x('Newest', 'Plugin Installer');
$nonmenu_tabs = array('plugin-information');
//Valid actions to perform which do not have a Menu item.
$tabs = apply_filters('install_plugins_tabs', $tabs);
$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
// If a non-valid menu tab has been selected, And its not a non-menu action.
if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
$tab = key($tabs);
}
$args = array('page' => $paged, 'per_page' => $per_page);
switch ($tab) {
case 'search':
$type = isset($_REQUEST['type']) ? stripslashes($_REQUEST['type']) : 'term';
$term = isset($_REQUEST['s']) ? stripslashes($_REQUEST['s']) : '';
switch ($type) {
case 'tag':
$args['tag'] = sanitize_title_with_dashes($term);
break;
case 'term':
$args['search'] = $term;
break;
case 'author':
$args['author'] = $term;
break;
}
add_action('install_plugins_table_header', 'install_search_form', 10, 0);
break;
case 'featured':
case 'popular':
case 'new':
$args['browse'] = $tab;
break;
default:
$args = false;
}
if (!$args) {
return;
}
$api = plugins_api('query_plugins', $args);
if (is_wp_error($api)) {
wp_die($api->get_error_message() . '</p> <p class="hide-if-no-js"><a href="#" onclick="document.location.reload(); return false;">' . __('Try again') . '</a>');
}
$this->items = $api->plugins;
$this->set_pagination_args(array('total_items' => $api->info['results'], 'per_page' => $per_page));
}
示例6: prepare_items
function prepare_items()
{
global $status, $themes, $totals, $page, $orderby, $order, $s;
wp_reset_vars(array('orderby', 'order', 's'));
$themes = array('all' => apply_filters('all_themes', get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array());
$site_allowed_themes = get_site_allowed_themes();
if (!$this->is_site_themes) {
$allowed_themes = $site_allowed_themes;
$themes_per_page = $this->get_items_per_page('themes_network_per_page');
} else {
$allowed_themes = wpmu_get_blog_allowedthemes($this->site_id);
$themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
}
$current = get_site_transient('update_themes');
foreach ((array) $themes['all'] as $key => $theme) {
$theme_key = $theme['Stylesheet'];
if (isset($allowed_themes[$theme_key])) {
$themes['all'][$key]['enabled'] = true;
$themes['enabled'][$key] = $themes['all'][$key];
} else {
$themes['all'][$key]['enabled'] = false;
$themes['disabled'][$key] = $themes['all'][$key];
}
if (isset($current->response[$theme['Template']])) {
$themes['upgrade'][$key] = $themes['all'][$key];
}
if ($this->is_site_themes && isset($site_allowed_themes[$theme_key])) {
unset($themes['all'][$key]);
unset($themes['enabled'][$key]);
unset($themes['disabled'][$key]);
}
}
if (!current_user_can('update_themes') || $this->is_site_themes) {
$themes['upgrade'] = array();
}
if ($s) {
$status = 'search';
$themes['search'] = array_filter($themes['all'], array(&$this, '_search_callback'));
}
$totals = array();
foreach ($themes as $type => $list) {
$totals[$type] = count($list);
}
if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
$status = 'all';
}
$this->items = $themes[$status];
$total_this_page = $totals[$status];
if ($orderby) {
$orderby = ucfirst($orderby);
$order = strtoupper($order);
uasort($this->items, array(&$this, '_order_callback'));
}
$start = ($page - 1) * $themes_per_page;
if ($total_this_page > $themes_per_page) {
$this->items = array_slice($this->items, $start, $themes_per_page);
}
$this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
}
示例7: handle_repair_panel
function handle_repair_panel()
{
global $action, $page, $M_options;
wp_reset_vars(array('action', 'page'));
?>
<div class='wrap nosubsub'>
<div class="icon32" id="icon-tools"><br></div>
<h2><?php
_e('Repair Membership', 'membership');
?>
</h2>
<?php
if (isset($_GET['msg'])) {
echo '<div id="message" class="updated fade"><p>' . $messages[(int) $_GET['msg']] . '</p></div>';
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
}
?>
<p><?php
_e('If you are having problems with your membership site, or have recently upgraded and are seeing strange behaviour then try the membership check below to see if there are any issues with your table structure. Click on the repair button if you want to repair any issues found (back up your database first).', 'membership');
?>
</p>
<p>
<?php
echo "<a href='" . wp_nonce_url("?page=" . $page . "&tab=advanced&verify=yes", 'verify-membership') . "' class='button'>" . __('Verify Membership Tables', 'membership') . "</a> ";
?>
<?php
echo "<a href='" . wp_nonce_url("?page=" . $page . "&tab=advanced&repair=yes", 'repair-membership') . "' class='button'>" . __('Repair Membership Tables', 'membership') . "</a>";
?>
</p>
<?php
if (isset($_GET['verify'])) {
check_admin_referer('verify-membership');
include_once membership_dir('membershipincludes/classes/upgrade.php');
?>
<p><strong><?php
_e('Verifying', 'membership');
?>
</strong></p>
<?php
M_verify_tables();
}
if (isset($_GET['repair'])) {
check_admin_referer('repair-membership');
include_once membership_dir('membershipincludes/classes/upgrade.php');
?>
<p><strong><?php
_e('Verifying and Repairing', 'membership');
?>
</strong></p>
<?php
M_repair_tables();
}
?>
</div> <!-- wrap -->
<?php
}
示例8: prepare_items
/**
*
* @global string $status
* @global array $totals
* @global int $page
* @global string $orderby
* @global string $order
* @global string $s
*/
public function prepare_items()
{
global $status, $totals, $page, $orderby, $order, $s;
wp_reset_vars(array('orderby', 'order', 's'));
$themes = array('all' => apply_filters('all_themes', wp_get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes(array('errors' => true)));
if ($this->is_site_themes) {
$themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
$allowed_where = 'site';
} else {
$themes_per_page = $this->get_items_per_page('themes_network_per_page');
$allowed_where = 'network';
}
$maybe_update = current_user_can('update_themes') && !$this->is_site_themes && ($current = get_site_transient('update_themes'));
foreach ((array) $themes['all'] as $key => $theme) {
if ($this->is_site_themes && $theme->is_allowed('network')) {
unset($themes['all'][$key]);
continue;
}
if ($maybe_update && isset($current->response[$key])) {
$themes['all'][$key]->update = true;
$themes['upgrade'][$key] = $themes['all'][$key];
}
$filter = $theme->is_allowed($allowed_where, $this->site_id) ? 'enabled' : 'disabled';
$themes[$filter][$key] = $themes['all'][$key];
}
if ($s) {
$status = 'search';
$themes['search'] = array_filter(array_merge($themes['all'], $themes['broken']), array($this, '_search_callback'));
}
$totals = array();
foreach ($themes as $type => $list) {
$totals[$type] = count($list);
}
if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
$status = 'all';
}
$this->items = $themes[$status];
WP_Theme::sort_by_name($this->items);
$this->has_items = !empty($themes['all']);
$total_this_page = $totals[$status];
wp_localize_script('updates', '_wpUpdatesItemCounts', array('themes' => $totals, 'totals' => wp_get_update_data()));
if ($orderby) {
$orderby = ucfirst($orderby);
$order = strtoupper($order);
if ($orderby === 'Name') {
if ('ASC' === $order) {
$this->items = array_reverse($this->items);
}
} else {
uasort($this->items, array($this, '_order_callback'));
}
}
$start = ($page - 1) * $themes_per_page;
if ($total_this_page > $themes_per_page) {
$this->items = array_slice($this->items, $start, $themes_per_page, true);
}
$this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
}
示例9: prepare_items
public function prepare_items()
{
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
global $tabs, $tab, $paged, $type, $term;
wp_reset_vars(array('tab'));
$paged = $this->get_pagenum();
// These are the tabs which are shown on the page
$tabs = array();
$tabs['purchased'] = __('Purchased Plugins', 'wp-e-commerce');
$tabs['yours'] = __('Your Plugins', 'wp-e-commerce');
$nonmenu_tabs = array();
//Valid actions to perform which do not have a Menu item.
$tabs = apply_filters('install_plugins_tabs', $tabs);
$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
// If a non-valid menu tab has been selected, and its not a non-menu action.
if (empty($tab) || !isset($tabs[$tab]) && !in_array($tab, (array) $nonmenu_tabs)) {
$tab = key($tabs);
}
$args = array();
try {
switch ($tab) {
case 'yours':
add_filter('sputnik_install_row_action_links', array(__CLASS__, 'mangle_action_for_own'), 10, 2);
add_filter('sputnik_install_grid_action_links', array(__CLASS__, 'mangle_action_for_own'), 10, 2);
$api = Sputnik_API::get_own();
break;
default:
case 'purchased':
$api = Sputnik_API::get_purchased();
break;
}
} catch (Exception $e) {
$this->connect_error = true;
return false;
}
if (!empty($_REQUEST['view'])) {
switch ($_REQUEST['view']) {
case 'grid':
case 'list':
$this->view = $_REQUEST['view'];
break;
default:
$this->view = 'grid';
break;
}
} else {
$this->view = 'grid';
}
$this->items = $api['body'];
if (isset($api['headers']['x-pagecount'])) {
$this->set_pagination_args(array('total_items' => $api['headers']['x-pagecount'], 'per_page' => 30));
}
}
示例10: __construct
public function __construct($base)
{
$this->base = $base;
$this->admin = $base->admin;
$this->referer = $this->admin->get_referer();
if ('' != wp_get_original_referer()) {
$this->referer = wp_get_original_referer();
}
$this->referer = remove_query_arg(array('approved', 'unapproved', 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $this->referer);
global $action;
wp_reset_vars(array('action'));
if ('cdc' == $action) {
$action = 'delete';
} elseif ('mac' == $action) {
$action = 'approve';
}
if (isset($_GET['dt'])) {
if ('spam' == $_GET['dt']) {
$action = 'spam';
} elseif ('trash' == $_GET['dt']) {
$action = 'trash';
}
}
switch ($action) {
case 'spam':
case 'approve':
case 'delete':
case 'trash':
$this->confirm($action);
break;
case 'editcomment':
$this->edit_form();
break;
case 'deletecomment':
case 'trashcomment':
case 'untrashcomment':
case 'spamcomment':
case 'unspamcomment':
$this->delete_comment($action);
exit;
case 'approvecomment':
case 'unapprovecomment':
$this->approve_comment($action);
exit;
case 'editedcomment':
$this->edited_comment();
exit;
default:
break;
}
}
示例11: __construct
function __construct()
{
global $post_type, $taxonomy, $tax;
wp_reset_vars(array('action', 'taxonomy', 'post_type'));
if (empty($taxonomy)) {
$taxonomy = 'post_tag';
}
if (!taxonomy_exists($taxonomy)) {
wp_die(__('Invalid taxonomy'));
}
$tax = get_taxonomy($taxonomy);
if (empty($post_type) || !in_array($post_type, get_post_types(array('show_ui' => true)))) {
$post_type = 'post';
}
parent::__construct(array('plural' => 'tags', 'singular' => 'tag'));
}
示例12: WP_Terms_List_Table
function WP_Terms_List_Table()
{
global $post_type, $taxonomy, $tax;
wp_reset_vars(array('action', 'taxonomy', 'post_type'));
if (empty($taxonomy)) {
$taxonomy = 'post_tag';
}
if (!taxonomy_exists($taxonomy)) {
wp_die(__('Invalid taxonomy'));
}
$tax = get_taxonomy($taxonomy);
if (empty($post_type) || !in_array($post_type, get_post_types(array('public' => true)))) {
$post_type = 'post';
}
parent::WP_List_Table(array('plural' => 'tags', 'singular' => 'tag'));
}
開發者ID:Esleelkartea,項目名稱:herramienta_para_autodiagnostico_ADEADA,代碼行數:16,代碼來源:class-wp-terms-list-table.php
示例13: __construct
public function __construct($base)
{
$this->base = $base;
$this->admin = $base->admin;
global $action, $posts;
wp_reset_vars(array('action', 'posts'));
if (isset($_POST['deletepost'])) {
$action = 'delete';
} elseif (isset($_POST['selcats'])) {
$action = 'selcats';
}
$this->sendback = $this->admin->get_referer();
if (strpos($this->sendback, 'post.php') !== false || strpos($this->sendback, 'post-new.php') !== false) {
$this->sendback = 'edit.php';
} else {
$this->sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $this->sendback);
}
switch ($action) {
case 'post':
$this->post();
exit;
case 'edit':
$this->edit();
break;
case 'editpost':
$this->editpost();
exit;
case 'delete':
$this->delete();
exit;
case 'trash':
$this->trash();
exit;
case 'untrash':
$this->untrash();
exit;
case 'selcats':
$this->select_cats();
break;
case 'changecats':
$this->change_cats();
break;
default:
$this->admin->redirect('edit.php');
exit;
}
}
示例14: __construct
public function __construct($base)
{
$this->base = $base;
$this->admin = $base->admin;
global $action;
wp_reset_vars(array('action'));
switch ($action) {
case 'post':
$this->post_reply();
break;
default:
if (isset($_GET['replytocom'])) {
$this->show_form();
}
break;
}
}
示例15: prepare_items
/**
*
* @global int $cat_id
* @global string $s
* @global string $orderby
* @global string $order
*/
public function prepare_items() {
global $cat_id, $s, $orderby, $order;
wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );
$args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );
if ( 'all' != $cat_id )
$args['category'] = $cat_id;
if ( !empty( $s ) )
$args['search'] = $s;
if ( !empty( $orderby ) )
$args['orderby'] = $orderby;
if ( !empty( $order ) )
$args['order'] = $order;
$this->items = get_bookmarks( $args );
}