当前位置: 首页>>代码示例>>PHP>>正文


PHP wpv_parse_args_recursive函数代码示例

本文整理汇总了PHP中wpv_parse_args_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP wpv_parse_args_recursive函数的具体用法?PHP wpv_parse_args_recursive怎么用?PHP wpv_parse_args_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpv_parse_args_recursive函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpv_parse_args_recursive

/**
 * Fix WP's multiarray parsing.
 * 
 * @param type $arg
 * @param type $defaults
 * @return type 
 */
function wpv_parse_args_recursive($arg, $defaults)
{
    $temp = false;
    if (isset($arg[0])) {
        $temp = $arg[0];
    } else {
        if (isset($defaults[0])) {
            $temp = $defaults[0];
        }
    }
    $arg = wp_parse_args($arg, $defaults);
    if ($temp) {
        $arg[0] = $temp;
    }
    foreach ($defaults as $default_setting_parent => $default_setting) {
        if (!is_array($default_setting)) {
            if (!isset($arg[$default_setting_parent])) {
                $arg[$default_setting_parent] = $default_setting;
            }
            continue;
        }
        if (!isset($arg[$default_setting_parent])) {
            $arg[$default_setting_parent] = $defaults[$default_setting_parent];
        }
        $arg[$default_setting_parent] = wpv_parse_args_recursive($arg[$default_setting_parent], $defaults[$default_setting_parent]);
    }
    return $arg;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:35,代码来源:functions.php

示例2: wpv_post_types_defaults_save

function wpv_post_types_defaults_save($view_settings)
{
    // we need to set 0 for the checkboxes that aren't checked and are missing for the $_POST.
    $defaults = array('post_type_dont_include_current_page' => 0);
    $view_settings = wpv_parse_args_recursive($view_settings, $defaults);
    return $view_settings;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:7,代码来源:wpv-filter-post-types.php

示例3: wpv_pager_defaults_save

function wpv_pager_defaults_save($view_settings)
{
    // we need to set 0 for the checkboxes that aren't checked and are missing for the $_POST.
    $defaults = array('pagination' => array('preload_images' => 0, 'cache_pages' => 0, 'preload_pages' => 0), 'rollover' => array('preload_images' => 0));
    $view_settings = wpv_parse_args_recursive($view_settings, $defaults);
    return $view_settings;
}
开发者ID:davilode83,项目名称:occupysandy.net,代码行数:7,代码来源:wpv-pagination-embedded.php

示例4: wpv_taxonomy_defaults_save

function wpv_taxonomy_defaults_save($view_settings)
{
    global $taxonomy_checkboxes_defaults;
    // we need to set 0 for the checkboxes that aren't checked and are missing for the $_POST.
    $defaults = array();
    foreach ($taxonomy_checkboxes_defaults as $key => $value) {
        $defaults[$key] = 0;
    }
    $view_settings = wpv_parse_args_recursive($view_settings, $defaults);
    return $view_settings;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:11,代码来源:wpv-filter-taxonomy.php

示例5: get_view_settings

 /**
  * get the view settings for the current view
  * 
  * @param integer $view_id View post ID
  * @param $settings Additional forced settings
  */
 function get_view_settings($view_id = null, $settings = array())
 {
     static $view_settings = array();
     if (is_null($view_id)) {
         $view_id = $this->get_current_view();
     }
     if (!isset($view_settings[$view_id])) {
         $view_settings[$view_id] = apply_filters('wpv_view_settings', (array) get_post_meta($view_id, '_wpv_settings', true), $view_id);
         if (!empty($settings) && is_array($settings)) {
             $view_settings[$view_id] = wpv_parse_args_recursive($settings, $view_settings[$view_id]);
         }
         // PATCH - v1.1 - add the default view mode to normal (not archive)
         if (!isset($view_settings[$view_id]['view-query-mode'])) {
             $view_settings[$view_id]['view-query-mode'] = 'normal';
         }
     }
     return $view_settings[$view_id];
 }
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:24,代码来源:wpv.class.php

示例6: wpv_update_pagination_callback

function wpv_update_pagination_callback()
{
    $nonce = $_POST["wpnonce"];
    if (!wp_verify_nonce($nonce, 'wpv_view_pagination_nonce')) {
        die("Security check");
    }
    $changed = false;
    parse_str($_POST['settings'], $settings);
    $defaults = array('pagination' => array('preload_images' => 0, 'cache_pages' => 0, 'preload_pages' => 0), 'rollover' => array('preload_images' => 0));
    $settings = wpv_parse_args_recursive($settings, $defaults);
    $view_array = get_post_meta($_POST["id"], '_wpv_settings', true);
    if ($view_array['posts_per_page'] != $settings['posts_per_page']) {
        $view_array['posts_per_page'] = $settings['posts_per_page'];
        $changed = true;
    }
    if ($view_array['pagination'] != $settings['pagination']) {
        $view_array['pagination'] = $settings['pagination'];
        $changed = true;
    }
    if ($view_array['ajax_pagination'] != $settings['ajax_pagination']) {
        $view_array['ajax_pagination'] = $settings['ajax_pagination'];
        $changed = true;
    }
    if ($view_array['rollover'] != $settings['rollover']) {
        $view_array['rollover'] = $settings['rollover'];
        $changed = true;
    }
    if ($changed) {
        $result = update_post_meta($_POST["id"], '_wpv_settings', $view_array);
        echo $result ? $_POST["id"] : false;
    } else {
        echo $_POST["id"];
    }
    die;
}
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:35,代码来源:wpv-admin-ajax.php

示例7: wpv_update_pagination_callback

function wpv_update_pagination_callback() {
	if ( ! current_user_can( 'manage_options' ) ) {
		$data = array(
			'type' => 'capability',
			'message' => __( 'You do not have permissions for that.', 'wpv-views' )
		);
		wp_send_json_error( $data );
	}
	if ( 
		! isset( $_POST["wpnonce"] )
		|| ! wp_verify_nonce( $_POST["wpnonce"], 'wpv_view_pagination_nonce' ) 
	) {
		$data = array(
			'type' => 'nonce',
			'message' => __( 'Your security credentials have expired. Please reload the page to get new ones.', 'wpv-views' )
		);
		wp_send_json_error( $data );
	}
	if (
		! isset( $_POST["id"] )
		|| ! is_numeric( $_POST["id"] )
		|| intval( $_POST['id'] ) < 1 
	) {
		$data = array(
			'type' => 'id',
			'message' => __( 'Wrong or missing ID.', 'wpv-views' )
		);
		wp_send_json_error( $data );
	}
	$changed = false;
	parse_str( $_POST['settings'], $settings );
	$defaults = array(
		'pagination' => array(
			'preload_images' => 0,
			'cache_pages' => 0,
			'preload_pages' => 0,
		),
		'rollover' => array(
			'preload_images' => 0,
		),
	);
	$settings = wpv_parse_args_recursive( $settings, $defaults );
	$view_array = get_post_meta( $_POST["id"], '_wpv_settings', true );
	if ( $view_array['posts_per_page'] != $settings['posts_per_page'] ) {
		$view_array['posts_per_page'] = $settings['posts_per_page'];
		$changed = true;
	}
	if ( $view_array['pagination'] != $settings['pagination'] ) {
		$view_array['pagination'] = $settings['pagination'];
		$changed = true;
	}
	if ( $view_array['ajax_pagination'] != $settings['ajax_pagination'] ) {
		$view_array['ajax_pagination'] = $settings['ajax_pagination'];
		$changed = true;
	}
	if ( $view_array['rollover'] != $settings['rollover'] ) {
		$view_array['rollover'] = $settings['rollover'];
		$changed = true;
	}
	if ( $changed ) {
		update_post_meta( $_POST["id"], '_wpv_settings', $view_array );
		do_action( 'wpv_action_wpv_save_item', $_POST["id"] );
	}
	$data = array(
		'id' => $_POST["id"],
		'message' => __( 'Pagination saved', 'wpv-views' )
	);
	wp_send_json_success( $data );
}
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:69,代码来源:wpv-section-pagination.php


注:本文中的wpv_parse_args_recursive函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。