本文整理汇总了PHP中FileManager类的典型用法代码示例。如果您正苦于以下问题:PHP FileManager类的具体用法?PHP FileManager怎么用?PHP FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: deposits
/**
* Provide an endpoint for the PLN staging server to retrieve a deposit
* @param array $args
* @param Request $request
*/
function deposits($args, &$request)
{
$journal =& $request->getJournal();
$depositDao =& DAORegistry::getDAO('DepositDAO');
$fileManager = new FileManager();
$dispatcher = $request->getDispatcher();
$depositUuid = !isset($args[0]) || empty($args[0]) ? null : $args[0];
// sanitize the input
if (!preg_match('/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/', $depositUuid)) {
error_log(__("plugins.generic.pln.error.handler.uuid.invalid"));
$dispatcher->handle404();
return FALSE;
}
$deposit =& $depositDao->getDepositByUUID($journal->getId(), $depositUuid);
if (!$deposit) {
error_log(__("plugins.generic.pln.error.handler.uuid.notfound"));
$dispatcher->handle404();
return FALSE;
}
$depositPackage = new DepositPackage($deposit, null);
$depositBag = $depositPackage->getPackageFilePath();
if (!$fileManager->fileExists($depositBag)) {
error_log("plugins.generic.pln.error.handler.file.notfound");
$dispatcher->handle404();
return FALSE;
}
return $fileManager->downloadFile($depositBag, mime_content_type($depositBag), TRUE);
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:33,代码来源:PLNHandler.inc.php
示例2: __construct
/**
* DiscoverRowBuilder constructor.
* @param array $location
*/
function __construct(array $location)
{
echo '
<div id="' . $location['id_location'] . '" class="contentLocation">
<table style="width:100%" class="table" onclick="openlocation(' . $location['id_location'] . ', \'' . $location['name'] . '\')">
<tr>
<th>Name:</th>
<th>Description:</th>
</tr>
<tr>
<td>' . $location['name'] . '</td>
<td>' . $location['description'] . '</td>
</tr>
</table>';
$filemanager = new FileManager();
$stmt = $filemanager->getImages($location['id_location']);
$images = array();
while ($idImage = sqlsrv_fetch_array($stmt)['id_image']) {
array_push($images, $idImage);
}
if (count($images) > 0) {
echo '<div class="newSlides">';
foreach ($images as $image) {
$fileName = glob('../images/' . $image . '.*')[0];
echo '<img src="../images/' . $fileName . '"\\>';
}
echo '</div>';
}
echo '</div>';
}
开发者ID:PascalHonegger,项目名称:M151,代码行数:34,代码来源:DiscoverRowBuilder.php
示例3: generateLocaleFile
/**
* Perform message string munging.
* @param $localeFile string
* @param $localeFilePath string
* @param $outFile string
*/
function generateLocaleFile($localeFile, $localeFilePath, $outFile)
{
$localeData = LocaleFile::load($localeFilePath);
if (!isset($localeData)) {
printf('Invalid locale \'%s\'', $this->inLocale);
exit(1);
}
$destDir = dirname($outFile);
if (!file_exists($destDir)) {
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if (!$fileManager->mkdir($destDir)) {
printf('Failed to createDirectory \'%s\'', $destDir);
exit(1);
}
}
$fp = fopen($outFile, 'wb');
if (!$fp) {
printf('Failed to write to \'%s\'', $outFile);
exit(1);
}
$dtdLocation = substr($localeFilePath, 0, 3) == 'lib' ? '../../dtd/locale.dtd' : '../../lib/pkp/dtd/locale.dtd';
fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<!DOCTYPE locale SYSTEM \"{$dtdLocation}\">\n\n" . "<!--\n" . " * {$localeFile}\n" . " *\n" . " * Copyright (c) 2013-2016 Simon Fraser University Library\n" . " * Copyright (c) 2003-2016 John Willinsky\n" . " * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.\n" . " *\n" . sprintf(" * Localization strings for the %s (%s) locale.\n", $this->outLocale, DEFAULT_OUT_LOCALE_NAME) . " *\n" . " -->\n\n" . sprintf("<locale name=\"%s\" full_name=\"%s\">\n", $this->outLocale, DEFAULT_OUT_LOCALE_NAME));
foreach ($localeData as $key => $message) {
$outMessage = $this->fancifyString($message);
if (strstr($outMessage, '<') || strstr($outMessage, '>')) {
$outMessage = '<![CDATA[' . $outMessage . ']]>';
}
fwrite($fp, sprintf("\t<message key=\"%s\">%s</message>\n", $key, $outMessage));
}
fwrite($fp, "</locale>\n");
fclose($fp);
}
开发者ID:NateWr,项目名称:omp,代码行数:39,代码来源:genTestLocale.php
示例4: clear
public static function clear($key)
{
// Clear cache by deleting requested file
$filename = md5($key);
$path = __DIR__ . self::$cache_root . $filename;
$file = new FileManager($path);
$file->delete();
}
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:8,代码来源:Cache.php
示例5: _cacheMiss
function _cacheMiss(&$cache, $id)
{
$allCodelistItems =& Registry::get('all' . $this->getListName() . 'CodelistItems', true, null);
if ($allCodelistItems === null) {
// Add a locale load to the debug notes.
$notes =& Registry::get('system.debug.notes');
$locale = $cache->cacheId;
if ($locale == null) {
$locale = AppLocale::getLocale();
}
$filename = $this->getFilename($locale);
$notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
// Reload locale registry file
$xmlDao = new XMLDAO();
$listName =& $this->getListName();
// i.e., 'List30'
import('lib.pkp.classes.codelist.ONIXParserDOMHandler');
$handler = new ONIXParserDOMHandler($listName);
import('lib.pkp.classes.xslt.XSLTransformer');
import('lib.pkp.classes.file.FileManager');
import('classes.file.TemporaryFileManager');
$temporaryFileManager = new TemporaryFileManager();
$fileManager = new FileManager();
$tmpName = tempnam($temporaryFileManager->getBasePath(), 'ONX');
$xslTransformer = new XSLTransformer();
$xslTransformer->setParameters(array('listName' => $listName));
$xslTransformer->setRegisterPHPFunctions(true);
$xslFile = 'lib/pkp/xml/onixFilter.xsl';
$filteredXml = $xslTransformer->transform($filename, XSL_TRANSFORMER_DOCTYPE_FILE, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING);
if (!$filteredXml) {
assert(false);
}
$data = null;
if (is_writeable($tmpName)) {
$fp = fopen($tmpName, 'wb');
fwrite($fp, $filteredXml);
fclose($fp);
$data = $xmlDao->parseWithHandler($tmpName, $handler);
$fileManager->deleteFile($tmpName);
} else {
fatalError('misconfigured directory permissions on: ' . $temporaryFileManager->getBasePath());
}
// Build array with ($charKey => array(stuff))
if (isset($data[$listName])) {
foreach ($data[$listName] as $code => $codelistData) {
$allCodelistItems[$code] = $codelistData;
}
}
if (is_array($allCodelistItems)) {
asort($allCodelistItems);
}
$cache->setEntireCache($allCodelistItems);
}
return null;
}
开发者ID:yuricampos,项目名称:ojs,代码行数:55,代码来源:ONIXCodelistItemDAO.inc.php
示例6: createLocation
/**
* @param int $idCreator
* @param string $name
* @param string $description
* @param string $position
*/
public function createLocation(int $idCreator, string $name, string $description, string $position)
{
if (strlen($name) < 50 && strlen($name) > 1 && strlen($description) < 100 && strlen($description) > 1) {
$inserted = $this->model->creatLocation($idCreator, $name, $description, $position);
if ($inserted) {
if (isset($_FILES['userfile']) && count($_FILES['userfile']['name']) > 0) {
$filemanager = new FileManager();
$filemanager->setImage($_FILES['userfile'], $inserted);
}
return;
}
}
http_response_code(500);
}
开发者ID:PascalHonegger,项目名称:M151,代码行数:20,代码来源:LocationController.php
示例7: select
function select()
{
// Check for request forgeries
if (!JSession::checkToken('request')) {
echo json_encode(array('status' => '0', 'error' => JText::_('JINVALID_TOKEN')));
return;
}
// Get the user
$user = JFactory::getUser();
$params = JComponentHelper::getParams('com_j2xml');
$remote_folder = $params->get('remote_folder', '../media/com_j2xml/files');
jimport('eshiol.filemanager.filemanager');
$browser = new FileManager(array('directory' => $remote_folder));
$browser->fireEvent(!empty($_GET['event']) ? $_GET['event'] : null);
}
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:15,代码来源:file.json.php
示例8: addCustomLocale
function addCustomLocale($hookName, $args)
{
$locale =& $args[0];
$localeFilename =& $args[1];
$journal = Request::getJournal();
$journalId = $journal->getId();
$publicFilesDir = Config::getVar('files', 'public_files_dir');
$customLocalePath = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if ($fileManager->fileExists($customLocalePath)) {
AppLocale::registerLocaleFile($locale, $customLocalePath, false);
}
return true;
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:15,代码来源:CustomLocalePlugin.inc.php
示例9: upload
/**
* {@inheritdoc}
*/
public function upload($fp, $dst, $name, $tmpname)
{
$this->setConnectorFromPlugin();
// upload file by elfinder.
$result = parent::upload($fp, $dst, $name, $tmpname);
$name = $result['name'];
$filtered = \URLify::filter($result['name'], 80);
if (strcmp($name, $filtered) != 0) {
/*$arg = array('target' => $file['hash'], 'name' => $filtered);
$elFinder->exec('rename', $arg);*/
$this->rename($result['hash'], $filtered);
}
$realPath = $this->realpath($result['hash']);
if (!empty($realPath)) {
// Getting file info
//$info = $elFinder->exec('file', array('target' => $file['hash']));
/** @var elFinderVolumeLocalFileSystem $volume */
//$volume = $info['volume'];
//$root = $volume->root();
//var/www/chamilogits/data/courses/NEWONE/document
$realPathRoot = $this->getCourseDocumentSysPath();
// Removing course path
$realPath = str_replace($realPathRoot, '/', $realPath);
\FileManager::add_document($this->connector->course, $realPath, 'file', intval($result['size']), $result['name']);
}
return $result;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:CourseDriver.php
示例10: HotPotGCt
/**
* Garbage collector
*/
function HotPotGCt($folder, $flag, $userID)
{
// Garbage Collector
$filelist = array();
if ($dir = @opendir($folder)) {
while (($file = readdir($dir)) !== false) {
if ($file != ".") {
if ($file != "..") {
$full_name = $folder . "/" . $file;
if (is_dir($full_name)) {
HotPotGCt($folder . "/" . $file, $flag);
} else {
$filelist[] = $file;
}
}
}
}
closedir($dir);
}
while (list($key, $val) = each($filelist)) {
if (stristr($val, $userID . ".t.html")) {
if ($flag == 1) {
FileManager::my_delete($folder . "/" . $val);
} else {
echo $folder . "/" . $val . "<br />";
}
}
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:32,代码来源:GC.php
示例11: login
static function login($data)
{
if (!isset($data["username"])) {
return self::UM_NoUserError;
} else {
$u = false;
$logged = false;
//check nick and password
$u = self::loadUserByNickname($data["username"]);
// assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura
if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) {
$logged = true;
}
if ($u === false) {
//check mail and password
$u = self::loadUserByMail($data["username"]);
// assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura
if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) {
header("location: " . FileManager::appendToRootPath());
}
}
if ($u !== false) {
if ($logged) {
if (Session::start($u)) {
return true;
} else {
return self::UM_NoSessionError;
}
}
return self::UM_NoPasswordError;
}
return self::UM_NoUserError;
}
}
开发者ID:Esisto,项目名称:IoEsisto,代码行数:34,代码来源:UserManager.php
示例12: addCustomLocale
function addCustomLocale($hookName, $args)
{
$locale =& $args[0];
$localeFilename =& $args[1];
$request =& $this->getRequest();
$conference = $request->getConference();
$conferenceId = $conference->getId();
$publicFilesDir = Config::getVar('files', 'public_files_dir');
$customLocalePath = $publicFilesDir . DIRECTORY_SEPARATOR . 'conferences' . DIRECTORY_SEPARATOR . $conferenceId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFilename;
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if ($fileManager->fileExists($customLocalePath)) {
AppLocale::registerLocaleFile($locale, $customLocalePath, true);
}
return true;
}
开发者ID:artkuo,项目名称:ocs,代码行数:16,代码来源:CustomLocalePlugin.inc.php
示例13: initWorkingDir
/**
* Initialize the working directory and ensure it exists
* @return string Path to working directory
*/
public function initWorkingDir()
{
// Check if working directory is already initialized
if (is_dir($this->workingDir)) {
return $this->workingDir;
}
// Get temp target directory
$tmpDir = Configure::read('Chaucer.instanceName') . '/' . $this->bookId;
$targetDir = Folder::addPathElement($this->FileManager->getTmpPath(), $tmpDir);
// Create and return dir
if (!$this->FileManager->createDir($targetDir)) {
throw new Exception('Unable to create working directory: ' . $targetDir);
}
CakeLog::debug('[CommonProcessor::initWorkingDir] working dir: ' . $targetDir);
return $targetDir;
}
开发者ID:skypeter1,项目名称:webapps,代码行数:20,代码来源:CommonProcessor.php
示例14: testCompareLines
/**
* This function tests the replaceWikiLinks function in the Util class.
* It uses the testData in testUtilStrings_wikiLinks.txt and compares the
* output from the replaceWikiLinks function with the expected results in
* the testUtilStrings_wikiLinks_expectedResults.txt
*/
function testCompareLines()
{
// LOADTIME
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
$handleInput = fopen('../testData/2009-01-15-english-infobox.nt', 'r');
$handleExpRes = fopen('../testData/2009-01-06-english-infobox.nt', 'r');
$x = 1;
while (!feof($handleInput) && !feof($handleExpRes) && $x < 1001) {
$bufferInput = FileManager::getNextFileLine($handleInput);
$bufferExpRes = FileManager::getNextFileLine($handleExpRes);
$this->assertEqual($bufferExpRes, $bufferInput, 'Line:' . $x);
echo 'Input: ';
var_dump(htmlspecialchars($bufferInput));
echo '<br />ExpRes: ';
var_dump(htmlspecialchars($bufferExpRes));
echo '<br />';
$x++;
}
fclose($handleInput);
fclose($handleExpRes);
// LOADTIME
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round($finish - $start, 4);
echo '<p>Page generated in ' . $total_time . ' seconds</p>';
}
开发者ID:ljarray,项目名称:dbpedia,代码行数:37,代码来源:DumpTest.php
示例15: create_backup_is_admin
function create_backup_is_admin($_cid)
{
if (isset($_GET['session']) && $_GET['session']) {
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$_cid = true;
$is_courseAdmin = true;
} else {
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
}
$archive_file = $_GET['archive'];
$archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
list($extension) = FileManager::getextension($archive_file);
if (empty($extension) || !file_exists($archive_path . $archive_file)) {
return false;
}
$extension = strtolower($extension);
$content_type = '';
if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
$content_type = 'application/force-download';
// TODO: The following unclear condition is commented ant is to be checked. A replacement has been proposed.
//} elseif (strtolower($extension) == 'zip' || ('html' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin))) {
} elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
//
$content_type = 'application/force-download';
}
if (empty($content_type)) {
return false;
}
return true;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:download.lib.php
示例16: carga
public static function carga($clase)
{
$archivo = "classes/" . str_replace('\\', '/', $clase) . '.php';
if (file_exists($archivo)) {
require $archivo;
} else {
if (file_exists('../' . $archivo)) {
require '../' . $archivo;
} else {
if (file_exists('../../' . $archivo)) {
require '../../' . $archivo;
} else {
if (file_exists('../../../' . $archivo)) {
require '../../../' . $archivo;
} else {
$modules = FileManager::scan('../modules');
foreach ($modules as $value) {
if (file_exists($value . '/' . $archivo)) {
require $value . '/' . $archivo;
break;
}
}
}
}
}
}
}
开发者ID:developdms,项目名称:Practica-5,代码行数:27,代码来源:AutoLoad.php
示例17: addPluginVersions
/**
* For 2.3 upgrade: Add initial plugin data to versions table
* @return boolean
*/
function addPluginVersions()
{
$versionDao =& DAORegistry::getDAO('VersionDAO');
import('site.VersionCheck');
$categories = PluginRegistry::getCategories();
foreach ($categories as $category) {
PluginRegistry::loadCategory($category, true);
$plugins = PluginRegistry::getPlugins($category);
foreach ($plugins as $plugin) {
$versionFile = $plugin->getPluginPath() . '/version.xml';
if (FileManager::fileExists($versionFile)) {
$versionInfo =& VersionCheck::parseVersionXML($versionFile);
$pluginVersion = $versionInfo['version'];
$pluginVersion->setCurrent(1);
$versionDao->insertVersion($pluginVersion);
} else {
$pluginVersion = new Version();
$pluginVersion->setMajor(1);
$pluginVersion->setMinor(0);
$pluginVersion->setRevision(0);
$pluginVersion->setBuild(0);
$pluginVersion->setDateInstalled(Core::getCurrentDate());
$pluginVersion->setCurrent(1);
$pluginVersion->setProductType('plugins.' . $category);
$pluginVersion->setProduct(basename($plugin->getPluginPath()));
$versionDao->insertVersion($pluginVersion);
}
}
}
}
开发者ID:jalperin,项目名称:harvester,代码行数:34,代码来源:Upgrade.inc.php
示例18: getCover
/**
* Вывод обложки для file manager
* @param int $id идентификатор модели
* @param string $name имя модели
* @param string $link ссылка, если задана, то выводится ссылка, иначе галерея
* @param string $noImage если изображение не найдено
* @param string $type тип изображения, которое хотим получить
* @return string
*/
public static function getCover($id, $name, $link = '', $type = 'thumbnail', $noImage = '')
{
Yii::import('application.modules.file.models.FileManager');
$data = FileManager::model()->find('model_name=:model_name AND model_id = :model_id AND cover = 1', array(':model_id' => $id, ':model_name' => $name));
if ($data === null) {
$noImage = '<img alt = "" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '"/>';
if ($link == '') {
$view = $noImage;
} else {
$view = '<a href = "' . $link . '">' . $noImage . '</a>';
}
} else {
$file = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder . DS . $data->folder . DS . $type . DS . $data->file;
if (Yii::app()->cFile->set($file)->exists) {
$img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/' . $type . '/' . $data->file . '"/>';
} else {
$img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '/>';
}
if ($link == '') {
$view = '<ul id= "j-photobox_gallery_cover" class = "b-images_view b-image_cover j-photobox_gallery">
<li class = "l-inline_block">
<a href = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/original/' . $data->file . '">' . $img . '</a>
</li>
</ul>';
if (!Yii::app()->request->isAjaxRequest) {
Yii::app()->clientScript->registerPackage('photobox');
}
JS::add('photobox_init', "\$('.j-photobox_gallery').photobox('a',{ 'time':0, 'loop':false, 'afterClose': function(){}});");
} else {
$view = '<a href = "' . $link . '">' . $img . '</a>';
}
}
return $view;
}
开发者ID:blrtromax,项目名称:seobility,代码行数:43,代码来源:Helper.php
示例19: info
public function info($filename = '')
{
$this->open($filename);
$i['width'] = $this->im->getImageWidth();
$i['height'] = $this->im->getImageHeight();
$i['type'] = FileManager::get_ext($filename);
return $i;
}
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:8,代码来源:ImageManager_ImageMagick_Driver.php
示例20: run
public function run()
{
if (!Yii::app()->request->isAjaxRequest) {
Yii::app()->clientScript->registerPackage('photobox');
}
Yii::import('application.modules.file.models.FileManager');
$dataprovider = FileManager::model()->findAll(array('order' => 'position, date DESC', 'condition' => 'model_id=:model_id AND model_name=:model_name AND file_type=:file_type', 'params' => array(':model_id' => $this->id, ':model_name' => $this->modelName, ':file_type' => 'file')));
$this->render('file', array('dataprovider' => $dataprovider));
}
开发者ID:blrtromax,项目名称:seobility,代码行数:9,代码来源:FileRenderWidget.php
注:本文中的FileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论