本文整理汇总了PHP中Ak::copy方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::copy方法的具体用法?PHP Ak::copy怎么用?PHP Ak::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Test_copy_directories
public function Test_copy_directories()
{
$original_path = 'ak_test_folder';
$copy_path = $original_path . '_copy';
$this->assertTrue(Ak::copy($original_path, $copy_path));
$file_name = $copy_path . '/new_folder/test_file.txt';
$content = "\rThis is the content of the test file";
$this->assertTrue(Ak::file_get_contents($file_name) === $content);
}
示例2: copy
/**
* This static method will copy recursively all the files or directories from one
* path within an Akelos application to another.
*
* It uses current installation settings, so it can perform copies via the filesystem or via FTP
*/
function copy($origin, $target, $options = array())
{
$default_options = array('ftp' => defined('AK_UPLOAD_FILES_USING_FTP') && AK_UPLOAD_FILES_USING_FTP, 'base_path' => AK_BASE_DIR);
$options = array_merge($default_options, $options);
$sucess = true;
$origin = Ak::_getRestrictedPath($origin, $options);
$target = Ak::_getRestrictedPath($target, $options);
if (empty($origin) || empty($target)) {
return false;
}
if ($options['ftp']) {
require_once AK_LIB_DIR . DS . 'AkFtp.php';
}
$destination = str_replace($origin, $target, $origin);
if (is_file($options['base_path'] . DS . $origin)) {
return Ak::file_put_contents($options['base_path'] . DS . $destination, Ak::file_get_contents($options['base_path'] . DS . $origin, $options), $options);
}
Ak::make_dir($options['base_path'] . DS . $destination);
if ($fs_items = glob($options['base_path'] . DS . $origin . "/*")) {
$items_to_copy = array('directories' => array(), 'files' => array());
foreach ($fs_items as $fs_item) {
$items_to_copy[is_dir($fs_item) ? 'directories' : 'files'][] = $fs_item;
}
foreach ($items_to_copy['files'] as $file) {
$destination = str_replace($origin, $target, $file);
$sucess = $sucess ? Ak::file_put_contents($destination, Ak::file_get_contents($file, $options), $options) : $sucess;
}
foreach ($items_to_copy['directories'] as $directory) {
$destination = str_replace($origin, $target, $directory);
$sucess = $sucess ? Ak::copy($directory, $destination, $options) : $sucess;
}
}
return $sucess;
}
示例3: __construct
function __construct()
{
empty($this->avoid_copying_views) && Ak::copy(AK_BASE_DIR.DS.'app'.DS.'views',AK_VIEWS_DIR);
}
示例4: manifest
function manifest()
{
Ak::copy($this->_generator_base_path.DS.'templates', AK_PUBLIC_DIR.DS.'stylesheets'.DS.'calendar');
}