[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/workaround.inc.php, 1.1.2.1
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/workaround.inc.php, 1.1.2.1 |
Date: |
Thu, 20 May 2004 21:27:42 -0000 |
Update of /api
Added Files:
Branch: proposal-branch
workaround.inc.php
date: 2004/04/16 20:59:49; author: seek3r; state: Exp; lines: +168 -0
Log Message:
bringing savannah cvs back up to date with what we were doing on our private
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
<?php
// workaround for no 'is_a'
// PHP < 4.2.0
if (!function_exists('is_a'))
{
function is_a($object,$class_name)
{
$class_name = strtolower($class_name);
return (get_class($object) == $class_name) ||
is_subclass_of($object,$class_name);
}
}
// workaround for no 'image_type_to_mime_type'
// PHP < 4.3.0
if (!function_exists('image_type_to_mime_type'))
{
function image_type_to_mime_type($image_type)
{
switch ($image_type)
{
case IMAGETYPE_GIF:
return 'image/gif';
case IMAGETYPE_JPG:
case IMAGETYPE_JPEG:
return 'image/jpeg';
case IMAGETYPE_PNG:
return 'image/png';
case IMAGETYPE_SWF:
return 'application/x-shockwave-flash';
case IMAGETYPE_PSD:
return 'image/psd';
case IMAGETYPE_BMP:
return 'image/bmp';
case IMAGETYPE_TIFF_II:
case IMAGETYPE_TIFF_MM:
return 'image/tiff';
case IMAGETYPE_JPC:
return 'image/jpc';
case IMAGETYPE_JP2:
return 'image/jp2';
case IMAGETYPE_JPX:
return 'image/jpx';
case IMAGETYPE_SWC:
return 'image/swc';
}
return FALSE;
}
}
// workaround for no 'html_entity_decode'
// PHP < 4.3.0
if (!function_exists('html_entity_decode'))
{
function html_entity_decode($string,$quote_style = ENT_COMPAT,$charset
= 'ISO-8859-1')
{
$trans_tbl = get_html_translation_table(HTML_ENTITIES,
$quote_style);
$trans_tbl = array_flip($trans_tbl);
return strtr($string,$trans_tbl);
}
}
// workaround for no 'array_filter'
// PHP < 4.0.6
if (!function_exists('array_filter'))
{
function array_filter($array,$callback)
{
$farray = array();
foreach ($array as $key => $value)
{
if ($callback($value))
{
$farray[$key] = $value;
}
}
return $farray;
}
}
// workaround for no 'array_combine'
// PHP < 5
if (!function_exists('array_combine'))
{
function array_combine($keys,$values)
{
switch (TRUE)
{
case !is_array($keys) || empty($keys):
case !is_array($values) || empty($values):
case count($keys) != count($values):
return FALSE;
}
$return = array();
reset ($values);
foreach ($keys as $key)
{
$value = each($values);
$return[$key] = $value[1];
}
return $return;
}
}
// workaround for no 'ob_clean'
// PHP < 4.2.0
if (!function_exists('ob_clean'))
{
function ob_clean()
{
ob_end_clean();
ob_start();
}
}
// workaround for no 'ob_flush'
// PHP < 4.2.0
if (!function_exists('ob_flush'))
{
function ob_flush()
{
ob_end_flush();
ob_start();
}
}
// workaround for no 'file_get_contents'
// PHP < 4.3.0
/*!
@function file_get_contents
@abstract emulate the new PHP function if the current PHP version doesnt
include it.
@result reads file contents
*/
if(!function_exists('file_get_contents'))
{
function file_get_contents($filename,$use_include_path=0)
{
if ($fd = fopen($filename,'rb',$use_include_path))
{
$content = fread($fd,filesize($filename));
fclose($fd);
return $content;
}
return FALSE;
}
}
if(!function_exists('debug_backtrace'))
{
function debug_backtrace()
{
return array(
array(
'file' => __FILE__,
'line' => __LINE__,
'class' => 'using fake backtrace',
'function' => 'using fake backtrace'
),
array(
'class' => 'using fake backtrace',
'function' => 'using fake backtrace'
)
);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/workaround.inc.php, 1.1.2.1,
nomail <=