| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | 'span', |
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | public static function get_site_domain() { |
| 31 | - return str_ireplace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) ); | |
| 31 | + return str_ireplace( 'www.', '', wp_parse_url( home_url(), PHP_URL_HOST ) ); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public static function readable_num( $size ) { |
| 35 | 35 | $l = substr( $size, -1 ); |
| @@ -55,14 +55,18 @@ | ||
| 55 | 55 | * Validate an HTML tag against a safe allowed list. |
| 56 | 56 | * @param string $tag |
| 57 | 57 | * @return string |
| 58 | 58 | */ |
| 59 | - public static function get_valid_html_tag( $tag ) { | |
| 60 | - return in_array( strtolower( $tag ), self::ALLOWED_HTML_WRAPPER_TAGS ) ? $tag : 'div'; | |
| 59 | + public static function get_valid_html_tag( $tag ) { | |
| 60 | + if ( ! is_scalar( $tag ) ) { | |
| 61 | + return 'div'; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return in_array( strtolower( (string) $tag ), self::ALLOWED_HTML_WRAPPER_TAGS ) ? $tag : 'div'; | |
| 61 | 65 | } |
| 62 | 66 | |
| 63 | - public static function print_valid_html_tag( $tag ) { | |
| 64 | - echo in_array( strtolower( $tag ), self::ALLOWED_HTML_WRAPPER_TAGS ) ? $tag : 'div'; | |
| 67 | + public static function print_valid_html_tag( $tag ) { | |
| 68 | + echo esc_attr( self::get_valid_html_tag( $tag ) ); | |
| 65 | 69 | } |
| 66 | 70 | |
| 67 | 71 | /** |
| 68 | 72 | * Get placeholder image source. |