Permalink
Browse files

Sanitize background color and image.

  • Loading branch information...
1 parent 53a93e4 commit 9efa6a554016ad6ab771703fda9412fcb8232bdc @justintadlock committed Sep 5, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 extensions/random-custom-background.php
@@ -195,7 +195,7 @@ public function generate_random_background() {
public function background_color( $color ) {
/* Only return random color if the user hasn't chosen a color. */
- return empty( $color ) ? $this->color : $color;
+ return empty( $color ) ? preg_replace( '/[^0-9a-fA-F]/', '', $this->color ) : $color;
}
/**
@@ -210,7 +210,7 @@ public function background_color( $color ) {
public function background_image( $image ) {
/* Only return the random image if the user hasn't chosen an image. */
- return empty( $image ) ? $this->image : $image;
+ return empty( $image ) ? esc_url( $this->image ) : $image;
}
/**

0 comments on commit 9efa6a5

Please sign in to comment.