Changeset 10376 for trunk/wp-includes/formatting.php
- Timestamp:
- 01/19/2009 04:40:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r10370 r10376 213 213 } 214 214 215 // Account for the previous behaviour of the function when the $quote_style is not an accepted value 216 if ( empty( $quote_style ) ) { 217 $quote_style = ENT_NOQUOTES; 218 } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { 219 $quote_style = ENT_QUOTES; 220 } 221 215 222 // Store the site charset as a static to avoid multiple calls to wp_load_alloptions() 216 223 if ( !$charset ) { … … 226 233 } 227 234 228 switch ( $quote_style ) { 229 case ENT_QUOTES: 230 default: 231 $quote_style = ENT_QUOTES; 232 $_quote_style = ENT_QUOTES; 233 break; 234 case ENT_COMPAT: 235 case 'double': 236 $quote_style = ENT_COMPAT; 237 $_quote_style = ENT_COMPAT; 238 break; 239 case 'single': 240 $quote_style = ENT_NOQUOTES; 241 $_quote_style = 'single'; 242 break; 243 case ENT_NOQUOTES: 244 case false: 245 case 0: 246 case '': 247 case null: 248 $quote_style = ENT_NOQUOTES; 249 $_quote_style = ENT_NOQUOTES; 250 break; 235 $_quote_style = $quote_style; 236 237 if ( $quote_style === 'double' ) { 238 $quote_style = ENT_COMPAT; 239 $_quote_style = ENT_COMPAT; 240 } elseif ( $quote_style === 'single' ) { 241 $quote_style = ENT_NOQUOTES; 251 242 } 252 243 … … 297 288 if ( strpos( $string, '&' ) === false ) { 298 289 return $string; 290 } 291 292 // Match the previous behaviour of wp_specialchars() when the $quote_style is not an accepted value 293 if ( empty( $quote_style ) ) { 294 $quote_style = ENT_NOQUOTES; 295 } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) { 296 $quote_style = ENT_QUOTES; 299 297 } 300 298 … … 307 305 $others_preg = array( '/�*60;/' => '<', '/�*62;/' => '>', '/�*38;/' => '&', '/�*26;/i' => '&' ); 308 306 309 switch ( $quote_style ) { 310 case ENT_QUOTES: 311 default: 312 $translation = array_merge( $single, $double, $others ); 313 $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); 314 break; 315 case ENT_COMPAT: 316 case 'double': 317 $translation = array_merge( $double, $others ); 318 $translation_preg = array_merge( $double_preg, $others_preg ); 319 break; 320 case 'single': 321 $translation = array_merge( $single, $others ); 322 $translation_preg = array_merge( $single_preg, $others_preg ); 323 break; 324 case ENT_NOQUOTES: 325 case false: 326 case 0: 327 case '': 328 case null: 329 $translation = $others; 330 $translation_preg = $others_preg; 331 break; 307 if ( $quote_style === ENT_QUOTES ) { 308 $translation = array_merge( $single, $double, $others ); 309 $translation_preg = array_merge( $single_preg, $double_preg, $others_preg ); 310 } elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) { 311 $translation = array_merge( $double, $others ); 312 $translation_preg = array_merge( $double_preg, $others_preg ); 313 } elseif ( $quote_style === 'single' ) { 314 $translation = array_merge( $single, $others ); 315 $translation_preg = array_merge( $single_preg, $others_preg ); 316 } elseif ( $quote_style === ENT_NOQUOTES ) { 317 $translation = $others; 318 $translation_preg = $others_preg; 332 319 } 333 320
Note: See TracChangeset
for help on using the changeset viewer.