本文整理汇总了PHP中wp_parse_str函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_parse_str函数的具体用法?PHP wp_parse_str怎么用?PHP wp_parse_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_parse_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: farmtoyou_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since Farmtoyou 1.0
*
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
*/
function farmtoyou_paging_nav()
{
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'farmtoyou'), 'next_text' => __('Next →', 'farmtoyou')));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="pagination loop-pagination">
<?php
echo $links;
?>
</div><!-- .pagination -->
</nav><!-- .navigation -->
<?php
}
}
开发者ID:abcode619,项目名称:wpstuff,代码行数:40,代码来源:template-tags.php
示例2: abramoca_pagination
function abramoca_pagination($query = null)
{
global $wp_query;
if (empty($query)) {
$query = $wp_query;
}
if ($query->max_num_pages < 2) {
return;
}
if (is_front_page()) {
$paged = get_query_var('page') ? intval(get_query_var('page')) : 1;
} else {
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
}
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'array', 'add_args' => array_map('urlencode', $query_args), 'prev_next' => True, 'prev_text' => !is_rtl() ? __('← Previous ') : __(' → Previous'), 'next_text' => !is_rtl() ? __('Next →') : __('Next ←')));
if (is_array($links)) {
echo '<ul class="pagination">';
//Aquí se editaría la clase CSS de la paginación
foreach ($links as $page) {
echo "<li>{$page}</li>";
}
echo '</ul>';
}
}
开发者ID:abramoca,项目名称:Wordpress-Setup,代码行数:34,代码来源:pagination-ESPECIAL.php
示例3: add_lang_to_link
function add_lang_to_link($link)
{
global $sitepress;
$lang = '';
if (false !== ($index = strpos($link, '?'))) {
// We honor the ?lang argument from the link itself (if present).
$data = array();
wp_parse_str(substr($link, $index + 1), $data);
if (!empty($data['lang'])) {
$lang = $data['lang'];
}
} else {
$lang = $this->get_current_language();
}
if (!$lang) {
return $link;
}
$nego_type = absint($sitepress->get_setting('language_negotiation_type'));
if (1 == $nego_type) {
if ($trans_id = icl_object_id(wpbdp_get_page_id(), 'page', false, $lang)) {
$real_link = get_permalink($trans_id);
$used_link = _get_page_link($trans_id);
$link = str_replace($used_link, $real_link, $link);
return $link;
}
}
$link = add_query_arg('lang', $lang, $link);
return $link;
}
开发者ID:Nedick,项目名称:stzagora-website,代码行数:29,代码来源:class-wpml-compat.php
示例4: anciela_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since Anciela 1.0
*/
function anciela_paging_nav($query = null)
{
// Don't print empty markup if there's only one page.
if ($query == null) {
$query = $GLOBALS['wp_query'];
}
if ($query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Plus récents', 'anciela'), 'next_text' => __('Plus anciens →', 'anciela')));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<?php
echo $links;
?>
</nav><!-- .navigation -->
<?php
}
}
开发者ID:Anciela,项目名称:anciela.info,代码行数:37,代码来源:template-tags.php
示例5: iva_pagination
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since hopes 1.0
*/
function iva_pagination()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'iva_theme_front'), 'next_text' => __('Next →', 'iva_theme_front')));
if ($links) {
$out = '<nav class="navigation paging-navigation" role="navigation">';
$out .= '<div class="pagination loop-pagination">';
$out .= $links;
$out .= '</div>';
$out .= '</nav>';
}
return $out;
}
开发者ID:abdullaniyas,项目名称:cleansweep2,代码行数:33,代码来源:theme_functions.php
示例6: gazeta_the_posts_pagination
function gazeta_the_posts_pagination($query, $echo = true)
{
$pagination = '';
global $wp_query;
if (empty($query)) {
$query = $wp_query;
}
if ($query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
$args = array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'list', 'add_args' => array_map('urlencode', $query_args), 'prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>', 'before_page_number' => '<span>', 'after_page_number' => '</span>');
// Set up paginated links.
$pagination = paginate_links(apply_filters('gazeta_old_navigation_args', $args));
if ($pagination) {
if ($echo === false) {
return '<nav class="navigation pagination"><div class="nav-links">' . $pagination . '</div></nav>';
} else {
echo '<nav class="navigation pagination"><div class="nav-links">';
echo $pagination;
echo '</div></nav>';
}
}
}
开发者ID:alvarpoon,项目名称:get-it-write,代码行数:34,代码来源:templates.php
示例7: pagination
function pagination($pages = '', $range = 4)
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-angle-left"></i>', 'crunchpress'), 'next_text' => __('<i class="fa fa-angle-right"></i>', 'crunchpress')));
if ($links) {
?>
<div class="pagination-all pagination" role="navigation">
<ul id='pagination'>
<li>
<?php
echo $links;
?>
</li>
</ul><!-- .pagination -->
</div><!-- .navigation -->
<?php
}
}
开发者ID:pcco,项目名称:portal-redesign,代码行数:33,代码来源:pagination.php
示例8: flat_paging_nav
function flat_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 4, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', 'flat'), 'next_text' => __('<i class="fa fa-chevron-right"></i>', 'flat')));
$allowed_html = array('a' => array('href' => array(), 'class' => array()), 'span' => array('class' => array()), 'i' => array('class' => array()));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="nav-links">
<?php
echo wp_kses($links, $allowed_html);
?>
</div>
</nav>
<?php
}
}
开发者ID:pivaker,项目名称:driverschool,代码行数:32,代码来源:template-tags.php
示例9: _ks_parse_arg
function _ks_parse_arg($func_get_args, $defaults = '')
{
$r = array();
$arg = $func_get_args[0];
if (is_object($arg)) {
$r = get_object_vars($arg);
if (is_array($defaults)) {
$r = array_merge($defaults, $r);
}
} elseif (is_array($arg)) {
if (is_array($defaults)) {
$r = array_merge($defaults, $arg);
}
} elseif (is_string($arg) && count($arg) == 1 && preg_match('/^\\w+=/', $arg) && strpos($arg, ' ') === false) {
// query striing
wp_parse_str($arg, $r);
if (is_array($defaults)) {
$r = array_merge($defaults, $r);
}
} elseif (is_array($defaults)) {
$func_get_args = (array) $func_get_args;
// force array for null arguments
$r = array();
foreach ($defaults as $key => $value) {
$a = array_shift($func_get_args);
$r[$key] = is_null($a) ? $value : $a;
}
}
return $r;
}
开发者ID:masayukiando,项目名称:wordpress-event-search,代码行数:30,代码来源:template-tags.php
示例10: get_photos
/**
* Returns an array of photos on a WP_Error.
*/
private function get_photos($args = array())
{
$transient_key = md5('aquick-flickr-cache-' . print_r($args, true));
$cached = get_transient($transient_key);
if ($cached) {
return $cached;
}
$username = isset($args['username']) ? $args['username'] : '';
$tags = isset($args['tags']) ? $args['tags'] : '';
$count = isset($args['count']) ? absint($args['count']) : 10;
$query = array('tagmode' => 'any', 'tags' => $tags);
// If username is an RSS feed
if (preg_match('#^https?://api\\.flickr\\.com/services/feeds/photos_public\\.gne#', $username)) {
$url = parse_url($username);
$url_query = array();
wp_parse_str($url['query'], $url_query);
$query = array_merge($query, $url_query);
} else {
$user = $this->request('flickr.people.findByUsername', array('username' => $username));
if (is_wp_error($user)) {
return $user;
}
$user_id = $user->user->id;
$query['id'] = $user_id;
}
$photos = $this->request_feed('photos_public', $query);
if (!$photos) {
return new WP_Error('error', __('Could not fetch photos.', AZ_THEME_NAME));
}
$photos = array_slice($photos, 0, $count);
set_transient($transient_key, $photos, apply_filters('quick_flickr_widget_cache_timeout', 3600));
return $photos;
}
开发者ID:SIB-Colombia,项目名称:biodiversidad_wp,代码行数:36,代码来源:flickr-widget.php
示例11: my_simone_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @return void
*/
function my_simone_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 2, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'my-simone'), 'next_text' => __('Next →', 'my-simone'), 'type' => 'list'));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Posts navigation', 'my-simone');
?>
</h1>
<?php
echo $links;
?>
</nav><!-- .navigation -->
<?php
}
}
开发者ID:sintija,项目名称:wordpress_backup,代码行数:38,代码来源:template-tags.php
示例12: learn_press_course_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*/
function learn_press_course_paging_nav()
{
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<', 'learn_press'), 'next_text' => __('>', 'learn_press'), 'type' => 'list'));
if ($links) {
?>
<div class="navigation pagination">
<?php
echo $links;
?>
</div>
<!-- .pagination -->
<?php
}
}
开发者ID:shrimp2t,项目名称:LearnPress,代码行数:32,代码来源:lpr-core-functions.php
示例13: test_wp_parse_args_other
function test_wp_parse_args_other() {
$b = true;
wp_parse_str($b, $s);
$this->assertEquals($s, wp_parse_args($b));
$q = 'x=5&_baba=dudu&';
wp_parse_str($q, $ss);
$this->assertEquals($ss, wp_parse_args($q));
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:8,代码来源:functions.php
示例14: bp_activity_action_permalink_router
/**
* Catch and route requests for single activity item permalinks.
*
* @since 1.2.0
*
* @return bool False on failure.
*/
function bp_activity_action_permalink_router()
{
// Not viewing activity.
if (!bp_is_activity_component() || !bp_is_current_action('p')) {
return false;
}
// No activity to display.
if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
return false;
}
// Get the activity details.
$activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
// 404 if activity does not exist
if (empty($activity['activities'][0])) {
bp_do_404();
return;
} else {
$activity = $activity['activities'][0];
}
// Do not redirect at default.
$redirect = false;
// Redirect based on the type of activity.
if (bp_is_active('groups') && $activity->component == buddypress()->groups->id) {
// Activity is a user update.
if (!empty($activity->user_id)) {
$redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
// Activity is something else.
} else {
// Set redirect to group activity stream.
if ($group = groups_get_group($activity->item_id)) {
$redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
}
}
// Set redirect to users' activity stream.
} elseif (!empty($activity->user_id)) {
$redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
}
// If set, add the original query string back onto the redirect URL.
if (!empty($_SERVER['QUERY_STRING'])) {
$query_frags = array();
wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
$redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
}
/**
* Filter the intended redirect url before the redirect occurs for the single activity item.
*
* @since 1.2.2
*
* @param array $value Array with url to redirect to and activity related to the redirect.
*/
if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
bp_core_redirect(bp_get_root_domain());
}
// Redirect to the actual activity permalink page.
bp_core_redirect($redirect);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:63,代码来源:bp-activity-actions.php
示例15: parse_query
/**
* Allow $atts to be just the post_query as a string or object
*
* @param string|array $qs
* @return array Properly formatted $atts
* @since 0.4.2
*/
public static function parse_query($qs)
{
if (is_string($qs)) {
$query = array();
wp_parse_str($qs, $query);
} else {
$query = $qs;
}
return $query;
}
开发者ID:wir,项目名称:WP-Tiles,代码行数:17,代码来源:Helper.php
示例16: wp_parse_args
function wp_parse_args($args, $defaults = '')
{
if (is_object($args)) {
$r = get_object_vars($args);
} elseif (is_array($args)) {
$r =& $args;
} else {
wp_parse_str($args, $r);
}
return is_array($defaults) ? array_merge($defaults, $r) : $r;
}
开发者ID:bruno-barros,项目名称:w.eloquent-framework,代码行数:11,代码来源:wp-functions.php
示例17: s2_ajax_form_handler
/**
Ajax form handler
*/
function s2_ajax_form_handler()
{
require_once ABSPATH . '/wp-includes/shortcodes.php';
$response = str_replace(':', '&', $_POST['data']);
$response = str_replace('-', '=', $response);
wp_parse_str($response, $atts);
global $s2_frontend;
$content = $s2_frontend->shortcode($atts);
$content = apply_filters('s2_ajax_form', $content);
echo $content;
wp_die();
}
开发者ID:jimrucinski,项目名称:Vine,代码行数:15,代码来源:class-s2-ajax.php
示例18: setup_inputs
function setup_inputs( $method = null, $url = null, $post_body = null ) {
if ( is_null( $method ) ) {
$this->method = strtoupper( $_SERVER['REQUEST_METHOD'] );
} else {
$this->method = strtoupper( $method );
}
if ( is_null( $url ) ) {
$this->url = ( is_ssl() ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} else {
$this->url = $url;
}
$parsed = parse_url( $this->url );
$this->path = $parsed['path'];
if ( !empty( $parsed['query'] ) ) {
wp_parse_str( $parsed['query'], $this->query );
}
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && $_SERVER['HTTP_ACCEPT'] ) {
$this->accept = $_SERVER['HTTP_ACCEPT'];
}
if ( 'POST' == $this->method ) {
if ( is_null( $post_body ) ) {
$this->post_body = file_get_contents( 'php://input' );
if ( isset( $_SERVER['HTTP_CONTENT_TYPE'] ) && $_SERVER['HTTP_CONTENT_TYPE'] ) {
$this->content_type = $_SERVER['HTTP_CONTENT_TYPE'];
} elseif ( isset( $_SERVER['CONTENT_TYPE'] ) && $_SERVER['CONTENT_TYPE'] ) {
$this->content_type = $_SERVER['CONTENT_TYPE'] ;
} elseif ( '{' === $this->post_body[0] ) {
$this->content_type = 'application/json';
} else {
$this->content_type = 'application/x-www-form-urlencoded';
}
if ( 0 === strpos( strtolower( $this->content_type ), 'multipart/' ) ) {
$this->post_body = http_build_query( stripslashes_deep( $_POST ) );
$this->files = $_FILES;
$this->content_type = 'multipart/form-data';
}
} else {
$this->post_body = $post_body;
$this->content_type = '{' === $this->post_body[0] ? 'application/json' : 'application/x-www-form-urlencoded';
}
} else {
$this->post_body = null;
$this->content_type = null;
}
$this->_server_https = array_key_exists( 'HTTPS', $_SERVER ) ? $_SERVER['HTTPS'] : '--UNset--';
}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:53,代码来源:class.json-api.php
示例19: wp_parse_args
function wp_parse_args( $args, $defaults = '' ) {
if ( is_object( $args ) )
$r = get_object_vars( $args );
elseif ( is_array( $args ) )
$r =& $args;
else
wp_parse_str( $args, $r );
if ( is_array( $defaults ) )
return array_merge( $defaults, $r );
return $r;
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:12,代码来源:functions_for_wp_old.php
示例20: is_mt_package
/**
* Whether the current package is an MT plugin package or not.
*
* @param string $package The package file name or URL.
*
* @return bool
*/
protected function is_mt_package($package)
{
if (empty($package) || !preg_match('!^(http|https|ftp)://!i', $package) || file_exists($package)) {
return false;
}
$query_vars = parse_url($package, PHP_URL_QUERY);
if (empty($query_vars)) {
return false;
}
wp_parse_str($query_vars, $parsed);
return isset($parsed['pu_get_download']) && $parsed['pu_get_download'] == 1;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:19,代码来源:Package_Handler.php
注:本文中的wp_parse_str函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论