本文整理汇总了PHP中StringUtil::deserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::deserialize方法的具体用法?PHP StringUtil::deserialize怎么用?PHP StringUtil::deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::deserialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
/**
* Add specific attributes
*
* @param string $strKey The attribute name
* @param mixed $varValue The attribute value
*/
public function __set($strKey, $varValue)
{
switch ($strKey) {
case 'mandatory':
if ($varValue) {
$this->arrAttributes['required'] = 'required';
} else {
unset($this->arrAttributes['required']);
}
parent::__set($strKey, $varValue);
break;
case 'mSize':
if ($this->multiple) {
$this->arrAttributes['size'] = $varValue;
}
break;
case 'multiple':
if ($varValue != '') {
$this->arrAttributes['multiple'] = 'multiple';
}
break;
case 'options':
$this->arrOptions = \StringUtil::deserialize($varValue);
break;
case 'rgxp':
case 'minlength':
case 'maxlength':
// Ignore
break;
default:
parent::__set($strKey, $varValue);
break;
}
}
示例2: generate
/**
* Parse the template
*
* @return string
*/
public function generate()
{
$objElement = \ContentModel::findByPk($this->cteAlias);
if ($objElement === null) {
return '';
}
$strClass = static::findClass($objElement->type);
if (!class_exists($strClass)) {
return '';
}
$objElement->origId = $objElement->id;
$objElement->id = $this->id;
$objElement->typePrefix = 'ce_';
/** @var ContentElement $objElement */
$objElement = new $strClass($objElement);
$cssID = \StringUtil::deserialize($objElement->cssID, true);
// Override the CSS ID (see #305)
if (!empty($this->cssID[0])) {
$cssID[0] = $this->cssID[0];
}
// Merge the CSS classes (see #6011)
if (!empty($this->cssID[1])) {
$cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
}
$objElement->cssID = $cssID;
return $objElement->generate();
}
示例3: compile
/**
* Generate the module
*/
protected function compile()
{
$this->Template->src = $this->singleSRC;
$this->Template->href = $this->source == 'external' ? $this->url : $this->singleSRC;
$this->Template->alt = $this->altContent;
$this->Template->var = 'swf' . $this->id;
$this->Template->transparent = $this->transparent ? true : false;
$this->Template->interactive = $this->interactive ? true : false;
$this->Template->flashId = $this->flashID ?: 'swf_' . $this->id;
$this->Template->fsCommand = ' ' . preg_replace('/[\\n\\r]/', "\n ", \StringUtil::decodeEntities($this->flashJS));
$this->Template->flashvars = 'URL=' . \Environment::get('base');
$this->Template->version = $this->version ?: '6.0.0';
$size = \StringUtil::deserialize($this->size);
$this->Template->width = $size[0];
$this->Template->height = $size[1];
$intMaxWidth = TL_MODE == 'BE' ? 320 : \Config::get('maxImageWidth');
// Adjust movie size
if ($intMaxWidth > 0 && $size[0] > $intMaxWidth) {
$this->Template->width = $intMaxWidth;
$this->Template->height = floor($intMaxWidth * $size[1] / $size[0]);
}
if (strlen($this->flashvars)) {
$this->Template->flashvars .= '&' . \StringUtil::decodeEntities($this->flashvars);
}
}
示例4: __set
/**
* Add specific attributes
*
* @param string $strKey
* @param mixed $varValue
*/
public function __set($strKey, $varValue)
{
switch ($strKey) {
case 'maxlength':
if ($varValue > 0) {
$this->arrAttributes['maxlength'] = $varValue;
}
break;
case 'mandatory':
if ($varValue) {
$this->arrAttributes['required'] = 'required';
} else {
unset($this->arrAttributes['required']);
}
parent::__set($strKey, $varValue);
break;
case 'placeholder':
$this->arrAttributes['placeholder'] = $varValue;
break;
case 'options':
$this->arrUnits = \StringUtil::deserialize($varValue);
break;
default:
parent::__set($strKey, $varValue);
break;
}
}
示例5: getOptionsForUser
/**
* Returns the image sizes for the given user suitable for widgets.
*
* @param BackendUser $user
*
* @return array
*/
public function getOptionsForUser(BackendUser $user)
{
$this->loadOptions();
$event = new ImageSizesEvent($user->isAdmin ? $this->options : $this->filterOptions(\StringUtil::deserialize($user->imageSizes, true)), $user);
$this->eventDispatcher->dispatch(ContaoCoreEvents::IMAGE_SIZES_USER, $event);
return $event->getImageSizes();
}
示例6: generate
/**
* Parse the template
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start != '' && $this->start > time() || $this->stop != '' && $this->stop < time())) {
return '';
}
$objModule = \ModuleModel::findByPk($this->module);
if ($objModule === null) {
return '';
}
$strClass = \Module::findClass($objModule->type);
if (!class_exists($strClass)) {
return '';
}
$objModule->typePrefix = 'ce_';
/** @var Module $objModule */
$objModule = new $strClass($objModule, $this->strColumn);
$cssID = \StringUtil::deserialize($objModule->cssID, true);
// Override the CSS ID (see #305)
if (!empty($this->cssID[0])) {
$cssID[0] = $this->cssID[0];
}
// Merge the CSS classes (see #6011)
if (!empty($this->cssID[1])) {
$cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
}
$objModule->cssID = $cssID;
return $objModule->generate();
}
示例7: compile
/**
* Generate the content element
*/
protected function compile()
{
$rows = \StringUtil::deserialize($this->tableitems);
$this->Template->id = 'table_' . $this->id;
$this->Template->summary = \StringUtil::specialchars($this->summary);
$this->Template->useHeader = $this->thead ? true : false;
$this->Template->useFooter = $this->tfoot ? true : false;
$this->Template->useLeftTh = $this->tleft ? true : false;
$this->Template->sortable = $this->sortable ? true : false;
$arrHeader = array();
$arrBody = array();
$arrFooter = array();
// Table header
if ($this->thead) {
foreach ($rows[0] as $i => $v) {
// Set table sort cookie
if ($this->sortable && $i == $this->sortIndex) {
$co = 'TS_TABLE_' . $this->id;
$so = $this->sortOrder == 'descending' ? 'desc' : 'asc';
if (\Input::cookie($co) == '') {
\System::setCookie($co, $i . '|' . $so, 0);
}
}
// Add cell
$arrHeader[] = array('class' => 'head_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[0]) - 1 ? ' col_last' : '') . ($i == 0 && $this->tleft ? ' unsortable' : ''), 'content' => $v != '' ? nl2br_html5($v) : ' ');
}
array_shift($rows);
}
$this->Template->header = $arrHeader;
$limit = $this->tfoot ? count($rows) - 1 : count($rows);
// Table body
for ($j = 0; $j < $limit; $j++) {
$class_tr = '';
if ($j == 0) {
$class_tr .= ' row_first';
}
if ($j == $limit - 1) {
$class_tr .= ' row_last';
}
$class_eo = $j % 2 == 0 ? ' odd' : ' even';
foreach ($rows[$j] as $i => $v) {
$class_td = '';
if ($i == 0) {
$class_td .= ' col_first';
}
if ($i == count($rows[$j]) - 1) {
$class_td .= ' col_last';
}
$arrBody['row_' . $j . $class_tr . $class_eo][] = array('class' => 'col_' . $i . $class_td, 'content' => $v != '' ? nl2br_html5($v) : ' ');
}
}
$this->Template->body = $arrBody;
// Table footer
if ($this->tfoot) {
foreach ($rows[count($rows) - 1] as $i => $v) {
$arrFooter[] = array('class' => 'foot_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[count($rows) - 1]) - 1 ? ' col_last' : ''), 'content' => $v != '' ? nl2br_html5($v) : ' ');
}
}
$this->Template->footer = $arrFooter;
}
示例8: __set
/**
* Add specific attributes
*
* @param string $strKey
* @param mixed $varValue
*/
public function __set($strKey, $varValue)
{
switch ($strKey) {
case 'options':
$this->arrOptions = \StringUtil::deserialize($varValue);
break;
default:
parent::__set($strKey, $varValue);
break;
}
}
示例9: compile
/**
* Generate the content element
*/
protected function compile()
{
$arrItems = array();
$items = \StringUtil::deserialize($this->listitems);
$limit = count($items) - 1;
for ($i = 0, $c = count($items); $i < $c; $i++) {
$arrItems[] = array('class' => $i == 0 ? 'first' : ($i == $limit ? 'last' : ''), 'content' => $items[$i]);
}
$this->Template->items = $arrItems;
$this->Template->tag = $this->listtype == 'ordered' ? 'ol' : 'ul';
}
示例10: generate
/**
* Check the source folder
*
* @return string
*/
public function generate()
{
$this->multiSRC = \StringUtil::deserialize($this->multiSRC);
if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
return '';
}
$this->objFiles = \FilesModel::findMultipleByUuids($this->multiSRC);
if ($this->objFiles === null) {
return '';
}
return parent::generate();
}
示例11: compile
/**
* Generate the module
*/
protected function compile()
{
$size = \StringUtil::deserialize($this->playerSize);
if (!is_array($size) || empty($size[0]) || empty($size[1])) {
$this->Template->size = ' width="640" height="360"';
} else {
$this->Template->size = ' width="' . $size[0] . '" height="' . $size[1] . '"';
}
$url = 'https://www.youtube.com/embed/' . $this->youtube;
if ($this->autoplay) {
$url .= '?autoplay=1';
}
$this->Template->src = $url;
}
示例12: __construct
/**
* Load the database object
*
* @param array $arrAttributes
*/
public function __construct($arrAttributes = null)
{
$this->import('Database');
parent::__construct($arrAttributes);
// Prepare the order field
if ($this->orderField != '') {
$this->strOrderId = $this->orderField . str_replace($this->strField, '', $this->strId);
$this->strOrderName = $this->orderField . str_replace($this->strField, '', $this->strName);
// Retrieve the order value
$objRow = $this->Database->prepare("SELECT {$this->orderField} FROM {$this->strTable} WHERE id=?")->limit(1)->execute($this->activeRecord->id);
$tmp = \StringUtil::deserialize($objRow->{$this->orderField});
$this->{$this->orderField} = !empty($tmp) && is_array($tmp) ? array_filter($tmp) : array();
}
}
示例13: compile
/**
* Generate the content element
*/
protected function compile()
{
if (TL_MODE == 'BE') {
$this->strTemplate = 'be_wildcard';
/** @var BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate($this->strTemplate);
$this->Template = $objTemplate;
$this->Template->title = $this->mooHeadline;
}
$classes = \StringUtil::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;
}
示例14: __set
/**
* Add specific attributes
*
* @param string $strKey
* @param mixed $varValue
*/
public function __set($strKey, $varValue)
{
switch ($strKey) {
case 'maxlength':
if ($varValue > 0) {
$this->arrAttributes['maxlength'] = $varValue;
}
break;
case 'options':
$this->arrOptions = \StringUtil::deserialize($varValue);
break;
default:
parent::__set($strKey, $varValue);
break;
}
}
示例15: __set
/**
* Add specific attributes
*
* @param string $strKey The attribute name
* @param mixed $varValue The attribute value
*/
public function __set($strKey, $varValue)
{
switch ($strKey) {
case 'options':
$this->arrOptions = \StringUtil::deserialize($varValue);
break;
case 'rgxp':
case 'minlength':
case 'maxlength':
// Ignore
break;
default:
parent::__set($strKey, $varValue);
break;
}
}