Subversion Repositories PHPX

Rev

Rev 13 | Rev 23 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13 Rev 22
Line 221... Line 221...
221
  
221
  
222
  return preg_replace($searcharray, $replacearray, $text);
222
  return preg_replace($searcharray, $replacearray, $text);
223
}
223
}
224
224
225
/**
225
/**
-
 
226
 * Converts HTML entities to real characters using the detected
-
 
227
 * or specified character encoding.
-
 
228
 *
-
 
229
 * @param string $s
-
 
230
 * @param int[optional] $quote_style
-
 
231
 * @return string
-
 
232
 */
-
 
233
function htmlEntityDecode($s, $quote_style=ENT_COMPAT, $encoding=null)
-
 
234
{
-
 
235
  $s = (string) $s;
-
 
236
  
-
 
237
  if (is_null($encoding))
-
 
238
  {
-
 
239
    $encoding = mb_detect_encoding($s);
-
 
240
    if ($encoding === 'ASCII')
-
 
241
    {
-
 
242
      $encoding = 'ISO-8859-1';
-
 
243
    }
-
 
244
  }
-
 
245
  
-
 
246
  return html_entity_decode($s, $quote_style, $encoding);
-
 
247
}
-
 
248
-
 
249
-
 
250
/**
226
 * Converts the argument into a visible (X)HTML hyperlink if a condition
251
 * Converts the argument into a visible (X)HTML hyperlink if a condition
227
 * applies.
252
 * applies.
228
 *
253
 *
229
 * @author
254
 * @author
230
 *   (C) 2003, 2004  Thomas Lahn <selfhtml.de@PointedEars.de>
255
 *   (C) 2003, 2004  Thomas Lahn <selfhtml.de@PointedEars.de>