1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00
php-e107/e107_handlers/php_compatibility_handler.php
Nick Liu f23aec7395
Replaced e_date::strptime() with eShims::strptime()
- NEW: Added \e107\Shims\Internal\StrptimeTrait, which implements PHP internal function
       strptime(). On not-Windows, the built-in function is called. If that function fails
       or if the operating system is Windows, the alternative pure PHP implementation is
       attempted. The first successful call is returned, or false if none are successful.
- MOD: Deprecated e_date::strptime() in favor of eShims::strptime()
- FIX: License misatributed for e_date::strptime() (now eShims::strptime()). The library
       used was public domain, not CC BY-NC-SA 2.0 FR by Lionel Sauron.
- MOD: Removed STRPTIME_COMPAT constant now that eShims::strptime() exists
- MOD: Removed support for calling e_date::strptime() with:
       - a localized full month name
       - a localized abbreviated month name
       - AM or PM
       - am or pm
       because these features were only implemented in Windows mode (STRPTIME_COMPAT).
- MOD: php_compatibility_handler.php now defines global strptime() using the
       eShims::strptime() implementation
- NEW: Test all(?) the possibilities of eShims::strptime()
2020-01-22 09:07:27 +01:00

67 lines
1.2 KiB
PHP

<?php
/*
* e107 website system
*
* Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* e107 requires PHP >= 5 - implement functions only supported in later versions
*
* $URL$
* $Id$
*
*/
if (!defined('e107_INIT'))
{
exit;
}
/**
* Handle system messages
*
* @package e107
* @subpackage e107_handlers
* @copyright Copyright (C) 2008-2016 e107 Inc (e107.org)
*/
if (!function_exists('strptime'))
{
function strptime($date, $format)
{
return eShims::strptime($date, $format);
}
}
//PHP < 5.2 compatibility
if (!function_exists('json_encode'))
{
require_once(e_HANDLER.'json_compat_handler.php');
function json_encode($array)
{
$json = new Services_JSON();
return $json->encode($array);
}
function json_decode($json_obj)
{
$json = new Services_JSON();
return $json->decode($json_obj);
}
}
// Fix for exim missing.
if(!function_exists('exif_imagetype'))
{
function exif_imagetype($filename)
{
if((list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false)
{
return $type;
}
return false;
}
}