當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayUtil::fromObject方法代碼示例

本文整理匯總了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);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:9,代碼來源:TagLib.php

示例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);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:16,代碼來源:Mail.php

示例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;
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:25,代碼來源:WidgetTagLib.php

示例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);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:22,代碼來源:Pdf.php

示例5: getElementAttr

 protected function getElementAttr($attrs)
 {
     $this->handleBehaviour($attrs);
     $elmAttr = ArrayUtil::fromObject($attrs);
     $this->handleOptions($attrs, $elmAttr);
     $this->clearNonHtmlAttributes($elmAttr);
     return $elmAttr;
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:8,代碼來源:FormTagLib.php

示例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);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:9,代碼來源:BasicTagLib.php


注:本文中的ArrayUtil::fromObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。