本文整理汇总了PHP中unpack_object函数的典型用法代码示例。如果您正苦于以下问题:PHP unpack_object函数的具体用法?PHP unpack_object怎么用?PHP unpack_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unpack_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name = 'ip', $value)
{
$this->ip_parts = array();
if (!is_array($value)) {
$value = explode('.', $value);
}
if (!isset($value[0])) {
$value[0] = 0;
}
if (!isset($value[1])) {
$value[1] = 0;
}
if (!isset($value[2])) {
$value[2] = 0;
}
if (!isset($value[3])) {
$value[3] = 0;
}
for ($i = 0; $i < 4; $i++) {
$this->ip_parts[$i] = new CNumericBox($name . '[' . $i . ']', $value[$i], 3);
if ($i != 3) {
$this->ip_parts[$i]->tag_end = '';
$this->ip_parts[$i]->AddAction('OnKeyDown', ' this.maxlength = this.getAttribute("maxlength"); ' . ' this.oldlength = this.value.length; ');
$this->ip_parts[$i]->AddAction('OnKeyUp', ' if(this.oldlength != this.value.length && this.value.length == this.maxlength) {' . ' var el = this.form.elements["' . $name . '[' . ($i + 1) . ']' . '"];' . ' if(el) { el.focus(); el.select(); }}');
}
$this->ip_parts[$i] = unpack_object($this->ip_parts[$i]);
}
}
示例2: zbx_jsvalue
function zbx_jsvalue($value)
{
if (!is_array($value)) {
if (is_object($value)) {
return unpack_object($value);
}
if (is_string($value)) {
return '\'' . str_replace('\'', '\\\'', str_replace("\n", '\\n', str_replace("\\", "\\\\", str_replace("\r", '', $value)))) . '\'';
}
if (is_null($value)) {
return 'null';
}
return strval($value);
}
if (count($value) == 0) {
return '[]';
}
foreach ($value as $id => $v) {
if (!isset($is_object) && is_string($id)) {
$is_object = true;
}
$value[$id] = (isset($is_object) ? '\'' . $id . '\' : ' : '') . zbx_jsvalue($v);
}
if (isset($is_object)) {
return '{' . implode(',', $value) . '}';
} else {
return '[' . implode(',', $value) . ']';
}
}
示例3: setTitle
public function setTitle($value = null)
{
if (is_null($value)) {
$this->title = null;
return 0;
}
$this->title = unpack_object($value);
}
示例4: setTitle
public function setTitle($value = NULL)
{
if (is_null($value)) {
unset($this->title);
return 0;
}
$this->title = unpack_object($value);
}
示例5: addItem
public function addItem($value)
{
if (is_array($value)) {
foreach ($value as $item) {
array_push($this->items, unpack_object($item));
}
} elseif (!is_null($value)) {
array_push($this->items, unpack_object($value));
}
}
示例6: addItem
public function addItem($value)
{
if (is_object($value)) {
array_push($this->items, unpack_object($value));
} elseif (is_string($value)) {
array_push($this->items, $value);
} elseif (is_array($value)) {
foreach ($value as $item) {
$this->addItem($item);
// attention, recursion !!!
}
} elseif (!is_null($value)) {
array_push($this->items, unpack_object($value));
}
return $this;
}
示例7: __construct
public function __construct($name = 'visibilitybox', $value = 'yes', $object_name = null, $replace_to = null)
{
$action = '';
if (!is_array($object_name)) {
$object_name = array($object_name);
}
$this->object_name = $object_name;
$this->replace_to = unpack_object($replace_to);
foreach ($this->object_name as $obj_name) {
if (empty($obj_name)) {
continue;
}
$action .= 'visibility_status_changeds(this.checked, ' . zbx_jsvalue($obj_name) . ',' . zbx_jsvalue($this->replace_to) . ');';
}
parent::__construct($name, $value, $action, '1');
insert_javascript_for_visibilitybox();
}
示例8: toString
public function toString()
{
$content = array();
if (!is_null($this->header)) {
$header_div = new CDiv($this->header, 'formElement_header');
$content[] = $header_div;
}
if (!is_null($this->body)) {
$body_div = new CDiv($this->body, 'formElement_body');
$content[] = $body_div;
}
if (!is_null($this->footer)) {
$footer_div = new CDiv($this->footer, 'formElement_footer');
$content[] = $footer_div;
}
$main_div = new CDiv($content, 'formElement');
return unpack_object($main_div);
}
示例9: insert_show_color_picker_javascript
function insert_show_color_picker_javascript()
{
global $SHOW_COLOR_PICKER_SCRIPT_ISERTTED;
if ($SHOW_COLOR_PICKER_SCRIPT_ISERTTED) {
return;
}
$SHOW_COLOR_PICKER_SCRIPT_ISERTTED = true;
$table = '';
$table .= '<table cellspacing="0" cellpadding="1">';
$table .= '<tr>';
/* gray colors */
foreach (array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'b', 'C', 'D', 'E', 'F') as $c) {
$color = $c . $c . $c . $c . $c . $c;
$table .= '<td>' . unpack_object(new CColorCell(null, $color, 'set_color(\\\'' . $color . '\\\')')) . '</td>';
}
$table .= '</tr>';
/* other colors */
$colors = array(array('r' => 0, 'g' => 0, 'b' => 1), array('r' => 0, 'g' => 1, 'b' => 0), array('r' => 1, 'g' => 0, 'b' => 0), array('r' => 0, 'g' => 1, 'b' => 1), array('r' => 1, 'g' => 0, 'b' => 1), array('r' => 1, 'g' => 1, 'b' => 0));
$brigs = array(array(0 => '0', 1 => '3'), array(0 => '0', 1 => '4'), array(0 => '0', 1 => '5'), array(0 => '0', 1 => '6'), array(0 => '0', 1 => '7'), array(0 => '0', 1 => '8'), array(0 => '0', 1 => '9'), array(0 => '0', 1 => 'A'), array(0 => '0', 1 => 'B'), array(0 => '0', 1 => 'C'), array(0 => '0', 1 => 'D'), array(0 => '0', 1 => 'E'), array(0 => '3', 1 => 'F'), array(0 => '6', 1 => 'F'), array(0 => '9', 1 => 'F'), array(0 => 'C', 1 => 'F'));
foreach ($colors as $c) {
$table .= '<tr>';
foreach ($brigs as $br) {
$r = $br[$c['r']];
$g = $br[$c['g']];
$b = $br[$c['b']];
$color = $r . $r . $g . $g . $b . $b;
$table .= '<td>' . unpack_object(new CColorCell(null, $color, 'set_color(\\\'' . $color . '\\\')')) . '</td>';
}
$table .= '</tr>';
}
$table .= '</table>';
$cancel = '<span onclick="javascript:hide_color_picker();" class="link">' . S_CANCEL . '</span>';
$script = 'var color_picker = null;
var curr_lbl = null;
var curr_txt = null;' . "\n";
$script .= "var color_table = '" . $table . $cancel . "'\n";
insert_js($script);
print '<script type="text/javascript" src="js/color_picker.js"></script>';
zbx_add_post_js('create_color_picker();');
}
示例10: addItem
public function addItem($value)
{
if (is_object($value)) {
array_push($this->items, unpack_object($value));
} else {
if (is_string($value)) {
array_push($this->items, str_replace(array('<', '>', '"'), array('<', '>', '"'), $value));
// array_push($this->items,htmlspecialchars($value));
} else {
if (is_array($value)) {
foreach ($value as $item) {
$this->addItem($item);
// Attention, recursion !!!
}
} else {
if (!is_null($value)) {
array_push($this->items, unpack_object($value));
}
}
}
}
}
示例11: addItem
public function addItem($value)
{
if (is_object($value)) {
array_push($this->items, unpack_object($value));
} else {
if (is_string($value)) {
array_push($this->items, zbx_htmlstr($value));
// array_push($this->items,htmlspecialchars($value));
} else {
if (is_array($value)) {
foreach ($value as $item) {
$this->addItem($item);
// Attention, recursion !!!
}
} else {
if (!is_null($value)) {
array_push($this->items, unpack_object($value));
}
}
}
}
}
示例12: toString
public function toString()
{
$tab = $this->get();
return unpack_object($tab);
}
示例13: setHint
/**
* Adds a hint box to the element.
*
* @param string|array|CTag $text Hint content.
* @param string $span_class Wrap the content in a span element and assign this class
* to the span.
* @param bool $freeze_on_click If set to true, it will be possible to "freeze" the hint box
* via a mouse click.
* @param string $styles Custom css styles.
* Syntax:
* property1: value1; property2: value2; property(n): value(n)
*
* @return bool
*/
public function setHint($text, $span_class = '', $freeze_on_click = true, $styles = '')
{
if (empty($text)) {
return $this;
}
encodeValues($text);
$text = unpack_object($text);
$this->onMouseover('hintBox.HintWraper(event, this, ' . zbx_jsvalue($text) . ', "' . $span_class . '", "' . $styles . '");');
if ($freeze_on_click) {
$this->onClick('hintBox.showStaticHint(event, this, ' . zbx_jsvalue($text) . ', "' . $span_class . '", false, "' . $styles . '");');
}
return $this;
}
示例14: insert_show_color_picker_javascript
function insert_show_color_picker_javascript()
{
global $SHOW_COLOR_PICKER_SCRIPT_INSERTED;
if ($SHOW_COLOR_PICKER_SCRIPT_INSERTED) {
return;
}
$SHOW_COLOR_PICKER_SCRIPT_INSERTED = true;
$table = [];
// gray colors
$row = [];
foreach (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] as $c) {
$color = $c . $c . $c . $c . $c . $c;
$row[] = (new CColorCell(null, $color))->setTitle('#' . $color)->onClick('set_color("' . $color . '");');
}
$table[] = (new CDiv($row))->addClass(ZBX_STYLE_COLOR_PICKER);
// other colors
$colors = [['r' => 0, 'g' => 0, 'b' => 1], ['r' => 0, 'g' => 1, 'b' => 0], ['r' => 1, 'g' => 0, 'b' => 0], ['r' => 0, 'g' => 1, 'b' => 1], ['r' => 1, 'g' => 0, 'b' => 1], ['r' => 1, 'g' => 1, 'b' => 0]];
$brigs = [[0 => '0', 1 => '3'], [0 => '0', 1 => '4'], [0 => '0', 1 => '5'], [0 => '0', 1 => '6'], [0 => '0', 1 => '7'], [0 => '0', 1 => '8'], [0 => '0', 1 => '9'], [0 => '0', 1 => 'A'], [0 => '0', 1 => 'B'], [0 => '0', 1 => 'C'], [0 => '0', 1 => 'D'], [0 => '0', 1 => 'E'], [0 => '3', 1 => 'F'], [0 => '6', 1 => 'F'], [0 => '9', 1 => 'F'], [0 => 'C', 1 => 'F']];
foreach ($colors as $c) {
$row = [];
foreach ($brigs as $br) {
$r = $br[$c['r']];
$g = $br[$c['g']];
$b = $br[$c['b']];
$color = $r . $r . $g . $g . $b . $b;
$row[] = (new CColorCell(null, $color))->setTitle('#' . $color)->onClick('set_color("' . $color . '");');
}
$table[] = (new CDiv($row))->addClass(ZBX_STYLE_COLOR_PICKER);
}
$cancel = (new CSpan())->addClass(ZBX_STYLE_OVERLAY_CLOSE_BTN)->onClick('javascript: hide_color_picker();');
$tmp = [$cancel, $table];
insert_js('var color_picker = null,' . "\n" . 'curr_lbl = null,' . "\n" . 'curr_txt = null,' . "\n" . 'color_table = ' . zbx_jsvalue(unpack_object($tmp)) . "\n");
zbx_add_post_js('create_color_picker();');
}
示例15: setHint
/**
* Adds a hint box to the elemt.
*
* @param string|array|CTag $text hint content
* @param string $spanClass wrap the content in a span element and assign a this class to the span
* @param bool $byClick if set to true, it will be possible to "freeze" the hint box via a mouse
* click
*
* @return bool
*/
public function setHint($text, $spanClass = '', $byClick = true)
{
if (empty($text)) {
return false;
}
encodeValues($text);
$text = unpack_object($text);
$this->addAction('onmouseover', 'hintBox.HintWraper(event, this, ' . zbx_jsvalue($text) . ', "' . $spanClass . '");');
if ($byClick) {
$this->addAction('onclick', 'hintBox.showStaticHint(event, this, ' . zbx_jsvalue($text) . ', "' . $spanClass . '");');
}
return true;
}