Changeset:
        6bfad1d8c4d2
        
https://sourceforge.net/p/mrbs/hg-code/ci/6bfad1d8c4d2cc9b3e561df05ed33fa723e3513c
Author:
        Campbell Morrison <[email protected]>
Date:
        Sat Mar 11 18:37:03 2017 +0000
Log message:

Eliminated the function mrbs_entity_decode() as it's unnecessary now that the
PHP version is at least 5.3.3.

diffstat:

 web/functions.inc        |  26 --------------------------
 web/js/edit_entry.js.php |  10 +++++-----
 web/js/resizable.js.php  |   4 ++--
 web/report.php           |   4 ++--
 4 files changed, 9 insertions(+), 35 deletions(-)

diffs (122 lines):

diff -r 9a9c4e996b03 -r 6bfad1d8c4d2 web/functions.inc
--- a/web/functions.inc Sat Mar 11 18:21:43 2017 +0000
+++ b/web/functions.inc Sat Mar 11 18:37:03 2017 +0000
@@ -2196,32 +2196,6 @@
   }
 }
 
-// Version of the standard PHP function html_entity_decode()
-// Although html_entity_decode() was introduced in PHP 4.3.0, support for
-// multi-byte character sets was only introduced in PHP 5.0.0.   
-// So if we're running PHP5 or higher we'll use the standard
-// PHP function; otherwise we'll do the best we can.   At the moment
-// we just replace &nbsp; with an ordinary space, which
-// should be sufficient in most MRBS circumstances.   This could
-// always be extended later to do something more sophisticated if
-// necessary.
-//
-// Note: the charset defaults to UTF-8.  This is slightly different from the
-// behaviour in the PHP html_entity_decode() function where the default charset
-// was only changed from ISO-8859-1 to UTF-8 in PHP 5.4.0
-function mrbs_entity_decode($string, $quote_style=ENT_COMPAT, $charset = 
'UTF-8')
-{
-  if (function_exists('version_compare') && version_compare(PHP_VERSION, 
'5.0.0', 'ge'))
-  {
-    $string = html_entity_decode($string, $quote_style, $charset);
-  }
-  else
-  {
-    $string = str_replace('&nbsp;', ' ', $string);
-  }
-  return $string;
-}
-
 
 function validate_email($email)
 {
diff -r 9a9c4e996b03 -r 6bfad1d8c4d2 web/js/edit_entry.js.php
--- a/web/js/edit_entry.js.php  Sat Mar 11 18:21:43 2017 +0000
+++ b/web/js/edit_entry.js.php  Sat Mar 11 18:37:03 2017 +0000
@@ -604,14 +604,14 @@
             if (result.conflicts.length === 0)
             {
               conflictDiv.attr('class', 'good');
-              titleText = '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("no_conflicts"))) ?>';
+              titleText = '<?php echo 
escape_js(html_entity_decode(get_vocab("no_conflicts"))) ?>';
               detailsHTML = titleText;
             }
             else
             {
               conflictDiv.attr('class', 'bad');
               detailsHTML = "<p>";
-              titleText = '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("conflict"))) ?>' + "\n\n";
+              titleText = '<?php echo 
escape_js(html_entity_decode(get_vocab("conflict"))) ?>' + "\n\n";
               detailsHTML += titleText + "<\/p>";
               var conflictsList = getErrorList(result.conflicts);
               detailsHTML += conflictsList.html;
@@ -632,14 +632,14 @@
               if (result.violations.notices.length === 0)
               {
                 policyDiv.attr('class', 'good');
-                titleText = '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("no_rules_broken"))) ?>';
+                titleText = '<?php echo 
escape_js(html_entity_decode(get_vocab("no_rules_broken"))) ?>';
                 detailsHTML = titleText;
               }
               else
               {
                 policyDiv.attr('class', 'notice');
                 detailsHTML = "<p>";
-                titleText = '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("rules_broken_notices"))) ?>' + "\n\n";
+                titleText = '<?php echo 
escape_js(html_entity_decode(get_vocab("rules_broken_notices"))) ?>' + "\n\n";
                 detailsHTML += titleText + "<\/p>";
                 var rulesList = getErrorList(result.violations.notices);
                 detailsHTML += rulesList.html;
@@ -650,7 +650,7 @@
             {
               policyDiv.attr('class', 'bad');
               detailsHTML = "<p>";
-              titleText = '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("rules_broken"))) ?>' + "\n\n";
+              titleText = '<?php echo 
escape_js(html_entity_decode(get_vocab("rules_broken"))) ?>' + "\n\n";
               detailsHTML += titleText + "<\/p>";
               var rulesList = getErrorList(result.violations.errors);
               detailsHTML += rulesList.html;
diff -r 9a9c4e996b03 -r 6bfad1d8c4d2 web/js/resizable.js.php
--- a/web/js/resizable.js.php   Sat Mar 11 18:21:43 2017 +0000
+++ b/web/js/resizable.js.php   Sat Mar 11 18:37:03 2017 +0000
@@ -1112,7 +1112,7 @@
                                 var alertMessage = '';
                                 if (result.conflicts.length > 0)
                                 {
-                                  alertMessage += '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("conflict"))) ?>' + ":  \n\n";
+                                  alertMessage += '<?php echo 
escape_js(html_entity_decode(get_vocab("conflict"))) ?>' + ":  \n\n";
                                   var conflictsList = 
getErrorList(result.conflicts);
                                   alertMessage += conflictsList.text;
                                 }
@@ -1122,7 +1122,7 @@
                                   {
                                     alertMessage += "\n\n";
                                   }
-                                  alertMessage += '<?php echo 
escape_js(mrbs_entity_decode(get_vocab("rules_broken"))) ?>' + ":  \n\n";
+                                  alertMessage += '<?php echo 
escape_js(html_entity_decode(get_vocab("rules_broken"))) ?>' + ":  \n\n";
                                   var rulesList = 
getErrorList(result.violations.errors);
                                   alertMessage += rulesList.text;
                                 }
diff -r 9a9c4e996b03 -r 6bfad1d8c4d2 web/report.php
--- a/web/report.php    Sat Mar 11 18:21:43 2017 +0000
+++ b/web/report.php    Sat Mar 11 18:37:03 2017 +0000
@@ -535,13 +535,13 @@
   
   // Find out what the non-breaking space is in this character set
   $charset = get_charset();
-  $nbsp = mrbs_entity_decode('&nbsp;', ENT_NOQUOTES, $charset);
+  $nbsp = html_entity_decode('&nbsp;', ENT_NOQUOTES, $charset);
   for ($i=0; $i < count($values); $i++)
   {
     if ($output_format != OUTPUT_HTML)
     {
       // Remove any HTML entities from the values
-      $values[$i] = mrbs_entity_decode($values[$i], ENT_NOQUOTES, $charset);
+      $values[$i] = html_entity_decode($values[$i], ENT_NOQUOTES, $charset);
       // Trim non-breaking spaces from the string
       $values[$i] = trim($values[$i], $nbsp);
       // And do an ordinary trim

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to