当前位置: 首页>>代码示例>>PHP>>正文


PHP copyr函数代码示例

本文整理汇总了PHP中copyr函数的典型用法代码示例。如果您正苦于以下问题:PHP copyr函数的具体用法?PHP copyr怎么用?PHP copyr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了copyr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copyr

 /**
  * Method to copy files and directories recursively
  *
  * @param $source
  * @param $dest
  * @param bool $override
  * @throws \Exception
  */
 function copyr($source, $dest, $override = false)
 {
     $dir = opendir($source);
     if (!is_dir($dest)) {
         mkdir($dest);
     } else {
         chmod($dest, 0755);
     }
     if (is_resource($dir)) {
         while (false !== ($file = readdir($dir))) {
             if ($file != '.' && $file != '..') {
                 if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
                     copyr($source . DIRECTORY_SEPARATOR . $file, $dest . DIRECTORY_SEPARATOR . $file);
                 } elseif (is_readable($dest . DIRECTORY_SEPARATOR . $file) && $override === true) {
                     copy($source . DIRECTORY_SEPARATOR . $file, $dest . DIRECTORY_SEPARATOR . $file);
                 } elseif (!is_readable($dest . DIRECTORY_SEPARATOR . $file)) {
                     copy($source . DIRECTORY_SEPARATOR . $file, $dest . DIRECTORY_SEPARATOR . $file);
                 }
             }
         }
     } else {
         throw new \Exception("readdir() expects parameter 1 to be resource", 10);
     }
     closedir($dir);
 }
开发者ID:core-framework,项目名称:core,代码行数:33,代码来源:Helper.php

示例2: profile_2012100501

function profile_2012100501($user)
{
    global $CONFIG;
    $data_root = $CONFIG->dataroot;
    $join_date = $user->getTimeCreated();
    date_default_timezone_set('UTC');
    $user_path_utc = date('Y/m/d/', $join_date) . $user->guid;
    $user_path_utc = "{$data_root}{$user_path_utc}";
    date_default_timezone_set('Europe/Berlin');
    $user_path = date('Y/m/d/', $join_date) . $user->guid;
    $user_path = "{$data_root}{$user_path}";
    $user_path2 = date('Y/m/d', $join_date);
    $user_path2 = "{$data_root}{$user_path2}";
    if ($user_path == $user_path_utc) {
        return true;
    }
    // error_log("check $user_path_utc");
    if (file_exists($user_path_utc)) {
        if (!file_exists($user_path)) {
            mkdir($user_path, 0700, true);
        }
        error_log("merge files: {$user_path_utc}, {$user_path}");
        copyr($user_path_utc, $user_path2);
    }
    return true;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:26,代码来源:fixicons.php

示例3: copyr

/**
 * Copy a file, or recursively copy a folder and its contents
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.1
 * @link        http://aidanlister.com/2004/04/recursively-copying-directories-in-php/
 * @param       string   $source    Source path
 * @param       string   $dest      Destination path
 * @return      bool     Returns TRUE on success, FALSE on failure
 */
function copyr($source, $dest)
{
    // Check for symlinks
    if (is_link($source)) {
        return symlink(readlink($source), $dest);
    }
    // Simple copy for a file
    if (is_file($source)) {
        return copy($source, $dest);
    }
    // Make destination directory
    if (!is_dir($dest)) {
        mkdir($dest);
    }
    // Loop through the folder
    $dir = dir($source);
    while (false !== ($entry = $dir->read())) {
        // Skip pointers
        if ($entry == '.' || $entry == '..') {
            continue;
        }
        // Deep copy directories
        copyr("{$source}/{$entry}", "{$dest}/{$entry}");
    }
    // Clean up
    $dir->close();
    return true;
}
开发者ID:vortechs2000,项目名称:aidanlister-code,代码行数:38,代码来源:function.copyr.php

示例4: install

 public function install($filename)
 {
     $src = ROOT . '/sys/tmp/' . $filename;
     $dest = ROOT . '/sys/tmp/install_plugin/';
     Zip::extractZip($src, $dest);
     if (!file_exists($dest)) {
         $this->errors = __('Some error occurred');
         return false;
     }
     $tmp_plugin_path = glob($dest . '*', GLOB_ONLYDIR);
     $tmp_plugin_path = $tmp_plugin_path[0];
     $plugin_basename = substr(strrchr($tmp_plugin_path, '/'), 1);
     $plugin_path = ROOT . '/sys/plugins/' . $plugin_basename;
     copyr($dest, ROOT . '/sys/plugins/', 0755);
     $this->files = getDirFiles($plugin_path);
     if (file_exists($plugin_path . '/config.dat')) {
         $config = json_decode(file_get_contents($plugin_path . '/config.dat'), true);
         include_once $plugin_path . '/index.php';
         $className = $config['className'];
         $obj = new $className(null);
         if (method_exists($obj, 'install')) {
             $obj->install();
         }
     }
     _unlink($src);
     _unlink($dest);
     return true;
 }
开发者ID:VictorSproot,项目名称:AtomXCMS-2,代码行数:28,代码来源:plugins.class.php

示例5: move_upload_directories

function move_upload_directories() {
	global $sl_upload_path, $sl_path;
	
	if (!is_dir(ABSPATH . "wp-content/uploads")) {
			mkdir(ABSPATH . "wp-content/uploads", 0755);
	}
	if (!is_dir($sl_upload_path)) {
			mkdir($sl_upload_path, 0755);
	}
	if (is_dir($sl_path . "/addons") && !is_dir($sl_upload_path . "/addons")) {
		copyr($sl_path . "/addons", $sl_upload_path . "/addons");
	}
	if (is_dir($sl_path . "/themes") && !is_dir($sl_upload_path . "/themes")) {
		copyr($sl_path . "/themes", $sl_upload_path . "/themes");
	}
	if (is_dir($sl_path . "/languages") && !is_dir($sl_upload_path . "/languages")) {
		copyr($sl_path . "/languages", $sl_upload_path . "/languages");
	}
	if (is_dir($sl_path . "/images") && !is_dir($sl_upload_path . "/images")) {
		copyr($sl_path . "/images", $sl_upload_path . "/images");
	}
	//mkdir($sl_upload_path . "/addons", 0755);
	//mkdir($sl_upload_path . "/themes", 0755);
	//mkdir($sl_upload_path . "/languages", 0755);
	if (!is_dir($sl_upload_path . "/custom-icons")) {
		mkdir($sl_upload_path . "/custom-icons", 0755);
	}
	//mkdir($sl_upload_path . "/images", 0755);
	if (!is_dir($sl_upload_path . "/custom-css")) {
		mkdir($sl_upload_path . "/custom-css", 0755);
	}
	//copyr($sl_path . "/store-locator.css", $sl_upload_path . "/custom-css/store-locator.css");
}
开发者ID:robbiespire,项目名称:paQui,代码行数:33,代码来源:functions.sl.php

示例6: copyr

/**
 * Recursively copies from one directory to another
 *
 * @access	public
 * @param 	string
 * @param 	string
 * @return	array
 */
function copyr($source, $dest)
{
    // Simple copy for a file
    if (is_file($source)) {
        return copy($source, $dest);
    }
    // Make destination directory
    if (!is_dir($dest)) {
        mkdir($dest);
    }
    // If the source is a symlink
    if (is_link($source)) {
        $link_dest = readlink($source);
        return symlink($link_dest, $dest);
    }
    // Loop through the folder
    $dir = dir($source);
    if (!is_object($dir)) {
        return FALSE;
    }
    while (false !== ($entry = $dir->read())) {
        // Skip pointers
        if ($entry == '.' or $entry == '..') {
            continue;
        }
        // Deep copy directories
        if ($dest !== "{$source}/{$entry}") {
            copyr("{$source}/{$entry}", "{$dest}/{$entry}");
        }
    }
    // Clean up
    $dir->close();
    return true;
}
开发者ID:kbjohnson90,项目名称:FUEL-CMS,代码行数:42,代码来源:MY_directory_helper.php

示例7: copyr

 function copyr($source, $dest)
 {
     if (is_link($source)) {
         return symlink(readlink($source), $dest);
     }
     if (is_file($source)) {
         $copied = copy($source, $dest);
         $content = file_get_contents($dest);
         $content = str_replace("Forone\\Admin\\Controllers", "App\\Http\\Controllers\\Forone\\Admin\\Controllers", $content);
         file_put_contents($dest, $content);
         return $copied;
     }
     if (!is_dir($dest)) {
         mkdir($dest, 0777, true);
     }
     $dir = dir($source);
     while (false !== ($entry = $dir->read())) {
         if ($entry == '.' || $entry == '..') {
             continue;
         }
         copyr("{$source}/{$entry}", "{$dest}/{$entry}");
     }
     $dir->close();
     return true;
 }
开发者ID:pfncfen,项目名称:ForoneAdministrator,代码行数:25,代码来源:CopyForone.php

示例8: copyr

 function copyr($source, $dest)
 {
     if (is_file($source)) {
         return copy($source, $dest);
     }
     if (!is_dir($dest)) {
         mkdir($dest);
     }
     $dir = dir($source);
     while (false !== ($entry = $dir->read())) {
         if ($entry == '.' || $entry == '..') {
             continue;
         }
         if ($dest !== "{$source}/{$entry}") {
             copyr("{$source}/{$entry}", "{$dest}/{$entry}");
         }
     }
     $dir->close();
     return true;
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:20,代码来源:nivoslider4wp.php

示例9: copyr

/**
 * Copy a file, or recursively copy a folder and its contents
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.1
 * @link        http://aidanlister.com/repos/v/function.copyr.php
 * @param       string   $source    Source path
 * @param       string   $dest      Destination path
 * @return      bool     Returns TRUE on success, FALSE on failure
 */
function copyr($source, $dest)
{
    global $CFG;
    // Simple copy for a file
    if (is_file($source)) {
        return copy($source, $dest);
    }
    // Make destination directory
    if (!is_dir($dest)) {
        mkdir($dest, $CFG->directorypermissions, true);
    }
    // Loop through the folder
    $dir = dir($source);
    while (false !== ($entry = $dir->read())) {
        // Skip pointers
        if ($entry == '.' || $entry == '..') {
            continue;
        }
        // Deep copy directories
        if ($dest !== "{$source}/{$entry}") {
            copyr("{$source}/{$entry}", "{$dest}/{$entry}");
        }
    }
    // Clean up
    $dir->close();
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:pathutils.php

示例10: error

                if ($imgid > 10000) {
                    error('admin.php?action=designs&job=design_import', 'Execution stopped: Buffer overflow (Images)');
                }
            }
            $imgdir = 'images/' . $imgid;
        } else {
            $tplid = $row['images'];
        }
        if (!empty($ini['template'])) {
            copyr($tempdir . 'templates', $tpldir);
        }
        if (!empty($ini['stylesheet'])) {
            copyr($tempdir . 'designs', $cssdir);
        }
        if (!empty($ini['images'])) {
            copyr($tempdir . 'images', $imgdir);
        }
        $db->query("INSERT INTO `{$db->pre}designs` (`template` , `stylesheet` , `images` , `name`) VALUES ('{$tplid}', '{$cssid}', '{$imgid}', '{$ini['name']}')");
        unset($archive);
        if ($del > 0) {
            $filesystem->unlink($file);
        }
        rmdirr($tempdir);
    }
    $delobj = $scache->load('loaddesign');
    $delobj->delete();
    ok('admin.php?action=designs&job=design', 'Design "' . $ini['name'] . '" successfully imported!');
} elseif ($job == 'design_export') {
    $id = $gpc->get('id', int);
    echo head();
    ?>
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:designs.php

示例11: getcwd

} else {
    $sitep = $_POST["site"];
}
//get site
$site = $blSite->getSiteByName($sitep);
//css folder
$csssourcefolder = getcwd() . '/sites/' . $site->getOriginalName() . '/css';
$cssdestinationfolder = getcwd() . '/html/' . $site->getName() . '/css';
if (is_dir($csssourcefolder)) {
    copyr($csssourcefolder, $cssdestinationfolder);
}
//scripts folder
$scriptssourcefolder = getcwd() . '/sites/' . $site->getOriginalName() . '/scripts';
$scriptsdestinationfolder = getcwd() . '/html/' . $site->getName() . '/scripts';
if (is_dir($scriptssourcefolder)) {
    copyr($scriptssourcefolder, $scriptsdestinationfolder);
    //update facebox.js file
    $filename = $scriptsdestinationfolder . "/facebox/facebox.js";
    // open file
    $data = file_get_contents($filename);
    // replace string
    $data = str_replace("/media_sites/sites/" . $site->getName() . "/", "", $data);
    // write file
    file_put_contents($filename, $data);
}
//images folder
$imagessourcefolder = getcwd() . '/sites/' . $site->getOriginalName() . '/images';
$imagesdestinationfolder = getcwd() . '/html/' . $site->getName() . '/images';
if (is_dir($imagessourcefolder)) {
    copyr($imagessourcefolder, $imagesdestinationfolder);
}
开发者ID:janb87,项目名称:media-cars,代码行数:31,代码来源:copyresources.php

示例12: create_domain_config_dir

/**
 *  Method create directory with domain specific config 
 *	Function create the directory by copy the html/domains/_default
 *
 *	@param string $domainname	name of directory with domain config files
 *	@param array  $errors		array with error messages
 *	@return bool				return TRUE on success, FALSE on failure
 */
function create_domain_config_dir($domainname, &$errors)
{
    $serweb_root = dirname(dirname(dirname(__FILE__))) . "/";
    $target = $serweb_root . "html/domains/" . $domainname;
    if (file_exists($target)) {
        return true;
    }
    FileJournal::add_created_file($target);
    if (false === copyr($serweb_root . "html/domains/_default", $target)) {
        log_errors(PEAR::raiseError("Can't create domain specific config", NULL, NULL, NULL, "Can't create dicetory with domain config. Directory:" . $target), $errors);
        return false;
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:22,代码来源:symlinks_functions.php

示例13: copyResourcesFolder

 public function copyResourcesFolder($type = 'site', $overWrite = true)
 {
     // Get theme path
     $path = Yii::getPathOfAlias('themes.' . $type) . '/www';
     $dest = Yii::getPathOfAlias('themes.' . $this->dirname . '/www');
     $files = $this->getResourcesFiles($type);
     foreach ($files as $key => $file) {
         $source = $file;
         $file = str_replace($this->getSourceWwwDir($type), '', $file);
         $inserts[] = array('file_name' => end(explode('/', $file)), 'file_location' => '/www' . $file, 'file_directory' => 'www/' . trim(str_replace(array('/www', end(explode('/', $file))), '', $file), '/'), 'file_ext' => end(explode('.', $file)), 'content' => file_get_contents($source));
     }
     foreach ($inserts as $insert) {
         // Check if the file location exists
         $exists = ThemeFile::model()->exists('theme_id=:id AND file_location=:location', array(':id' => $this->id, ':location' => $insert['file_location']));
         if (!$exists) {
             // Add to the db
             $themeFile = new ThemeFile();
             $themeFile->theme_id = $this->id;
             $themeFile->file_name = $insert['file_name'];
             $themeFile->file_location = $insert['file_location'];
             $themeFile->file_directory = $insert['file_directory'];
             $themeFile->file_ext = $insert['file_ext'];
             $themeFile->content = $insert['content'];
             $themeFile->save(false);
         }
     }
     if ($path) {
         // We copy themes/$type/www to the new theme location
         return copyr($path, $dest, $overWrite);
     }
     return false;
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:32,代码来源:Theme.php

示例14: while

         }
     }
     $filesystem->mkdir("templates/{$template}/", 0777);
 }
 if ($stylesheet == 0) {
     $stylesheet = 1;
     while (is_dir('designs/' . $stylesheet)) {
         $stylesheet++;
         if ($stylesheet > 10000) {
             error('admin.php?action=designs&job=design_add', $lang->phrase('admin_design_buffer_overflow_css'));
         }
     }
     $result = $db->query("SELECT stylesheet FROM {$db->pre}designs WHERE id = '{$config['templatedir']}' LIMIT 1");
     $info = $db->fetch_assoc($result);
     $filesystem->mkdir("designs/{$stylesheet}/", 0777);
     copyr("designs/{$info['stylesheet']}/", "designs/{$stylesheet}/");
 }
 if ($images == 0) {
     $images = 1;
     while (is_dir('images/' . $images)) {
         $images++;
         if ($images > 10000) {
             error('admin.php?action=designs&job=design_add', $lang->phrase('admin_design_buffer_overflow_images'));
         }
     }
     $filesystem->mkdir("images/{$images}/", 0777);
 }
 $delobj = $scache->load('loaddesign');
 $delobj->delete();
 $db->query("INSERT INTO {$db->pre}designs SET template = '{$template}', stylesheet = '{$stylesheet}', images = '{$images}', publicuse = '{$use}', name = '{$name}'", __LINE__, __FILE__);
 ok('admin.php?action=designs&job=design', $lang->phrase('admin_design_design_successfully_added'));
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:designs.php

示例15: mover

function mover($source, $dest)
{
    global $filesystem;
    if (!is_dir($dest)) {
        $filesystem->mkdir($dest, 0777);
    }
    if ($filesystem->rename($source, $dest)) {
        return true;
    } else {
        if (copyr($source, $dest)) {
            rmdirr($source);
            return true;
        }
        return false;
    }
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:16,代码来源:function.global.php


注:本文中的copyr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。