本文整理汇总了PHP中rcopy函数的典型用法代码示例。如果您正苦于以下问题:PHP rcopy函数的具体用法?PHP rcopy怎么用?PHP rcopy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rcopy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generate the API documentation using the markdown and include files
*
* @param $folder
* @return false|null
*/
public function generate($folder)
{
$source_dir = $folder . '/source';
if (!is_dir($source_dir)) {
return false;
}
$parser = new Parser();
$document = $parser->parse(file_get_contents($source_dir . '/index.md'));
$frontmatter = $document->getYAML();
$html = $document->getContent();
$renderer = new BladeRenderer([__DIR__ . '/../resources/views'], ['cache_path' => $source_dir . '/_tmp']);
// Parse and include optional include markdown files
if (isset($frontmatter['includes'])) {
foreach ($frontmatter['includes'] as $include) {
if (file_exists($include_file = $source_dir . '/includes/_' . $include . '.md')) {
$document = $parser->parse(file_get_contents($include_file));
$html .= $document->getContent();
}
}
}
$output = $renderer->render('index', ['page' => $frontmatter, 'content' => $html]);
file_put_contents($folder . '/index.html', $output);
// Copy assets
rcopy($source_dir . '/assets/images/', $folder . '/images');
rcopy($source_dir . '/assets/stylus/fonts/', $folder . '/css/fonts');
}
示例2: rcopy
function rcopy($source, $dest, $folderPermission = 0777)
{
$result = false;
if (is_dir($source)) {
if (!is_dir($dest)) {
@mkdir($dest, $folderPermission);
chmod($dest, $folderPermission);
}
$result = file_exists($dest) && is_dir($dest);
if (substr($source, -1) != '/') {
$source = $source . "/";
}
if (substr($dest, -1) != '/') {
$dest = $dest . "/";
}
$dirHandle = opendir($source);
while ($file = readdir($dirHandle)) {
if ($file != '.' && $file != '..') {
if (is_dir($source . $file)) {
$result = rcopy($source . $file, $dest . $file, $folderPermission);
} else {
if ('.htaccess' == $file) {
$result = copy($source . $file, $dest . $file);
}
}
}
}
closedir($dirHandle);
}
return $result;
}
示例3: rcopy
function rcopy($src, $dst)
{
if (file_exists($dst)) {
//rrmdir ( $dst );
}
if (is_dir($src)) {
$files = scandir($src);
mkdir($dst);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
rcopy($src . '/' . $file, $dst . '/' . $file);
rrmdir($src . '/' . $file);
}
$iterator = new FilesystemIterator($src);
$isDirEmpty = !$iterator->valid();
if ($isDirEmpty) {
rmdir($src);
}
}
} else {
if (file_exists($src)) {
copy($src, $dst);
}
}
}
示例4: rcopy
function rcopy($src, $dest)
{
// If source is not a directory stop processing
if (!is_dir($src)) {
return false;
}
// If the destination directory does not exist create it
if (!is_dir($dest)) {
if (!mkdir($dest)) {
// If the destination directory could not be created stop processing
return false;
}
}
// Open the source directory to read in files
$i = new DirectoryIterator($src);
foreach ($i as $f) {
if ($f->isFile()) {
copy($f->getRealPath(), "{$dest}/" . $f->getFilename());
} else {
if (!$f->isDot() && $f->isDir()) {
rcopy($f->getRealPath(), "{$dest}/{$f}");
}
}
}
}
示例5: copyFiles
function copyFiles($files, &$result)
{
foreach ($files as $key => $file) {
if (is_int($key)) {
$key = $file;
}
if (is_dir(ROOT . '/' . $key)) {
$result->{$key} = @rcopy(ROOT . '/' . $key, BUILD . '/' . $file);
} elseif (is_file(ROOT . '/' . $key)) {
$result->{$key} = @copy(ROOT . '/' . $key, BUILD . '/' . $file);
}
i($result->{$key}, $key);
}
}
示例6: file_put_contents_backup
function file_put_contents_backup($filename, $data, $basepath = '.backup' . DIRECTORY_SEPARATOR)
{
global $file_put_contents_backup__counter;
if (file_exists($filename)) {
$bakfile = $filename;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && isset($bakfile[2]) && $bakfile[2] == ':') {
$bakfile[2] = DIRECTORY_SEPARATOR;
}
$target = fakepath($basepath . $bakfile . '.' . date('Y-m-d--H-i-s') . '--' . ++$file_put_contents_backup__counter . '--' . md5(rand()) . '.bak');
if (!rcopy($filename, $target)) {
trigger_error('copy ' . $filename . ' to ' . $bakfile . ' for backup failed', E_USER_NOTICE);
}
}
return file_put_contents($filename, $data);
}
示例7: rcopy
function rcopy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if ($file != '.' and $file != '..') {
if (is_dir($src . '/' . $file)) {
rcopy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
示例8: rcopy
function rcopy($src, $dst)
{
if (is_dir($src)) {
mkdir($dst);
$files = scandir($src);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
rcopy("{$src}/{$file}", "{$dst}/{$file}");
}
}
} else {
if (file_exists($src)) {
copy($src, $dst);
}
}
}
示例9: _registerServices
protected function _registerServices()
{
$loader = $this->loader;
$dirs = $this->loader->getConfigDirs('../');
$this->di->set(Service::LOADER, function () use($loader) {
return $loader;
}, true);
$theme = 'default/';
//$theme = 'javj/' ;
$this->di->set(Service::VIEW, function () use($dirs, $theme) {
$view = new \Phalcon\Mvc\View();
$view->setLayoutsDir('../../../' . $dirs->ui->themes . $theme);
$view->setPartialsDir('../../../' . $dirs->ui->themes . $theme . 'partials/');
$view->setTemplateAfter('main');
$view->hook = new Hook();
//TODO manage themes
if (is_dir($dirs->ui->themes . $theme . 'assets/')) {
rcopy($dirs->ui->themes . $theme . 'assets/', $dirs->assets->themes . $theme, true);
}
return $view;
}, true);
$this->di->set(Service::THEME_NAME, function () use($theme) {
return str_replace('/', '', $theme);
}, true);
$this->di->set(Service::URL, function () use($dirs) {
$url = new \Phalcon\Mvc\Url();
$url->setBaseUri($dirs->base->uri);
return $url;
}, true);
$this->di->set(Service::ROUTER, function () {
$router = new Router(false);
$router->add('core/ui/themes/default/', array('controller' => 'index'))->setName('theme');
return $router;
}, true);
$this->di->set(Service::DISPATCHER, function () {
$dispatcher = new \Phalcon\Mvc\Dispatcher();
return $dispatcher;
}, true);
$this->di->set(Service::VOLT, function ($view, $di) use($dirs) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array("compiledPath" => $dirs->cache->volt));
return $volt;
}, true);
$this->di->set(Service::DB, function () {
return $this->loader->getDbConnection(self::$_token);
});
}
示例10: rcopy
function rcopy($src, $dst)
{
if (file_exists($dst)) {
rrmdir($dst);
}
if (is_dir($src)) {
mkdir($dst);
$files = array_diff(scandir($src), array(".", ".."));
foreach ($files as $file) {
rcopy("{$src}/{$file}", "{$dst}/{$file}");
}
} else {
if (file_exists($src)) {
copy($src, $dst);
}
}
}
示例11: rcopy
function rcopy($src, $dest)
{
if (!is_dir($src)) {
return false;
}
if (!is_dir($dest)) {
if (!mkdir($dest)) {
return false;
}
}
$i = new DirectoryIterator($src);
foreach ($i as $f) {
if ($f->isFile()) {
copy($f->getRealPath(), "{$dest}/" . $f->getFilename());
} else {
if (!$f->isDot() && $f->isDir()) {
rcopy($f->getRealPath(), "{$dest}/{$f}");
}
}
}
}
示例12: rcopy
function rcopy($src, $dst)
{
if (file_exists($dst)) {
//echo $dst;
deleteDirectory($dst);
}
if (is_dir($src)) {
mkdir($dst);
$files = scandir($src);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
rcopy("{$src}/{$file}", "{$dst}/{$file}");
}
}
} else {
if (file_exists($src)) {
// echo $src."<br>";
copy($src, $dst);
}
}
}
开发者ID:dimahongkong,项目名称:Searching-Exploring-with-Speech-Augmented-Map-Information-SESAMI,代码行数:21,代码来源:makePackage.php
示例13: rcopy
function rcopy($src, $dest, $cached = false)
{
/*var_dump($src);
var_dump('dirname '.dirname($src));*/
/*var_dump($dest);
var_dump('dirname '.dirname($dest));*/
if (!is_dir($src)) {
return false;
}
if (!is_dir($dest)) {
$cached = false;
if (!mkdir($dest)) {
return false;
}
}
$i = new DirectoryIterator($src);
foreach ($i as $f) {
if ($f->isFile()) {
if ($cached) {
if (file_exists("{$dest}/" . $f->getFilename())) {
$destTime = filemtime("{$dest}/" . $f->getFilename());
$srcTime = filemtime($f->getRealPath());
$diff = $srcTime - $destTime;
if ($diff < 0) {
continue;
}
var_dump('copy file');
}
}
copy($f->getRealPath(), "{$dest}/" . $f->getFilename());
} else {
if (!$f->isDot() && $f->isDir()) {
rcopy($f->getRealPath(), "{$dest}/{$f}", $cached);
}
}
}
}
示例14: folder_append_files
function folder_append_files($src_folder, $dst_folder)
{
$files = scandir($src_folder);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
if (file_exists("{$dst_folder}/{$file}")) {
rename("{$dst_folder}/{$file}", "{$dst_folder}/{$file}" . "_old");
}
rcopy("{$src_folder}/{$file}", "{$dst_folder}/{$file}");
}
}
}
示例15: response
response('no action', 400)->send();
exit;
}
// check for writability
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE) {
response(trans('Dir_No_Write') . '<br/>' . str_replace('../', '', $path) . '<br/>' . str_replace('../', '', $path_thumb), 403)->send();
exit;
}
// check if server disables copy or rename
if (is_function_callable($action == 'copy' ? 'copy' : 'rename') === FALSE) {
response(sprintf(trans('Function_Disabled'), $action == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut'))), 403)->send();
exit;
}
if ($action == 'copy') {
rcopy($data['path'], $path);
rcopy($data['path_thumb'], $path_thumb);
} elseif ($action == 'cut') {
rrename($data['path'], $path);
rrename($data['path_thumb'], $path_thumb);
// cleanup
if (is_dir($data['path']) === TRUE) {
rrename_after_cleaner($data['path']);
rrename_after_cleaner($data['path_thumb']);
}
}
// cleanup
$_SESSION['RF']['clipboard']['path'] = NULL;
$_SESSION['RF']['clipboard_action'] = NULL;
break;
case 'chmod':
$mode = $_POST['new_mode'];