Location: PHPKode > projects > UNKNOW > webifycore/inc/functions.php
<?PHP
function Zip($source, $destination)
{
    if (!extension_loaded('zip') || !file_exists($source)) {
        return false;
    }

    $zip = new ZipArchive();
    if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
        return false;
    }

    $source = str_replace('\\', '/', realpath($source));

    if (is_dir($source) === true)
    {
        $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);

        foreach ($files as $file)
        {
            $file = str_replace('\\', '/', realpath($file));

            if (is_dir($file) === true)
            {
                $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
            }
            else if (is_file($file) === true)
            {
                $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
            }
        }
    }
    else if (is_file($source) === true)
    {
        $zip->addFromString(basename($source), file_get_contents($source));
    }

    return $zip->close();
}
?><?php

function copy_directory( $source, $destination ) {
        if ( is_dir( $source ) ) {
                @mkdir( $destination );
                $directory = dir( $source );
                while ( FALSE !== ( $readdirectory = $directory->read() ) ) {
                        if ( $readdirectory == '.' || $readdirectory == '..' ) {
                                continue;
                        }
                        $PathDir = $source . '/' . $readdirectory;
                        if ( is_dir( $PathDir ) ) {
                                copy_directory( $PathDir, $destination . '/' . $readdirectory );
                                continue;
                        }
                        copy( $PathDir, $destination . '/' . $readdirectory );
                }

                $directory->close();
        }else {
                copy( $source, $destination );
        }
}
?><?PHP
function removeDir($dir)
{
if (!file_exists($dir)) return true;
if (!is_dir($dir) || is_link($dir)) return unlink($dir);

foreach (scandir($dir) as $item)
{
if ($item == '.' || $item == '..') continue;
if (!removeDir($dir . "/" . $item))
{

if (!removeDir($dir . "/" . $item)) return false;
};
}
return rmdir($dir);
}
?><?PHP
function EdURL($uttl) {
        $uttl=str_replace("$","","$uttl");
        $uttl=str_replace("&","","$uttl");
        $uttl=str_replace("=","","$uttl");
        $uttl=str_replace("?","","$uttl");
        $uttl=str_replace("`","","$uttl");
        $uttl=str_replace(":","","$uttl");
        $uttl=str_replace("<","","$uttl");
        $uttl=str_replace(">","","$uttl");
        $uttl=str_replace("[","","$uttl");
        $uttl=str_replace("]","","$uttl");
        $uttl=str_replace("{","","$uttl");
        $uttl=str_replace("}","","$uttl");
        $uttl=str_replace("\"","","$uttl");
        $uttl=str_replace("+","","$uttl");
        $uttl=str_replace("%","","$uttl");
        $uttl=str_replace("@","","$uttl");
        $uttl=str_replace("/","","$uttl");
        $uttl=str_replace(";","","$uttl");
        $uttl=str_replace("\\","","$uttl");
        $uttl=str_replace("^","","$uttl");
        $uttl=str_replace("|","","$uttl");
        $uttl=str_replace("~","","$uttl");
        $uttl=str_replace("'","","$uttl");
        $uttl=str_replace(",","","$uttl");
        $uttl=str_replace("#","","$uttl");
        $uttl=str_replace("(","","$uttl");
        $uttl=str_replace("_","","$uttl");
        $uttl=str_replace("!","","$uttl");
        $uttl=str_replace(".","","$uttl");
        $uttl=str_replace("  "," ","$uttl");
        $uttl=str_replace(" ","-","$uttl");
        $uttl=urlencode($uttl);
        return $uttl;
}
?><?php
function countFiles($strDirName)
{
if ($hndDir = opendir($strDirName))
{
$intCount = 0;
while (false !== ($strFilename = readdir($hndDir)))
{
if ($strFilename != "." && $strFilename != "..")
{
$intCount++;
}
}
closedir($hndDir);
}
else
{
$intCount = -1;
}

echo $intCount;
}
?>
Return current item: UNKNOW