本文整理汇总了PHP中wp_removable_query_args函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_removable_query_args函数的具体用法?PHP wp_removable_query_args怎么用?PHP wp_removable_query_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_removable_query_args函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set_return_url
/**
* Set URL to link the user to when closing the Customizer.
*
* URL is validated.
*
* @since 4.4.0
* @access public
*
* @param string $return_url URL for return link.
*/
public function set_return_url($return_url)
{
$return_url = esc_url_raw($return_url);
$return_url = remove_query_arg(wp_removable_query_args(), $return_url);
$return_url = wp_validate_redirect($return_url);
$this->return_url = $return_url;
}
开发者ID:idies,项目名称:escience-2016-wp,代码行数:17,代码来源:class-wp-customize-manager.php
示例2: define
* @package WordPress
* @subpackage Customize
* @since 3.4.0
*/
define('IFRAME_REQUEST', true);
/** Load WordPress Administration Bootstrap */
require_once dirname(__FILE__) . '/admin.php';
if (!current_user_can('customize')) {
wp_die('<h1>' . __('Cheatin’ uh?') . '</h1>' . '<p>' . __('You are not allowed to customize the appearance of this site.') . '</p>', 403);
}
wp_reset_vars(array('url', 'return'));
$url = wp_unslash($url);
$url = wp_validate_redirect($url, home_url('/'));
if ($return) {
$return = wp_unslash($return);
$return = remove_query_arg(wp_removable_query_args(), $return);
$return = wp_validate_redirect($return);
}
if (!$return) {
if ($url) {
$return = $url;
} elseif (current_user_can('edit_theme_options') || current_user_can('switch_themes')) {
$return = admin_url('themes.php');
} else {
$return = admin_url();
}
}
/**
* @global WP_Scripts $wp_scripts
* @global WP_Customize_Manager $wp_customize
*/
开发者ID:hpilevar,项目名称:WordPress,代码行数:31,代码来源:customize.php
示例3: wp_admin_canonical_url
/**
* Remove single-use URL parameters and create canonical link based on new URL.
*
* Remove specific query string parameters from a URL, create the canonical link,
* put it in the admin header, and change the current URL to match.
*
* @since 4.2.0
*/
function wp_admin_canonical_url()
{
$removable_query_args = wp_removable_query_args();
if (empty($removable_query_args)) {
return;
}
// Ensure we're using an absolute URL.
$current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$filtered_url = remove_query_arg($removable_query_args, $current_url);
?>
<link id="wp-admin-canonical" rel="canonical" href="<?php
echo esc_url($filtered_url);
?>
" />
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
}
</script>
<?php
}
开发者ID:akalipetis,项目名称:WordPress,代码行数:29,代码来源:misc.php
示例4: pagination
/**
* Display the pagination.
*
* @since 3.1.0
* @access protected
*
* @param string $which
*/
protected function pagination($which)
{
if (empty($this->_pagination_args)) {
return;
}
$total_items = $this->_pagination_args['total_items'];
$total_pages = $this->_pagination_args['total_pages'];
$infinite_scroll = false;
if (isset($this->_pagination_args['infinite_scroll'])) {
$infinite_scroll = $this->_pagination_args['infinite_scroll'];
}
if ('top' === $which && $total_pages > 1) {
$this->screen->render_screen_reader_content('heading_pagination');
}
$output = '<span class="displaying-num">' . sprintf(_n('%s item', '%s items', $total_items), number_format_i18n($total_items)) . '</span>';
$current = $this->get_pagenum();
$removable_query_args = wp_removable_query_args();
$current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$current_url = remove_query_arg($removable_query_args, $current_url);
$page_links = array();
$total_pages_before = '<span class="paging-input">';
$total_pages_after = '</span></span>';
$disable_first = $disable_last = $disable_prev = $disable_next = false;
if ($current == 1) {
$disable_first = true;
$disable_prev = true;
}
if ($current == 2) {
$disable_first = true;
}
if ($current == $total_pages) {
$disable_last = true;
$disable_next = true;
}
if ($current == $total_pages - 1) {
$disable_last = true;
}
if ($disable_first) {
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">«</span>';
} else {
$page_links[] = sprintf("<a class='first-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", esc_url(remove_query_arg('paged', $current_url)), __('First page'), '«');
}
if ($disable_prev) {
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">‹</span>';
} else {
$page_links[] = sprintf("<a class='prev-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", esc_url(add_query_arg('paged', max(1, $current - 1), $current_url)), __('Previous page'), '‹');
}
if ('bottom' === $which) {
$html_current_page = $current;
$total_pages_before = '<span class="screen-reader-text">' . __('Current Page') . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
} else {
$html_current_page = sprintf("%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>", '<label for="current-page-selector" class="screen-reader-text">' . __('Current Page') . '</label>', $current, strlen($total_pages));
}
$html_total_pages = sprintf("<span class='total-pages'>%s</span>", number_format_i18n($total_pages));
$page_links[] = $total_pages_before . sprintf(_x('%1$s of %2$s', 'paging'), $html_current_page, $html_total_pages) . $total_pages_after;
if ($disable_next) {
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">›</span>';
} else {
$page_links[] = sprintf("<a class='next-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", esc_url(add_query_arg('paged', min($total_pages, $current + 1), $current_url)), __('Next page'), '›');
}
if ($disable_last) {
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">»</span>';
} else {
$page_links[] = sprintf("<a class='last-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", esc_url(add_query_arg('paged', $total_pages, $current_url)), __('Last page'), '»');
}
$pagination_links_class = 'pagination-links';
if (!empty($infinite_scroll)) {
$pagination_links_class = ' hide-if-js';
}
$output .= "\n<span class='{$pagination_links_class}'>" . join("\n", $page_links) . '</span>';
if ($total_pages) {
$page_class = $total_pages < 2 ? ' one-page' : '';
} else {
$page_class = ' no-pages';
}
$this->_pagination = "<div class='tablenav-pages{$page_class}'>{$output}</div>";
echo $this->_pagination;
}
开发者ID:pjsong,项目名称:WordPress,代码行数:86,代码来源:class-wp-list-table.php
注:本文中的wp_removable_query_args函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论