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


PHP Validator::isStringUuid方法代码示例

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


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

示例1: fixUuidToBinary

 protected function fixUuidToBinary($strUuid)
 {
     if (\Validator::isStringUuid($strUuid)) {
         $strUuid = \String::uuidToBin($strUuid);
     }
     return $strUuid;
 }
开发者ID:craffft,项目名称:contao-imagesortwizard,代码行数:7,代码来源:ImageSortWizard.php

示例2: findByPidAndUuid

 /**
  * Find a watchlist item by its pid and uuid
  *
  * @param string $intPid    The watchlist id
  * @param string $intUuid   The files uuid
  * @param array  $arrOptions An optional options array
  *
  * @return \Model|null The model or null if there is no watchlist
  */
 public static function findByPidAndUuid($intPid, $strUuid, array $arrOptions = array())
 {
     $t = static::$strTable;
     // Convert UUIDs to binary
     if (\Validator::isStringUuid($strUuid)) {
         $strUuid = \String::uuidToBin($strUuid);
     }
     return static::findOneBy(array("{$t}.pid=?", "{$t}.uuid=UNHEX(?)"), array($intPid, bin2hex($strUuid)), $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-watchlist,代码行数:18,代码来源:WatchlistItemModel.php

示例3: findByUuidAndPidAndUrl

 public static function findByUuidAndPidAndUrl($strUuid, $intPid, $strUrl, array $arrOptions = array())
 {
     $t = static::$strTable;
     // Convert UUIDs to binary
     if (\Validator::isStringUuid($strUuid)) {
         $strUuid = \StringUtil::uuidToBin($strUuid);
     }
     $arrColumns = array("{$t}.uuid=UNHEX(?) AND {$t}.pid=? AND {$t}.url=?");
     return static::findBy($arrColumns, array(bin2hex($strUuid), $intPid, $strUrl), $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-filecredits,代码行数:10,代码来源:FileCreditModel.php

示例4: run

 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_picker');
     $this->Template->main = '';
     // Ajax request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax = new Ajax(Input::post('action'));
         $this->objAjax->executePreActions();
     }
     $strTable = Input::get('table');
     $strField = Input::get('field');
     // Define the current ID
     define('CURRENT_ID', Input::get('table') ? $this->Session->get('CURRENT_ID') : Input::get('id'));
     $this->loadDataContainer($strTable);
     $strDriver = 'DC_' . $GLOBALS['TL_DCA'][$strTable]['config']['dataContainer'];
     $objDca = new $strDriver($strTable);
     // AJAX request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax->executePostActions($objDca);
     }
     $this->Session->set('filePickerRef', \Environment::get('request'));
     $arrValues = array_filter(explode(',', Input::get('value')));
     // Convert UUIDs to binary
     foreach ($arrValues as $k => $v) {
         // Can be a UUID or a path
         if (Validator::isStringUuid($v)) {
             $arrValues[$k] = String::uuidToBin($v);
         }
     }
     // Prepare the widget
     $class = $GLOBALS['BE_FFL']['fileSelector'];
     $objFileTree = new $class($class::getAttributesFromDca($GLOBALS['TL_DCA'][$strTable]['fields'][$strField], $strField, $arrValues, $strField, $strTable, $objDca));
     $this->Template->main = $objFileTree->generate();
     $this->Template->theme = Backend::getTheme();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->addSearch = false;
     $this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->value = $this->Session->get('file_selector_search');
     $this->Template->manager = $GLOBALS['TL_LANG']['MSC']['fileManager'];
     $this->Template->managerHref = 'contao/main.php?do=files&popup=1';
     $this->Template->breadcrumb = $GLOBALS['TL_DCA']['tl_files']['list']['sorting']['breadcrumb'];
     Config::set('debugMode', false);
     $this->Template->output();
 }
开发者ID:iCodr8,项目名称:core,代码行数:51,代码来源:file.php

示例5: run

 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_picker');
     $objTemplate->main = '';
     // Ajax request
     if ($_POST && \Environment::get('isAjaxRequest')) {
         $this->objAjax = new \Ajax(\Input::post('action'));
         $this->objAjax->executePreActions();
     }
     $strTable = \Input::get('table');
     $strField = \Input::get('field');
     // Define the current ID
     define('CURRENT_ID', \Input::get('table') ? $this->Session->get('CURRENT_ID') : \Input::get('id'));
     $this->loadDataContainer($strTable);
     $strDriver = 'DC_' . $GLOBALS['TL_DCA'][$strTable]['config']['dataContainer'];
     $objDca = new $strDriver($strTable);
     $objDca->field = $strField;
     // Set the active record
     if ($this->Database->tableExists($strTable)) {
         /** @var \Model $strModel */
         $strModel = \Model::getClassFromTable($strTable);
         if (class_exists($strModel)) {
             $objModel = $strModel::findByPk(\Input::get('id'));
             if ($objModel !== null) {
                 $objDca->activeRecord = $objModel;
             }
         }
     }
     // AJAX request
     if ($_POST && \Environment::get('isAjaxRequest')) {
         $this->objAjax->executePostActions($objDca);
     }
     $this->Session->set('filePickerRef', \Environment::get('request'));
     $arrValues = array_filter(explode(',', \Input::get('value')));
     // Convert UUIDs to binary
     foreach ($arrValues as $k => $v) {
         // Can be a UUID or a path
         if (\Validator::isStringUuid($v)) {
             $arrValues[$k] = \StringUtil::uuidToBin($v);
         }
     }
     // Call the load_callback
     if (is_array($GLOBALS['TL_DCA'][$strTable]['fields'][$strField]['load_callback'])) {
         foreach ($GLOBALS['TL_DCA'][$strTable]['fields'][$strField]['load_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $arrValues = $this->{$callback[0]}->{$callback[1]}($arrValues, $objDca);
             } elseif (is_callable($callback)) {
                 $arrValues = $callback($arrValues, $objDca);
             }
         }
     }
     /** @var \FileSelector $strClass */
     $strClass = $GLOBALS['BE_FFL']['fileSelector'];
     /** @var \FileSelector $objFileTree */
     $objFileTree = new $strClass($strClass::getAttributesFromDca($GLOBALS['TL_DCA'][$strTable]['fields'][$strField], $strField, $arrValues, $strField, $strTable, $objDca));
     $objTemplate->main = $objFileTree->generate();
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->addSearch = false;
     $objTemplate->search = $GLOBALS['TL_LANG']['MSC']['search'];
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->value = $this->Session->get('file_selector_search');
     $objTemplate->manager = $GLOBALS['TL_LANG']['MSC']['fileManager'];
     $objTemplate->managerHref = 'contao/main.php?do=files&popup=1';
     $objTemplate->breadcrumb = $GLOBALS['TL_DCA']['tl_files']['list']['sorting']['breadcrumb'];
     if (\Input::get('switch')) {
         $objTemplate->switch = $GLOBALS['TL_LANG']['MSC']['pagePicker'];
         $objTemplate->switchHref = str_replace('contao/file.php', 'contao/page.php', ampersand(\Environment::get('request')));
     }
     \Config::set('debugMode', false);
     $objTemplate->output();
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:80,代码来源:BackendFile.php

示例6: findMultipleByUuidsAndExtensions

 /**
  * Find multiple files by UUID and a list of extensions
  *
  * @param array $arrUuids      An array of file UUIDs
  * @param array $arrExtensions An array of file extensions
  * @param array $arrOptions    An optional options array
  *
  * @return \Model\Collection|null A collection of models or null of there are no matching files
  */
 public static function findMultipleByUuidsAndExtensions($arrUuids, $arrExtensions, array $arrOptions = array())
 {
     if (!is_array($arrUuids) || empty($arrUuids) || !is_array($arrExtensions) || empty($arrExtensions)) {
         return null;
     }
     foreach ($arrExtensions as $k => $v) {
         if (!preg_match('/^[a-z0-9]{2,5}$/i', $v)) {
             unset($arrExtensions[$k]);
         }
     }
     $t = static::$strTable;
     foreach ($arrUuids as $k => $v) {
         // Convert UUIDs to binary
         if (\Validator::isStringUuid($v)) {
             $v = \String::uuidToBin($v);
         }
         $arrUuids[$k] = "UNHEX('" . bin2hex($v) . "')";
     }
     if (!isset($arrOptions['order'])) {
         $arrOptions['order'] = "{$t}.uuid!=" . implode(", {$t}.uuid!=", $arrUuids);
     }
     return static::findBy(array("{$t}.uuid IN(" . implode(",", $arrUuids) . ") AND {$t}.extension IN('" . implode("','", $arrExtensions) . "')"), null, $arrOptions);
 }
开发者ID:iCodr8,项目名称:core,代码行数:32,代码来源:FilesModel.php

示例7: updatePhotoalbums2AlbumImageSortField

 /**
  * Fix imageSort bug to add UUID support
  */
 protected function updatePhotoalbums2AlbumImageSortField()
 {
     $objModel = $this->Database->prepare("SELECT id, imageSort FROM tl_photoalbums2_album")->execute();
     while ($objModel->next()) {
         $arrItem = deserialize($objModel->imageSort);
         if (is_array($arrItem)) {
             foreach ($arrItem as $k => $v) {
                 if (\Validator::isStringUuid($v)) {
                     $arrItem[$k] = \String::uuidToBin($v);
                 }
             }
         }
         $this->Database->prepare("UPDATE tl_photoalbums2_album %s WHERE id=?")->set(array('imageSort' => serialize($arrItem)))->execute($objModel->id);
     }
 }
开发者ID:craffft,项目名称:contao-photoalbums2,代码行数:18,代码来源:Updater.php

示例8: addItem

 /**
  * Adds a new item to the watchlist
  * @param WatchlistItemModel $objItem
  * @throws \Exception
  */
 public function addItem(WatchlistItemModel $objItem)
 {
     // Throw an exception if there's no id:
     if (!\Validator::isStringUuid($objItem->uuid)) {
         throw new \Exception('The watchlist requires items with an unique file uuid.');
     }
     $strUuid = $objItem->uuid;
     $objItem->uuid = \String::uuidToBin($objItem->uuid);
     // transform string to bin
     // Add or delete:
     if (isset($this->arrItems[$strUuid])) {
         \Input::setGet('act', WATCHLIST_ACT_DELETE);
         $this->deleteItem($strUuid);
     } else {
         $objItem = $objItem->save();
         $this->arrItems[$strUuid] = $objItem;
         $this->arrIds[] = $strUuid;
         // Store the id, too!
         $this->addNotification(sprintf($GLOBALS['TL_LANG']['WATCHLIST']['notify_add_item'], $objItem->getTitle()), WATCHLIST_NOTIFICATION_ADD_ITEM);
     }
 }
开发者ID:heimrichhannot,项目名称:contao-watchlist,代码行数:26,代码来源:Watchlist.php

示例9: validatorSingle

 /**
  * Validate the single file
  * @param mixed
  * @param string
  * @return mixed
  */
 protected function validatorSingle($varFile, $strDestination)
 {
     $varOld = $varFile;
     // Move the temporary file
     if (!\Validator::isStringUuid($varFile) && is_file(TL_ROOT . '/' . $varFile)) {
         $varFile = $this->moveTemporaryFile($varFile, $strDestination);
     }
     // Convert uuid to binary format
     if (\Validator::isStringUuid($varFile)) {
         $varFile = \String::uuidToBin($varFile);
     }
     // Store in the mapper
     $this->arrFilesMapper[$varOld] = $varFile;
     return $varFile;
 }
开发者ID:kikmedia,项目名称:contao-fineuploader,代码行数:21,代码来源:FineUploaderBase.php

示例10: handleCustomFileTree

 /**
  * Manipulate the field definition for custom file trees.
  *
  * @param array $arrFieldDef The field definition to manipulate.
  *
  * @return void
  */
 private function handleCustomFileTree(&$arrFieldDef)
 {
     if (strlen($this->get('file_uploadFolder'))) {
         // Set root path of file chooser depending on contao version.
         $objFile = null;
         if (\Validator::isStringUuid($this->get('file_uploadFolder')) || \Validator::isBinaryUuid($this->get('file_uploadFolder'))) {
             $objFile = \FilesModel::findByUuid($this->get('file_uploadFolder'));
         }
         // Check if we have a file.
         if ($objFile != null) {
             $arrFieldDef['eval']['path'] = $objFile->path;
         } else {
             // Fallback.
             $arrFieldDef['eval']['path'] = $this->get('file_uploadFolder');
         }
     }
     if (strlen($this->get('file_validFileTypes'))) {
         $arrFieldDef['eval']['extensions'] = $this->get('file_validFileTypes');
     }
     if (strlen($this->get('file_filesOnly'))) {
         $arrFieldDef['eval']['filesOnly'] = true;
     }
 }
开发者ID:designs2,项目名称:attribute_translatedfile,代码行数:30,代码来源:TranslatedFile.php

示例11: validatorSingle

 /**
  * Validate a single file.
  *
  * @param mixed
  * @param string
  * @return mixed
  */
 protected function validatorSingle($varFile, $strDestination)
 {
     // Move the temporary file
     if (!\Validator::isStringUuid($varFile) && is_file(TL_ROOT . '/' . $varFile)) {
         $varFile = $this->moveTemporaryFile($varFile, $strDestination);
     }
     // Convert uuid to binary format
     if (\Validator::isStringUuid($varFile)) {
         $varFile = \StringUtil::uuidToBin($varFile);
     }
     return $varFile;
 }
开发者ID:terminal42,项目名称:contao-fineuploader,代码行数:19,代码来源:FineUploaderBase.php


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