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


PHP t3lib_div::formatSize方法代码示例

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


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

示例1: getAttachedFiles

 /**
  * Gets our attached files as an array of arrays with the elements "name"
  * and "size" of the attached file.
  *
  * The displayed file name is relative to the tx_seminars upload directory
  * and is linked to the actual file's URL.
  *
  * The file size will have, depending on the file size, one of the following
  * units appended: K for Kilobytes, M for Megabytes and G for Gigabytes.
  *
  * The returned array will be sorted like the files are sorted in the back-
  * end form.
  *
  * If this event is an event date, this function will return both the
  * topic's file and the date's files (in that order).
  *
  * Note: This functions' return values already are htmlspecialchared.
  *
  * @param tslib_pibase $plugin a tslib_pibase object for a live page
  *
  * @return array[] an array of arrays with the elements "name" and
  *               "size" of the attached file, will be empty if
  *               there are no attached files
  */
 public function getAttachedFiles(tslib_pibase $plugin)
 {
     if (!$this->hasAttachedFiles()) {
         return array();
     }
     if ($this->isTopicOkay()) {
         $filesFromTopic = $this->topic->getAttachedFiles($plugin);
     } else {
         $filesFromTopic = array();
     }
     $result = $filesFromTopic;
     $uploadFolderPath = PATH_site . 'uploads/tx_seminars/';
     $uploadFolderUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'uploads/tx_seminars/';
     $attachedFiles = t3lib_div::trimExplode(',', $this->getRecordPropertyString('attached_files'), TRUE);
     foreach ($attachedFiles as $attachedFile) {
         $matches = array();
         preg_match('/\\.(\\w+)$/', basename($attachedFile), $matches);
         $result[] = array('name' => $plugin->cObj->typoLink(htmlspecialchars(basename($attachedFile)), array('parameter' => $uploadFolderUrl . $attachedFile)), 'type' => htmlspecialchars(isset($matches[1]) ? $matches[1] : 'none'), 'size' => t3lib_div::formatSize(filesize($uploadFolderPath . $attachedFile)));
     }
     return $result;
 }
开发者ID:kurtkk,项目名称:seminars,代码行数:45,代码来源:class.tx_seminars_seminar.php

示例2: cacheFiles

    /**
     * The main function in the class
     *
     * @return	string		HTML content
     */
    function cacheFiles()
    {
        $content = '';
        // CURRENT:
        $content .= '<strong>1: The current cache files:</strong>' . Tx_Extdeveval_Compatibility::viewArray(t3lib_extMgm::currentCacheFiles());
        // REMOVING?
        if (t3lib_div::_GP('REMOVE_temp_CACHED')) {
            $number = $this->removeCacheFiles();
            $content .= '<hr /><p><strong>2: Tried to remove ' . $number . ' cache files.</strong></p>';
        }
        if (t3lib_div::_GP('REMOVE_temp_CACHED_ALL')) {
            $content .= '<hr /><p><strong>2: Removing ALL "temp_CACHED_*" files:</strong></p>' . $this->removeALLtempCachedFiles();
        }
        $files = t3lib_div::getFilesInDir(PATH_typo3conf, 'php');
        $tRows = array();
        foreach ($files as $f) {
            $tRows[] = '<tr>
				<td>' . htmlspecialchars($f) . '</td>
				<td>' . t3lib_div::formatSize(filesize(PATH_typo3conf . $f)) . '</td>
			</tr>';
        }
        $content .= '<br /><strong>3: PHP files (now) in "' . PATH_typo3conf . '":</strong><br />
		<table border="1">' . implode('', $tRows) . '</table>

		<input type="submit" name="REMOVE_temp_CACHED" value="REMOVE current temp_CACHED files" />
		<input type="submit" name="REMOVE_temp_CACHED_ALL" value="REMOVE ALL temp_CACHED_* files" />
		<input type="submit" name="_" value="Refresh" />
		';
        return $content;
    }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:35,代码来源:class.tx_extdeveval_cachefiles.php

示例3: render

 /**
  * Renders the size of a file using t3lib_div::formatSize
  *
  * @param string $file Path to the file
  * @param string $format Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value)
  * @param boolean $hideError Define if an error should be displayed if file not found
  * @return string
  * @throws Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException
  */
 public function render($file, $format = '', $hideError = FALSE)
 {
     if (!is_file($file)) {
         $errorMessage = sprintf('Given file "%s" for %s is not valid', htmlspecialchars($file), get_class());
         t3lib_div::devLog($errorMessage, 'news', t3lib_div::SYSLOG_SEVERITY_WARNING);
         if (!$hideError) {
             throw new Tx_Fluid_Core_ViewHelper_Exception_InvalidVariableException('Given file is not a valid file: ' . htmlspecialchars($file));
         }
     }
     $fileSize = t3lib_div::formatSize(filesize($file), $format);
     return $fileSize;
 }
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:21,代码来源:FileSizeViewHelper.php

示例4: displayContentOverview

    /**
     * Displays an overview of the header-content.
     *
     * @return	string		HTML content
     */
    function displayContentOverview()
    {
        global $LANG;
        // Check extension dependencies:
        if (is_array($this->dat['header']['extensionDependencies'])) {
            foreach ($this->dat['header']['extensionDependencies'] as $extKey) {
                if (!t3lib_extMgm::isLoaded($extKey)) {
                    $this->error('DEPENDENCY: The extension with key "' . $extKey . '" must be installed!');
                }
            }
        }
        // Probably this is done to save memory space?
        unset($this->dat['files']);
        // Traverse header:
        $this->remainHeader = $this->dat['header'];
        if (is_array($this->remainHeader)) {
            // If there is a page tree set, show that:
            if (is_array($this->dat['header']['pagetree'])) {
                reset($this->dat['header']['pagetree']);
                $lines = array();
                $this->traversePageTree($this->dat['header']['pagetree'], $lines);
                $rows = array();
                $rows[] = '
				<tr class="bgColor5 tableheader">
					<td>' . $LANG->getLL('impexpcore_displaycon_controls', 1) . '</td>
					<td>' . $LANG->getLL('impexpcore_displaycon_title', 1) . '</td>
					<td>' . $LANG->getLL('impexpcore_displaycon_size', 1) . '</td>
					<td>' . $LANG->getLL('impexpcore_displaycon_message', 1) . '</td>
					' . ($this->update ? '<td>' . $LANG->getLL('impexpcore_displaycon_updateMode', 1) . '</td>' : '') . '
					' . ($this->update ? '<td>' . $LANG->getLL('impexpcore_displaycon_currentPath', 1) . '</td>' : '') . '
					' . ($this->showDiff ? '<td>' . $LANG->getLL('impexpcore_displaycon_result', 1) . '</td>' : '') . '
				</tr>';
                foreach ($lines as $r) {
                    $rows[] = '
					<tr class="' . $r['class'] . '">
						<td>' . $this->renderControls($r) . '</td>
						<td nowrap="nowrap">' . $r['preCode'] . $r['title'] . '</td>
						<td nowrap="nowrap">' . t3lib_div::formatSize($r['size']) . '</td>
						<td nowrap="nowrap">' . ($r['msg'] && !$this->doesImport ? '<span class="typo3-red">' . htmlspecialchars($r['msg']) . '</span>' : '') . '</td>
						' . ($this->update ? '<td nowrap="nowrap">' . $r['updateMode'] . '</td>' : '') . '
						' . ($this->update ? '<td nowrap="nowrap">' . $r['updatePath'] . '</td>' : '') . '
						' . ($this->showDiff ? '<td>' . $r['showDiffContent'] . '</td>' : '') . '
					</tr>';
                }
                $out = '
					<strong>' . $LANG->getLL('impexpcore_displaycon_insidePagetree', 1) . '</strong>
					<br /><br />
					<table border="0" cellpadding="0" cellspacing="1">' . implode('', $rows) . '</table>
					<br /><br />';
            }
            // Print remaining records that were not contained inside the page tree:
            $lines = array();
            if (is_array($this->remainHeader['records'])) {
                if (is_array($this->remainHeader['records']['pages'])) {
                    $this->traversePageRecords($this->remainHeader['records']['pages'], $lines);
                }
                $this->traverseAllRecords($this->remainHeader['records'], $lines);
                if (count($lines)) {
                    $rows = array();
                    $rows[] = '
					<tr class="bgColor5 tableheader">
						<td>' . $LANG->getLL('impexpcore_displaycon_controls', 1) . '</td>
						<td>' . $LANG->getLL('impexpcore_displaycon_title', 1) . '</td>
						<td>' . $LANG->getLL('impexpcore_displaycon_size', 1) . '</td>
						<td>' . $LANG->getLL('impexpcore_displaycon_message', 1) . '</td>
						' . ($this->update ? '<td>' . $LANG->getLL('impexpcore_displaycon_updateMode', 1) . '</td>' : '') . '
						' . ($this->update ? '<td>' . $LANG->getLL('impexpcore_displaycon_currentPath', 1) . '</td>' : '') . '
						' . ($this->showDiff ? '<td>' . $LANG->getLL('impexpcore_displaycon_result', 1) . '</td>' : '') . '
					</tr>';
                    foreach ($lines as $r) {
                        $rows[] = '<tr class="' . $r['class'] . '">
							<td>' . $this->renderControls($r) . '</td>
							<td nowrap="nowrap">' . $r['preCode'] . $r['title'] . '</td>
							<td nowrap="nowrap">' . t3lib_div::formatSize($r['size']) . '</td>
							<td nowrap="nowrap">' . ($r['msg'] && !$this->doesImport ? '<span class="typo3-red">' . htmlspecialchars($r['msg']) . '</span>' : '') . '</td>
							' . ($this->update ? '<td nowrap="nowrap">' . $r['updateMode'] . '</td>' : '') . '
							' . ($this->update ? '<td nowrap="nowrap">' . $r['updatePath'] . '</td>' : '') . '
							' . ($this->showDiff ? '<td>' . $r['showDiffContent'] . '</td>' : '') . '
						</tr>';
                    }
                    $out .= '
						<strong>' . $LANG->getLL('impexpcore_singlereco_outsidePagetree', 1) . '</strong>
						<br /><br />
						<table border="0" cellpadding="0" cellspacing="1">' . implode('', $rows) . '</table>';
                }
            }
        }
        return $out;
    }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:94,代码来源:class.tx_impexp.php

示例5: TBE_dragNDrop

    /**
     * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
     * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
     *
     * @param	string		The folder path to expand
     * @param	string		List of fileextensions to show
     * @return	string		HTML output
     */
    function TBE_dragNDrop($expandFolder = 0, $extensionList = '')
    {
        global $BACK_PATH;
        $extensionList = $extensionList == '*' ? '' : $extensionList;
        $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
        $out = '';
        if ($expandFolder && $this->checkFolder($expandFolder)) {
            if ($this->isWebFolder($expandFolder)) {
                // Read files from directory:
                $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
                // $extensionList="",$prependPath=0,$order='')
                if (is_array($files)) {
                    $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', count($files)));
                    $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
                    $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                    $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
                    $out .= $picon . '<br />';
                    // Init row-array:
                    $lines = array();
                    // Add "drag-n-drop" message:
                    $lines[] = '
						<tr>
							<td colspan="2">' . $this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')) . '</td>
						</tr>';
                    // Traverse files:
                    foreach ($files as $filepath) {
                        $fI = pathinfo($filepath);
                        // URL of image:
                        $iurl = $this->siteURL . t3lib_div::rawurlencodeFP(substr($filepath, strlen(PATH_site)));
                        // Show only web-images
                        if (t3lib_div::inList('gif,jpeg,jpg,png', strtolower($fI['extension']))) {
                            $imgInfo = @getimagesize($filepath);
                            $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                            $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                            $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
                            $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $ficon, 'width="18" height="16"') . ' class="absmiddle" title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                            $filenameAndIcon = $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen));
                            if (t3lib_div::_GP('noLimit')) {
                                $maxW = 10000;
                                $maxH = 10000;
                            } else {
                                $maxW = 380;
                                $maxH = 500;
                            }
                            $IW = $imgInfo[0];
                            $IH = $imgInfo[1];
                            if ($IW > $maxW) {
                                $IH = ceil($IH / $IW * $maxW);
                                $IW = $maxW;
                            }
                            if ($IH > $maxH) {
                                $IW = ceil($IW / $IH * $maxH);
                                $IH = $maxH;
                            }
                            // Make row:
                            $lines[] = '
								<tr class="bgColor4">
									<td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
									<td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('noLimit' => '1'))) . '">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('clickToRedrawFullSize', 1) . '" alt="" />' . '</a>' : '') . $pDim . '&nbsp;</td>
								</tr>';
                            $lines[] = '
								<tr>
									<td colspan="2"><img src="' . $iurl . '" width="' . $IW . '" height="' . $IH . '" border="1" alt="" /></td>
								</tr>';
                            $lines[] = '
								<tr>
									<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
								</tr>';
                        }
                    }
                    // Finally, wrap all rows in a table tag:
                    $out .= '


			<!--
				File listing / Drag-n-drop
			-->
						<table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
							' . implode('', $lines) . '
						</table>';
                }
            } else {
                // Print this warning if the folder is NOT a web folder:
                $out .= $this->barheader($GLOBALS['LANG']->getLL('files'));
                $out .= $this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'), 'icon_warning2');
            }
        }
        return $out;
    }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:97,代码来源:class.browse_links.php

示例6: 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('&nbsp;', ' ', 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();
//.........这里部分代码省略.........
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:101,代码来源:class.tx_rtehtmlarea_user.php

示例7: 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 . '&nbsp;</td></tr><tr><td nowrap="nowrap" class="pixel">' . $pDim . '&nbsp;</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;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:60,代码来源:rte_select_image.php

示例8: bytes

 /**
  * Formats a number to GB, Mb or Kb or just bytes
  *
  * @param	integer		Number of bytes to format.
  * @param	string		Labels for bytes, kilo, mega and giga separated by vertical bar (|) and possibly encapsulated in "". Eg: " | K| M| G" (which is the default value)
  * @return	string
  * @see t3lib_div::formatSize(), stdWrap()
  * @deprecated since TYPO3 3.6, will be removed in TYPO3 4.6 - Use t3lib_div::formatSize() instead
  */
 function bytes($sizeInBytes, $labels)
 {
     t3lib_div::logDeprecatedFunction();
     return t3lib_div::formatSize($sizeInBytes, $labels);
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:14,代码来源:class.tslib_content.php

示例9: view_result

    /**
     * View result
     *
     * @return    HTML with filelist and fileview
     */
    function view_result()
    {
        $this->makeFilesArray($this->saveKey);
        $keyA = array_keys($this->fileArray);
        asort($keyA);
        $filesOverview1 = array();
        $filesOverview2 = array();
        $filesContent = array();
        $filesOverview1[] = '<tr' . $this->bgCol(1) . '>
			<td><strong>' . $this->fw('Filename:') . '</strong></td>
			<td><strong>' . $this->fw('Size:') . '</strong></td>
			<td><strong>' . $this->fw('&nbsp;') . '</strong></td>
			<td><strong>' . $this->fw('Overwrite:') . '</strong></td>
		</tr>';
        foreach ($keyA as $fileName) {
            $data = $this->fileArray[$fileName];
            $fI = pathinfo($fileName);
            if (t3lib_div::inList('php,sql,txt,xml', strtolower($fI['extension']))) {
                $linkToFile = '<strong><a href="#' . md5($fileName) . '">' . $this->fw("&nbsp;View&nbsp;") . '</a></strong>';
                if ($fI['extension'] == 'xml') {
                    $data['content'] = $GLOBALS['LANG']->csConvObj->utf8_decode($data['content'], $GLOBALS['LANG']->charSet);
                }
                $filesContent[] = '<tr' . $this->bgCol(1) . '>
				<td><a name="' . md5($fileName) . '"></a><strong>' . $this->fw($fileName) . '</strong></td>
				</tr>
				<tr>
					<td>' . $this->preWrap($data['content'], $fI['extension']) . '</td>
				</tr>';
            } else {
                $linkToFile = $this->fw('&nbsp;');
            }
            $line = '<tr' . $this->bgCol(2) . '>
				<td>' . $this->fw($fileName) . '</td>
				<td>' . $this->fw(t3lib_div::formatSize($data['size'])) . '</td>
				<td>' . $linkToFile . '</td>
				<td>';
            if ($fileName == 'doc/wizard_form.dat' || $fileName == 'doc/wizard_form.html') {
                $line .= '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="1" />';
            } else {
                $checked = '';
                if (!is_array($this->wizArray['save']['overwrite_files']) || isset($this->wizArray['save']['overwrite_files'][$fileName]) && $this->wizArray['save']['overwrite_files'][$fileName] == '1' || !isset($this->wizArray['save']['overwrite_files'][$fileName])) {
                    $checked = ' checked="checked"';
                }
                $line .= '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="0" />';
                $line .= '<input type="checkbox" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="1"' . $checked . ' />';
            }
            $line .= '</td>
			</tr>';
            if (strstr($fileName, '/')) {
                $filesOverview2[] = $line;
            } else {
                $filesOverview1[] = $line;
            }
        }
        $content = '<table border="0" cellpadding="1" cellspacing="2">' . implode('', $filesOverview1) . implode('', $filesOverview2) . '</table>';
        $content .= '<br /><input type="submit" name="' . $this->piFieldName('updateResult') . '" value="Update result" /><br />';
        $content .= $this->fw('<br /><strong>Author name:</strong> ' . $this->wizArray['emconf'][1]['author'] . '
							<br /><strong>Author email:</strong> ' . $this->wizArray['emconf'][1]['author_email']);
        $content .= '<br /><br />';
        if (!$this->EMmode) {
            $content .= '<input type="submit" name="' . $this->piFieldName('WRITE') . '" value="WRITE to \'' . $this->saveKey . '\'" />';
        } else {
            // $content.='
            // 	<strong>'.$this->fw('Write to location:').'</strong><br />
            // 	<select name="'.$this->piFieldName('loc').'">'.
            // 		'<option value="L" selected="selected">Local: '.$this->pObj->typePaths['L'].$this->saveKey.'/'.(@is_dir(PATH_site.$this->pObj->typePaths['L'].$this->saveKey)?' (OVERWRITE)':' (empty)').'</option>':'').
            // 	'</select>
            // 	<input type="submit" name="'.$this->piFieldName('WRITE').'" value="WRITE" onclick="return confirm(\'If the setting in the selectorbox says OVERWRITE\nthen the marked files of the current extension in that location will be OVERRIDDEN! \nPlease decide if you want to continue.\n\n(Remember, this is a *kickstarter* - NOT AN editor!)\');" />
            // ';
        }
        $this->afterContent = '<br /><table border="0" cellpadding="1" cellspacing="2">' . implode('', $filesContent) . '</table>';
        return $content;
    }
开发者ID:jaguerra,项目名称:TYPO3-Kickstarter,代码行数:78,代码来源:class.tx_kickstarter_wizard.php

示例10: checkValue_group_select_file


//.........这里部分代码省略.........
                         if (!$maxSize || $fileSize <= $maxSize * 1024) {
                             // Check file size:
                             // Prepare filename:
                             $theEndFileName = isset($this->alternativeFileName[$theFile]) ? $this->alternativeFileName[$theFile] : $theFile;
                             $fI = t3lib_div::split_fileref($theEndFileName);
                             // Check for allowed extension:
                             if ($this->fileFunc->checkIfAllowed($fI['fileext'], $dest, $theEndFileName)) {
                                 $theDestFile = $this->fileFunc->getUniqueName($this->fileFunc->cleanFileName($fI['file']), $dest);
                                 // If we have a unique destination filename, then write the file:
                                 if ($theDestFile) {
                                     t3lib_div::upload_copy_move($theFile, $theDestFile);
                                     // Hook for post-processing the upload action
                                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'])) {
                                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $classRef) {
                                             $hookObject = t3lib_div::getUserObj($classRef);
                                             if (!$hookObject instanceof t3lib_TCEmain_processUploadHook) {
                                                 throw new UnexpectedValueException('$hookObject must implement interface t3lib_TCEmain_processUploadHook', 1279962349);
                                             }
                                             $hookObject->processUpload_postProcessAction($theDestFile, $this);
                                         }
                                     }
                                     $this->copiedFileMap[$theFile] = $theDestFile;
                                     clearstatcache();
                                     if (!@is_file($theDestFile)) {
                                         $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)", 16, array($theFile, dirname($theDestFile), $recFID), $propArr['event_pid']);
                                     }
                                 } else {
                                     $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: No destination file (%s) possible!. (%s)", 11, array($theFile, $theDestFile, $recFID), $propArr['event_pid']);
                                 }
                             } else {
                                 $this->log($table, $id, 5, 0, 1, "File extension '%s' not allowed. (%s)", 12, array($fI['fileext'], $recFID), $propArr['event_pid']);
                             }
                         } else {
                             $this->log($table, $id, 5, 0, 1, "Filesize (%s) of file '%s' exceeds limit (%s). (%s)", 13, array(t3lib_div::formatSize($fileSize), $theFile, t3lib_div::formatSize($maxSize * 1024), $recFID), $propArr['event_pid']);
                         }
                     } else {
                         $this->log($table, $id, 5, 0, 1, 'The destination (%s) or the source file (%s) does not exist. (%s)', 14, array($dest, $theFile, $recFID), $propArr['event_pid']);
                     }
                     // If the destination file was created, we will set the new filename in the value array, otherwise unset the entry in the value array!
                     if (@is_file($theDestFile)) {
                         $info = t3lib_div::split_fileref($theDestFile);
                         $valueArray[$key] = $info['file'];
                         // The value is set to the new filename
                     } else {
                         unset($valueArray[$key]);
                         // The value is set to the new filename
                     }
                 }
             }
         }
         // If MM relations for the files, we will set the relations as MM records and change the valuearray to contain a single entry with a count of the number of files!
         if ($tcaFieldConf['MM']) {
             $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
             /* @var $dbAnalysis t3lib_loadDBGroup */
             $dbAnalysis->tableArray['files'] = array();
             // dummy
             foreach ($valueArray as $key => $theFile) {
                 // explode files
                 $dbAnalysis->itemArray[]['id'] = $theFile;
             }
             if ($status == 'update') {
                 $dbAnalysis->writeMM($tcaFieldConf['MM'], $id, 0);
                 $newFiles = implode(',', $dbAnalysis->getValueArray());
                 list(, , $recFieldName) = explode(':', $recFID);
                 if ($currentFilesForHistory != $newFiles) {
                     $this->mmHistoryRecords[$table . ':' . $id]['oldRecord'][$recFieldName] = $currentFilesForHistory;
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:67,代码来源:class.t3lib_tcemain.php

示例11: getItemColumns

 /**
  * Renders the data columns
  *
  * @param	array		$item item array
  * @return	array
  */
 function getItemColumns($item)
 {
     $type = $item['__type'];
     // 	Columns rendering
     $columns = array();
     foreach ($this->columnList as $field => $descr) {
         switch ($field) {
             case 'perms':
                 if ($this->showUnixPerms) {
                     $columns[$field] = $this->getFilePermString($item[$type . '_perms']);
                 } else {
                     $columns[$field] = ($item[$type . '_readable'] ? 'R' : '') . ($item[$type . '_writable'] ? 'W' : '');
                 }
                 break;
             case 'size':
                 if ($type === 'file') {
                     $columns[$field] = (string) $item[$type . '_size'];
                 } else {
                     $columns[$field] = '';
                 }
                 break;
             case 'file_type':
                 $columns[$field] = strtoupper($item[$field]);
                 break;
             case 'mtime':
                 $columns[$field] = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $item[$type . '_mtime']);
                 break;
             case 'title':
                 if ($type === 'file') {
                     $columns[$field] = $this->linkWrapFile($this->cropTitle($item[$type . '_title'], $field), $item);
                 } else {
                     $columns[$field] = $this->linkWrapDir($this->cropTitle($item[$type . '_title'], $field), $item[$type . '_path_absolute']);
                 }
                 break;
             case '_CLIPBOARD_':
                 $columns[$field] = $this->clipboard_getItemControl($item);
                 break;
             case '_CONTROL_':
                 $columns[$field] = $this->getItemControl($item);
                 $this->columnTDAttr[$field] = ' nowrap="nowrap"';
                 break;
             default:
                 if (isset($item[$type . $field])) {
                     $content = $item[$type . $field];
                 } else {
                     $content = $item[$field];
                 }
                 $columns[$field] = htmlspecialchars(t3lib_div::fixed_lgd_cs($content, $this->titleLength));
                 break;
         }
         if ($columns[$field] === '') {
             $columns[$field] = '&nbsp;';
         }
     }
     // Thumbsnails?
     if ($this->showThumbs and $this->thumbnailPossible($item)) {
         $columns['title'] .= '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail($item) . '</div>';
     }
     if (!$this->showDetailedSize) {
         $columns['size'] = t3lib_div::formatSize($columns['size']);
     }
     return $columns;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:69,代码来源:class.tx_dam_listfiles.php

示例12: makeUploadarray

 /**
  * Make upload array out of extension
  *
  * @param	string		Extension key
  * @param	array		Extension information array
  * @return	mixed		Returns array with extension upload array on success, otherwise an error string.
  */
 function makeUploadarray($extKey, $conf)
 {
     $extPath = tx_em_Tools::getExtPath($extKey, $conf['type']);
     if ($extPath) {
         // Get files for extension:
         $fileArr = array();
         $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $extPath, '', 0, 99, $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging']);
         // Calculate the total size of those files:
         $totalSize = 0;
         foreach ($fileArr as $file) {
             $totalSize += filesize($file);
         }
         // If the total size is less than the upper limit, proceed:
         if ($totalSize < $this->maxUploadSize) {
             // Initialize output array:
             $uploadArray = array();
             $uploadArray['extKey'] = $extKey;
             $uploadArray['EM_CONF'] = $conf['EM_CONF'];
             $uploadArray['misc']['codelines'] = 0;
             $uploadArray['misc']['codebytes'] = 0;
             $uploadArray['techInfo'] = $this->install->makeDetailedExtensionAnalysis($extKey, $conf, 1);
             // Read all files:
             foreach ($fileArr as $file) {
                 $relFileName = substr($file, strlen($extPath));
                 $fI = pathinfo($relFileName);
                 if ($relFileName != 'ext_emconf.php') {
                     // This file should be dynamically written...
                     $uploadArray['FILES'][$relFileName] = array('name' => $relFileName, 'size' => filesize($file), 'mtime' => filemtime($file), 'is_executable' => TYPO3_OS == 'WIN' ? 0 : is_executable($file), 'content' => t3lib_div::getUrl($file));
                     if (t3lib_div::inList('php,inc', strtolower($fI['extension']))) {
                         $uploadArray['FILES'][$relFileName]['codelines'] = count(explode(LF, $uploadArray['FILES'][$relFileName]['content']));
                         $uploadArray['misc']['codelines'] += $uploadArray['FILES'][$relFileName]['codelines'];
                         $uploadArray['misc']['codebytes'] += $uploadArray['FILES'][$relFileName]['size'];
                         // locallang*.php files:
                         if (substr($fI['basename'], 0, 9) == 'locallang' && strstr($uploadArray['FILES'][$relFileName]['content'], '$LOCAL_LANG')) {
                             $uploadArray['FILES'][$relFileName]['LOCAL_LANG'] = tx_em_Tools::getSerializedLocalLang($file, $uploadArray['FILES'][$relFileName]['content']);
                         }
                     }
                     $uploadArray['FILES'][$relFileName]['content_md5'] = md5($uploadArray['FILES'][$relFileName]['content']);
                 }
             }
             // Return upload-array:
             return $uploadArray;
         } else {
             return sprintf($GLOBALS['LANG']->getLL('makeUploadArray_error_size'), $totalSize, t3lib_div::formatSize($this->maxUploadSize));
         }
     } else {
         return sprintf($GLOBALS['LANG']->getLL('makeUploadArray_error_path'), $extKey);
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:56,代码来源:class.tx_em_extensions_details.php

示例13: printContentFromTab

    /**
     * Print the content on a pad. Called from ->printClipboard()
     *
     * @param	string		Pad reference
     * @return	array		Array with table rows for the clipboard.
     * @access private
     */
    function printContentFromTab($pad)
    {
        global $TBE_TEMPLATE;
        $lines = array();
        if (is_array($this->clipData[$pad]['el'])) {
            foreach ($this->clipData[$pad]['el'] as $k => $v) {
                if ($v) {
                    list($table, $uid) = explode('|', $k);
                    $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4';
                    if ($table == '_FILE') {
                        // Rendering files/directories on the clipboard:
                        if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
                            $fI = pathinfo($v);
                            $icon = is_dir($v) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                            $size = ' (' . t3lib_div::formatSize(filesize($v)) . 'bytes)';
                            $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($v) ? 'folder' : strtolower($fI['extension']), array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars($fI['basename'] . $size)));
                            $thumb = $this->clipData['_setThumb'] ? t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['extension']) ? t3lib_BEfunc::getThumbNail($this->backPath . 'thumbs.php', $v, ' vspace="4"') : '' : '';
                            $lines[] = '
								<tr>
									<td class="' . $bgColClass . '">' . $icon . '</td>
									<td class="' . $bgColClass . '" nowrap="nowrap" width="95%">&nbsp;' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($v), $GLOBALS['BE_USER']->uc['titleLen'])), $v) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;' . ($thumb ? '<br />' . $thumb : '') . '</td>
									<td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $v . '\', \'\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl('_FILE', t3lib_div::shortmd5($v))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td>
								</tr>';
                        } else {
                            // If the file did not exist (or is illegal) then it is removed from the clipboard immediately:
                            unset($this->clipData[$pad]['el'][$k]);
                            $this->changed = 1;
                        }
                    } else {
                        // Rendering records:
                        $rec = t3lib_BEfunc::getRecordWSOL($table, $uid);
                        if (is_array($rec)) {
                            $lines[] = '
								<tr>
									<td class="' . $bgColClass . '">' . $this->linkItemText(t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td>
									<td class="' . $bgColClass . '" nowrap="nowrap" width="95%">&nbsp;' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td>
									<td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td>
								</tr>';
                            $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad);
                            if ($localizationData) {
                                $lines[] = $localizationData;
                            }
                        } else {
                            unset($this->clipData[$pad]['el'][$k]);
                            $this->changed = 1;
                        }
                    }
                }
            }
        }
        if (!count($lines)) {
            $lines[] = '
								<tr>
									<td class="bgColor4"><img src="clear.gif" width="56" height="1" alt="" /></td>
									<td colspan="2" class="bgColor4" nowrap="nowrap" width="95%">&nbsp;<em>(' . $this->clLabel('clipNoEl') . ')</em>&nbsp;</td>
								</tr>';
        }
        $this->endClipboard();
        return $lines;
    }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:67,代码来源:class.t3lib_clipboard.php

示例14: renderFileContent

    /**
     * Renders the API listing for a single file, represented by the input array
     *
     * @param	array		Array with API information for a single file.
     * @return	array		Array with superindex / index / body content (keys 0/1)
     */
    function renderFileContent($fDat)
    {
        // Set anchor value:
        $anchor = md5($fDat['filename']);
        $this->fileSizeTotal += $fDat['filesize'];
        $this->funcClassesTotal += is_array($fDat['DAT']) ? count($fDat['DAT']) : '0';
        // Create file header content:
        $superIndex .= '
			<h3><a href="#s-' . $anchor . '">' . htmlspecialchars($fDat['filename']) . '</a></h3>
		';
        $index .= '
			<h3><a name="s-' . $anchor . '"></a><a href="#' . $anchor . '">' . htmlspecialchars($fDat['filename']) . '</a></h3>
			<p class="c-fileDescription">' . nl2br(htmlspecialchars(trim($fDat['header']['text']))) . '</p>';
        $content .= '

					<!--
						API content for file: ' . htmlspecialchars($fDat['filename']) . '
					-->
					<div class="c-header">
						<a name="' . $anchor . '"></a>
						<h3><a href="#top">' . htmlspecialchars($fDat['filename']) . '</a></h3>
						<p class="c-fileDescription">' . nl2br(htmlspecialchars(trim($fDat['header']['text']))) . '</p>

						<table border="0" cellpadding="0" cellspacing="1" class="c-details">
							<tr>
								<td class="c-Hcell">Filesize:</td>
								<td>' . t3lib_div::formatSize($fDat['filesize']) . '</td>
							</tr>
							<tr>
								<td class="c-Hcell">Func/Classes:</td>
								<td>' . (is_array($fDat['DAT']) ? count($fDat['DAT']) : 'N/A') . '</td>
							</tr>' . (is_array($fDat['header']['other']) ? '
							<tr>
								<td class="c-Hcell">Tags:</td>
								<td>' . nl2br(htmlspecialchars(implode(chr(10), $fDat['header']['other']))) . '</td>
							</tr>' : '') . '
						</table>
					</div>
			';
        // If there are classes/functions in the file, render API for those:
        if (is_array($fDat['DAT'])) {
            // Traverse list of classes/functions:
            foreach ($fDat['DAT'] as $k => $v) {
                if (is_array($v['sectionText']) && count($v['sectionText'])) {
                    // Section header:
                    $index .= '

							<h3 class="section">' . nl2br(htmlspecialchars(trim(implode(chr(10), $v['sectionText'])))) . '</h3>
							';
                }
                // Check, if the access tag is set to private (and if so, do not show):
                if ($v['cDat']['access'] != 'private' && !$v['cDat']['ignore'] || $this->showPrivateIgnoreFunc) {
                    // Set anchor value first:
                    $anchor = md5($fDat['filename'] . ':' . $v['header'] . $v['parentClass']);
                    $headerString = preg_replace('#\\{[[:space:]]*$#', '', $v['header']);
                    $tClass = 'c-' . (t3lib_div::isFirstPartOfStr(strtolower($v['header']), 'class') ? 'class' : 'function');
                    // Add header for function (title / description etc):
                    $index .= '
						<h4 class="' . $tClass . '"><a href="#' . $anchor . '">' . htmlspecialchars($headerString) . '</a></h4>';
                    $content .= '
					<!--
						Description for "' . htmlspecialchars($headerString) . '"
					-->
					<div class="' . $tClass . '">
						<a name="' . $anchor . '"></a>
						<h4><a href="#top">' . htmlspecialchars($headerString) . '</a></h4>
						<p class="c-funcDescription">' . nl2br(htmlspecialchars(trim($v['cDat']['text']))) . '</p>
						';
                    // Render details for the function/class:
                    // Parameters:
                    $tableRows = array();
                    if (is_array($v['cDat']['param'])) {
                        // Get argument names of current function:
                        $funcHeadParams = $this->splitFunctionHeader($v['header']);
                        // For each argument, render a row in the table:
                        foreach ($v['cDat']['param'] as $k2 => $pp) {
                            $tableRows[] = '
							<tr>
								<td class="c-Hcell">' . htmlspecialchars($funcHeadParams[$k2]) . '</td>
								<td class="c-vType">' . htmlspecialchars($pp[0]) . '</td>
								<td class="c-vDescr">' . htmlspecialchars(trim($pp[1])) . '</td>
							</tr>';
                        }
                    }
                    // Add "return" value:
                    $tableRows[] = '
							<tr>
								<td class="c-Hcell">Returns: </td>
								<td class="c-vType">' . htmlspecialchars($v['cDat']['return'][0]) . '</td>
								<td class="c-vDescr">' . htmlspecialchars(trim($v['cDat']['return'][1])) . '</td>
							</tr>';
                    // Add other tags:
                    if (is_array($v['cDat']['other'])) {
                        foreach ($v['cDat']['other'] as $k2 => $pp) {
//.........这里部分代码省略.........
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:101,代码来源:class.tx_extdeveval_apidisplay.php

示例15: previewFieldValue

 /**
  * Rendering preview output of a field value which is not shown as a form field but just outputted.
  *
  * @param	string		The value to output
  * @param	array		Configuration for field.
  * @param	string		Name of field.
  * @return	 string		HTML formatted output
  */
 function previewFieldValue($value, $config, $field = '')
 {
     if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
         // Ignore uploadfolder if internal_type is file_reference
         if ($config['config']['internal_type'] === 'file_reference') {
             $config['config']['uploadfolder'] = '';
         }
         $show_thumbs = TRUE;
         $table = 'tt_content';
         // Making the array of file items:
         $itemArray = t3lib_div::trimExplode(',', $value, 1);
         // Showing thumbnails:
         $thumbsnail = '';
         if ($show_thumbs) {
             $imgs = array();
             foreach ($itemArray as $imgRead) {
                 $imgP = explode('|', $imgRead);
                 $imgPath = rawurldecode($imgP[0]);
                 $rowCopy = array();
                 $rowCopy[$field] = $imgPath;
                 // Icon + clickmenu:
                 $absFilePath = t3lib_div::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
                 $fileInformation = pathinfo($imgPath);
                 $fileIcon = t3lib_iconWorks::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!'))));
                 $imgs[] = '<span class="nobr">' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>';
             }
             $thumbsnail = implode('<br />', $imgs);
         }
         return $thumbsnail;
     } else {
         return nl2br(htmlspecialchars($value));
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:41,代码来源:class.t3lib_tceforms.php


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