• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FilesModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: transferAction

 public function transferAction()
 {
     $fc = FrontController::getInstance();
     $file = new FilesModel();
     $params = $fc->getParams();
     if (preg_match("/^[a-zA-Z0-9_]+(_[\\d]+s|).txt\$/", $params['filename'])) {
         $file->getDataFromFile($params['filename']);
         $file->connectToDb();
         $file->putDataToDatabase();
         $file->getStatus();
     }
 }
开发者ID:onpavlov,项目名称:Auto_Playlist_v2,代码行数:12,代码来源:FilesController.php


示例2: updateFileTreeFields

 /**
  * Update FileTree fields
  */
 public function updateFileTreeFields()
 {
     $objDatabase = \Database::getInstance();
     $arrFields = array('singleSRC', 'imgSRC');
     // Check the column type
     $objDesc = $objDatabase->query("DESC tl_downloadarchiveitems singleSRC");
     // Change the column type
     if ($objDesc->Type != 'binary(16)') {
         foreach ($arrFields as $field) {
             $objFiles = $objDatabase->execute("SELECT id,{$field} FROM tl_downloadarchiveitems");
             $objDatabase->query("ALTER TABLE tl_downloadarchiveitems CHANGE {$field} {$field} binary(16) NULL");
             #$objDatabase->query("UPDATE tl_downloadarchiveitems SET $field=NULL WHERE $field='' OR $field=0");
             while ($objFiles->next()) {
                 $objHelper = $this->generateHelperObject($this->changePath($objFiles->{$field}));
                 // UUID already
                 if ($objHelper->isUuid) {
                     continue;
                 }
                 // Numeric ID to UUID
                 if ($objHelper->isNumeric) {
                     $objFile = \FilesModel::findByPk($objHelper->value);
                     $objDatabase->prepare("UPDATE tl_downloadarchiveitems SET {$field}=? WHERE id=?")->execute($objFile->uuid, $objFiles->id);
                 } else {
                     $objFile = \FilesModel::findByPath($objHelper->value);
                     $objDatabase->prepare("UPDATE tl_downloadarchiveitems SET {$field}=? WHERE id=?")->execute($objFile->uuid, $objFiles->id);
                 }
             }
         }
     }
 }
开发者ID:felixpfeiffer,项目名称:contao-downloadarchive,代码行数:33,代码来源:runonce.php


示例3: getFiles

 /**
  * Collect all Songs per Playlist and return them as array
  * 
  * @param object $objSongs
  * @return array
  */
 public function getFiles($objSongs)
 {
     $arrFiles = array();
     $i = 0;
     if ($objSongs === null) {
         return;
     }
     while ($objSongs->next()) {
         $arrSong = $objSongs->row();
         $arrFiles[$i]['protected'] = $arrSong['protected'];
         $arrFiles[$i]['groups'] = $arrSong['groups'];
         $arrFiles[$i]['id'] = $arrSong['id'];
         $arrFiles[$i]['interpreter'] = $arrSong['interpreter'];
         $arrFiles[$i]['title'] = $arrSong['title'];
         $arrFiles[$i]['album'] = $arrSong['album'];
         $arrFiles[$i]['track'] = $arrSong['track'];
         $arrFiles[$i]['files'] = array();
         $arrUuids = deserialize($arrSong['file']);
         $objSongFiles = \FilesModel::findMultipleByUuids($arrUuids);
         while ($objSongFiles->next()) {
             $arrSongFile = $objSongFiles->row();
             $objFile = new \Contao\File($arrSongFile['path'], true);
             $arrFiles[$i]['files'][] = array('file' => $arrSongFile['path'], 'type' => $objFile->mime);
         }
         $i++;
     }
     // sort out protected songs
     $arrFiles = $this->sortOutProtected($arrFiles);
     return $arrFiles;
 }
开发者ID:MacGyer,项目名称:audiomax,代码行数:36,代码来源:Audiomax.php


示例4: generateSprite

 /**
  * Generate sprite from given data
  */
 public function generateSprite(\DataContainer $row)
 {
     // Get the theme meta data
     $objTheme = $this->Database->prepare("SELECT * FROM tl_theme WHERE id=?")->execute($row->id);
     if ($objTheme->numRows < 1) {
         return;
     }
     if ($objTheme->spritegen_enable != false) {
         // Replace the numeric folder IDs
         $objInputFolder = FilesModel::findByPk($objTheme->spritegen_source);
         $objOutputFolder = FilesModel::findByPk($objTheme->spritegen_output_folder);
         if ($objInputFolder !== null) {
             // Provide settings for SpriteGen()
             $cssSprites = new \SpriteGen();
             $cssSprites->addImageFolder(TL_ROOT . '/' . $objInputFolder->path);
             $cssSprites->setOutputFolder(TL_ROOT . '/' . $objOutputFolder->path);
             $cssSprites->setCacheTime(0);
             $cssSprites->useDatabase($objTheme->spritegen_modify_selectors, unserialize($objTheme->spritegen_selectors));
             // Generate Sprite
             $cssSprites->generateSprite($objTheme->spritegen_output_file, $objTheme->id, true, $objTheme->spritegen_direction, $objTheme->spritegen_output_width);
             // Display success confirmation
             \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['spritegen_successful']);
             $this->log('Generated image and style sheet for sprite ' . $objTheme->spritegen_output_file, __METHOD__, CRON);
         }
     }
 }
开发者ID:richardhj,项目名称:contao_cssspritegen,代码行数:29,代码来源:tl_theme.php


示例5: generate

 /**
  * Generate the widget and return it as string
  *
  * @return string
  */
 public function generate()
 {
     global $objPage;
     if ($objPage->outputFormat == 'html5') {
         $blnIsHtml5 = true;
     }
     $blnSwitchOrder = (bool) $this->efgSwitchButtonOrder;
     $strButtonBack = '';
     $strButtonSubmit = '';
     if ($this->efgAddBackButton && ($this->formTotalPages > 1 && $this->formActivePage > 1 || TL_MODE == 'BE')) {
         if ($this->efgBackImageSubmit && $this->efgBackSingleSRC != '') {
             $objFileModel = \FilesModel::findById($this->efgBackSingleSRC);
             $strButtonBack .= sprintf('<input type="image"%s src="%s" id="ctrl_%s_back" class="submit back%s" alt="%s" title="%s" value="%s"%s%s', $this->formActivePage ? ' name="FORM_BACK"' : '', $objFileModel->path, $this->strId, strlen($this->strClass) ? ' ' . $this->strClass : '', specialchars($this->efgBackSlabel), specialchars($this->efgBackSlabel), specialchars('submit_back'), $this->getAttributes(), $this->strTagEnding);
         } else {
             $strButtonBack .= sprintf('<input type="submit"%s id="ctrl_%s_back" class="submit back%s" value="%s"%s%s', $this->formActivePage ? ' name="FORM_BACK"' : '', $this->strId, strlen($this->strClass) ? ' ' . $this->strClass : '', specialchars($this->efgBackSlabel), $this->getAttributes(), $this->strTagEnding);
         }
     }
     if ($this->imageSubmit && $this->singleSRC != '') {
         $objFileModel = \FilesModel::findById($this->singleSRC);
         $strButtonSubmit .= sprintf('<input type="image"%s src="%s" id="ctrl_%s" class="submit next%s" alt="%s" title="%s" value="%s"%s%s', $this->formActivePage ? ' name="FORM_NEXT"' : '', $objFileModel->path, $this->strId, strlen($this->strClass) ? ' ' . $this->strClass : '', specialchars($this->slabel), specialchars($this->slabel), specialchars('submit_next'), $this->getAttributes(), $this->strTagEnding);
     } else {
         $strButtonSubmit .= sprintf('<input type="submit"%s id="ctrl_%s" class="submit next%s" value="%s"%s%s', $this->formActivePage ? ' name="FORM_NEXT"' : '', $this->strId, strlen($this->strClass) ? ' ' . $this->strClass : '', specialchars($this->slabel), $this->getAttributes(), $this->strTagEnding);
     }
     return $blnSwitchOrder ? $strButtonSubmit . $strButtonBack : $strButtonBack . $strButtonSubmit;
 }
开发者ID:Jobu,项目名称:core,代码行数:30,代码来源:EfgFormPaginator.php


示例6: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     // Clean RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \StringUtil::toXhtml($this->text);
     } else {
         $this->text = \StringUtil::toHtml5($this->text);
     }
     $this->Template->text = \StringUtil::encodeEmail($this->text);
     $this->Template->addImage = false;
     // Add an image
     if ($this->addImage && $this->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($this->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($this->singleSRC)) {
                 $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             $this->singleSRC = $objModel->path;
             $this->addImageToTemplate($this->Template, $this->arrData);
         }
     }
     $classes = deserialize($this->mooClasses);
     $this->Template->toggler = $classes[0] ?: 'toggler';
     $this->Template->accordion = $classes[1] ?: 'accordion';
     $this->Template->headlineStyle = $this->mooStyle;
     $this->Template->headline = $this->mooHeadline;
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:33,代码来源:ContentAccordion.php


示例7: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->size = '';
     // Set the size
     if ($this->playerSize != '') {
         $size = deserialize($this->playerSize);
         if (is_array($size)) {
             $this->Template->size = ' width="' . $size[0] . 'px" height="' . $size[1] . 'px"';
         }
     }
     $this->Template->poster = false;
     // Optional poster
     if ($this->posterSRC != '') {
         if (($objFile = \FilesModel::findByPk($this->posterSRC)) !== null) {
             $this->Template->poster = $objFile->path;
         }
     }
     // Pre-sort the array by preference
     if (in_array($this->objFiles->extension, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv'))) {
         $this->Template->isVideo = true;
         $arrFiles = array('mp4' => null, 'm4v' => null, 'mov' => null, 'wmv' => null, 'webm' => null, 'ogv' => null);
     } else {
         $this->Template->isVideo = false;
         $arrFiles = array('m4a' => null, 'mp3' => null, 'wma' => null, 'mpeg' => null, 'wav' => null);
     }
     $this->objFiles->reset();
     // Pass File objects to the template
     while ($this->objFiles->next()) {
         $objFile = new \File($this->objFiles->path);
         $arrFiles[$objFile->extension] = $objFile;
     }
     $this->Template->files = array_values(array_filter($arrFiles));
     $this->Template->autoplay = $this->autoplay;
 }
开发者ID:rikaix,项目名称:core,代码行数:37,代码来源:ContentMedia.php


示例8: cb_parseTemplate

 public function cb_parseTemplate(\Template &$objTemplate)
 {
     global $objPage;
     if (strpos($objTemplate->getName(), 'news_') === 0) {
         if ($objTemplate->source == 'singlefile') {
             $modelFile = \FilesModel::findByUuid($objTemplate->singlefileSRC);
             try {
                 if ($modelFile === null) {
                     throw new \Exception("no file");
                 }
                 $allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
                 if (!in_array($modelFile->extension, $allowedDownload)) {
                     throw new Exception("download not allowed by extension");
                 }
                 $objFile = new \File($modelFile->path, true);
                 $strHref = \System::urlEncode($objFile->value);
             } catch (\Exception $e) {
                 $strHref = "";
             }
             $target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
             $objTemplate->more = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $GLOBALS['TL_LANG']['MSC']['more']);
             $objTemplate->linkHeadline = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $objTemplate->headline);
         }
     }
 }
开发者ID:kikmedia,项目名称:contao,代码行数:25,代码来源:NewsSingleFile.php


示例9: prepareLabel

 /**
  * Get the label for a form value to store in lead table.
  *
  * @param mixed $varValue
  * @param \Database\Result $objField
  *
  * @return mixed
  */
 public static function prepareLabel($varValue, $objField)
 {
     // Run for all values in an array
     if (is_array($varValue)) {
         foreach ($varValue as $k => $v) {
             $varValue[$k] = self::prepareLabel($v, $objField);
         }
         return $varValue;
     }
     // File upload
     if ($objField->type == 'upload') {
         $objFile = \FilesModel::findByUuid($varValue);
         if ($objFile !== null) {
             return $objFile->path;
         }
     }
     // Convert timestamps into date format
     if ($varValue != '' && in_array($objField->rgxp, array('date', 'time', 'datim'))) {
         $varValue = \Date::parse($GLOBALS['TL_CONFIG'][$objField->rgxp . 'Format'], $varValue);
     }
     if ($objField->options != '') {
         $arrOptions = deserialize($objField->options, true);
         foreach ($arrOptions as $arrOption) {
             if ($arrOption['value'] == $varValue && $arrOption['label'] != '') {
                 $varValue = $arrOption['label'];
             }
         }
     }
     return $varValue;
 }
开发者ID:terminal42,项目名称:contao-leads,代码行数:38,代码来源:Leads.php


示例10: getPictureFromDB

 public function getPictureFromDB($strTable, $strColumn, $strWhereParam, $strObjID)
 {
     $query = "SELECT " . $strColumn . " FROM " . $strTable . "WHERE " . $strWhereParam . "=?";
     $objPicture = $this->Database->prepare($query)->execute($strObjID);
     $objFile = \FilesModel::findByUuid($objPicture->{$strColumn});
     return $objFile->path;
 }
开发者ID:blioxxx,项目名称:contao-universal-library,代码行数:7,代码来源:images.php


示例11: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->Template->size = '';
     // Set the size
     if ($this->playerSize != '') {
         $size = deserialize($this->playerSize);
         if (is_array($size)) {
             $this->Template->size = ' width="' . $size[0] . '" height="' . $size[1] . '"';
         }
     }
     $this->Template->poster = false;
     // Optional poster
     if ($this->posterSRC != '') {
         if (($objFile = \FilesModel::findByUuid($this->posterSRC)) !== null) {
             $this->Template->poster = $objFile->path;
         }
     }
     // Check for SSL (see #6900)
     $protocol = \Environment::get('ssl') ? 'https://' : 'http://';
     $objFile = new \stdClass();
     $objFile->mime = 'video/x-youtube';
     $objFile->path = $protocol . 'www.youtube.com/watch?v=' . $this->youtube;
     $this->Template->isVideo = true;
     $this->Template->files = array($objFile);
     $this->Template->autoplay = $this->autoplay;
 }
开发者ID:iCodr8,项目名称:core,代码行数:29,代码来源:ContentYouTube.php


示例12: buildFileDir

 protected function buildFileDir($objEntity = null)
 {
     if ($this->fileDir && ($objFolder = \FilesModel::findByUuid($this->fileDir))) {
         $objMember = \FrontendUser::getInstance();
         $strDir = $objFolder->path;
         if ($this->useHomeDir && FE_USER_LOGGED_IN && $objMember->assignDir && $objMember->homeDir) {
             $strDir = Files::getPathFromUuid($objMember->homeDir);
         }
         if (in_array('protected_homedirs', \ModuleLoader::getActive())) {
             if ($this->useProtectedHomeDir && $objMember->assignProtectedDir && $objMember->protectedHomeDir) {
                 $strDir = Files::getPathFromUuid($objMember->protectedHomeDir);
             }
         }
         if ($this->fileSubDirName) {
             $strDir .= '/' . $this->fileSubDirName;
         }
         if (isset($GLOBALS['TL_HOOKS']['exporter_modifyFileDir']) && is_array($GLOBALS['TL_HOOKS']['exporter_modifyFileDir'])) {
             foreach ($GLOBALS['TL_HOOKS']['exporter_modifyFileDir'] as $callback) {
                 $objCallback = \System::importStatic($callback[0]);
                 $strFixedDir = $objCallback->{$callback}[1]($strDir, $this);
                 $strDir = $strFixedDir ?: $strDir;
             }
         }
         return $strDir;
     }
     throw new \Exception('No exporter fileDir defined!');
 }
开发者ID:heimrichhannot,项目名称:contao-exporter,代码行数:27,代码来源:Exporter.php


示例13: actionPreviewPage

 public function actionPreviewPage($id)
 {
     $file = FilesModel::getFile($id);
     if (!$file) {
         throw new BadRequestException("File not found", 404);
     }
     if (!$this->triggerEvent('allowFileDownload', $file)) {
         throw new BadRequestException("File download forbidden", 403);
     }
     $this->template->file = $file;
     $this->setLayout(false);
     //experimental for documentFile
     $xml = substr($file->info, 5);
     $sxml = simplexml_load_string($xml);
     //TODO proč nefunguje vždy?
     $pages = array();
     if ($sxml && $sxml->page) {
         foreach ($sxml->page as $p) {
             $page = array($p, array());
             foreach ($p->block as $b) {
                 foreach ($b->text as $t) {
                     $page[1][] = $t;
                 }
             }
             $pages[] = $page;
         }
     }
     $this->template->pdf2xml = $pages;
 }
开发者ID:osmcz,项目名称:website,代码行数:29,代码来源:FilesPresenter.php


示例14: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new FilesModel();
     }
     return self::$instance;
 }
开发者ID:nokatsur,项目名称:blog,代码行数:7,代码来源:files_model.php


示例15: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $intList = $this->athletes_group;
     $objMembers = $this->Database->prepare("SELECT * FROM tl_athlete WHERE published=1 AND pid=? ORDER BY sorting")->execute($intList);
     //$objMembers = \MembersModel;
     // Return if no Members were found
     if (!$objMembers->numRows) {
         return;
     }
     $strLink = '';
     // Generate a jumpTo link
     if ($this->jumpTo > 0) {
         $objJump = \PageModel::findByPk($this->jumpTo);
         if ($objJump !== null) {
             $strLink = $this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s');
         }
     }
     $arrMembers = array();
     // Generate Members
     while ($objMembers->next()) {
         $strPhoto = '';
         $objPhoto = \FilesModel::findByPk($objMembers->photo);
         // Add photo image
         if ($objPhoto !== null) {
             $strPhoto = \Image::getHtml(\Image::get($objPhoto->path, '140', '187', 'center_center'));
         }
         $arrMembers[] = array('name' => $objMembers->name, 'family' => $objMembers->family, 'post' => $objMembers->post, 'joined' => $objMembers->joined, 'photo' => $strPhoto, 'link' => strlen($strLink) ? sprintf($strLink, $objMembers->alias) : '');
     }
     $this->Template->members = $arrMembers;
 }
开发者ID:respinar,项目名称:contao-athletes,代码行数:33,代码来源:ModuleAthleteList.php


示例16: storeFileMetaInformation

 public function storeFileMetaInformation($varValue, DataContainer $dc)
 {
     if ($dc->activeRecord->singleSRC == $varValue) {
         return $varValue;
     }
     $objFile = FilesModel::findByUuid($varValue);
     if ($objFile !== null) {
         $arrMeta = deserialize($objFile->meta);
         if (!empty($arrMeta)) {
             $objPage = $this->Database->prepare("SELECT * FROM tl_page WHERE id=(SELECT pid FROM " . ($dc->activeRecord->ptable ?: 'tl_article') . " WHERE id=?)")->execute($dc->activeRecord->pid);
             if ($objPage->numRows) {
                 $objModel = new PageModel();
                 $objModel->setRow($objPage->row());
                 $objModel->loadDetails();
                 // Convert the language to a locale (see #5678)
                 $strLanguage = str_replace('-', '_', $objModel->rootLanguage);
                 if (isset($arrMeta[$strLanguage])) {
                     Input::setPost('alt', $arrMeta[$strLanguage]['title']);
                     Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
                 }
             }
         }
     }
     return $varValue;
 }
开发者ID:designs2,项目名称:codeowl_design_presets,代码行数:25,代码来源:tl_co_presets.php


示例17: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     global $objPage;
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \String::toXhtml($this->text);
     } else {
         $this->text = \String::toHtml5($this->text);
     }
     // Add the static files URL to images
     if (TL_FILES_URL != '') {
         $path = $GLOBALS['TL_CONFIG']['uploadPath'] . '/';
         $this->text = str_replace(' src="' . $path, ' src="' . TL_FILES_URL . $path, $this->text);
     }
     $this->Template->text = \String::encodeEmail($this->text);
     $this->Template->addImage = false;
     // Add an image
     if ($this->addImage && $this->singleSRC != '') {
         if (!is_numeric($this->singleSRC)) {
             $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         } else {
             $objModel = \FilesModel::findByPk($this->singleSRC);
             if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                 $this->singleSRC = $objModel->path;
                 $this->addImageToTemplate($this->Template, $this->arrData);
             }
         }
     }
 }
开发者ID:rburch,项目名称:core,代码行数:32,代码来源:ContentText.php


示例18: generate

 /**
  * Return if the file does not exist
  * @return string
  */
 public function generate()
 {
     // Return if there is no file
     if ($this->singleSRC == '') {
         return '';
     }
     // Check for version 3 format
     if (!is_numeric($this->singleSRC)) {
         return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
     }
     $objFile = \FilesModel::findByPk($this->singleSRC);
     if ($objFile === null) {
         return '';
     }
     $allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
     // Return if the file type is not allowed
     if (!in_array($objFile->extension, $allowedDownload)) {
         return '';
     }
     $file = \Input::get('file', true);
     // Send the file to the browser and do not send a 404 header (see #4632)
     if ($file != '' && $file == $objFile->path) {
         $this->sendFileToBrowser($file);
     }
     $this->singleSRC = $objFile->path;
     return parent::generate();
 }
开发者ID:rburch,项目名称:core,代码行数:31,代码来源:ContentDownload.php


示例19: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \StringUtil::toXhtml($this->text);
     } else {
         $this->text = \StringUtil::toHtml5($this->text);
     }
     // Add the static files URL to images
     if (TL_FILES_URL != '') {
         $path = \Config::get('uploadPath') . '/';
         $this->text = str_replace(' src="' . $path, ' src="' . TL_FILES_URL . $path, $this->text);
     }
     $this->Template->text = \StringUtil::encodeEmail($this->text);
     $this->Template->addImage = false;
     // Add an image
     if ($this->addImage && $this->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($this->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($this->singleSRC)) {
                 $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             $this->singleSRC = $objModel->path;
             $this->addImageToTemplate($this->Template, $this->arrData);
         }
     }
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:33,代码来源:ContentText.php


示例20: updateFileField

 protected function updateFileField($table)
 {
     $database = \Database::getInstance();
     if (!$database->tableExists($table)) {
         return;
     }
     if ($database->fieldExists('file', $table)) {
         // get the field description
         $desc = $database->query('DESC ' . $table . ' file');
         // convert the field into a blob
         if ($desc->Type != 'blob') {
             $database->query('ALTER TABLE `' . $table . '` CHANGE `file` `file` blob NULL');
             $database->query('UPDATE `' . $table . '` SET `file`=NULL WHERE `file`=\'\' OR `file`=0');
         }
         // select fields with numeric values
         $resultSet = $database->query('SELECT id, file FROM ' . $table . ' WHERE file REGEXP \'^[0-9]+$\'');
         while ($resultSet->next()) {
             // Numeric ID to UUID
             $file = \FilesModel::findByPk($resultSet->file);
             if ($file) {
                 $database->prepare('UPDATE `' . $table . '` SET file=? WHERE id=?')->execute($file->uuid, $resultSet->id);
             }
         }
     }
 }
开发者ID:bit3,项目名称:contao-theme-plus,代码行数:25,代码来源:upgrade_to_contao3_2.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Filesystem类代码示例发布时间:2022-05-23
下一篇:
PHP Files类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap