本文整理汇总了PHP中t3lib_div::getFilesInDir方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::getFilesInDir方法的具体用法?PHP t3lib_div::getFilesInDir怎么用?PHP t3lib_div::getFilesInDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::getFilesInDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearTempFiles
/**
* Deletes all files older than a specific time in a temporary upload folder.
* Settings for the threshold time and the folder are made in TypoScript.
*
* Here is an example:
* <code>
* plugin.Tx_Formhandler.settings.files.clearTempFilesOlderThanHours = 24
* plugin.Tx_Formhandler.settings.files.tmpUploadFolder = uploads/formhandler/tmp
* </code>
*
* @param integer $olderThan Delete files older than $olderThan hours.
* @return void
* @author Reinhard Führicht <rf@typoheads.at>
*/
protected function clearTempFiles($uploadFolder, $olderThanValue, $olderThanUnit)
{
if (!$olderThanValue) {
return;
}
//build absolute path to upload folder
$path = Tx_Formhandler_StaticFuncs::getDocumentRoot() . $uploadFolder;
//read files in directory
$tmpFiles = t3lib_div::getFilesInDir($path);
Tx_Formhandler_StaticFuncs::debugMessage('cleaning_temp_files', array($path));
//calculate threshold timestamp
//hours * 60 * 60 = millseconds
$threshold = Tx_Formhandler_StaticFuncs::getTimestamp($olderThanValue, $olderThanUnit);
//for all files in temp upload folder
foreach ($tmpFiles as $idx => $file) {
//if creation timestamp is lower than threshold timestamp
//delete the file
$creationTime = filemtime($path . $file);
//fix for different timezones
$creationTime += date('O') / 100 * 60;
if ($creationTime < $threshold) {
unlink($path . $file);
Tx_Formhandler_StaticFuncs::debugMessage('deleting_file', array($file));
}
}
}
示例2: tearDown
public function tearDown()
{
$tmpFiles = t3lib_div::getFilesInDir($this->testDir);
foreach ($tmpFiles as $tmpFile) {
//unlink($this->testDir . $tmpFile);
}
//rmdir($this->testDir);
}
示例3: registerPngFix
function registerPngFix($params, $parent)
{
// handle stupid IE6
$userAgent = t3lib_div::getIndpEnv('HTTP_USER_AGENT');
if (!(strpos($userAgent, 'MSIE 6') === false) && strpos($userAgent, 'Opera') === false && strpos($userAgent, 'MSIE 7') === false) {
//make sure we match IE6 but not Opera or IE7
$files = t3lib_div::getFilesInDir(PATH_typo3 . 'sysext/t3skin/stylesheets/ie6', 'css', 0, 1);
foreach ($files as $fileName) {
$params['pageRenderer']->addCssFile($parent->backPath . 'sysext/t3skin/stylesheets/ie6/' . $fileName);
}
// load files of spriteGenerator for ie6
$files = t3lib_div::getFilesInDir(PATH_site . t3lib_SpriteManager::$tempPath . 'ie6/', 'css', 0, 1);
foreach ($files as $fileName) {
$params['pageRenderer']->addCssFile($parent->backPath . '../' . t3lib_SpriteManager::$tempPath . 'ie6/' . $fileName);
}
}
}
示例4: main
/**
* Manipulating the input array, $params, adding new selectorbox items.
*
* @param array array of select field options (reference)
* @param object parent object (reference)
* @return void
*/
function main(&$params, &$pObj)
{
// get the current page ID
$thePageId = $params['row']['pid'];
$template = t3lib_div::makeInstance('t3lib_tsparser_ext');
// do not log time-performance information
$template->tt_track = 0;
$template->init();
$sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
$rootLine = $sys_page->getRootLine($thePageId);
// generate the constants/config + hierarchy info for the template.
$template->runThroughTemplates($rootLine);
$template->generateConfig();
// get value for the path containing the template files
$readPath = t3lib_div::getFileAbsFileName($template->setup['plugin.']['tx_ttaddress_pi1.']['templatePath']);
// if that direcotry is valid and is a directory then select files in it
if (@is_dir($readPath)) {
$template_files = t3lib_div::getFilesInDir($readPath, 'tmpl,html,htm', 1, 1);
$parseHTML = t3lib_div::makeInstance('t3lib_parseHTML');
foreach ($template_files as $htmlFilePath) {
// reset vars
$selectorBoxItem_title = '';
$selectorBoxItem_icon = '';
// read template content
$content = t3lib_div::getUrl($htmlFilePath);
// ... and extract content of the title-tags
$parts = $parseHTML->splitIntoBlock('title', $content);
$titleTagContent = $parseHTML->removeFirstAndLastTag($parts[1]);
// set the item label
$selectorBoxItem_title = trim($titleTagContent . ' (' . basename($htmlFilePath) . ')');
// try to look up an image icon for the template
$fI = t3lib_div::split_fileref($htmlFilePath);
$testImageFilename = $readPath . $fI['filebody'] . '.gif';
if (@is_file($testImageFilename)) {
$selectorBoxItem_icon = '../' . substr($testImageFilename, strlen(PATH_site));
}
// finally add the new item
$params['items'][] = array($selectorBoxItem_title, basename($htmlFilePath), $selectorBoxItem_icon);
}
}
}
示例5: getAllFilesAndFoldersInPath
/**
* Recursively gather all files and folders of a path.
* Usage: 5
*
* @param array $fileArr: Empty input array (will have files added to it)
* @param string $path: The path to read recursively from (absolute) (include trailing slash!)
* @param string $extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
* @param boolean $regDirs: If set, directories are also included in output.
* @param integer $recursivityLevels: The number of levels to dig down...
* @return array An array with the found files/directories.
*/
function getAllFilesAndFoldersInPath($fileArr, $path, $extList = '', $regDirs = 0, $recursivityLevels = 99)
{
if ($regDirs) {
$fileArr[] = $path;
}
$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path, $extList, 1, 1));
$dirs = t3lib_div::get_dirs($path);
if (is_array($dirs) && $recursivityLevels > 0) {
foreach ($dirs as $subdirs) {
if ((string) $subdirs != '') {
$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $path . $subdirs . '/', $extList, $regDirs, $recursivityLevels - 1);
}
}
}
return $fileArr;
}
示例6: renderTemplateSelector
/**
* Renders the template selector.
*
* @param integer Position id. Can be positive and negative depending of where the new page is going: Negative always points to a position AFTER the page having the abs. value of the positionId. Positive numbers means to create as the first subpage to another page.
* @param string $templateType: The template type, 'tmplobj' or 't3d'
* @return string HTML output containing a table with the template selector
*/
function renderTemplateSelector($positionPid, $templateType = 'tmplobj')
{
global $LANG, $TYPO3_DB;
$storageFolderPID = $this->apiObj->getStorageFolderPid($positionPid);
$tmplHTML = array();
switch ($templateType) {
case 'tmplobj':
// Create the "Default template" entry
$previewIconFilename = $GLOBALS['BACK_PATH'] . '../' . t3lib_extMgm::siteRelPath($this->extKey) . 'res1/default_previewicon.gif';
$previewIcon = '<input type="image" class="c-inputButton" name="i0" value="0" src="' . $previewIconFilename . '" title="" />';
$description = htmlspecialchars($LANG->getLL('template_descriptiondefault'));
$tmplHTML[] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
<h3 class="bgColor3-20">' . htmlspecialchars($LANG->getLL('template_titledefault')) . '</h3></td></tr>
<tr><td valign="top">' . $previewIcon . '</td><td width="120" valign="top"><p>' . $description . '</p></td></tr></table>';
$tTO = 'tx_templavoila_tmplobj';
$tDS = 'tx_templavoila_datastructure';
$where = $tTO . '.parent=0 AND ' . $tTO . '.pid=' . intval($storageFolderPID) . ' AND ' . $tDS . '.scope=1' . $this->buildRecordWhere($tTO) . $this->buildRecordWhere($tDS) . t3lib_befunc::deleteClause($tTO) . t3lib_befunc::deleteClause($tDS) . t3lib_BEfunc::versioningPlaceholderClause($tTO) . t3lib_BEfunc::versioningPlaceholderClause($tDS);
$res = $TYPO3_DB->exec_SELECTquery($tTO . '.*', $tTO . ' LEFT JOIN ' . $tDS . ' ON ' . $tTO . '.datastructure = ' . $tDS . '.uid', $where);
while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
// Check if preview icon exists, otherwise use default icon:
$tmpFilename = 'uploads/tx_templavoila/' . $row['previewicon'];
$previewIconFilename = @is_file(PATH_site . $tmpFilename) ? $GLOBALS['BACK_PATH'] . '../' . $tmpFilename : $GLOBALS['BACK_PATH'] . '../' . t3lib_extMgm::siteRelPath($this->extKey) . 'res1/default_previewicon.gif';
// Note: we cannot use value of image input element because MSIE replaces this value with mouse coordinates! Thus on click we set value to a hidden field. See http://bugs.typo3.org/view.php?id=3376
$previewIcon = '<input type="image" class="c-inputButton" name="i' . $row['uid'] . '" onclick="document.getElementById(\'data_tx_templavoila_to\').value=' . $row['uid'] . '" src="' . $previewIconFilename . '" title="" />';
$description = $row['description'] ? htmlspecialchars($row['description']) : $LANG->getLL('template_nodescriptionavailable');
$tmplHTML[] = '<table style="width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap"><h3 class="bgColor3-20">' . htmlspecialchars($row['title']) . '</h3></td></tr>' . '<tr><td valign="top">' . $previewIcon . '</td><td width="120" valign="top"><p>' . $description . '</p></td></tr></table>';
}
$tmplHTML[] = '<input type="hidden" id="data_tx_templavoila_to" name="data[tx_templavoila_to]" value="0" />';
break;
case 't3d':
if (t3lib_extMgm::isLoaded('impexp')) {
// Read template files from a certain folder. I suggest this is configurable in some way. But here it is hardcoded for initial tests.
$templateFolder = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '/export/templates/';
$files = t3lib_div::getFilesInDir($templateFolder, 't3d,xml', 1, 1);
// Traverse the files found:
foreach ($files as $absPath) {
// Initialize the import object:
$import = $this->getImportObject();
if ($import->loadFile($absPath)) {
if (is_array($import->dat['header']['pagetree'])) {
// This means there are pages in the file, we like that...:
// Page tree:
reset($import->dat['header']['pagetree']);
$pageTree = current($import->dat['header']['pagetree']);
// Thumbnail icon:
if (is_array($import->dat['header']['thumbnail'])) {
$pI = pathinfo($import->dat['header']['thumbnail']['filename']);
if (t3lib_div::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) {
// Construct filename and write it:
$fileName = PATH_site . 'typo3temp/importthumb_' . t3lib_div::shortMD5($absPath) . '.' . $pI['extension'];
t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
// Check that the image really is an image and not a malicious PHP script...
if (getimagesize($fileName)) {
// Create icon tag:
$iconTag = '<img src="' . $this->doc->backPath . '../' . substr($fileName, strlen(PATH_site)) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />';
} else {
t3lib_div::unlink_tempfile($fileName);
$iconTag = '';
}
}
}
$aTagB = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('templateFile' => $absPath))) . '">';
$aTagE = '</a>';
$tmplHTML[] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
<h3 class="bgColor3-20">' . $aTagB . htmlspecialchars($import->dat['header']['meta']['title'] ? $import->dat['header']['meta']['title'] : basename($absPath)) . $aTagE . '</h3></td></tr>
<tr><td valign="top">' . $aTagB . $iconTag . $aTagE . '</td><td valign="top"><p>' . htmlspecialchars($import->dat['header']['meta']['description']) . '</p>
<em>Levels: ' . (count($pageTree) > 1 ? 'Deep structure' : 'Single page') . '<br/>
File: ' . basename($absPath) . '</em></td></tr></table>';
}
}
}
}
break;
}
if (is_array($tmplHTML) && count($tmplHTML)) {
$counter = 0;
$content .= '<table>';
foreach ($tmplHTML as $single) {
$content .= ($counter ? '' : '<tr>') . '<td valign="top">' . $single . '</td>' . ($counter ? '</tr>' : '');
$counter++;
if ($counter > 1) {
$counter = 0;
}
}
$content .= '</table>';
}
return $content;
}
示例7: getFiles
function getFiles($conf, $folder, $sort = 'ASC', $limit = '', $hash = 0)
{
$files = t3lib_div::getFilesInDir($folder, $conf['main.']['file_extensions'], 1, 1);
// Get all pictures (sort by name ASC AND with folders)
// 1. sort array
switch ($sort) {
// sortmode
case 'random':
// shuffle array
shuffle($files);
break;
case 'DESC':
// alphabetical descendening
arsort($files);
break;
case 'newest':
// newest or
// newest or
case 'oldest':
// oldest files
if (is_array($files)) {
// if files is an array
$newarray = array();
foreach ($files as $value) {
// one loop for every file
$newarray[filemtime($value)] = $value;
// $array[time] = pic.jpg
}
if ($sort == 'newest') {
krsort($newarray);
}
// sort from key
if ($sort == 'oldest') {
ksort($newarray);
}
// sort from key
$files = $newarray;
// overwrite files array
}
break;
case strpos($method, '"') !== false:
// " found
$files[0] = $folder . str_replace('"', '', $sort);
// special picture
break;
default:
// default
// default
case 'ASC':
// or ASC - so do nothing
break;
}
// 2. rewrite keys of array
$array = array();
if (is_array($files)) {
// if the array is filled
foreach ($files as $key => $value) {
// one loop for every key
// rewrite key in new array
if (!$hash) {
$array[] = $value;
} else {
$array[] = $this->hashCode($value);
}
// with hashcode instead of filename
}
}
// 3. return whole or part of array
if (!empty($array)) {
// if there is an entry
if (empty($limit)) {
// no limit
return $array;
// return complete array
} else {
// there is an entry for limit
if (strlen($limit) > 6) {
// return only a special picture like pic.jpg
$temparray = array();
if (is_array($array)) {
// if is array
foreach ($array as $key => $value) {
// one loop for every picture in array
if ($this->hashCode($value) == $limit) {
// if hash fits, return picture
$temparray[] = $value;
// $temparray[0] = fileadmin/pic.jpg
return $temparray;
}
}
}
} else {
// cut after X
return array_slice($array, 0, $limit);
// return only the first X values of the array
}
}
}
}
示例8: rebuildCache
/**
* this method calls the main methods from the handler classes
* merges the results with the data from the skin, and cache it
*
* @return void
*/
protected function rebuildCache()
{
// ask the handlerClass to kindly rebuild our data
$this->handler->generate();
// get all Icons registered from skins, merge with core-Icon-List
$availableSkinIcons = (array) $GLOBALS['TBE_STYLES']['spriteIconApi']['coreSpriteImageNames'];
foreach ($GLOBALS['TBE_STYLES']['skins'] as $skinName => $skinData) {
$availableSkinIcons = array_merge($availableSkinIcons, (array) $skinData['availableSpriteIcons']);
}
// merge icon names whith them provided by the skin,
// registered from "complete sprites" and the ones detected
// by the handlerclass
$this->iconNames = array_merge($availableSkinIcons, (array) $GLOBALS['TBE_STYLES']['spritemanager']['spriteIconsAvailable'], $this->handler->getAvailableIconNames());
// serialize found icons, and cache them to file
$cacheString = addslashes(serialize($this->iconNames));
$fileContent = '<?php $GLOBALS[\'TBE_STYLES\'][\'spriteIconApi\'][\'iconsAvailable\'] = unserialize(stripslashes(\'' . $cacheString . '\')); ?>';
// delete old cache files
$oldFiles = t3lib_div::getFilesInDir(PATH_site . self::$tempPath, 'inc', 1);
foreach ($oldFiles as $file) {
@unlink($file);
}
// and write the new one
t3lib_div::writeFile($this->tempFileName, $fileContent);
}
示例9: main
/**
* Main Task center module
*
* @return string HTML content.
*/
public function main()
{
$content = '';
$id = intval(t3lib_div::_GP('display'));
// if a preset is found, it is rendered using an iframe
if ($id > 0) {
$url = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id;
return $this->taskObject->urlInIframe($url, 1);
} else {
// header
$content .= $this->taskObject->description($GLOBALS['LANG']->getLL('.alttitle'), $GLOBALS['LANG']->getLL('.description'));
$thumbnails = $lines = array();
// Thumbnail folder and files:
$tempDir = $this->userTempFolder();
if ($tempDir) {
$thumbnails = t3lib_div::getFilesInDir($tempDir, 'png,gif,jpg', 1);
}
$clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
$usernames = t3lib_BEfunc::getUserNames();
// Create preset links:
$presets = $this->getPresets();
// if any presets found
if (is_array($presets)) {
foreach ($presets as $key => $presetCfg) {
$configuration = unserialize($presetCfg['preset_data']);
$thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
$title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
$icon = 'EXT:impexp/export.gif';
$description = array();
// is public?
if ($presetCfg['public']) {
$description[] = $GLOBALS['LANG']->getLL('task.public') . ': ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
}
// owner
$description[] = $GLOBALS['LANG']->getLL('task.owner') . ': ' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? $GLOBALS['LANG']->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']');
// page & path
if ($configuration['pagetree']['id']) {
$description[] = $GLOBALS['LANG']->getLL('task.page') . ': ' . $configuration['pagetree']['id'];
$description[] = $GLOBALS['LANG']->getLL('task.path') . ': ' . htmlspecialchars(t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'], $clause, 20));
} else {
$description[] = $GLOBALS['LANG']->getLL('single-record');
}
// Meta information
if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) {
$metaInformation = '';
if ($configuration['meta']['title']) {
$metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />';
}
if ($configuration['meta']['description']) {
$metaInformation .= htmlspecialchars($configuration['meta']['description']);
}
if ($configuration['meta']['notes']) {
$metaInformation .= '<br /><br />
<strong>' . $GLOBALS['LANG']->getLL('notes') . ': </strong>
<em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>';
}
$description[] = '<br />' . $metaInformation;
}
// collect all preset information
$lines[$key] = array('icon' => $icon, 'title' => $title, 'descriptionHtml' => implode('<br />', $description), 'link' => 'mod.php?M=user_task&SET[function]=impexp.tx_impexp_task&display=' . $presetCfg['uid']);
}
// render preset list
$content .= $this->taskObject->renderListMenu($lines);
} else {
// no presets found
$flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('no-presets'), '', t3lib_FlashMessage::NOTICE);
$content .= $flashMessage->render();
}
}
return $content;
}
示例10: addStyleSheetDirectory
/**
* Add all *.css files of the directory $path to the stylesheets
*
* @param string directory to add
* @return void
*/
function addStyleSheetDirectory($path)
{
// calculation needed, when TYPO3 source is used via a symlink
// absolute path to the stylesheets
$filePath = dirname(t3lib_div::getIndpEnv('SCRIPT_FILENAME')) . '/' . $GLOBALS['BACK_PATH'] . $path;
// clean the path
$resolvedPath = t3lib_div::resolveBackPath($filePath);
// read all files in directory and sort them alphabetically
$files = t3lib_div::getFilesInDir($resolvedPath, 'css', FALSE, 1);
foreach ($files as $file) {
$this->pageRenderer->addCssFile($GLOBALS['BACK_PATH'] . $path . $file, 'stylesheet', 'all');
}
}
示例11: renameIconsInTypo3Temp
/**
* Rename "icon_" files in typo3temp/
* Function for development purposes.
*
* @return void
*/
function renameIconsInTypo3Temp()
{
$files = t3lib_div::getFilesInDir(PATH_site . 'typo3temp/', 'gif,png', 1);
foreach ($files as $filename) {
if (t3lib_div::isFirstPartOfStr(basename($filename), 'icon_')) {
$dir = dirname($filename) . '/';
$reg = array();
if (preg_match('#icon_[[:alnum:]]+_([[:alnum:]_]+).(gif|png).(gif|png)#', basename($filename), $reg)) {
if (@is_file($filename)) {
$newFile = $dir . $reg[1] . '.' . $reg[3];
debug($newFile, 1);
rename($filename, $newFile);
}
}
}
}
}
示例12: main_user
/**
* Rich Text Editor (RTE) user element selector
*
* @param [type] $openKeys: ...
* @return [type] ...
*/
function main_user($openKeys)
{
global $LANG, $BACK_PATH, $BE_USER;
// Starting content:
$content .= $this->doc->startPage($LANG->getLL('Insert Custom Element', 1));
$RTEtsConfigParts = explode(':', t3lib_div::_GP('RTEtsConfigParams'));
$RTEsetup = $BE_USER->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
$thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
if (is_array($thisConfig['userElements.'])) {
$categories = array();
foreach ($thisConfig['userElements.'] as $k => $value) {
$ki = intval($k);
$v = $thisConfig['userElements.'][$ki . '.'];
if (substr($k, -1) == "." && is_array($v)) {
$subcats = array();
$openK = $ki;
if ($openKeys[$openK]) {
$mArray = '';
switch ((string) $v['load']) {
case 'images_from_folder':
$mArray = array();
if ($v['path'] && @is_dir(PATH_site . $v['path'])) {
$files = t3lib_div::getFilesInDir(PATH_site . $v['path'], 'gif,jpg,jpeg,png', 0, '');
if (is_array($files)) {
$c = 0;
foreach ($files as $filename) {
$iInfo = @getimagesize(PATH_site . $v['path'] . $filename);
$iInfo = $this->calcWH($iInfo, 50, 100);
$ks = (string) (100 + $c);
$mArray[$ks] = $filename;
$mArray[$ks . "."] = array('content' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" />', '_icon' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" ' . $iInfo[3] . ' />', 'description' => $LANG->getLL('filesize') . ': ' . str_replace(' ', ' ', t3lib_div::formatSize(@filesize(PATH_site . $v['path'] . $filename))) . ', ' . $LANG->getLL('pixels', 1) . ': ' . $iInfo[0] . 'x' . $iInfo[1]);
$c++;
}
}
}
break;
}
if (is_array($mArray)) {
if ($v['merge']) {
$v = t3lib_div::array_merge_recursive_overrule($mArray, $v);
} else {
$v = $mArray;
}
}
foreach ($v as $k2 => $dummyValue) {
$k2i = intval($k2);
if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) {
$title = trim($v[$k2i]);
if (!$title) {
$title = '[' . $LANG->getLL('noTitle', 1) . ']';
} else {
$title = $LANG->sL($title, 1);
}
$description = $LANG->sL($v[$k2i . '.']['description'], 1) . '<br />';
if (!$v[$k2i . '.']['dontInsertSiteUrl']) {
$v[$k2i . '.']['content'] = str_replace('###_URL###', $this->siteUrl, $v[$k2i . '.']['content']);
}
$logo = $v[$k2i . '.']['_icon'] ? $v[$k2i . '.']['_icon'] : '';
$onClickEvent = '';
switch ((string) $v[$k2i . '.']['mode']) {
case 'wrap':
$wrap = explode('|', $v[$k2i . '.']['content']);
$onClickEvent = 'wrapHTML(' . $LANG->JScharCode($wrap[0]) . ',' . $LANG->JScharCode($wrap[1]) . ',false);';
break;
case 'processor':
$script = trim($v[$k2i . '.']['submitToScript']);
if (substr($script, 0, 4) != 'http') {
$script = $this->siteUrl . $script;
}
if ($script) {
$onClickEvent = 'processSelection(' . $LANG->JScharCode($script) . ');';
}
break;
case 'insert':
default:
$onClickEvent = 'insertHTML(' . $LANG->JScharCode($v[$k2i . '.']['content']) . ');';
break;
}
$A = array('<a href="#" onClick="' . $onClickEvent . 'return false;">', '</a>');
$subcats[$k2i] = '<tr>
<td><img src="clear.gif" width="18" height="1" /></td>
<td class="bgColor4" valign="top">' . $A[0] . $logo . $A[1] . '</td>
<td class="bgColor4" valign="top">' . $A[0] . '<strong>' . $title . '</strong><br />' . $description . $A[1] . '</td>
</tr>';
}
}
ksort($subcats);
}
$categories[$ki] = implode('', $subcats);
}
}
ksort($categories);
# Render menu of the items:
$lines = array();
//.........这里部分代码省略.........
示例13: displayItemsList
/**
* tx_adgallery_pi1::displayItemsList()
*
* @return
*/
public function displayItemsList()
{
$content = '';
$contentList = '';
$res = $this->getAllItems();
$markerArrayGlobal = array();
$iItem = 1;
$markerArrayTemp = array();
// Normal mode with selected files
if ($this->conf['displayType'] == 0) {
$files = t3lib_div::trimExplode(',', $this->conf['classicimages']);
$titles = t3lib_div::trimExplode(chr(10), $this->conf['classicimagestitles']);
$alt_texts = t3lib_div::trimExplode(chr(10), $this->conf['classicimagesalttexts']);
foreach ($files as $file) {
$markerArray = array();
$item['file_path'] = trim($this->imageDir);
$item['file_name'] = $file;
$item['title'] = count($titles) >= $iItem ? $titles[$iItem - 1] : '';
$item['alt_text'] = count($alt_texts) >= $iItem ? $alt_texts[$iItem - 1] : '';
$item['description'] = $item['file_path'] . $file;
$item = $this->processItemList($item);
$item['i'] = $iItem++;
$markerArray = array_merge($markerArray, $this->misc->convertToMarkerArray($item));
$markerArrayTemp[] = $markerArray;
unset($markerArray);
}
} else {
if ($this->conf['displayType'] == 3) {
// Normal mode without DAM
$path = rtrim(trim(PATH_site . $this->conf['classicimagespath']), '/');
$files = t3lib_div::getFilesInDir($path, 'png,gif,jpg,jpeg', 0, 1);
foreach ($files as $file) {
$markerArray = array();
$item['file_path'] = trim($this->conf['classicimagespath']);
$item['file_name'] = $file;
$item['title'] = $file;
$item['alt_text'] = '';
$item['description'] = '';
$item = $this->processItemList($item);
$item['i'] = $iItem++;
$markerArray = array_merge($markerArray, $this->misc->convertToMarkerArray($item));
$markerArrayTemp[] = $markerArray;
unset($markerArray);
}
} else {
if ($this->conf['displayType'] == 4) {
while ($item = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
$file = $fileRepository->findByUid($item['uid']);
$storageConfiguration = $file->getStorage()->getConfiguration();
$basePath = rtrim($storageConfiguration['basePath'], '/');
$markerArray = array();
$item['file_path'] = $basePath . dirname($item['identifier']) . '/';
$item['file_name'] = $item['name'];
$item['title'] = $item['title'];
$item['alt_text'] = $item['alternative'];
$item = $this->processItemList($item);
$item['i'] = $iItem++;
$markerArray = array_merge($markerArray, $this->misc->convertToMarkerArray($item));
$markerArrayTemp[] = $markerArray;
unset($markerArray);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
} else {
if (version_compare(TYPO3_version, '6.2.0', '<')) {
// Mode with DAM directory or DAM category
while ($item = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$markerArray = array();
$item = $this->processItemList($item);
$item['i'] = $iItem++;
$markerArray = array_merge($markerArray, $this->misc->convertToMarkerArray($item));
$markerArrayTemp[] = $markerArray;
unset($markerArray);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
} else {
foreach ($res as $file) {
$item = $file->getProperties();
$storageConfiguration = $file->getStorage()->getConfiguration();
$basePath = rtrim($storageConfiguration['basePath'], '/');
$markerArray = array();
$item['file_path'] = $basePath . dirname($item['identifier']) . '/';
$item['file_name'] = $item['name'];
$item['title'] = $item['title'];
$item['alt_text'] = $item['alternative'];
$item = $this->processItemList($item);
$item['i'] = $iItem++;
$markerArray = array_merge($markerArray, $this->misc->convertToMarkerArray($item));
$markerArrayTemp[] = $markerArray;
unset($markerArray);
}
}
}
}
}
//.........这里部分代码省略.........
示例14: rmCachedFiles
/**
* Removing temp_CACHED files for installation
*
* @param string KEY pointing to installation
* @return string HTML content
*/
function rmCachedFiles($exp)
{
$all = $this->globalSiteInfo[$exp];
$content = '
<h2>' . htmlspecialchars($all['siteInfo']['sitename'] . ' (DB: ' . $all['siteInfo']['TYPO3_db']) . ')</h2>
<hr />
<h3>typo3conf/temp_CACHED_* files:</h3>';
$path = $all['siteInfo']['SA_PATH'] . '/typo3conf/';
if (@is_dir($path)) {
$filesInDir = t3lib_div::getFilesInDir($path, 'php', 1);
foreach ($filesInDir as $kk => $vv) {
if (t3lib_div::isFirstPartOfStr(basename($vv), 'temp_CACHED_')) {
if (strstr(basename($vv), 'ext_localconf.php') || strstr(basename($vv), 'ext_tables.php')) {
$content .= 'REMOVED: ' . $vv . '<br />';
unlink($vv);
if (file_exists($vv)) {
$content .= $this->error('ERROR: File still exists, so could not be removed anyways!') . '<br />';
}
}
}
}
} else {
$content .= $this->error('ERROR: ' . $path . ' was not a directory!');
}
return $content;
}
示例15: expandFolder
/**
* @param [type] $expandFolder: ...
* @param [type] $plainFlag: ...
* @return [type] ...
*/
function expandFolder($expandFolder = 0, $plainFlag = 0, $noThumbs = 0)
{
global $LANG;
$expandFolder = $expandFolder ? $expandFolder : t3lib_div::_GP("expandFolder");
$out = "";
$resolutionLimit_x = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['width'];
$resolutionLimit_y = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['height'];
if ($expandFolder) {
$files = t3lib_div::getFilesInDir($expandFolder, $plainFlag ? "jpg,jpeg,gif,png" : $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"], 1, 1);
// $extensionList="",$prependPath=0,$order="")
if (is_array($files)) {
reset($files);
$titleLen = intval($GLOBALS["BE_USER"]->uc["titleLen"]);
$picon = '<img src="' . $this->doc->backPath . 'gfx/i/_icon_webfolders.gif" width="18" height="16" alt="folder" />';
$picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
$out .= '<span class="nobr">' . $picon . '</span><br />';
$imgObj = t3lib_div::makeInstance("t3lib_stdGraphic");
$imgObj->init();
$imgObj->mayScaleUp = 0;
$imgObj->tempPath = PATH_site . $imgObj->tempPath;
$lines = array();
while (list(, $filepath) = each($files)) {
$fI = pathinfo($filepath);
//$iurl = $this->siteUrl.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site)));
$iurl = t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site)));
$imgInfo = $imgObj->getImageDimensions($filepath);
$icon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"]));
$pDim = $imgInfo[0] . "x" . $imgInfo[1] . " pixels";
$size = " (" . t3lib_div::formatSize(filesize($filepath)) . "bytes, " . $pDim . ")";
$icon = '<img src="' . $this->doc->backPath . 'gfx/fileicons/' . $icon . '" style="width: 18px; height: 16px; border: none;" title="' . $fI["basename"] . $size . '" class="absmiddle" alt="' . $icon . '" />';
if (!$plainFlag) {
$ATag = '<a href="#" onclick="return jumpToUrl(\'?insertMagicImage=' . rawurlencode($filepath) . '\');">';
} else {
$ATag = '<a href="#" onclick="return insertImage(\'' . $iurl . '\',' . $imgInfo[0] . ',' . $imgInfo[1] . ');">';
}
$ATag_e = "</a>";
if ($plainFlag && ($imgInfo[0] > $resolutionLimit_x || $imgInfo[1] > $resolutionLimit_y)) {
$ATag = "";
$ATag_e = "";
$ATag2 = "";
$ATag2_e = "";
} else {
$ATag2 = '<a href="#" onclick="launchView(\'' . rawurlencode($filepath) . '\'); return false;">';
$ATag2_e = "</a>";
}
$filenameAndIcon = $ATag . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e;
$lines[] = '<tr class="bgColor4"><td nowrap="nowrap">' . $filenameAndIcon . ' </td></tr><tr><td nowrap="nowrap" class="pixel">' . $pDim . ' </td></tr>';
$lines[] = '<tr><td>' . ($noThumbs ? "" : $ATag2 . t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"', $this->thisConfig['typo3filemanager.']['thumbs.']['width'] . 'x' . $this->thisConfig['typo3filemanager.']['thumbs.']['height']) . $ATag2_e) . '</td></tr>';
$lines[] = '<tr><td><img src="clear.gif" style="width: 1px; height: 3px;" alt="clear" /></td></tr>';
}
$out .= '<table border="0" cellpadding="0" cellspacing="1">' . implode("", $lines) . '</table>';
}
}
return $out;
}