本文整理汇总了PHP中PublicFileManager::uploadConferenceFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager::uploadConferenceFile方法的具体用法?PHP PublicFileManager::uploadConferenceFile怎么用?PHP PublicFileManager::uploadConferenceFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PublicFileManager
的用法示例。
在下文中一共展示了PublicFileManager::uploadConferenceFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadStyleSheet
/**
* Uploads conference custom stylesheet.
* @param $settingName string setting key associated with the file
*/
function uploadStyleSheet($settingName)
{
$conference =& Request::getConference();
$settingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
import('file.PublicFileManager');
$fileManager = new PublicFileManager();
if ($fileManager->uploadError($settingName)) {
return false;
}
if ($fileManager->uploadedFileExists($settingName)) {
$type = $fileManager->getUploadedFileType($settingName);
if ($type != 'text/plain' && $type != 'text/css') {
return false;
}
$uploadName = $settingName . '.css';
if ($fileManager->uploadConferenceFile($conference->getId(), $settingName, $uploadName)) {
$value = array('name' => $fileManager->getUploadedFileName($settingName), 'uploadName' => $uploadName, 'dateUploaded' => date("Y-m-d g:i:s"));
$settingsDao->updateSetting($conference->getId(), $settingName, $value, 'object');
return true;
}
}
return false;
}
示例2: uploadImage
/**
* Uploads a conference image.
* @param $settingName string setting key associated with the file
* @param $locale string
*/
function uploadImage($settingName, $locale)
{
$conference =& Request::getConference();
$settingsDao = DAORegistry::getDAO('ConferenceSettingsDAO');
$faviconTypes = array('.ico', '.png', '.gif');
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
if ($fileManager->uploadError($settingName)) {
return false;
}
if ($fileManager->uploadedFileExists($settingName)) {
$type = $fileManager->getUploadedFileType($settingName);
$extension = $fileManager->getImageExtension($type);
if (!$extension) {
return false;
}
if ($settingName == 'conferenceFavicon' && !in_array($extension, $faviconTypes)) {
return false;
}
$uploadName = $settingName . '_' . $locale . $extension;
if ($fileManager->uploadConferenceFile($conference->getId(), $settingName, $uploadName)) {
// Get image dimensions
$filePath = $fileManager->getConferenceFilesPath($conference->getId());
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
$value = $conference->getSetting($settingName);
$value[$locale] = array('name' => $fileManager->getUploadedFileName($settingName), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'mimeType' => $fileManager->getUploadedFileType($settingName), 'dateUploaded' => Core::getCurrentDate());
$settingsDao->updateSetting($conference->getId(), $settingName, $value, 'object', true);
return true;
}
}
return false;
}