Permalink
Browse files

Count only characters, without tags.

  • Loading branch information...
1 parent 8a6311d commit 81c078839e47d3e6b21436adfa309121d69a2b1e @vlad-ghita vlad-ghita committed Jan 21, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 fields/field.multilingual.php
@@ -531,7 +531,17 @@ public function checkPostFieldData($data, &$message, $entry_id = null) {
$message = null;
foreach ($this->_supported_language_codes as $language) {
- $value = $data['value-'.$language];
+ // strip tags
+ $value = strip_tags($data['value-'.$language]);
+ // convert decimal entities
+ $value = preg_replace_callback(
+ "/(&#[0-9]+;)/",
+ create_function(
+ '$m',
+ 'return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES");'
+ ),
+ $value
+ );
if ($this->get('required') == 'yes' and strlen(trim($value)) == 0) {
$message = __(

0 comments on commit 81c0788

Please sign in to comment.