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


PHP Validator::isUuid方法代码示例

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


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

示例1: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     if (substr($this->url, 0, 7) == 'mailto:') {
         $this->url = \StringUtil::encodeEmail($this->url);
     } else {
         $this->url = ampersand($this->url);
     }
     $embed = explode('%s', $this->embed);
     if ($this->linkTitle == '') {
         $this->linkTitle = $this->url;
     }
     // Use an image instead of the title
     if ($this->useImage && $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)) {
             /** @var \FrontendTemplate|object $objTemplate */
             $objTemplate = new \FrontendTemplate('ce_hyperlink_image');
             $this->Template = $objTemplate;
             $this->Template->setData($this->arrData);
             $this->singleSRC = $objModel->path;
             $this->addImageToTemplate($this->Template, $this->arrData);
             $this->Template->linkTitle = specialchars($this->linkTitle);
         }
     }
     if (strncmp($this->rel, 'lightbox', 8) !== 0 || $objPage->outputFormat == 'xhtml') {
         $this->Template->attribute = ' rel="' . $this->rel . '"';
     } else {
         $this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
     }
     $this->Template->rel = $this->rel;
     // Backwards compatibility
     $this->Template->href = $this->url;
     $this->Template->embed_pre = $embed[0];
     $this->Template->embed_post = $embed[1];
     $this->Template->link = $this->linkTitle;
     $this->Template->linkTitle = specialchars($this->titleText ?: $this->linkTitle);
     $this->Template->target = '';
     // Override the link target
     if ($this->target) {
         $this->Template->target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
     }
     // Unset the title attributes in the back end (see #6258)
     if (TL_MODE == 'BE') {
         $this->Template->title = '';
         $this->Template->linkTitle = '';
     }
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:56,代码来源:ContentHyperlink.php

示例2: generate

 /**
  * Return if there are no files
  *
  * @return string
  */
 public function generate()
 {
     // Use the home directory of the current user as file source
     if ($this->useHomeDir && FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         if ($this->User->assignDir && $this->User->homeDir) {
             $this->multiSRC = array($this->User->homeDir);
         }
     } else {
         $this->multiSRC = deserialize($this->multiSRC);
     }
     // Return if there are no files
     if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
         return '';
     }
     // Get the file entries from the database
     $this->objFiles = \FilesModel::findMultipleByUuids($this->multiSRC);
     if ($this->objFiles === null) {
         if (!\Validator::isUuid($this->multiSRC[0])) {
             return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         }
         return '';
     }
     return parent::generate();
 }
开发者ID:Jobu,项目名称:core,代码行数:30,代码来源:ContentGallery.php

示例3: __construct

 /**
  * __construct function.
  *
  * @access public
  * @param string
  * @return void
  */
 public function __construct($uuid)
 {
     if (!\Validator::isUuid($uuid)) {
         return;
     }
     $this->uuid = $uuid;
 }
开发者ID:craffft,项目名称:contao-photoalbums2,代码行数:14,代码来源:Pa2Image.php

示例4: addUuids

 /**
  * add uuids to tl_gallery_creator_pictures version added in 4.8.0
  */
 public static function addUuids()
 {
     // add field
     if (!\Database::getInstance()->fieldExists('uuid', 'tl_gallery_creator_pictures')) {
         \Database::getInstance()->query("ALTER TABLE `tl_gallery_creator_pictures` ADD `uuid` BINARY(16) NULL");
     }
     $objDB = \Database::getInstance()->execute("SELECT * FROM tl_gallery_creator_pictures WHERE uuid IS NULL");
     while ($objDB->next()) {
         if ($objDB->path == '') {
             continue;
         }
         if (is_file(TL_ROOT . '/' . $objDB->path)) {
             \Dbafs::addResource($objDB->path);
         } else {
             continue;
         }
         $oFile = new \File($objDB->path);
         $oFile->close();
         $fileModel = $oFile->getModel();
         if (\Validator::isUuid($fileModel->uuid)) {
             \Database::getInstance()->prepare("UPDATE tl_gallery_creator_pictures SET uuid=? WHERE id=?")->execute($fileModel->uuid, $objDB->id);
             $_SESSION["TL_CONFIRM"][] = "Added a valid file-uuid into tl_gallery_creator_pictures.uuid ID " . $objDB->id . ". Please check if all the galleries are running properly.";
         }
     }
 }
开发者ID:Aiod,项目名称:gallery_creator,代码行数:28,代码来源:runonce.php

示例5: addDummyImage

 protected function addDummyImage(&$objTemplate, $arrArticle, $objModule)
 {
     if ($objTemplate->addImage) {
         return;
     }
     $objArchive = \NewsArchiveModel::findByPk($arrArticle['pid']);
     if ($objArchive === null) {
         return;
     }
     $objTemplate->addDummyImage = false;
     if ($objArchive->addDummyImage && $objArchive->dummyImageSingleSRC != '') {
         $objModel = \FilesModel::findByUuid($objArchive->dummyImageSingleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($objArchive->dummyImageSingleSRC)) {
                 $objTemplate->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             // Override the default image size
             if ($objModule->imgSize != '') {
                 $size = deserialize($objModule->imgSize);
                 if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
                     $arrArticle['size'] = $objModule->imgSize;
                 }
             }
             $arrArticle['singleSRC'] = $objModel->path;
             $this->addImageToTemplate($objTemplate, $arrArticle);
             $objTemplate->class .= ' dummy-image';
             $objTemplate->addDummyImage = true;
             $objTemplate->addImage = false;
         }
     }
 }
开发者ID:heimrichhannot,项目名称:contao-news_plus,代码行数:32,代码来源:Hooks.php

示例6: getFileModel

 /**
  * @param $file
  *
  * @return bool|FilesModel
  * @throws \RuntimeException
  */
 public static function getFileModel($file)
 {
     if (empty($file)) {
         /**
          * No file model source given
          */
         return false;
     } elseif (\Validator::isUuid($file)) {
         /**
          * Get file by DBAFS UUID
          */
         $file = FilesModel::findByUuid($file, array('uncached' => true));
     } else {
         /**
          * Search the old way
          */
         return parent::getFileModel($file);
     }
     /**
      * Get path from model
      */
     if ($file instanceof FilesModel) {
         return $file;
     }
     return false;
 }
开发者ID:bit3,项目名称:contao-compat,代码行数:32,代码来源:Compat.php

示例7: generateAddActions

 public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
 {
     global $objPage;
     if ($objPage === null) {
         return;
     }
     if (\Validator::isUuid($id)) {
         $objFile = \FilesModel::findByUuid($id);
     } else {
         $objFile = \FilesModel::findBy('path', $id);
     }
     $objItem = new WatchlistItemModel();
     $objItem->pid = Watchlist::getInstance()->getId();
     $objItem->uuid = $objFile->uuid;
     $objItem->pageID = $objPage->id;
     $objItem->cid = $arrData['id'];
     $objItem->type = $arrData['type'];
     $objT = new \FrontendTemplate('watchlist_add_actions');
     $objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
     $objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
     $objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
     $objT->active = $objWatchlist->isInList($strUuid);
     $objT->id = $strUuid;
     return $objT->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-watchlist,代码行数:25,代码来源:WatchlistItemEnclosure.php

示例8: generate

 /**
  * Return if there are no files
  * @return string
  */
 public function generate()
 {
     // Use the home directory of the current user as file source
     if ($this->useHomeDir && FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         if ($this->User->assignDir && $this->User->homeDir) {
             $this->folderSRC = $this->User->homeDir;
         }
     }
     // Return if there is no folder defined
     if (empty($this->folderSRC)) {
         return '';
     }
     // Get the folders from the database
     $this->objFolder = \FilesModel::findByUuid($this->folderSRC);
     if ($this->objFolder === null) {
         if (!\Validator::isUuid($this->folderSRC[0])) {
             return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         }
         return '';
     }
     $file = \Input::get('file', true);
     // Send the file to the browser and do not send a 404 header (see #4632)
     if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
         if (strpos(dirname($file), $this->objFolder->path) !== FALSE) {
             \Controller::sendFileToBrowser($file);
         }
     }
     return parent::generate();
 }
开发者ID:hofff,项目名称:contao-recursive-download-folder,代码行数:34,代码来源:ContentRecursiveDownloadFolder.php

示例9: 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

示例10: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     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 = \Config::get('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 != '') {
         $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:juergen83,项目名称:contao,代码行数:33,代码来源:ContentText.php

示例11: generate

 /**
  * Return if there are no files
  *
  * @return string
  */
 public function generate()
 {
     // Use the home directory of the current user as file source
     if ($this->useHomeDir && FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         if ($this->User->assignDir && $this->User->homeDir) {
             $this->multiSRC = array($this->User->homeDir);
         }
     } else {
         $this->multiSRC = deserialize($this->multiSRC);
     }
     // Return if there are no files
     if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
         return '';
     }
     // Get the file entries from the database
     $this->objFiles = \FilesModel::findMultipleByUuids($this->multiSRC);
     if ($this->objFiles === null) {
         if (!\Validator::isUuid($this->multiSRC[0])) {
             return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         }
         return '';
     }
     $file = \Input::get('file', true);
     // Send the file to the browser and do not send a 404 header (see #4632)
     if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
         while ($this->objFiles->next()) {
             if ($file == $this->objFiles->path || dirname($file) == $this->objFiles->path) {
                 \Controller::sendFileToBrowser($file);
             }
         }
         $this->objFiles->reset();
     }
     return parent::generate();
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:40,代码来源:ContentDownloads.php

示例12: generate

 /**
  * Return if the file does not exist
  * @return string
  */
 public function generate()
 {
     // Return if there is no file
     if ($this->singleSRC == '') {
         return '';
     }
     $objFile = \FilesModel::findByUuid($this->singleSRC);
     if ($objFile === null) {
         if (!\Validator::isUuid($this->singleSRC)) {
             return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         }
         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) {
         \Controller::sendFileToBrowser($file);
     }
     $this->singleSRC = $objFile->path;
     return parent::generate();
 }
开发者ID:delirius,项目名称:download_extended,代码行数:30,代码来源:ContentDownloadExtended.php

示例13: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     if (TL_MODE == 'BE') {
         // Im Backend-Modus
         $this->strTemplate = 'be_wildcard';
         $this->Template = new \BackendTemplate($this->strTemplate);
         if ($this->headline) {
             $this->Template->title = $this->headline;
         }
         $this->Template->wildcard = $this->text;
         $this->Template->wildcard .= '<hr style="margin: 0 15px 5px;" />';
         $this->cmh = unserialize($this->cmHeadline);
         $this->cm_headline = $this->cmh['value'];
         if ($this->cm_headline) {
             $this->Template->wildcard .= '<h1>' . $this->cm_headline . "</h1>";
         }
         $this->Template->wildcard .= $this->cmText;
         return;
     }
     // Im Frontend-Modus
     // CSS einbinden
     $GLOBALS['TL_CSS'][] = 'system/modules/content-memory/assets/ce_content-memory.css';
     $this->Template->headline = $this->headline;
     $this->Template->hl = $this->hl;
     $this->Template->textvorn = $this->text;
     $this->cmh = unserialize($this->cmHeadline);
     $this->cm_headline = $this->cmh['value'];
     $this->cm_hl = $this->cmh['unit'];
     $this->Template->cmheadline = $this->cm_headline;
     $this->Template->cmhl = $this->cm_hl;
     $this->Template->texthint = $this->cmText;
     //$this->Template->addImage = false;
     //$this->Template->cmAddImage = false;
     // add an image to the front side
     if ($this->addImage && $this->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($this->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($this->singleSRC)) {
                 $this->Template->textvorn = '<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);
         }
     }
     // add an image to the back side
     if ($this->cmAddImage && $this->cmSingleSRC != '') {
         $objModel = \FilesModel::findByUuid($this->cmSingleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($this->cmSingleSRC)) {
                 $this->Template->texthint = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             $this->cmSingleSRC = $objModel->path;
             $this->addImageToTemplate($this->Template, $this->arrData);
         }
     }
 }
开发者ID:wangaz,项目名称:contao-content-memory,代码行数:61,代码来源:ContentMemorySingle.php

示例14: onCreate

 public function onCreate($strTable, $insertID, $arrSet, \DataContainer $dc)
 {
     if (($objModel = SubmissionArchiveModel::findByPk($insertID)) === null) {
         return;
     }
     if (($uuid = Submissions::getDefaultAttachmentSRC()) !== null && \Validator::isUuid($uuid)) {
         $objModel->attachmentUploadFolder = class_exists('Contao\\StringUtil') ? \StringUtil::uuidToBin($uuid) : \String::uuidToBin($uuid);
     }
     $objModel->save();
 }
开发者ID:heimrichhannot,项目名称:contao-submissions,代码行数:10,代码来源:SubmissionArchiveBackend.php

示例15: findMultipleByIds

 /**
  * Find multiple files by their IDs or UUIDs (backwards compatibility)
  *
  * @param array $arrIds     An array of IDs or UUIDs
  * @param array $arrOptions An optional options array
  *
  * @return \Model\Collection|null A collection of models or null if there are no files
  */
 public static function findMultipleByIds($arrIds, array $arrOptions = array())
 {
     if (!is_array($arrIds) || empty($arrIds)) {
         return null;
     }
     if (\Validator::isUuid(current($arrIds))) {
         return static::findMultipleByUuids($arrIds, $arrOptions);
     }
     return parent::findMultipleByIds($arrIds, $arrOptions);
 }
开发者ID:iCodr8,项目名称:core,代码行数:18,代码来源:FilesModel.php


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