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


PHP files::makeDir方法代码示例

本文整理汇总了PHP中files::makeDir方法的典型用法代码示例。如果您正苦于以下问题:PHP files::makeDir方法的具体用法?PHP files::makeDir怎么用?PHP files::makeDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在files的用法示例。


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

示例1: writeFile

 public function writeFile($type, $f, $content)
 {
     $files = $this->getFilesFromType($type);
     if (!isset($files[$f])) {
         throw new Exception(__('File does not exist.'));
     }
     try {
         $dest = $this->getDestinationFile($type, $f);
         if ($dest == false) {
             throw new Exception();
         }
         if ($type == 'tpl' && !is_dir(dirname($dest))) {
             files::makeDir(dirname($dest));
         }
         $fp = @fopen($dest, 'wb');
         if (!$fp) {
             throw new Exception('tocatch');
         }
         $content = preg_replace('/(\\r?\\n)/m', "\n", $content);
         $content = preg_replace('/\\r/m', "\n", $content);
         fwrite($fp, $content);
         fclose($fp);
         # Updating inner files list
         $this->updateFileInList($type, $f, $dest);
     } catch (Exception $e) {
         throw new Exception(sprintf(__('Unable to write file %s. Please check your theme files and folders permissions.'), $f));
     }
 }
开发者ID:HackerMajor,项目名称:root,代码行数:28,代码来源:class.themeEditor.php

示例2: writeFileFromPost

 /**
  * Ecrit un fichier avec les données envoyées en POST.
  *
  * @param string $sFilename
  * @return void
  */
 public function writeFileFromPost($sFilename)
 {
     if (!is_dir(dirname($sFilename))) {
         files::makeDir(dirname($sFilename), true);
     }
     $aValues = array_merge($this->getDefaultValues(), $this->getPostValues());
     $sFileContent = $this->getFileContent($aValues);
     file_put_contents($sFilename, $sFileContent);
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:class.oktDefinitionsLessEditor.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param string $sLogDir
  */
 public function __construct($sLogDir = null)
 {
     if (is_null($sLogDir)) {
         $sLogDir = OKT_LOG_PATH;
     }
     $this->sLogDir = $sLogDir;
     if (!is_dir($this->sLogDir)) {
         files::makeDir($this->sLogDir, true);
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:class.oktSimpleLog.php

示例4: makeDirs

 /**
  * Make basis directories
  *
  */
 protected function makeDirs()
 {
     if (file_exists($this->dir)) {
         throw new Exception(sprintf(__('m_development_bootstrap_module_allready_exists'), $this->id));
     }
     files::makeDir($this->dir);
     files::makeDir($this->dir . '/_install', true);
     files::makeDir($this->dir . '/_install/tpl', true);
     files::makeDir($this->dir . '/inc', true);
     files::makeDir($this->dir . '/inc/admin', true);
     files::makeDir($this->dir . '/locales', true);
     files::makeDir($this->dir . '/locales/fr', true);
     files::makeDir($this->dir . '/locales/en', true);
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:18,代码来源:class.module.bootstrap.simple.php

示例5: __construct

 /**
  * Object constructor.
  *
  * @param object $core oktCore instance
  * @param string $type Media type filter
  * @return void
  */
 public function __construct($okt, $type = '')
 {
     $this->okt = $okt;
     $this->db = $okt->db;
     $this->config = $okt->media_manager->config;
     $this->t_media = $this->db->prefix . 'mod_media';
     $this->t_users = $this->db->prefix . 'core_users';
     $this->icon_img = OKT_PUBLIC_URL . '/img/media/%s.png';
     $root = OKT_UPLOAD_PATH . '/media_manager/';
     if (!is_dir($root)) {
         files::makeDir($root, true);
     }
     if (preg_match('#^http(s)?://#', OKT_UPLOAD_URL . '/media_manager/')) {
         $root_url = rawurldecode(OKT_UPLOAD_URL . '/media_manager/');
     } else {
         $root_url = rawurldecode($this->okt->config->app_host . path::clean(OKT_UPLOAD_URL . '/media_manager/'));
     }
     if (!is_dir($root)) {
         throw new Exception(sprintf(__('Directory %s does not exist.'), $root));
     }
     $this->type = $type;
     parent::__construct($root, $root_url);
     $this->chdir('');
     $this->path = OKT_UPLOAD_URL . '/media_manager/';
     //		$this->addExclusion(DC_RC_PATH);
     //		$this->addExclusion(__DIR__.'/../');
     $this->exclude_pattern = $this->config->media_exclusion;
     # Event handlers
     $this->addFileHandler('image/jpeg', 'create', array($this, 'imageThumbCreate'));
     $this->addFileHandler('image/png', 'create', array($this, 'imageThumbCreate'));
     $this->addFileHandler('image/gif', 'create', array($this, 'imageThumbCreate'));
     $this->addFileHandler('image/png', 'update', array($this, 'imageThumbUpdate'));
     $this->addFileHandler('image/jpeg', 'update', array($this, 'imageThumbUpdate'));
     $this->addFileHandler('image/gif', 'update', array($this, 'imageThumbUpdate'));
     $this->addFileHandler('image/png', 'remove', array($this, 'imageThumbRemove'));
     $this->addFileHandler('image/jpeg', 'remove', array($this, 'imageThumbRemove'));
     $this->addFileHandler('image/gif', 'remove', array($this, 'imageThumbRemove'));
     $this->addFileHandler('image/jpeg', 'create', array($this, 'imageMetaCreate'));
     # Thumbnails sizes
     $this->thumb_sizes['m'][0] = abs($this->config->media_img_m_size);
     $this->thumb_sizes['s'][0] = abs($this->config->media_img_s_size);
     $this->thumb_sizes['t'][0] = abs($this->config->media_img_t_size);
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:50,代码来源:class.oktMedia.php

示例6: getVersionInfo

 /**
  * Récupération des informations de version sur le dépot distant.
  *
  */
 protected function getVersionInfo($sVersionType)
 {
     $this->resetVersionInfos();
     $sVersionType = $sVersionType == 'dev' ? 'dev' : 'stable';
     $this->sCacheFile = OKT_CACHE_PATH . '/releases/okatea-' . $sVersionType;
     # Check cached file
     if (is_readable($this->sCacheFile) && filemtime($this->sCacheFile) > strtotime($this->sCacheTtl)) {
         $c = @file_get_contents($this->sCacheFile);
         $c = @unserialize($c);
         if (is_array($c)) {
             $this->aVersionInfo = $c;
             return $this->aVersionInfo;
         }
     }
     $sCacheDir = dirname($this->sCacheFile);
     $bCanWrite = !is_dir($sCacheDir) && is_writable(dirname($sCacheDir)) || !file_exists($this->sCacheFile) && is_writable($sCacheDir) || is_writable($this->sCacheFile);
     # If we can't write file, don't bug host with queries
     if (!$bCanWrite) {
         return $this->aVersionInfo;
     }
     if (!is_dir($sCacheDir)) {
         try {
             files::makeDir($sCacheDir);
         } catch (Exception $e) {
             return $this->aVersionInfo;
         }
     }
     # Try to get latest version number
     try {
         $sFilename = $this->sRepositoryPath . '/packages/versions.xml';
         if (!file_exists($sFilename)) {
             throw new Exception('File version.xml not found.');
         }
         $this->readVersion(file_get_contents($this->sRepositoryPath . '/packages/versions.xml'), $sVersionType);
     } catch (Exception $e) {
         return $this->aVersionInfo;
     }
     # Create cache
     file_put_contents($this->sCacheFile, serialize($this->aVersionInfo));
     return $this->aVersionInfo;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:45,代码来源:module_handler.php

示例7: getVersionInfo

 /**
  * Récupération des informations de version sur le dépot distant.
  *
  */
 public function getVersionInfo()
 {
     # Check cached file
     if (is_readable($this->sCacheFile) && filemtime($this->sCacheFile) > strtotime($this->sCacheTtl)) {
         $c = @file_get_contents($this->sCacheFile);
         $c = @unserialize($c);
         if (is_array($c)) {
             $this->aVersionInfo = $c;
             return;
         }
     }
     $sCacheDir = dirname($this->sCacheFile);
     $bCanWrite = !is_dir($sCacheDir) && is_writable(dirname($sCacheDir)) || !file_exists($this->sCacheFile) && is_writable($sCacheDir) || is_writable($this->sCacheFile);
     # If we can't write file, don't bug host with queries
     if (!$bCanWrite) {
         return;
     }
     if (!is_dir($sCacheDir)) {
         try {
             files::makeDir($sCacheDir);
         } catch (Exception $e) {
             return;
         }
     }
     # Try to get latest version number
     try {
         $sPath = '';
         $oClient = netHttp::initClient($this->sUrl, $sPath);
         if ($oClient !== false) {
             $oClient->setTimeout(4);
             $oClient->setUserAgent($_SERVER['HTTP_USER_AGENT']);
             $oClient->get($sPath);
             $this->readVersion($oClient->getContent());
         }
     } catch (Exception $e) {
     }
     # Create cache
     file_put_contents($this->sCacheFile, serialize($this->aVersionInfo));
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:43,代码来源:class.oktUpdate.php

示例8: makeDir

 /**
  * New directory
  *
  * Creates a new directory <var>$d</var> relative to working directory.
  *
  * @param string	$d			Directory name
  */
 public function makeDir($d)
 {
     files::makeDir($this->pwd . '/' . path::clean($d));
 }
开发者ID:HackerMajor,项目名称:root,代码行数:11,代码来源:class.filemanager.php

示例9: sprintf

}
if (!is_writable(dirname(DC_RC_PATH))) {
    $err = '<p>' . sprintf(__('Path <strong>%s</strong> is not writable.'), path::real(dirname(DC_RC_PATH))) . '</p>' . '<p>' . __('Dotclear installation wizard could not create configuration file for you. ' . 'You must change folder right or create the <strong>config.php</strong> ' . 'file manually, please refer to ' . '<a href="http://dotclear.org/documentation/2.0/admin/install">' . 'the documentation</a> to learn how to do this.') . '</p>';
}
$DBDRIVER = !empty($_POST['DBDRIVER']) ? $_POST['DBDRIVER'] : (function_exists('mysqli_connect') ? 'mysqli' : 'mysql');
$DBHOST = !empty($_POST['DBHOST']) ? $_POST['DBHOST'] : '';
$DBNAME = !empty($_POST['DBNAME']) ? $_POST['DBNAME'] : '';
$DBUSER = !empty($_POST['DBUSER']) ? $_POST['DBUSER'] : '';
$DBPASSWORD = !empty($_POST['DBPASSWORD']) ? $_POST['DBPASSWORD'] : '';
$DBPREFIX = !empty($_POST['DBPREFIX']) ? $_POST['DBPREFIX'] : 'dc_';
if (!empty($_POST)) {
    try {
        if ($DBDRIVER == 'sqlite') {
            if (strpos($DBNAME, '/') === false) {
                $sqlite_db_directory = dirname(DC_RC_PATH) . '/../db/';
                files::makeDir($sqlite_db_directory, true);
                # Can we write sqlite_db_directory ?
                if (!is_writable($sqlite_db_directory)) {
                    throw new Exception(sprintf(__('Cannot write "%s" directory.'), path::real($sqlite_db_directory, false)));
                }
                $DBNAME = $sqlite_db_directory . $DBNAME;
            }
        }
        # Tries to connect to database
        try {
            $con = dbLayer::init($DBDRIVER, $DBHOST, $DBNAME, $DBUSER, $DBPASSWORD);
        } catch (Exception $e) {
            throw new Exception('<p>' . __($e->getMessage()) . '</p>');
        }
        # Checks system capabilites
        require dirname(__FILE__) . '/check.php';
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:wizard.php

示例10: canWriteImages

 public static function canWriteImages($create = false)
 {
     global $core;
     $public = path::real($core->blog->public_path);
     $imgs = self::imagesPath();
     if (!function_exists('imagecreatetruecolor') || !function_exists('imagepng') || !function_exists('imagecreatefrompng')) {
         return false;
     }
     if (!is_dir($public)) {
         return false;
     }
     if (!is_dir($imgs)) {
         if (!is_writable($public)) {
             return false;
         }
         if ($create) {
             files::makeDir($imgs);
         }
         return true;
     }
     if (!is_writable($imgs)) {
         return false;
     }
     return true;
 }
开发者ID:HackerMajor,项目名称:root,代码行数:25,代码来源:class.blowup.config.php

示例11: empty

         $core->blog->settings->dcCKEditorAddons->put('active', $dcckeditor_addons_active, 'boolean');
         // change other settings only if they were in html page
         if ($dcckeditor_addons_was_actived) {
             $dcckeditor_addons_check_validity = empty($_POST['dcckeditor_addons_check_validity']) ? false : true;
             $core->blog->settings->dcCKEditorAddons->put('check_validity', $dcckeditor_addons_check_validity, 'boolean');
             if (empty($_POST['dcckeditor_addons_repository_path']) || trim($_POST['dcckeditor_addons_repository_path']) == '') {
                 $tmp_repository = $core->blog->public_path . '/dcckeditor_addons';
             } else {
                 $tmp_repository = trim($_POST['dcckeditor_addons_repository_path']);
             }
             if (is_dir($tmp_repository) && is_writable($tmp_repository)) {
                 $core->blog->settings->related->put('repository_path', $tmp_repository);
                 $repository = $tmp_repository;
             } else {
                 try {
                     files::makeDir($tmp_repository);
                     $core->blog->settings->dcCKEditorAddons->put('repository_path', $tmp_repository);
                     $repository = $tmp_repository;
                 } catch (Exception $e) {
                     throw new Exception(sprintf(__('Directory "%s" for dcCKEditorAddons plugins repository needs to allow read and write access.'), $tmp_repository));
                 }
             }
         }
         dcPage::addSuccessNotice(__('The configuration has been updated.'));
         http::redirect($p_url);
     } catch (Exception $e) {
         $core->error->add($e->getMessage());
     }
 } elseif (!empty($_POST['upload_plugin']) && !empty($_FILES['plugin_file']) || !empty($_POST['fetch_plugin']) && !empty($_POST['plugin_url'])) {
     if (empty($_POST['your_pwd']) || !$core->auth->checkPassword($core->auth->crypt($_POST['your_pwd']))) {
         dcPage::addErrorNotice(__('Password verification failed'));
开发者ID:nikrou,项目名称:dcCKEditorAddons,代码行数:31,代码来源:index.php

示例12: installPackage

 public static function installPackage($zip_file, dcModules &$modules)
 {
     $zip = new fileUnzip($zip_file);
     $zip->getList(false, '#(^|/)(__MACOSX|\\.svn|\\.hg|\\.git|\\.DS_Store|\\.directory|Thumbs\\.db)(/|$)#');
     $zip_root_dir = $zip->getRootDir();
     $define = '';
     if ($zip_root_dir != false) {
         $target = dirname($zip_file);
         $destination = $target . '/' . $zip_root_dir;
         $define = $zip_root_dir . '/_define.php';
         $has_define = $zip->hasFile($define);
     } else {
         $target = dirname($zip_file) . '/' . preg_replace('/\\.([^.]+)$/', '', basename($zip_file));
         $destination = $target;
         $define = '_define.php';
         $has_define = $zip->hasFile($define);
     }
     if ($zip->isEmpty()) {
         $zip->close();
         unlink($zip_file);
         throw new Exception(__('Empty module zip file.'));
     }
     if (!$has_define) {
         $zip->close();
         unlink($zip_file);
         throw new Exception(__('The zip file does not appear to be a valid Dotclear module.'));
     }
     $ret_code = 1;
     if (!is_dir($destination)) {
         try {
             files::makeDir($destination, true);
             $sandbox = clone $modules;
             $zip->unzip($define, $target . '/_define.php');
             $sandbox->resetModulesList();
             $sandbox->requireDefine($target, basename($destination));
             unlink($target . '/_define.php');
             $new_errors = $sandbox->getErrors();
             if (!empty($new_errors)) {
                 $new_errors = is_array($new_errors) ? implode(" \n", $new_errors) : $new_errors;
                 throw new Exception($new_errors);
             }
             files::deltree($destination);
         } catch (Exception $e) {
             $zip->close();
             unlink($zip_file);
             files::deltree($destination);
             throw new Exception($e->getMessage());
         }
     } else {
         # test for update
         $sandbox = clone $modules;
         $zip->unzip($define, $target . '/_define.php');
         $sandbox->resetModulesList();
         $sandbox->requireDefine($target, basename($destination));
         unlink($target . '/_define.php');
         $new_modules = $sandbox->getModules();
         if (!empty($new_modules)) {
             $tmp = array_keys($new_modules);
             $id = $tmp[0];
             $cur_module = $modules->getModules($id);
             if (!empty($cur_module) && (defined('DC_DEV') && DC_DEV === true || dcUtils::versionsCompare($new_modules[$id]['version'], $cur_module['version'], '>', true))) {
                 # delete old module
                 if (!files::deltree($destination)) {
                     throw new Exception(__('An error occurred during module deletion.'));
                 }
                 $ret_code = 2;
             } else {
                 $zip->close();
                 unlink($zip_file);
                 throw new Exception(sprintf(__('Unable to upgrade "%s". (older or same version)'), basename($destination)));
             }
         } else {
             $zip->close();
             unlink($zip_file);
             throw new Exception(sprintf(__('Unable to read new _define.php file')));
         }
     }
     $zip->unzipAll($target);
     $zip->close();
     unlink($zip_file);
     return $ret_code;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:82,代码来源:class.dc.modules.php

示例13: function

	var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
	window.addEventListener("keydown", function(e){
		kkeys.push(e.keyCode);
		if (kkeys.toString().indexOf( konami ) >= 0) {
			window.location = "http://jquery.com/";
		}
	}, true);
}
');
# News feed reader
if ($okt->config->news_feed['enabled'] && !empty($okt->config->news_feed['url'][$okt->user->language])) {
    require_once OKT_VENDOR_PATH . '/simplepie/autoloader.php';
    // We'll process this feed with all of the default options.
    $feed = new SimplePie();
    if (!is_dir(OKT_CACHE_PATH . '/feeds/')) {
        files::makeDir(OKT_CACHE_PATH . '/feeds/', true);
    }
    $feed->set_cache_location(OKT_CACHE_PATH . '/feeds/');
    // Set which feed to process.
    $feed->set_feed_url($okt->config->news_feed['url'][$okt->user->language]);
    // Run SimplePie.
    $feed_success = $feed->init();
    // This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
    $feed->handle_content_type();
    $okt->page->css->addCss('
		#news_feed_list {
			height: 13em;
			width: 28%;
			overflow-y: scroll;
			overflow-x: hidden;
			padding-right: 0.8em;
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:index.php

示例14: newDir

 function newDir($name)
 {
     $name = str_replace('/', '', $name);
     return files::makeDir($this->root . $this->base_path . '/' . $name);
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:5,代码来源:class.filemanager.php

示例15: testTargetDir

 protected function testTargetDir($dir)
 {
     if (is_dir($dir) && !is_writable($dir)) {
         throw new Exception(__('Unable to write in target directory, permission denied.'));
     }
     if (!is_dir($dir)) {
         files::makeDir($dir, true);
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:9,代码来源:class.unzip.php


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