本文整理汇总了PHP中NextendParse::parseUnit方法的典型用法代码示例。如果您正苦于以下问题:PHP NextendParse::parseUnit方法的具体用法?PHP NextendParse::parseUnit怎么用?PHP NextendParse::parseUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NextendParse
的用法示例。
在下文中一共展示了NextendParse::parseUnit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addCSS
function addCSS()
{
$id = $this->getId();
nextendimport('nextend.css.css');
$css = NextendCss::getInstance();
$css->createGroup($id);
$css->enableLess($id);
$css->addLessImportDir(NEXTEND_SMART_SLIDER2_ASSETS . 'less' . DIRECTORY_SEPARATOR, $id);
$data =& $this->_data;
$slider =& $this->_slider;
$sliderParams =& $this->_sliderParams;
$size = NextendParse::parse($sliderParams->get('size'));
$context = array('id' => '~"#' . $this->getId() . '"', 'width' => $size[0] . 'px', 'height' => $size[1] . 'px', 'canvas' => intval($size[2]), 'count' => count($this->_slides), 'margin' => NextendParse::parseUnit($sliderParams->get('margin'), ' '));
if ($this->_backend) {
$context['margin'] = '0px 0px 0px 0px';
}
nextendimport('nextend.parse.font');
$fonts = 0;
foreach (NextendSmartSliderFontSettings::getAll($this->_sliderid) as $k => $v) {
preg_match('/sliderfont(custom)?([0-9]*)$/', $k, $matches);
if (count($matches)) {
$context['font' . $fonts] = '~".' . $matches[0] . '"';
$tmp = json_decode($v);
if ($tmp === null || $tmp == $v) {
$v = base64_decode($v);
}
$font = new NextendParseFont($v);
$context['font' . $fonts . 'text'] = '";' . $font->printTab() . '"';
$font->mixinTab('Link');
$context['font' . $fonts . 'link'] = '";' . $font->printTab('Link') . '"';
$font->mixinTab('Link:Hover', 'Link');
$context['font' . $fonts . 'hover'] = '";' . $font->printTab('Link:Hover') . '"';
$fonts++;
}
}
$context['fonts'] = $fonts;
include $this->_typePath . 'context.php';
$css->addCssFile(array($this->getId(), $this->_typePath . 'style.less', $context), $this->getId());
$imageload = NextendParse::parse($this->_sliderParams->get('imageload', '0|*|0'));
$lazyload = intval($imageload[0]);
if ($lazyload) {
$css->addCssFile(array($this->getId() . 'spinner', NEXTEND_SMART_SLIDER2_ASSETS . 'less' . DIRECTORY_SEPARATOR . 'spinner.less', array('id' => '~"#' . $this->getId() . '"')), $this->getId());
}
if (strpos($context['margin'], '%')) {
$m = explode('% ', $context['margin']);
$m[1] = $m[1] / 100 * intval($context['width']);
$m[3] = $m[3] / 100 * intval($context['width']);
$m[0] = $m[0] / 100 * intval($context['height']);
$m[2] = $m[2] / 100 * intval($context['height']);
} else {
$m = explode('px ', $context['margin']);
}
$addcss = (array) NextendParse::parse(NextendSmartSliderSettings::get('externalcssfile'));
if ($this->_backend && count($addcss)) {
foreach ($addcss as $cssfile) {
$css->addCssFile($cssfile);
}
}
return array(intval($context['width']), intval($context['height']), $m[0] + $m[2], $m[1] + $m[3], intval($context['canvaswidth']), intval($context['canvasheight']));
}
示例2: nextendimport
<?php
nextendimport('nextend.image.color');
nextendimport('nextend.parse.font');
$font = new NextendParseFont($data->get('titlefont'));
$context['titlefont'] = '";' . $font->printTab() . '"';
$context['margin'] = NextendParse::parseUnit($data->get('margin'), ' ');
for ($i = 1; $i < 6; $i++) {
$context['level' . $i . 'margin'] = '"' . NextendParse::parseUnit($data->get('level' . $i . 'margin'), ' ') . '"';
$context['level' . $i . 'padding'] = '"' . NextendParse::parseUnit($data->get('level' . $i . 'padding'), ' ') . '"';
$border = NextendParse::parse($data->get('level' . $i . 'border'));
$context['level' . $i . 'borderstyle'] = $border[6];
unset($border[6]);
$context['level' . $i . 'bordercolor'] = '#' . $border[5];
unset($border[5]);
$context['level' . $i . 'borderwidth'] = NextendParse::parseUnit($border, ' ');
$minus = NextendParse::parse($data->get('level' . $i . 'minus'));
$context['level' . $i . 'minusimage'] = '"' . $minus[0] . '"';
$context['level' . $i . 'minusposition'] = $minus[1];
$context['level' . $i . 'minuscolor'] = '"' . $minus[2] . '"';
$context['level' . $i . 'minuscolorize'] = '"' . $minus[3] . '"';
$plus = NextendParse::parse($data->get('level' . $i . 'plus'));
$context['level' . $i . 'plusimage'] = '"' . $plus[0] . '"';
$context['level' . $i . 'plusposition'] = $plus[1];
$context['level' . $i . 'pluscolor'] = '"' . $plus[2] . '"';
$context['level' . $i . 'pluscolorize'] = '"' . $plus[3] . '"';
$font = new NextendParseFont($data->get('level' . $i . 'textfont'));
$context['level' . $i . 'font-text'] = '";' . $font->printTab() . '"';
$font->mixinTab('Active');
$context['level' . $i . 'font-active'] = '";' . $font->printTab('Active') . '"';
$font->mixinTab('Link');