本文整理汇总了PHP中CMS::mkdirs方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::mkdirs方法的具体用法?PHP CMS::mkdirs怎么用?PHP CMS::mkdirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::mkdirs方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_dir
public function update_dir($name, $attrs)
{
$path = $this->path($name);
if (!IO_FS::exists($path)) {
CMS::mkdirs($path);
}
$info = $this->load_dir_info($name);
if (is_string($attrs)) {
$attrs = array('_title' => $attrs);
}
foreach ($info as $field => $value) {
if (!isset($attrs[$field])) {
$attrs[$field] = $value;
}
}
foreach (CMS::vars()->config_fields() as $field => $data) {
if (!isset($attrs[$field])) {
$attrs[$field] = isset($data['default']) ? $data['default'] : '';
if ($attrs[$field] == '{name}') {
$attrs[$field] = $name;
}
}
}
$this->save_dir_info($name, $attrs);
}
示例2: cached_preview
protected function cached_preview()
{
if (!IO_FS::exists($this->get_preview_dir())) {
CMS::mkdirs($this->get_preview_dir());
}
$file = IO_FS::File($this->path());
$file->update($this->get_preview_src_from_youtube());
$file->close();
}
示例3: mkdirs
protected function mkdirs($dir)
{
return CMS::mkdirs($dir);
}
示例4: addfile
public function addfile($parms)
{
$id = (int) $parms['id'];
$file = $_FILES['up'];
$name = trim($file['name']);
$tmp_name = trim($file['tmp_name']);
if ($tmp_name != '') {
$dir = "./" . Core::option('files_name') . "/vars/{$id}";
CMS::mkdirs($dir);
$name = strtolower($name);
$name = trim(preg_replace('{[^a-z0-9_\\.\\-]}', '', $name));
if ($name == '') {
$name = 'noname';
}
if ($name[0] == '.') {
$name = "noname.{$name}";
}
move_uploaded_file($tmp_name, "{$dir}/{$name}");
CMS::chmod_file("{$dir}/{$name}");
Events::call('admin.change');
}
return $this->redirect_to($this->make_uri('attaches', $id));
}
示例5: change
public function change($id, $data, $item)
{
if (is_object($item)) {
$item->id = $id;
}
$file = $_FILES['value'];
$name = trim($file['name']);
$tmp_name = trim($file['tmp_name']);
if ($tmp_name != '') {
$dir = "./" . Core::option('files_name') . "/vars/{$id}";
CMS::mkdirs($dir, 0775);
foreach (IO_FS::Dir($dir) as $f) {
@IO_FS::rm($f->path);
}
$name = CMS::translit(mb_strtolower($name));
$name = preg_replace('{\\s+}', '_', $name);
$name = trim(preg_replace('{[^a-z0-9_\\.\\-]}', '', $name));
if ($name == '') {
$name = 'noname';
}
if ($name[0] == '.') {
$name = "noname.{$name}";
}
move_uploaded_file($tmp_name, "{$dir}/{$name}");
chmod("{$dir}/{$name}", 0775);
$rc = CMS::vars()->on_change_call($id, $value, $data);
if (is_string($rc)) {
$item->valuesrc = $data['valuesrc'];
return $rc;
}
$item->value = "{$dir}/{$name}";
$item->update_value();
}
}
示例6: create_module_file
protected function create_module_file($module, $content)
{
list($file, $dir) = $this->module_paths($module);
if (!IO_FS::exists($dir)) {
CMS::mkdirs($dir);
CMS::chmod_dir($dir);
}
if (IO_FS::exists($file)) {
//return "{$file} уже существует!";
}
$content = preg_replace('{^<}', '<', $content);
file_put_contents($file, $content);
CMS::chmod_file($file);
return false;
}
示例7: upload_file
protected function upload_file($fobject, $name, $data, $action, $item)
{
$file = $fobject->file_array;
$filename = $this->real_uploaded_filename($name, $data, $file);
$code = $this->request('code');
$dir = $this->dir_path($item, $code, $name, $data);
if (!empty($file['error'])) {
return $this->upload_error_message($file['error']);
} else {
if (!isset($file['tmp_name']) || empty($file['tmp_name']) || $file['tmp_name'] == 'none') {
throw new Exception(CMS::lang()->_common->no_file_uploaded);
//TODO: Exception class
} else {
$old = $file['tmp_name'];
$new = "{$dir}/{$filename}";
$valid = $this->upload_validate($name, $data, $file, $new);
if ($valid !== true) {
throw new Exception($valid);
}
$eres = Events::call('cms.fields.upload', $name, $data, $file, $new);
if (!is_null($eres) && $eres !== true) {
return $eres;
}
$eres = Events::call("cms.fields.{$name}.upload", $data, $file, $new);
if (!is_null($eres) && $eres !== true) {
return $eres;
}
if (!is_dir($dir)) {
CMS::mkdirs($dir);
}
CMS::copy($old, $new);
CMS::chmod_file($new);
return $this->upload_return($name, $data, $new, $dir, $filename);
}
}
}
示例8: info_path
public function info_path()
{
$dir = CMS_Stockroom::$info_dir;
if (!IO_FS::exists($dir)) {
CMS::mkdirs($dir);
}
$code = $this->code();
return "{$dir}/{$code}";
}
示例9: homedir
public function homedir($private = false)
{
$path = $private ? '../' : './';
$path .= Core::option('files_name');
$path .= '/varfiles/' . $this->id();
CMS::mkdirs($path);
return $path;
}
示例10: set
public function set($file)
{
if (!IO_FS::exists($file)) {
return $this;
}
$private = isset($this->data['private']) && $this->data['private'];
$dir = $this->type->uploaded_file_dir($this->data, $this->item, $private);
$filename = $this->type->uploaded_file_name($this->get_file_info($file), $this->data, $this->item, $this->name);
if (!$dir) {
return $this;
}
if (!IO_FS::exists($dir)) {
CMS::mkdirs($dir);
}
$_dir = preg_replace('{^\\./}', '', $dir);
copy($file, "{$dir}/{$filename}");
CMS::chmod_file("{$dir}/{$filename}");
$this->remove($file);
$file = "{$_dir}/{$filename}";
return parent::set($file);
}
示例11: maillist
/**
* Производит рассылку по майллисту.
*
* @param Mail_Message $mail
* @param array $list
* @param string $dir
*
* @return string
*/
static function maillist($mail, $list, $dir = '../bin/maillist')
{
$dir = rtrim($dir, '/');
CMS::mkdirs("{$dir}/messages");
CMS::mkdirs("{$dir}/recipients");
Core::load('Mail.List');
Mail_List::option('root', $dir);
$emails = array();
foreach ($list as $k => $item) {
if (is_string($k) && is_string($item)) {
$item = array('To' => $k, 'Unsubscribe-List' => $item, 'UNSUBSCRIBE' => $item);
} else {
if (is_string($item)) {
$item = array('To' => $item);
}
}
if (is_string($k) && !isset($item['To'])) {
$item['To'] = $k;
}
$emails[] = $item;
}
Mail_List::Spawner($mail, $emails)->id(time() . rand(1111, 9999))->spawn();
}
示例12: set
public function set($value)
{
if (IO_FS::exists($value)) {
$path = IO_FS::Path($value);
$ext = $path->extension;
$filename = $path->basename;
$filename = $this->type->uploaded_file_name($this->name, $this->data, $this->item, $ext, $filename);
$dir = $this->type->uploaded_file_dir($this->name, $this->data, $this->item);
if ($dir) {
if (!IO_FS::exists($dir)) {
CMS::mkdirs($dir);
}
$_dir = preg_replace('{^\\./}', '', $dir);
copy($value, "{$dir}/{$filename}");
$this->remove();
$value = "{$_dir}/{$filename}";
return parent::set($value);
}
}
return $this;
}
示例13: set
public function set($value)
{
if (IO_FS::exists($value)) {
$ext = '';
if ($m = Core_Regexps::match_with_results('{\\.([^\\.]+)$}', $value)) {
$ext = strtolower(trim($m[1]));
}
$filename = $this->type->uploaded_file_name($this->name, $this->data, $this->item, $ext);
$dir = $this->type->uploaded_file_dir($this->name, $this->data, $this->item);
if ($dir) {
if (!IO_FS::exists($dir)) {
CMS::mkdirs($dir);
}
$_dir = preg_replace('{^\\./}', '', $dir);
copy($value, "{$dir}/{$filename}");
IO_FS::rm($uploaded);
$value = "{$_dir}/{$filename}";
return parent::set($value);
}
}
return $this;
}