| @@ -5,10 +5,10 @@ | ||
| 5 | 5 | * |
| 6 | 6 | * @since 1.6 |
| 7 | 7 | */ |
| 8 | 8 | class PLL_Admin_Strings { |
| 9 | - protected static $strings = array(); // strings to translate | |
| 10 | - protected static $default_strings; // default strings to register | |
| 9 | + static protected $strings = array(); // strings to translate | |
| 10 | + static protected $default_strings; // default strings to register | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Add filters |
| 14 | 14 | * |
| @@ -50,12 +50,12 @@ | ||
| 50 | 50 | */ |
| 51 | 51 | public static function &get_strings() { |
| 52 | 52 | self::$default_strings = array( |
| 53 | 53 | 'options' => array( |
| 54 | - 'blogname' => __( 'Site Title', 'polylang' ), | |
| 55 | - 'blogdescription' => __( 'Tagline', 'polylang' ), | |
| 56 | - 'date_format' => __( 'Date Format', 'polylang' ), | |
| 57 | - 'time_format' => __( 'Time Format', 'polylang' ), | |
| 54 | + 'blogname' => __( 'Site Title' ), | |
| 55 | + 'blogdescription' => __( 'Tagline' ), | |
| 56 | + 'date_format' => __( 'Date Format' ), | |
| 57 | + 'time_format' => __( 'Time Format' ), | |
| 58 | 58 | ), |
| 59 | 59 | 'widget_title' => __( 'Widget title', 'polylang' ), |
| 60 | 60 | 'widget_text' => __( 'Widget text', 'polylang' ), |
| 61 | 61 | ); |
| @@ -117,8 +117,9 @@ | ||
| 117 | 117 | * @param string $name unique name for the string |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | 120 | public static function sanitize_string_translation( $translation, $name ) { |
| 121 | + $translation = wp_unslash( trim( $translation ) ); | |
| 121 | 122 | |
| 122 | 123 | if ( false !== ( $option = array_search( $name, self::$default_strings['options'], true ) ) ) { |
| 123 | 124 | $translation = sanitize_option( $option, $translation ); |
| 124 | 125 | } |
| @@ -123,13 +124,13 @@ | ||
| 123 | 124 | $translation = sanitize_option( $option, $translation ); |
| 124 | 125 | } |
| 125 | 126 | |
| 126 | 127 | if ( $name == self::$default_strings['widget_title'] ) { |
| 127 | - $translation = sanitize_text_field( $translation ); | |
| 128 | + $translation = strip_tags( $translation ); | |
| 128 | 129 | } |
| 129 | 130 | |
| 130 | 131 | if ( $name == self::$default_strings['widget_text'] && ! current_user_can( 'unfiltered_html' ) ) { |
| 131 | - $translation = wp_kses_post( $translation ); | |
| 132 | + $translation = wp_unslash( wp_filter_post_kses( addslashes( $translation ) ) ); // wp_filter_post_kses() expects slashed | |
| 132 | 133 | } |
| 133 | 134 | |
| 134 | 135 | return $translation; |
| 135 | 136 | } |