本文整理汇总了PHP中TbArray::popValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TbArray::popValue方法的具体用法?PHP TbArray::popValue怎么用?PHP TbArray::popValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbArray
的用法示例。
在下文中一共展示了TbArray::popValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
Yii::import('bootstrap.behaviors.TbWidget');
$this->attachBehavior('tbWidget', new TbWidget());
if (!isset($this->assetPath)) {
$this->assetPath = realpath(dirname(__FILE__) . '/../assets');
}
if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) {
$this->pluginOptions['data'] = $this->normalizeData($this->data);
}
if (isset($this->htmlOptions['placeholder'])) {
if ($this->asDropDownList) {
$this->htmlOptions['prompt'] = $this->htmlOptions['placeholder'];
} else {
$this->pluginOptions['placeholder'] = $this->htmlOptions['placeholder'];
}
unset($this->htmlOptions['placeholder']);
}
if (!$this->bindPlugin) {
$this->htmlOptions['data-plugin'] = 'select2';
$this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
}
if (TbArray::popValue('block', $this->htmlOptions, false)) {
TbHtml::addCssClass('input-block-level', $this->htmlOptions);
}
}
示例2: init
public function init()
{
parent::init();
TbHtml::addCssClass('bfh-fonts', $this->htmlOptions);
if (!isset($this->htmlOptions['data-font'])) {
$this->htmlOptions['data-font'] = TbArray::popValue('data-value', $this->htmlOptions);
}
unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
}
示例3: testPopValue
public function testPopValue()
{
$array = array('key' => 'value');
$this->assertEquals('value', TbArray::popValue('key', $array));
$this->assertArrayNotHasKey('key', $array);
$nullValueArray = array('key' => null);
$this->assertNull(TbArray::popValue('key', $nullValueArray, 'not null'), 'Null value has to be found');
$this->assertArrayNotHasKey('key', $nullValueArray);
}
示例4: init
/**
* Widget's init function
*/
public function init()
{
$this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
if (!($style = TbArray::popValue('style', $this->htmlOptions, ''))) {
$this->htmlOptions['style'] = $style;
}
$width = TbArray::getValue('width', $this->htmlOptions, '100%');
$height = TbArray::popValue('height', $this->htmlOptions, '450px');
$this->htmlOptions['style'] = "width:{$width};height:{$height};" . $this->htmlOptions['style'];
}
示例5: init
public function init()
{
if (empty($this->country)) {
throw new CException('"$country" cannot be empty.');
}
$this->pluginOptions['country'] = $this->country;
parent::init();
TbHtml::addCssClass('bfh-states', $this->htmlOptions);
if (!isset($this->htmlOptions['data-state'])) {
$this->htmlOptions['data-state'] = TbArray::popValue('data-value', $this->htmlOptions);
}
unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
}
示例6: init
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
Yii::import('bootstrap.behaviors.TbWidget');
$this->attachBehavior('tbWidget', new TbWidget());
if (!isset($this->assetPath)) {
$this->assetPath = Yii::getPathOfAlias('lib.select2');
}
if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) {
$this->pluginOptions['data'] = $data = $this->normalizeData($this->data);
}
if (!$this->bindPlugin) {
$this->htmlOptions['data-plugin'] = 'select2';
$this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
}
if (TbArray::popValue('block', $this->htmlOptions, false)) {
TbHtml::addCssClass('input-block-level', $this->htmlOptions);
}
}
示例7: run
/**
* Runs the widget.
*/
public function run()
{
/* @var $user CWebUser */
$user = Yii::app()->getUser();
if (count($user->getFlashes(false)) == 0) {
return;
}
echo TbHtml::openTag('div', $this->htmlOptions);
foreach ($this->alerts as $color => $alert) {
if (isset($alert['visible']) && !$alert['visible']) {
continue;
}
if ($user->hasFlash($color)) {
$htmlOptions = TbArray::popValue('htmlOptions', $alert, array());
TbArray::defaultValue('closeText', $this->closeText, $htmlOptions);
TbArray::defaultValue('block', $this->block, $htmlOptions);
TbArray::defaultValue('fade', $this->fade, $htmlOptions);
echo TbHtml::alert($color, $user->getFlash($color), $htmlOptions);
}
}
echo '</div>';
$this->registerEvents("#{$this->htmlOptions['id']} > .alert", $this->events);
}
示例8: renderButton
/**
* Renders a link button.
* @param string $id the ID of the button
* @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
* @param integer $row the row number (zero-based)
* @param mixed $data the data object associated with the row
*/
protected function renderButton($id, $button, $row, $data)
{
if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
return;
}
$url = TbArray::popValue('url', $button);
if ($url !== '#') {
$url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
}
$imageUrl = TbArray::popValue('imageUrl', $button, false);
$label = TbArray::popValue('label', $button, $id);
$options = TbArray::popValue('options', $button, array());
TbArray::defaultValue('title', $label, $options);
TbArray::defaultValue('rel', 'tooltip', $options);
if ($icon = TbArray::popValue('icon', $button, false)) {
echo CHtml::link(TbHtml::icon($icon), $url, $options);
} else {
if ($imageUrl && is_string($imageUrl)) {
echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
} else {
echo CHtml::link($label, $url, $options);
}
}
}
示例9: addTextAlignClass
/**
* Adds the text align class to the given options if applicable.
* @param array $htmlOptions the HTML attributes.
*/
protected static function addTextAlignClass(&$htmlOptions)
{
$align = TbArray::popValue('textAlign', $htmlOptions);
if (!empty($align)) {
self::addCssClass('text-' . $align, $htmlOptions);
}
}
示例10: processControlGroupOptions
/**
* Processes the options for a input row.
* @param CModel $model the data model.
* @param string $attribute the attribute name.
* @param array $options the options.
* @return array the processed options.
*/
protected function processControlGroupOptions($model, $attribute, $options)
{
$errorOptions = TbArray::popValue('errorOptions', $options, array());
$enableAjaxValidation = TbArray::popValue('enableAjaxValidation', $errorOptions, true);
$enableClientValidation = TbArray::popValue('enableClientValidation', $errorOptions, true);
$errorOptions['type'] = $this->helpType;
$error = $this->error($model, $attribute, $errorOptions, $enableAjaxValidation, $enableClientValidation);
// kind of a hack for ajax forms but this works for now.
if (!empty($error) && strpos($error, 'display:none') === false) {
$options['color'] = TbHtml::INPUT_COLOR_ERROR;
}
if (!$this->hideInlineErrors) {
$options['error'] = $error;
}
$helpOptions = TbArray::popValue('helpOptions', $options, array());
$helpOptions['type'] = $this->helpType;
$options['helpOptions'] = $helpOptions;
return $options;
}
示例11: normalizeTabs
/**
* Normalizes the tab configuration.
* @param array $tabs a reference to the tabs tab configuration.
*/
protected function normalizeTabs($tabs)
{
$controller = $this->getController();
if (isset($controller)) {
foreach ($tabs as &$tabOptions) {
$items = TbArray::getValue('items', $tabOptions, array());
if (!empty($items)) {
$tabOptions['items'] = $this->normalizeTabs($items);
} else {
if (isset($tabOptions['view'])) {
$view = TbArray::popValue('view', $tabOptions);
if ($controller->getViewFile($view) !== false) {
$tabOptions['content'] = $controller->renderPartial($view, $this->viewData, true);
}
}
}
}
}
return $tabs;
}
示例12: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = TbArray::popValue('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
if ($this->collapse !== false) {
TbHtml::addCssClass('nav-collapse', $this->collapseOptions);
ob_start();
/* @var TbCollapse $collapseWidget */
$collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
$collapseContent = ob_get_clean();
echo TbHtml::navbarCollapseLink('#' . $collapseWidget->getId());
echo $brand . $collapseContent;
} else {
echo $brand . $items;
}
$containerContent = ob_get_clean();
$containerOptions = TbArray::popValue('containerOptions', $this->htmlOptions, array());
TbHtml::addCssClass($this->fluid ? 'container-fluid' : 'container', $containerOptions);
ob_start();
echo TbHtml::openTag('div', $containerOptions);
echo $containerContent;
echo '</div>';
$content = ob_get_clean();
echo TbHtml::navbar($content, $this->htmlOptions);
}
示例13: testPopValue
public function testPopValue()
{
$array = array('key' => 'value');
$this->assertEquals('value', TbArray::popValue('key', $array));
$this->assertArrayNotHasKey('key', $array);
}
示例14: registerClientScript
/**
* Registers the client scripts for the button column.
*/
protected function registerClientScript()
{
$js = array();
$function = CJavaScript::encode(TbArray::popValue('click', $this->toggleOptions, ''));
$class = preg_replace('/\\s+/', '.', $this->toggleOptions['htmlOptions']['class']);
$js[] = "\$(document).on('click','#{$this->grid->id} a.{$class}',{$function});";
Yii::app()->getClientScript()->registerScript($this->name . '#ReadyJS', implode("\n", $js));
}
示例15: renderButton
/**
* Renders the button
*/
public function renderButton()
{
if (!empty($this->buttonOptions) && is_array($this->buttonOptions)) {
TbArray::defaultValue('data-toggle', 'modal', $this->buttonOptions);
if ($this->remote !== null) {
$this->buttonOptions['data-remote'] = CHtml::normalizeUrl($this->remote);
}
$selector = '#' . $this->htmlOptions['id'];
$label = TbArray::popValue('label', $this->buttonOptions, 'button');
$attr = isset($this->buttonOptions['data-remote']) ? 'data-target' : 'href';
TbArray::defaultValue($attr, $selector, $this->buttonOptions);
echo TbHtml::button($label, $this->buttonOptions);
}
}