本文整理汇总了PHP中ArrayUtil::fromObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtil::fromObject方法的具体用法?PHP ArrayUtil::fromObject怎么用?PHP ArrayUtil::fromObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil::fromObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toAttrString
protected function toAttrString($arrayOrObject)
{
$array = ArrayUtil::fromObject($arrayOrObject);
$out = '';
foreach ($array as $key => $value) {
$out .= $key . '="' . htmlentities($value, ENT_COMPAT, 'UTF-8') . '" ';
}
return trim($out);
}
示例2: preview
public static function preview($view, $data, $containerViewFile = 'mail', $textonly = false)
{
$mailViewFile = "mail/{$view}";
if (!$containerViewFile) {
$containerViewFile = 'mail';
}
$mailContainer = new View($containerViewFile);
$mailView = new View($mailViewFile);
if (!is_array($data)) {
$data = ArrayUtil::fromObject($data);
}
$data['textonly'] = $textonly;
$container = $data;
$container['body'] = $mailView->render($data);
return $mailContainer->render($container);
}
示例3: tagButton
/**
* Renders a button. All attributes not listed below will be forwarded to the actual html element
* @param string elm | tag type - defaults to a
* @param string class | CSS class to apply to button
* @param string event | event to trigger when clicked
* @deprecated
* @container
*/
protected function tagButton($attrs, $view)
{
if (!$attrs->elm) {
$attrs->elm = 'a';
}
if (!$attrs->class) {
$attrs->class = '';
}
$class = $this->evt2css($attrs->event);
$attrs->class = trim(trim(self::CSS_BTN . ' ' . $class) . ' ' . $attrs->class);
$elmAttr = ArrayUtil::fromObject($attrs);
unset($elmAttr['elm']);
unset($elmAttr['event']);
$elm = new HtmlElement($attrs->elm, $elmAttr);
$elm->addChild(new HtmlText(trim($this->body())));
return $elm;
}
示例4: append
public static function append(MPdf $pdf, $template, $data, $containerViewFile = null)
{
require_once Pimple::instance()->getRessource('lib/mpdf50/mpdf.php');
if ($containerViewFile) {
$container = new View($containerViewFile);
}
$view = new View($template);
if (!is_array($data)) {
$data = ArrayUtil::fromObject($data);
}
$cData = $data;
$cData['body'] = $view->render($data);
$css = "";
if ($container) {
$html = $container->render($cData);
self::readCss($pdf, $container);
} else {
$html = $cData['body'];
}
self::readCss($pdf, $view);
$pdf->WriteHTML($html);
}
示例5: getElementAttr
protected function getElementAttr($attrs)
{
$this->handleBehaviour($attrs);
$elmAttr = ArrayUtil::fromObject($attrs);
$this->handleOptions($attrs, $elmAttr);
$this->clearNonHtmlAttributes($elmAttr);
return $elmAttr;
}
示例6: tagImg
/**
* Renders an img tag - src is relative to the basepath.
* @param string src | path to image - relative to basepath of site
*/
protected function tagImg($attrs)
{
$attrs->src = Url::basePath() . $attrs->src;
return new HtmlElement('img', ArrayUtil::fromObject($attrs), false);
}