當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。