当前位置: 首页>>代码示例>>PHP>>正文


PHP Xml::Element方法代码示例

本文整理汇总了PHP中Xml::Element方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::Element方法的具体用法?PHP Xml::Element怎么用?PHP Xml::Element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xml的用法示例。


在下文中一共展示了Xml::Element方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderColorPicker

 /**
  * Render color picker
  *
  * @author Macbre
  * @param Array $colors A list of the colors to show,
  * a multidimensional array with 'class' or 'color' sub-elements, false results in a hr separator
  * <code>
  * array(
  *	#CSS classes
  *	array('class' => 'accent', property => 'border'),
  *	array('class' => 'color1', property => 'background'),
  *	#horizontal line
  *	false,
  *	#defined colors
  *	array('color' => '2daccd')
  * )
  * </code>
  */
 public static function renderColorPicker($id, $message, $colors, $default = null, $renderLabel = true)
 {
     wfProfileIn(__METHOD__);
     $ret = '';
     // render label
     if ($renderLabel) {
         $ret .= Xml::element('label', array('for' => $id), wfMsg($message));
     }
     // render color picker box
     $ret .= Xml::openElement('span', array('id' => $id, 'class' => 'WikiaPhotoGalleryColorPicker'), '');
     $options = array('id' => "{$id}_trigger");
     if (!empty($default) && is_string($default) && strpos($default, '#') === 0) {
         $options['style'] = "background-color:{$default}";
         $options['title'] = $default;
     } elseif (!empty($default) && is_array($default)) {
         $options['title'] = "{$default[0]}--{$default[1]}";
     }
     $ret .= Xml::element('span', $options, '');
     $ret .= Xml::closeElement('span');
     // render color picker popup box
     $ret .= Xml::openElement('div', array('class' => 'WikiaPhotoGalleryColorPickerPopUp', 'id' => "{$id}_popup"));
     $ret .= Xml::element('label', array(), wfMsg('wikiaPhotoGallery-preview-colorpicker-title'));
     foreach ($colors as $row) {
         if ($row == 'hr') {
             $ret .= Xml::element('hr');
         } else {
             $ret .= Xml::openElement('ul', array('style' => 'clear: both;'));
             foreach ($row as $entry) {
                 $attribs = array();
                 if (isset($entry['class'])) {
                     $attribs['class'] = $entry['class'];
                     $attribs['title'] = ".{$entry['class']}";
                     $attribs['rel'] = $entry['property'];
                 } else {
                     if ($entry['color'] == 'transparent') {
                         $attribs['class'] = "transparent-color";
                     } else {
                         $attribs['style'] = "background-color: {$entry['color']}";
                     }
                     $attribs['title'] = "{$entry['color']}";
                 }
                 $ret .= Xml::openElement('li');
                 $ret .= Xml::Element('span', $attribs, '');
                 $ret .= Xml::closeElement('li');
             }
             $ret .= Xml::closeElement('ul');
         }
     }
     // hex code input field
     $ret .= Xml::element('hr');
     $ret .= Xml::element('label', array('for' => "{$id}HexCode"), wfMsg('wikiaPhotoGallery-preview-colorpicker-hex'));
     $ret .= Xml::element('input', array('id' => "{$id}HexCode", 'type' => 'text'));
     // Ok button
     $ret .= Xml::element('button', array(), wfMsg('ok'));
     $ret .= Xml::closeElement('div');
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:76,代码来源:WikiaPhotoGalleryHelper.class.php

示例2: setProtectsiteForm

 function setProtectsiteForm()
 {
     global $wgOut, $wgProtectsiteDefaultTimeout, $wgProtectsiteLimit;
     $request = $this->mRequest->getValues();
     $createaccount = array(0 => false, 1 => false, 2 => false);
     $createaccount[isset($request['createaccount']) ? $request['createaccount'] : 0] = true;
     $createpage = array(0 => false, 1 => false, 2 => false);
     $createpage[isset($request['createpage']) ? $request['createpage'] : 0] = true;
     $edit = array(0 => false, 1 => false, 2 => false);
     $edit[isset($request['edit']) ? $request['edit'] : 0] = true;
     $move = array(0 => false, 1 => false);
     $move[isset($request['move']) ? $request['move'] : 0] = true;
     $upload = array(0 => false, 1 => false);
     $upload[isset($request['upload']) ? $request['upload'] : 0] = true;
     /* Construct page data and add to output. */
     $wgOut->addWikiMsg('protectsite-text-protect');
     $timelimitText = '';
     if (isset($wgProtectsiteLimit)) {
         $timelimitText = ' (' . wfMsg('protectsite-maxtimeout') . $wgProtectsiteLimit . ')';
         if ($this->isMagicUser) {
             $timelimitText = "<s title='you are exempt from the limit'>" . $timelimitText . '</s>';
         }
     }
     $noLogCheck = '';
     if ($this->isMagicUser) {
         $noLogCheck = "<div><label>" . wfMsg('protectsite-hide-time-length') . "<input type='checkbox' name=\"nolog\" />" . "</label></div>\n";
     }
     $wgOut->addHTML('<form name="Protectsite" action="' . $this->action . '" method="post">' . "\n" . $this->fieldset('title', $this->radiobox('createaccount', $createaccount) . $this->radiobox('createpage', $createpage) . $this->radiobox('edit', $edit) . $this->radiobox('move', $move) . $this->radiobox('upload', $upload) . $this->textbox('timeout', $wgProtectsiteDefaultTimeout, $timelimitText) . $this->textbox('comment', isset($request['comment']) ? $request['comment'] : '') . $noLogCheck . "\n<br />" . Xml::Element('input', array('type' => 'submit', 'name' => 'protect', 'value' => wfMsg($this->mName . '-protect')))) . '</form>');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:SpecialProtectSite_body.php

示例3: createProlog

        $r->nodeType = Xml::$DocType;
        $r->setNodeValue($data);
        return $r;
    }
    static function createProlog($data)
    {
        $r = new Xml();
        $r->nodeType = Xml::$Prolog;
        $r->setNodeValue($data);
        return $r;
    }
    static function createDocument()
    {
        $r = new Xml();
        $r->nodeType = Xml::$Document;
        $r->_children = new _hx_array(array());
        return $r;
    }
    function __toString()
    {
        return $this->toString();
    }
}
Xml::$Element = "element";
Xml::$PCData = "pcdata";
Xml::$CData = "cdata";
Xml::$Comment = "comment";
Xml::$DocType = "doctype";
Xml::$Prolog = "prolog";
Xml::$Document = "document";
Xml::$xmlChecker = new EReg("\\s*(<\\?xml|<!DOCTYPE)", "mi");
开发者ID:ralcr,项目名称:Apple-s-Dictionary-App-database-generator,代码行数:31,代码来源:Xml.class.php


注:本文中的Xml::Element方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。