| @@ -178,9 +178,14 @@ | ||
| 178 | 178 | |
| 179 | 179 | if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
| 180 | 180 | $cm_settings = array(); |
| 181 | 181 | $cm_settings['codeEditor'] = wp_enqueue_code_editor( |
| 182 | - array( 'type' => 'text/css' ) | |
| 182 | + array( | |
| 183 | + 'type' => 'text/css', | |
| 184 | + 'codemirror' => array( | |
| 185 | + 'lineWrapping' => true, | |
| 186 | + ), | |
| 187 | + ) | |
| 183 | 188 | ); |
| 184 | 189 | |
| 185 | 190 | wp_localize_script( 'jquery', 'cm_settings', $cm_settings ); |
| 186 | 191 | wp_enqueue_script( 'wp-theme-plugin-editor' ); |
| @@ -196,8 +201,10 @@ | ||
| 196 | 201 | if ( ! empty( $custom_css ) |
| 197 | 202 | && is_string( $custom_css ) |
| 198 | 203 | ) { |
| 199 | 204 | $custom_css = wp_strip_all_tags( $custom_css ); |
| 205 | + // Prevent breaking out of the <style> context | |
| 206 | + $custom_css = str_replace( '</style', '', $custom_css ); | |
| 200 | 207 | wp_add_inline_style( 'wplingua', $custom_css ); |
| 201 | 208 | } |
| 202 | 209 | } |
| 203 | 210 | |
| @@ -321,8 +328,18 @@ | ||
| 321 | 328 | 'wplingua-option-dictionary', |
| 322 | 329 | plugins_url() . '/wplingua/assets/js/admin/option-page-dictionary.js', |
| 323 | 330 | array( 'jquery' ), |
| 324 | 331 | WPLNG_PLUGIN_VERSION |
| 332 | + ); | |
| 333 | + | |
| 334 | + wp_localize_script( | |
| 335 | + 'wplingua-option-dictionary', | |
| 336 | + 'wplngDictionaryAjax', | |
| 337 | + array( | |
| 338 | + 'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
| 339 | + 'nonce' => wp_create_nonce( 'wplng_dictionary_update_translations' ), | |
| 340 | + 'errorMessageAjax' => esc_html__( 'Error [0]: The AJAX call failed.', 'wplingua' ), | |
| 341 | + ) | |
| 325 | 342 | ); |
| 326 | 343 | |
| 327 | 344 | /** |
| 328 | 345 | * Enqueue wpLingua CSS styles |