mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
Fix: avoid warning and strict mode story
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -27,32 +27,32 @@
|
|||||||
/**
|
/**
|
||||||
* Same function than javascript unescape() function but in PHP.
|
* Same function than javascript unescape() function but in PHP.
|
||||||
*
|
*
|
||||||
* @param string $sourcetodecode String to decode
|
* @param string $source String to decode
|
||||||
* @return
|
* @return String decoded
|
||||||
*/
|
*/
|
||||||
function jsUnEscape($source)
|
function jsUnEscape($source)
|
||||||
{
|
{
|
||||||
$decodedStr = "";
|
$decodedStr = "";
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
$len = strlen ($source);
|
$len = strlen($source);
|
||||||
while ($pos < $len) {
|
while ($pos < $len) {
|
||||||
$charAt = substr ($source, $pos, 1);
|
$charAt = substr($source, $pos, 1);
|
||||||
if ($charAt == '%') {
|
if ($charAt == '%') {
|
||||||
$pos++;
|
$pos++;
|
||||||
$charAt = substr ($source, $pos, 1);
|
$charAt = substr($source, $pos, 1);
|
||||||
if ($charAt == 'u') {
|
if ($charAt == 'u') {
|
||||||
// we got a unicode character
|
// we got a unicode character
|
||||||
$pos++;
|
$pos++;
|
||||||
$unicodeHexVal = substr ($source, $pos, 4);
|
$unicodeHexVal = substr($source, $pos, 4);
|
||||||
$unicode = hexdec ($unicodeHexVal);
|
$unicode = hexdec($unicodeHexVal);
|
||||||
$entity = "&#". $unicode . ';';
|
$entity = "&#". $unicode . ';';
|
||||||
$decodedStr .= utf8_encode ($entity);
|
$decodedStr .= utf8_encode($entity);
|
||||||
$pos += 4;
|
$pos += 4;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// we have an escaped ascii character
|
// we have an escaped ascii character
|
||||||
$hexVal = substr ($source, $pos, 2);
|
$hexVal = substr($source, $pos, 2);
|
||||||
$decodedStr .= chr (hexdec ($hexVal));
|
$decodedStr .= chr(hexdec ($hexVal));
|
||||||
$pos += 2;
|
$pos += 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user