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


PHP t3lib_div::tempnam方法代码示例

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


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

示例1: getContent

 /**
  * get Content of DOC file
  *
  * @param string $file
  * @return string The extracted content of the file
  */
 public function getContent($file)
 {
     // create the tempfile which will contain the content
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $tempFileName = TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('doc_files-Indexer');
     } else {
         $tempFileName = t3lib_div::tempnam('doc_files-Indexer');
     }
     // Delete if exists, just to be safe.
     @unlink($tempFileName);
     // generate and execute the pdftotext commandline tool
     $cmd = $this->app['catdoc'] . ' -s8859-1 -dutf-8 ' . escapeshellarg($file) . ' > ' . escapeshellarg($tempFileName);
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
     } else {
         t3lib_utility_Command::exec($cmd);
     }
     // check if the tempFile was successfully created
     if (@is_file($tempFileName)) {
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $content = TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
         } else {
             $content = t3lib_div::getUrl($tempFileName);
         }
         unlink($tempFileName);
     } else {
         return false;
     }
     // check if content was found
     if (strlen($content)) {
         return $content;
     } else {
         return false;
     }
 }
开发者ID:brainformatik,项目名称:ke_search,代码行数:41,代码来源:class.tx_kesearch_indexer_filetypes_doc.php

示例2: indexExternalUrl

 /**
  * Index External URLs HTML content
  *
  * @param	string		URL, eg. "http://typo3.org/"
  * @return	void
  * @see indexRegularDocument()
  */
 function indexExternalUrl($externalUrl)
 {
     // Parse External URL:
     $qParts = parse_url($externalUrl);
     $fI = pathinfo($qParts['path']);
     $ext = strtolower($fI['extension']);
     // Get headers:
     $urlHeaders = $this->getUrlHeaders($externalUrl);
     if (stristr($urlHeaders['Content-Type'], 'text/html')) {
         $content = $this->indexExternalUrl_content = t3lib_div::getUrl($externalUrl);
         if (strlen($content)) {
             // Create temporary file:
             $tmpFile = t3lib_div::tempnam('EXTERNAL_URL');
             if ($tmpFile) {
                 t3lib_div::writeFile($tmpFile, $content);
                 // Index that file:
                 $this->indexRegularDocument($externalUrl, TRUE, $tmpFile, 'html');
                 // Using "TRUE" for second parameter to force indexing of external URLs (mtime doesn't make sense, does it?)
                 unlink($tmpFile);
             }
         }
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:30,代码来源:class.indexer.php

示例3: readFileContent

 /**
  * Reads the content of an external file being indexed.
  *
  * @param	string		File extension, eg. "pdf", "doc" etc.
  * @param	string		Absolute filename of file (must exist and be validated OK before calling function)
  * @param	string		Pointer to section (zero for all other than PDF which will have an indication of pages into which the document should be splitted.)
  * @return	array		Standard content array (title, description, keywords, body keys)
  */
 function readFileContent($ext, $absFile, $cPKey)
 {
     unset($contentArr);
     // Return immediately if initialization didn't set support up:
     if (!$this->supportedExtensions[$ext]) {
         return FALSE;
     }
     // Switch by file extension
     switch ($ext) {
         case 'pdf':
             if ($this->app['pdfinfo']) {
                 // Getting pdf-info:
                 $cmd = $this->app['pdfinfo'] . ' ' . escapeshellarg($absFile);
                 exec($cmd, $res);
                 $pdfInfo = $this->splitPdfInfo($res);
                 unset($res);
                 if (intval($pdfInfo['pages'])) {
                     list($low, $high) = explode('-', $cPKey);
                     // Get pdf content:
                     $tempFileName = t3lib_div::tempnam('Typo3_indexer');
                     // Create temporary name
                     @unlink($tempFileName);
                     // Delete if exists, just to be safe.
                     $cmd = $this->app['pdftotext'] . ' -f ' . $low . ' -l ' . $high . ' -enc UTF-8 -q ' . escapeshellarg($absFile) . ' ' . $tempFileName;
                     exec($cmd);
                     if (@is_file($tempFileName)) {
                         $content = t3lib_div::getUrl($tempFileName);
                         unlink($tempFileName);
                     } else {
                         $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsFailed'), $absFile), 2);
                     }
                     if (strlen($content)) {
                         $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content));
                     }
                 }
             }
             break;
         case 'doc':
             if ($this->app['catdoc']) {
                 $cmd = $this->app['catdoc'] . ' -d utf-8 ' . escapeshellarg($absFile);
                 exec($cmd, $res);
                 $content = implode(LF, $res);
                 unset($res);
                 $contentArr = $this->pObj->splitRegularContent($this->removeEndJunk($content));
             }
             break;
         case 'pps':
         case 'ppt':
             if ($this->app['ppthtml']) {
                 $cmd = $this->app['ppthtml'] . ' ' . escapeshellarg($absFile);
                 exec($cmd, $res);
                 $content = implode(LF, $res);
                 unset($res);
                 $content = $this->pObj->convertHTMLToUtf8($content);
                 $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content));
                 $contentArr['title'] = basename($absFile);
                 // Make sure the title doesn't expose the absolute path!
             }
             break;
         case 'xls':
             if ($this->app['xlhtml']) {
                 $cmd = $this->app['xlhtml'] . ' -nc -te ' . escapeshellarg($absFile);
                 exec($cmd, $res);
                 $content = implode(LF, $res);
                 unset($res);
                 $content = $this->pObj->convertHTMLToUtf8($content);
                 $contentArr = $this->pObj->splitHTMLContent($this->removeEndJunk($content));
                 $contentArr['title'] = basename($absFile);
                 // Make sure the title doesn't expose the absolute path!
             }
             break;
         case 'sxi':
         case 'sxc':
         case 'sxw':
         case 'ods':
         case 'odp':
         case 'odt':
             if ($this->app['unzip']) {
                 // Read content.xml:
                 $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' content.xml';
                 exec($cmd, $res);
                 $content_xml = implode(LF, $res);
                 unset($res);
                 // Read meta.xml:
                 $cmd = $this->app['unzip'] . ' -p ' . escapeshellarg($absFile) . ' meta.xml';
                 exec($cmd, $res);
                 $meta_xml = implode(LF, $res);
                 unset($res);
                 $utf8_content = trim(strip_tags(str_replace('<', ' <', $content_xml)));
                 $contentArr = $this->pObj->splitRegularContent($utf8_content);
                 $contentArr['title'] = basename($absFile);
                 // Make sure the title doesn't expose the absolute path!
//.........这里部分代码省略.........
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:101,代码来源:class.external_parser.php

示例4: spellCheckHandler

 function spellCheckHandler($xml_parser, $string)
 {
     $incurrent = array();
     $stringText = $string;
     $words = preg_split($this->parserCharset == 'utf-8' ? '/\\P{L}+/u' : '/\\W+/', $stringText);
     while (list(, $word) = each($words)) {
         $word = preg_replace('/ /' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '', $word);
         if ($word && !is_numeric($word)) {
             if ($this->pspell_is_available && !$this->forceCommandMode) {
                 if (!pspell_check($this->pspell_link, $word)) {
                     if (!in_array($word, $this->misspelled)) {
                         if (sizeof($this->misspelled) != 0) {
                             $this->suggestedWords .= ',';
                         }
                         $suggest = array();
                         $suggest = pspell_suggest($this->pspell_link, $word);
                         if (sizeof($suggest) != 0) {
                             $this->suggestionCount++;
                             $this->suggestedWordCount += sizeof($suggest);
                         }
                         $this->suggestedWords .= '"' . $word . '":"' . implode(',', $suggest) . '"';
                         $this->misspelled[] = $word;
                         unset($suggest);
                     }
                     if (!in_array($word, $incurrent)) {
                         $stringText = preg_replace('/\\b' . $word . '\\b/' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '<span class="htmlarea-spellcheck-error">' . $word . '</span>', $stringText);
                         $incurrent[] = $word;
                     }
                 }
             } else {
                 $tmpFileName = t3lib_div::tempnam($this->filePrefix);
                 if (!($filehandle = fopen($tmpFileName, 'wb'))) {
                     echo 'SpellChecker tempfile open error';
                 }
                 if (!fwrite($filehandle, $word)) {
                     echo 'SpellChecker tempfile write error';
                 }
                 if (!fclose($filehandle)) {
                     echo 'SpellChecker tempfile close error';
                 }
                 $AspellCommand = 'cat ' . escapeshellarg($tmpFileName) . ' | ' . $this->AspellDirectory . ' -a check --mode=none --sug-mode=' . escapeshellarg($this->pspellMode) . $this->personalDictsArg . ' --lang=' . escapeshellarg($this->dictionary) . ' --encoding=' . escapeshellarg($this->aspellEncoding) . ' 2>&1';
                 $AspellAnswer = shell_exec($AspellCommand);
                 $AspellResultLines = array();
                 $AspellResultLines = t3lib_div::trimExplode(LF, $AspellAnswer, 1);
                 if (substr($AspellResultLines[0], 0, 6) == 'Error:') {
                     echo "{$AspellAnswer}";
                 }
                 t3lib_div::unlink_tempfile($tmpFileName);
                 if (substr($AspellResultLines['1'], 0, 1) != '*') {
                     if (!in_array($word, $this->misspelled)) {
                         if (sizeof($this->misspelled) != 0) {
                             $this->suggestedWords .= ',';
                         }
                         $suggest = array();
                         $suggestions = array();
                         if (substr($AspellResultLines['1'], 0, 1) == '&') {
                             $suggestions = t3lib_div::trimExplode(':', $AspellResultLines['1'], 1);
                             $suggest = t3lib_div::trimExplode(',', $suggestions['1'], 1);
                         }
                         if (sizeof($suggest) != 0) {
                             $this->suggestionCount++;
                             $this->suggestedWordCount += sizeof($suggest);
                         }
                         $this->suggestedWords .= '"' . $word . '":"' . implode(',', $suggest) . '"';
                         $this->misspelled[] = $word;
                         unset($suggest);
                         unset($suggestions);
                     }
                     if (!in_array($word, $incurrent)) {
                         $stringText = preg_replace('/\\b' . $word . '\\b/' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '<span class="htmlarea-spellcheck-error">' . $word . '</span>', $stringText);
                         $incurrent[] = $word;
                     }
                 }
                 unset($AspellResultLines);
             }
             $this->wordCount++;
         }
     }
     $this->text .= $stringText;
     unset($incurrent);
     return;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:82,代码来源:class.tx_rtehtmlarea_pi1.php

示例5: main

    /**
     * The main processing method if this class
     *
     * @return	string		Information of the template status or the taken actions as HTML string
     */
    function main()
    {
        global $SOBE, $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
        global $tmpl, $tplRow, $theConstants;
        $edit = $this->pObj->edit;
        $e = $this->pObj->e;
        t3lib_div::loadTCA('sys_template');
        // **************************
        // Checking for more than one template an if, set a menu...
        // **************************
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        // **************************
        // Initialize
        // **************************
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
        }
        // **************************
        // Create extension template
        // **************************
        $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
        if ($newId) {
            // switch to new template
            t3lib_utility_Http::redirect('index.php?id=' . $this->pObj->id . '&SET[templatesOnPage]=' . $newId);
        }
        if ($existTemplate) {
            // Update template ?
            $POST = t3lib_div::_POST();
            if ($POST['submit'] || t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']) || $POST['saveclose'] || t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y'])) {
                // Set the data to be saved
                $recData = array();
                $alternativeFileName = array();
                $resList = $tplRow['resources'];
                $tmp_upload_name = '';
                $tmp_newresource_name = '';
                // Set this to blank
                if (is_array($POST['data'])) {
                    foreach ($POST['data'] as $field => $val) {
                        switch ($field) {
                            case 'constants':
                            case 'config':
                            case 'title':
                            case 'sitetitle':
                            case 'description':
                                $recData['sys_template'][$saveId][$field] = $val;
                                break;
                            case 'resources':
                                $tmp_upload_name = t3lib_div::upload_to_tempfile($_FILES['resources']['tmp_name']);
                                // If there is an uploaded file, move it for the sake of safe_mode.
                                if ($tmp_upload_name) {
                                    if ($tmp_upload_name != 'none' && $_FILES['resources']['name']) {
                                        $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']);
                                        $resList = $tmp_upload_name . ',' . $resList;
                                    }
                                }
                                break;
                            case 'new_resource':
                                $newName = trim(t3lib_div::_GP('new_resource'));
                                if ($newName) {
                                    $newName .= '.' . t3lib_div::_GP('new_resource_ext');
                                    $tmp_newresource_name = t3lib_div::tempnam('new_resource_');
                                    $alternativeFileName[$tmp_newresource_name] = $newName;
                                    $resList = $tmp_newresource_name . ',' . $resList;
                                }
                                break;
                            case 'makecopy_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $tmp_name = PATH_site . $TCA['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $file;
                                        $resList = $tmp_name . ',' . $resList;
                                    }
                                }
                                break;
                            case 'remove_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $resList = str_replace(',' . $file . ',', ',', $resList);
                                    }
                                }
                                break;
                            case 'totop_resource':
                                if (is_array($val)) {
                                    $resList = ',' . $resList . ',';
                                    foreach ($val as $k => $file) {
                                        $resList = str_replace(',' . $file . ',', ',', $resList);
                                        $resList = ',' . $file . $resList;
                                    }
//.........这里部分代码省略.........
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:101,代码来源:class.tx_tstemplateinfo.php

示例6: import_addFileNameToBeCopied

 /**
  * Writes the file from import array to temp dir and returns the filename of it.
  *
  * @param	array		File information with three keys: "filename" = filename without path, "ID_absFile" = absolute filepath to the file (including the filename), "ID" = md5 hash of "ID_absFile"
  * @return	string		Absolute filename of the temporary filename of the file. In ->alternativeFileName the original name is set.
  */
 function import_addFileNameToBeCopied($fI)
 {
     if (is_array($this->dat['files'][$fI['ID']])) {
         $tmpFile = t3lib_div::tempnam('import_temp_');
         t3lib_div::writeFile($tmpFile, $this->dat['files'][$fI['ID']]['content']);
         clearstatcache();
         if (@is_file($tmpFile)) {
             $this->unlinkFiles[] = $tmpFile;
             if (filesize($tmpFile) == $this->dat['files'][$fI['ID']]['filesize']) {
                 $this->alternativeFileName[$tmpFile] = $fI['filename'];
                 $this->alternativeFilePath[$tmpFile] = $this->dat['files'][$fI['ID']]['relFileRef'];
                 return $tmpFile;
             } else {
                 $this->error('Error: temporary file ' . $tmpFile . ' had a size (' . filesize($tmpFile) . ') different from the original (' . $this->dat['files'][$fI['ID']]['filesize'] . ')', 1);
             }
         } else {
             $this->error('Error: temporary file ' . $tmpFile . ' was not written as it should have been!', 1);
         }
     } else {
         $this->error('Error: No file found for ID ' . $fI['ID'], 1);
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:28,代码来源:class.tx_impexp.php

示例7: upload_to_tempfile

 /**
  * Will move an uploaded file (normally in "/tmp/xxxxx") to a temporary filename in PATH_site."typo3temp/" from where TYPO3 can use it under safe_mode.
  * Use this function to move uploaded files to where you can work on them.
  * REMEMBER to use t3lib_div::unlink_tempfile() afterwards - otherwise temp-files will build up! They are NOT automatically deleted in PATH_site."typo3temp/"!
  * Usage: 6
  *
  * @param	string		The temporary uploaded filename, eg. $_FILES['[upload field name here]']['tmp_name']
  * @return	string		If a new file was successfully created, return its filename, otherwise blank string.
  * @see unlink_tempfile(), upload_copy_move()
  */
 function upload_to_tempfile($uploadedFileName)
 {
     if (is_uploaded_file($uploadedFileName)) {
         $tempFile = t3lib_div::tempnam('upload_temp_');
         move_uploaded_file($uploadedFileName, $tempFile);
         return @is_file($tempFile) ? $tempFile : '';
     }
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:18,代码来源:class.t3lib_div.php

示例8: getDiff

 /**
  * Produce a diff (using the "diff" application) between two strings
  * The function will write the two input strings to temporary files, then execute the diff program, delete the temp files and return the result.
  *
  * @param	string		String 1
  * @param	string		String 2
  * @return	array		The result from the exec() function call.
  * @access private
  */
 function getDiff($str1, $str2)
 {
     // Create file 1 and write string
     $file1 = t3lib_div::tempnam('diff1_');
     t3lib_div::writeFile($file1, $str1);
     // Create file 2 and write string
     $file2 = t3lib_div::tempnam('diff2_');
     t3lib_div::writeFile($file2, $str2);
     // Perform diff.
     $cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' ' . $this->diffOptions . ' ' . $file1 . ' ' . $file2;
     $res = array();
     t3lib_utility_Command::exec($cmd, $res);
     unlink($file1);
     unlink($file2);
     return $res;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:25,代码来源:class.t3lib_diff.php

示例9: tidyHTML

 /**
  * Pass the content through tidy - a little program that cleans up HTML-code.
  * Requires $this->TYPO3_CONF_VARS['FE']['tidy'] to be true and $this->TYPO3_CONF_VARS['FE']['tidy_path'] to contain the filename/path of tidy including clean-up arguments for tidy. See default value in TYPO3_CONF_VARS in t3lib/config_default.php
  *
  * @param	string		The page content to clean up. Will be written to a temporary file which "tidy" is then asked to clean up. File content is read back and returned.
  * @return	string		Returns the
  */
 function tidyHTML($content)
 {
     if ($this->TYPO3_CONF_VARS['FE']['tidy'] && $this->TYPO3_CONF_VARS['FE']['tidy_path']) {
         $oldContent = $content;
         $fname = t3lib_div::tempnam('typo3_tidydoc_');
         // Create temporary name
         @unlink($fname);
         // Delete if exists, just to be safe.
         $fp = fopen($fname, 'wb');
         // Open for writing
         fputs($fp, $content);
         // Put $content
         @fclose($fp);
         // Close
         exec($this->TYPO3_CONF_VARS['FE']['tidy_path'] . ' ' . $fname, $output);
         // run the $content through 'tidy', which formats the HTML to nice code.
         @unlink($fname);
         // Delete the tempfile again
         $content = implode(LF, $output);
         if (!trim($content)) {
             $content = $oldContent;
             // Restore old content due empty return value.
             $GLOBALS['TT']->setTSlogMessage('"tidy" returned an empty value!', 2);
         }
         $GLOBALS['TT']->setTSlogMessage('"tidy" content lenght: ' . strlen($content), 0);
     }
     return $content;
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:35,代码来源:class.tslib_fe.php

示例10: fetchMetaData

 /**
  * Fetches metadata and stores it to the corresponding place. This includes the mirror list,
  * extension XML files.
  *
  * @param	string		Type of data to fetch: (mirrors)
  * @param	boolean		If true the method doesn't produce any output
  * @return	void
  */
 function fetchMetaData($metaType)
 {
     global $TYPO3_CONF_VARS;
     $content = '';
     switch ($metaType) {
         case 'mirrors':
             $mfile = t3lib_div::tempnam('mirrors');
             $mirrorsFile = t3lib_div::getURL($this->MOD_SETTINGS['mirrorListURL'], 0, array(TYPO3_user_agent));
             if ($mirrorsFile === false) {
                 t3lib_div::unlink_tempfile($mfile);
                 $content = '<p>' . sprintf($GLOBALS['LANG']->getLL('ext_import_list_not_updated'), $this->MOD_SETTINGS['mirrorListURL']) . ' ' . $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
             } else {
                 t3lib_div::writeFile($mfile, $mirrorsFile);
                 $mirrors = implode('', gzfile($mfile));
                 t3lib_div::unlink_tempfile($mfile);
                 $mirrors = $this->xmlHandler->parseMirrorsXML($mirrors);
                 if (is_array($mirrors) && count($mirrors)) {
                     t3lib_BEfunc::getModuleData($this->MOD_MENU, array('extMirrors' => serialize($mirrors)), $this->MCONF['name'], '', 'extMirrors');
                     $this->MOD_SETTINGS['extMirrors'] = serialize($mirrors);
                     $content = '<p>' . sprintf($GLOBALS['LANG']->getLL('ext_import_list_updated'), count($mirrors)) . '</p>';
                 } else {
                     $content = '<p>' . $mirrors . '<br />' . $GLOBALS['LANG']->getLL('ext_import_list_empty') . '</p>';
                 }
             }
             break;
         case 'extensions':
             $this->fetchMetaData('mirrors');
             // if we fetch the extensions anyway, we can as well keep this up-to-date
             $mirror = $this->getMirrorURL();
             $extfile = $mirror . 'extensions.xml.gz';
             $extmd5 = t3lib_div::getURL($mirror . 'extensions.md5', 0, array(TYPO3_user_agent));
             if (is_file(PATH_site . 'typo3temp/extensions.xml.gz')) {
                 $localmd5 = md5_file(PATH_site . 'typo3temp/extensions.xml.gz');
             }
             // count cached extensions. If cache is empty re-fill it
             $cacheCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('extkey', 'cache_extensions');
             if ($extmd5 === false) {
                 $content .= '<p>' . sprintf($GLOBALS['LANG']->getLL('ext_import_md5_not_updated'), $mirror . 'extensions.md5') . $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
             } elseif ($extmd5 == $localmd5 && $cacheCount) {
                 $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('ext_import_list_unchanged'), $GLOBALS['LANG']->getLL('ext_import_list_unchanged_header'), t3lib_FlashMessage::INFO);
                 $content .= $flashMessage->render();
             } else {
                 $extXML = t3lib_div::getURL($extfile, 0, array(TYPO3_user_agent));
                 if ($extXML === false) {
                     $content .= '<p>' . sprintf($GLOBALS['LANG']->getLL('ext_import_list_unchanged'), $extfile) . ' ' . $GLOBALS['LANG']->getLL('translation_problems') . '</p>';
                 } else {
                     t3lib_div::writeFile(PATH_site . 'typo3temp/extensions.xml.gz', $extXML);
                     $content .= $this->xmlHandler->parseExtensionsXML(PATH_site . 'typo3temp/extensions.xml.gz');
                 }
             }
             break;
     }
     return $content;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:62,代码来源:index.php

示例11: generateGraphic

 /**
  * The actual sprite generator, renders the command for Im/GM and executes
  *
  * @return void
  */
 protected function generateGraphic()
 {
     $iconParameters = array();
     $tempSprite = t3lib_div::tempnam($this->spriteName);
     $filePath = array('mainFile' => PATH_site . $this->spriteFolder . $this->spriteName . '.png', 'gifFile' => NULL);
     // create black true color image with given size
     $newSprite = imagecreatetruecolor($this->spriteWidth, $this->spriteHeight);
     imagesavealpha($newSprite, TRUE);
     // make it transparent
     imagefill($newSprite, 0, 0, imagecolorallocatealpha($newSprite, 0, 255, 255, 127));
     foreach ($this->iconsData as $icon) {
         $function = 'imagecreatefrom' . strtolower($icon['fileExtension']);
         if (function_exists($function)) {
             $currentIcon = $function($icon['fileName']);
             imagecopy($newSprite, $currentIcon, $icon['left'], $icon['top'], 0, 0, $icon['width'], $icon['height']);
         }
     }
     imagepng($newSprite, $tempSprite . '.png');
     if ($this->generateGIFCopy) {
         $filePath['gifFile'] = PATH_site . $this->spriteFolder . $this->spriteName . '.gif';
         $gifSprite = imagecreatetruecolor($this->spriteWidth, $this->spriteHeight);
         // make it transparent
         imagefill($gifSprite, 0, 0, imagecolorallocate($gifSprite, 127, 127, 127));
         foreach ($this->iconsData as $icon) {
             $function = 'imagecreatefrom' . strtolower($icon['fileExtension']);
             if (function_exists($function)) {
                 $currentIcon = $function($icon['fileName']);
                 imagecopy($gifSprite, $currentIcon, $icon['left'], $icon['top'], 0, 0, $icon['width'], $icon['height']);
             }
         }
         imagecolortransparent($gifSprite, imagecolorallocate($gifSprite, 127, 127, 127));
         imagegif($gifSprite, $tempSprite . '.gif');
     }
     t3lib_div::upload_copy_move($tempSprite . '.png', $filePath['mainFile']);
     t3lib_div::unlink_tempfile($tempSprite . '.png');
     if ($this->generateGIFCopy) {
         t3lib_div::upload_copy_move($tempSprite . '.gif', $filePath['gifFile']);
         t3lib_div::unlink_tempfile($tempSprite . '.gif');
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:45,代码来源:class.t3lib_spritemanager_spritegenerator.php

示例12: div_arrayToCsvFile

 function div_arrayToCsvFile($aData, $sFilePath = FALSE, $sFSep = ";", $sLSep = "\r\n", $sStringWrap = "\"")
 {
     if ($sFilePath === FALSE) {
         $sFilePath = t3lib_div::tempnam("csv-" . strftime("%Y.%m.%d-%Hh%Mm%Ss" . "-")) . ".csv";
     } else {
         $sFilePath = tx_ameosformidable::toServerPath($sFilePath);
     }
     tx_ameosformidable::file_writeBin($sFilePath, tx_ameosformidable::div_arrayToCsvString($aData, $sFSep, $sLSep, $sStringWrap), FALSE);
     return $sFilePath;
 }
开发者ID:preinboth,项目名称:formidable,代码行数:10,代码来源:class.tx_ameosformidable.php

示例13: tempFile

 /**
  * Create a temporary file.
  *
  * @param	string		File prefix.
  * @return	string		File name or FALSE
  */
 function tempFile($filePrefix)
 {
     $absFile = t3lib_div::tempnam($filePrefix);
     if ($absFile) {
         $ret = TRUE;
         $this->registerTempFile($absFile);
     } else {
         $ret = FALSE;
         $this->errorPush(T3_ERR_SV_FILE_WRITE, 'Can not create temp file.');
     }
     return $ret ? $absFile : FALSE;
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:18,代码来源:class.t3lib_svbase.php

示例14: createFakeExtension

 /**
  * Creates a fake extension with a given table definition.
  *
  * @param string $tableDefinition SQL script to create the extension's tables
  * @return void
  */
 protected function createFakeExtension($tableDefinition)
 {
     // Prepare a fake extension configuration
     $ext_tables = t3lib_div::tempnam('ext_tables');
     t3lib_div::writeFile($ext_tables, $tableDefinition);
     $this->temporaryFiles[] = $ext_tables;
     $GLOBALS['TYPO3_LOADED_EXT']['test_dbal'] = array('ext_tables.sql' => $ext_tables);
     // Append our test table to the list of existing tables
     $GLOBALS['TYPO3_DB']->clearCachedFieldInfo();
     $GLOBALS['TYPO3_DB']->_call('initInternalVariables');
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:17,代码来源:dbGeneralTest.php

示例15: getContent

 /**
  * get Content of PDF file
  *
  * @param string $file
  * @return string The extracted content of the file
  */
 public function getContent($file)
 {
     if (TYPO3_VERSION_INTEGER >= 6002000) {
         $this->fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_lib_fileinfo');
     } else {
         $this->fileInfo = t3lib_div::makeInstance('tx_kesearch_lib_fileinfo');
     }
     $this->fileInfo->setFile($file);
     // get PDF informations
     if (!($pdfInfo = $this->getPdfInfo($file))) {
         return false;
     }
     // proceed only of there are any pages found
     if (intval($pdfInfo['pages']) && $this->isAppArraySet) {
         // create the tempfile which will contain the content
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $tempFileName = TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('pdf_files-Indexer');
         } else {
             $tempFileName = t3lib_div::tempnam('pdf_files-Indexer');
         }
         // Delete if exists, just to be safe.
         @unlink($tempFileName);
         // generate and execute the pdftotext commandline tool
         $cmd = $this->app['pdftotext'] . ' -enc UTF-8 -q ' . escapeshellarg($file) . ' ' . escapeshellarg($tempFileName);
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             TYPO3\CMS\Core\Utility\CommandUtility::exec($cmd);
         } else {
             t3lib_utility_Command::exec($cmd);
         }
         // check if the tempFile was successfully created
         if (@is_file($tempFileName)) {
             if (TYPO3_VERSION_INTEGER >= 7000000) {
                 $content = TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($tempFileName);
             } else {
                 $content = t3lib_div::getUrl($tempFileName);
             }
             unlink($tempFileName);
         } else {
             $this->addError('Content for file ' . $file . ' could not be extracted. Maybe it is encrypted?');
             // return empty string if no content was found
             $content = '';
         }
         return $this->removeEndJunk($content);
     } else {
         return false;
     }
 }
开发者ID:brainformatik,项目名称:ke_search,代码行数:53,代码来源:class.tx_kesearch_indexer_filetypes_pdf.php


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