Subversion Repositories php_utils

Rev

Blame | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * HtmlEntities compatibility functions
  5.  * Copyright 2019 Daniel Marschall, ViaThinkSoft
  6.  * Version 2019-11-18
  7.  *
  8.  * Licensed under the Apache License, Version 2.0 (the "License");
  9.  * you may not use this file except in compliance with the License.
  10.  * You may obtain a copy of the License at
  11.  *
  12.  *     http://www.apache.org/licenses/LICENSE-2.0
  13.  *
  14.  * Unless required by applicable law or agreed to in writing, software
  15.  * distributed under the License is distributed on an "AS IS" BASIS,
  16.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17.  * See the License for the specific language governing permissions and
  18.  * limitations under the License.
  19.  */
  20.  
  21. # http://www.ufive.unibe.ch/index.php?c=php54entitiesfix&l=de
  22. # This workaround is not required with PHP 5.6+, since htmlentities() now uses the default encoding charset as default parameter value
  23.  
  24. if (!function_exists('compat_htmlspecialchars')) {
  25.         function compat_htmlspecialchars($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
  26.                 return htmlspecialchars($string, $ent, $charset);
  27.         }
  28. }
  29.  
  30. if (!function_exists('compat_htmlentities')) {
  31.         function compat_htmlentities($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
  32.                 return htmlentities($string, $ent, $charset);
  33.         }
  34. }
  35.  
  36. if (!function_exists('compat_html_entity_decode')) {
  37.         function compat_html_entity_decode($string, $ent=ENT_COMPAT, $charset='ISO-8859-1') {
  38.                 return html_entity_decode($string, $ent, $charset);
  39.         }
  40. }
  41.  
  42.