remove functions for older php versions

This commit is contained in:
o.pinke 2024-03-12 15:59:14 +01:00
parent 3be4baf751
commit 910d246945
3 changed files with 0 additions and 177 deletions

View file

@ -1,132 +0,0 @@
<?php
/**
* Description:
* Fix functions for PHP 5.4
*
* @package Core
* @subpackage CL-Includes
* @author Ortwin Pinke <ortwin.pinke@conlite.org>
* @copyright (c) 2014, www.conlite.org
* @version $Rev$
*
* $Id$
*/
// security
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
*
* @return string
*/
function clCheckForPhp54() {
if(!defined("CL_PHP54")) {
/**
* PHP-version equal or greater PHP 5.4
* @constant CL_PHP54 phpversion >= 5.4
*/
define('CL_PHP54', version_compare(PHP_VERSION, '5.4.0', '>=') ? 1:0);
}
return CL_PHP54;
}
function clPhp54FixedFunc($funcname, $value, $flags = '', $encoding = '') {
if(clCheckForPhp54()) {
if($funcname == "get_html_translation_table") {
$value = ($value == '') ? HTML_SPECIALCHARS : $value;
}
$flags = (empty($flags))?ENT_COMPAT|ENT_HTML401:$flags;
$encoding = (empty($encoding))?'ISO-8859-1':$encoding;
} else {
$flags = (empty($flags))?ENT_COMPAT:$flags;
}
if($funcname == "get_html_translation_table") {
return $funcname($value, $flags);
} else {
return $funcname($value, $flags, $encoding);
}
}
/**
*
* @uses clPhp54FixedFunc multi fix func for PHP5.4
* @author Ortwin Pinke <ortwinpinke@conlite.org>
*
* @param string $value
* @param mixed $flags
* @param string $encoding
* @return string
*/
/*
function clHtmlSpecialChars($value, $flags = '', $encoding = '') {
return clPhp54FixedFunc("htmlspecialchars", $value, $flags, $encoding);
}
*/
/**
*
* @uses clPhp54FixedFunc multi fix func for PHP5.4
* @author Ortwin Pinke <ortwinpinke@conlite.org>
*
* @param string $value
* @param mixed $flags
* @param string $encoding
* @return string
*/
/*
function clHtmlEntityDecode($value, $flags = '', $encoding = '') {
return clPhp54FixedFunc("html_entity_decode", $value, $flags, $encoding);
}
*
*/
/**
*
* @uses clPhp54FixedFunc multi fix func for PHP5.4
* @author Ortwin Pinke <ortwinpinke@conlite.org>
*
* @param string $value
* @param mixed $flags
* @param string $encoding
* @return string
*/
/*
function clHtmlEntities($value, $flags = '', $encoding = '') {
return clPhp54FixedFunc("htmlentities", $value, $flags, $encoding);
}
*
*/
/**
*
* @uses clPhp54FixedFunc multi fix func for PHP5.4
* @author Ortwin Pinke <ortwinpinke@conlite.org>
*
* @param string $table
* @param mixed $flags
* @return string
*/
/*
function clGetHtmlTranslationTable($table = '', $flags = '') {
return clPhp54FixedFunc("get_html_translation_table", $table, $flags);
}
*
*/
// hold old functions from con 4.8 but use new ConLite functions, mark them as deprecated
/**
* Use compatible clHtmlSpecialChars instead
* @deprecated since version 2.0
*/
/**
if (function_exists('conHtmlSpecialChars') == false) {
function conHtmlSpecialChars($value, $flags = '', $encoding = '') {
return clHtmlSpecialChars($value, $flags, $encoding);
}
}
*
*/

View file

@ -1,38 +0,0 @@
<?php
/**
* PHP 7.3 functions for older PHP versions
*
* @package Core
* @subpackage functions
* @version $Rev$
* @since 2.0.3
* @author Ortwin Pinke <o.pinke@conlite.org>
* @copyright (c) 2019, conlite.org
* @license http://www.gnu.de/documents/gpl.en.html GPL v3 (english version)
* @license http://www.gnu.de/documents/gpl.de.html GPL v3 (deutsche Version)
* @link http://www.conlite.org ConLite.org
*
* $Id$
*/
// security check
defined('CON_FRAMEWORK') or die('Illegal call');
if (!function_exists('is_countable')) {
/**
* Verify that the contents of a variable is a countable value
* <p>Verify that the contents of a variable is an <code>array</code> or an object implementing Countable</p>
* @param mixed $var <p>The value to check</p>
* @return bool <p>Returns <b><code>TRUE</code></b> if <code>var</code> is countable, <b><code>FALSE</code></b> otherwise.</p>
* @link http://php.net/manual/en/function.is-countable.php
*
* @param Countable $var
* @return boolean
*/
function is_countable($var) {
return (is_array($var) || $var instanceof Countable);
}
}

View file

@ -75,13 +75,6 @@ define('CL_VERSION', '3.0.0 RC');
}
// fixed functions for PHP 5.4 and later
// @todo: Check what is needed for PHP7+
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/includes/functions.php54.php');
// simulate PHP 7.3 functions
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/includes/functions.php73.php');
// 1. security check: Include security class and invoke basic request checks
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/classes/class.security.php');
try {