本文整理汇总了PHP中FileUtil::getDataDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::getDataDirectory方法的具体用法?PHP FileUtil::getDataDirectory怎么用?PHP FileUtil::getDataDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::getDataDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUploadDir
private function createUploadDir()
{
$uploadDirectory = \FileUtil::getDataDirectory() . '/cmfcmf-media-module/media';
if (!is_dir($uploadDirectory)) {
mkdir($uploadDirectory, 0777, true);
}
$htaccess = <<<TXT
deny from all
<FilesMatch "(?i)\\.(css|js|rss|png|gif|jpg|jpeg|psd|svg|txt|rtf|xml|pdf|sdt|odt|doc|docx|pps|ppt|pptx|xls|xlsx|mp3|wav|wma|avi|flv|mov|mp4|rm|vob|wmv|gz|rar|tar.gz|zip|ogg|webm)\$">
order allow,deny
allow from all
</FilesMatch>
TXT;
file_put_contents($uploadDirectory . '/.htaccess', $htaccess);
}
示例2: uninstall
/**
* Uninstall Reviews.
*
* @return boolean True on success, false otherwise.
*/
public function uninstall()
{
// delete stored object workflows
$result = Zikula_Workflow_Util::deleteWorkflowsForModule($this->getName());
if ($result === false) {
return LogUtil::registerError($this->__f('An error was encountered while removing stored object workflows for the %s extension.', array($this->getName())));
}
try {
DoctrineHelper::dropSchema($this->entityManager, $this->listEntityClasses());
} catch (\Exception $e) {
if (System::isDevelopmentMode()) {
return LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage());
}
return LogUtil::registerError($this->__f('An error was encountered while dropping tables for the %s extension.', array($this->name)));
}
// unregister persistent event handlers
EventUtil::unregisterPersistentModuleHandlers($this->name);
// unregister hook subscriber bundles
HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles());
// remove all module vars
$this->delVars();
// remove category registry entries
ModUtil::dbInfoLoad('Categories');
DBUtil::deleteWhere('categories_registry', 'modname = \'' . $this->name . '\'');
// remove all thumbnails
$manager = $this->getServiceManager()->getService('systemplugin.imagine.manager');
$manager->setModule($this->name);
$manager->cleanupModuleThumbs();
// remind user about upload folders not being deleted
$uploadPath = FileUtil::getDataDirectory() . '/' . $this->name . '/';
LogUtil::registerStatus($this->__f('The upload directories at [%s] can be removed manually.', $uploadPath));
// uninstallation successful
return true;
}
示例3: getPathToUploadTo
public function getPathToUploadTo($defaultPath)
{
unset($defaultPath);
return \FileUtil::getDataDirectory() . '/cmfcmf-media-module/watermarks';
}
示例4: getFileBaseFolder
/**
* Retrieve the base path for given object type and upload field combination.
*
* @param string $objectType Name of treated entity type.
* @param string $fieldName Name of upload field.
* @param boolean $ignoreCreate Whether to ignore the creation of upload folders on demand or not.
*
* @return mixed Output.
* @throws Exception if invalid object type is given.
*/
public function getFileBaseFolder($objectType, $fieldName, $ignoreCreate = false)
{
if (!in_array($objectType, $this->getObjectTypes())) {
throw new Exception('Error! Invalid object type received.');
}
$basePath = FileUtil::getDataDirectory() . '/Reviews/';
switch ($objectType) {
case 'review':
$basePath .= 'reviews/coverupload/';
break;
}
$result = DataUtil::formatForOS($basePath);
if (substr($result, -1, 1) != '/') {
// reappend the removed slash
$result .= '/';
}
if (!is_dir($result) && !$ignoreCreate) {
$this->checkAndCreateAllUploadFolders();
}
return $result;
}
示例5: getFileBaseFolder
/**
* Retrieve the base path for given object type and upload field combination.
*
* @param string $objectType Name of treated entity type.
* @param string $fieldName Name of upload field.
* @param array $args Additional arguments.
*
* @return mixed Output.
*/
public static function getFileBaseFolder($objectType, $fieldName)
{
if (!in_array($objectType, self::getObjectTypes())) {
$objectType = self::getDefaultObjectType();
}
$basePath = FileUtil::getDataDirectory() . '/MUBoard/';
switch ($objectType) {
case 'posting':
$basePath .= 'postings/';
switch ($fieldName) {
case 'firstImage':
$basePath .= 'firstimage/';
break;
case 'secondImage':
$basePath .= 'secondimage/';
break;
case 'thirdImage':
$basePath .= 'thirdimage/';
break;
case 'firstFile':
$basePath .= 'firstfile/';
break;
case 'secondFile':
$basePath .= 'secondfile/';
break;
case 'thirdFile':
$basePath .= 'thirdfile/';
break;
}
break;
case 'rank':
$basePath .= 'ranks/uploadimage/';
break;
}
return $basePath;
}
示例6: getUploadRootDir
public function getUploadRootDir()
{
return \FileUtil::getDataDirectory() . '/kmgallery/media';
}