本文整理汇总了PHP中Contao\StringUtil::uuidToBin方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::uuidToBin方法的具体用法?PHP StringUtil::uuidToBin怎么用?PHP StringUtil::uuidToBin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contao\StringUtil
的用法示例。
在下文中一共展示了StringUtil::uuidToBin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scopeUuid
public function scopeUuid(Builder $query, $uuid)
{
if (is_array($uuid)) {
$uuid = array_map(function ($uuid) {
return Validator::isStringUuid($uuid) ? StringUtil::uuidToBin($uuid) : $uuid;
}, $uuid);
return $query->whereIn('uuid', $uuid);
}
if (Validator::isStringUuid($uuid)) {
$uuid = StringUtil::uuidToBin($uuid);
}
return $query->where('uuid', $uuid);
}
示例2: setContaoFile
private function setContaoFile($file)
{
if (is_array($file)) {
return serialize(array_map([__CLASS__, 'setContaoFile'], $file));
}
if ($file instanceof FilesModel) {
return $file->uuid;
}
if (Validator::isStringUuid($file)) {
return StringUtil::uuidToBin($file);
}
return $file;
}
示例3: run
/**
* Run the controller and parse the template
*
* @return Response
*/
public function run()
{
/** @var SessionInterface $objSession */
$objSession = \System::getContainer()->get('session');
/** @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') ? $objSession->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);
}
$objSession->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));
/** @var AttributeBagInterface $objSessionBag */
$objSessionBag = $objSession->getBag('contao_backend');
$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 = true;
$objTemplate->search = $GLOBALS['TL_LANG']['MSC']['search'];
$objTemplate->searchExclude = $GLOBALS['TL_LANG']['MSC']['searchExclude'];
$objTemplate->action = ampersand(\Environment::get('request'));
$objTemplate->value = $objSessionBag->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?', 'contao/page?', ampersand(\Environment::get('request')));
}
return $objTemplate->getResponse();
}
示例4: uuidToBin
/**
* Convert a UUID string to binary data.
*
* @param string $uuid The UUID string.
*
* @return string The binary data
*/
public static function uuidToBin($uuid)
{
if (self::isStringUtilAvailable()) {
return StringUtil::uuidToBin($uuid);
}
return \Contao\String::uuidToBin($uuid);
}