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


PHP WP_Customize_Manager::post_value方法代码示例

本文整理汇总了PHP中WP_Customize_Manager::post_value方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::post_value方法的具体用法?PHP WP_Customize_Manager::post_value怎么用?PHP WP_Customize_Manager::post_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Manager的用法示例。


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

示例1: array

 /**
  * Test the WP_Customize_Manager::post_value() method to make sure that the validation and sanitization are done in the right order.
  *
  * @ticket 37247
  */
 function test_post_value_validation_sanitization_order()
 {
     $default_value = '0';
     $setting = $this->manager->add_setting('numeric', array('validate_callback' => array($this, 'filter_customize_validate_numeric'), 'sanitize_callback' => array($this, 'filter_customize_sanitize_numeric')));
     $this->assertEquals($default_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($default_value, $setting->post_value($default_value));
     $post_value = '42';
     $this->manager->set_post_value('numeric', $post_value);
     $this->assertEquals($post_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($post_value, $setting->post_value($default_value));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:16,代码来源:manager.php

示例2: post_value

 /**
  * Fetch and sanitize the $_POST value for the setting.
  *
  * @since 3.4.0
  *
  * @param mixed $default A default value which is used as a fallback. Default is null.
  * @return mixed The default value on failure, otherwise the sanitized value.
  */
 public final function post_value($default = null)
 {
     // Check for a cached value
     if (isset($this->_post_value)) {
         return $this->_post_value;
     }
     // Call the manager for the post value
     $result = $this->manager->post_value($this);
     if (isset($result)) {
         return $this->_post_value = $result;
     } else {
         return $default;
     }
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:22,代码来源:class-wp-customize-setting.php

示例3: array

 /**
  * Test the WP_Customize_Manager::post_value() method for a setting value that fails validation.
  *
  * @ticket 34893
  */
 function test_invalid_post_value()
 {
     $default_value = 'foo_default';
     $setting = $this->manager->add_setting('foo', array('validate_callback' => array($this, 'filter_customize_validate_foo'), 'sanitize_callback' => array($this, 'filter_customize_sanitize_foo')));
     $this->assertEquals($default_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($default_value, $setting->post_value($default_value));
     $post_value = 'bar';
     $this->manager->set_post_value('foo', $post_value);
     $this->assertEquals(strtoupper($post_value), $this->manager->post_value($setting, $default_value));
     $this->assertEquals(strtoupper($post_value), $setting->post_value($default_value));
     $this->manager->set_post_value('foo', 'return_wp_error_in_sanitize');
     $this->assertEquals($default_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($default_value, $setting->post_value($default_value));
     $this->manager->set_post_value('foo', 'return_null_in_sanitize');
     $this->assertEquals($default_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($default_value, $setting->post_value($default_value));
     $post_value = '<script>evil</script>';
     $this->manager->set_post_value('foo', $post_value);
     $this->assertEquals($default_value, $this->manager->post_value($setting, $default_value));
     $this->assertEquals($default_value, $setting->post_value($default_value));
 }
开发者ID:ntwb,项目名称:wordpress-travis,代码行数:26,代码来源:manager.php

示例4: post_value

 /**
  * Fetch and sanitize the $_POST value for the setting.
  *
  * @since 3.4.0
  *
  * @param mixed $default A default value which is used as a fallback. Default is null.
  * @return mixed The default value on failure, otherwise the sanitized value.
  */
 public final function post_value($default = null)
 {
     return $this->manager->post_value($this, $default);
 }
开发者ID:beetleskin,项目名称:kathen,代码行数:12,代码来源:class-wp-customize-setting.php


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