";
print_r($array);
echo "
";
}
function spatiereRr($temp='', $nr_caractere)
{
$q=explode(" ",$temp);
$y="";
foreach($q as $temp1)
{
$x=$temp1;
$t=$nr_caractere;
while(strlen($x)>$t)
{
$y.=substr($x,0,$t)." ";
$x=substr($x,$t);
}
$y.=$x." ";
}
return $y;
}
function str_prepare($string)
{
if (!get_magic_quotes_gpc())
return trim(addslashes($string));
else
return trim($string);
}
function str_display($str, $IF=0)
{
if($IF==1)
return htmlspecialchars(stripslashes($str));
elseif($IF==0)
return stripslashes($str);
}
function get_is_set($var)
{
return (isset($var) && is_numeric($var) && !empty($var));
}
function testWebsite($adresa)
{
if(substr($adresa, 0, 7) == "http://")
return $adresa;
else
return "http://".$adresa;
}
function adaugaWatermark($img, $wm)
{
$watermark=imagecreatefrompng($wm);
$watermark_width=imagesx($watermark);
$watermark_height=imagesy($watermark);
$image=imagecreatetruecolor($watermark_width, $watermark_height);
$image=imagecreatefromjpeg($img);
$size=getimagesize($img);
$dest_x=ceil(($size[0]-$watermark_width)/2);
$dest_y=ceil(($size[1]-$watermark_height)/2);
imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);
imagejpeg($image, $img, 100);
imagedestroy($image);
imagedestroy($watermark);
}
function scrieSeparator($nr_spatii, $desp)
{
return scrieSpatii($nr_spatii).$desp.scrieSpatii($nr_spatii);
}
function substrReloaded($text, $length=230, $final="...")
{
$text=trim($text);
$txtl=strlen($text);
if($txtl>$length)
{
for($i=1; $text[$length-$i]!=" "; $i++)
{
if($i==$length)
{
return substr($text, 0, $length).$final;
}
}
for(; $text[$length-$i]=="," || $text[$length-$i]=="." || $text[$length-$i]==" "; $i++) {;}
$text=substr($text, 0, $length-$i+1).$final;
}
return $text;
}
function resetArrayKeys($array, $leadingZero=true)
{
$result=array();
$index=1;
foreach($array as $key=>$value)
{
if($leadingZero)
$result[]=$value;
else
$result[$index++]=$value;
}
return $result;
}
function applyColor($arg, $color="#000")
{
return "