コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 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>');
 }
コード例 #3
0
        $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");