Changeset 35788
- Timestamp:
- 12/06/2015 08:28:26 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r35709 r35788 3707 3707 $error = $value->get_error_message(); 3708 3708 } else { 3709 $value = wp_kses_post( $value );3710 3709 $value = esc_html( $value ); 3711 3710 } -
trunk/tests/phpunit/tests/formatting/BlogInfo.php
r33027 r35788 32 32 ); 33 33 } 34 35 /** 36 * @ticket 27942 37 */ 38 function test_bloginfo_sanitize_option() { 39 $old_values = array( 40 'blogname' => get_option( 'blogname' ), 41 'blogdescription' => get_option( 'blogdescription' ), 42 ); 43 44 $values = array( 45 'foo' => 'foo', 46 '<em>foo</em>' => '<em>foo</em>', 47 '<script>foo</script>' => '<script>foo</script>', 48 '<foo>' => '<foo>', 49 '<foo' => '<foo', 50 ); 51 52 foreach ( $values as $value => $expected ) { 53 $sanitized_value = sanitize_option( 'blogname', $value ); 54 update_option( 'blogname', $sanitized_value ); 55 56 $this->assertEquals( $expected, $sanitized_value ); 57 $this->assertEquals( $expected, get_bloginfo( 'name' ) ); 58 $this->assertEquals( $expected, get_bloginfo( 'name', 'display' ) ); 59 60 $sanitized_value = sanitize_option( 'blogdescription', $value ); 61 update_option( 'blogdescription', $sanitized_value ); 62 63 $this->assertEquals( $expected, $sanitized_value ); 64 $this->assertEquals( $expected, get_bloginfo( 'description' ) ); 65 $this->assertEquals( $expected, get_bloginfo( 'description', 'display' ) ); 66 } 67 68 // Restore old values. 69 foreach ( $old_values as $option_name => $value ) { 70 update_option( $option_name, $value ); 71 } 72 } 34 73 }
Note: See TracChangeset
for help on using the changeset viewer.