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


PHP Sanitizer::mergeAttributes方法代码示例

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


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

示例1: makeKnownLinkObj

 /**
  * @deprecated since 1.16 Use link()
  *
  * Make a link for a title which definitely exists. This is faster than makeLinkObj because
  * it doesn't have to do a database query. It's also valid for interwiki titles and special
  * pages.
  *
  * @param $title  Title object of target page
  * @param $text   String: text to replace the title
  * @param $query  String: link target
  * @param $trail  String: text after link
  * @param $prefix String: text before link text
  * @param $aprops String: extra attributes to the a-element
  * @param $style  String: style to apply - if empty, use getInternalLinkAttributesObj instead
  * @return the a-element
  */
 static function makeKnownLinkObj($title, $text = '', $query = '', $trail = '', $prefix = '', $aprops = '', $style = '')
 {
     wfProfileIn(__METHOD__);
     if ($text == '') {
         $text = self::linkText($title);
     }
     $attribs = Sanitizer::mergeAttributes(Sanitizer::decodeTagAttributes($aprops), Sanitizer::decodeTagAttributes($style));
     $query = wfCgiToArray($query);
     list($inside, $trail) = self::splitTrail($trail);
     $ret = self::link($title, "{$prefix}{$text}{$inside}", $attribs, $query, array('known', 'noclasses')) . $trail;
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:29,代码来源:Linker.php

示例2: toHTML

 /**
  * Return a HTML representation of the image gallery
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  */
 function toHTML()
 {
     global $wgLang;
     $sk = $this->getSkin();
     $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery', 'cellspacing' => '0', 'cellpadding' => '0'), $this->mAttribs);
     $s = Xml::openElement('table', $attribs);
     if ($this->mCaption) {
         $s .= "\n\t<caption>{$this->mCaption}</caption>";
     }
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     $i = 0;
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # Give extensions a chance to select the file revision for us
         $time = $descQuery = false;
         wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time, &$descQuery));
         $img = wfFindFile($nt, $time);
         if ($nt->getNamespace() != NS_FILE || !$img) {
             # We're dealing with a non-image, spit out the name and be done with it.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
         } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
             # The image is blacklisted, just show it as a text link.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . $sk->makeKnownLinkObj($nt, htmlspecialchars($nt->getText())) . '</div>';
         } elseif (!($thumb = $img->transform($params))) {
             # Error generating thumbnail.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
         } else {
             $vpad = floor((1.25 * $this->mHeights - $thumb->height) / 2) - 2;
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: ' . $vpad . 'px 0; width: ' . ($this->mWidths + 30) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . $this->mWidths . 'px;">' . $thumb->toHtml(array('desc-link' => true, 'desc-query' => $descQuery)) . '</div></div>';
             // Call parser transform hook
             if ($this->mParser && $img->getHandler()) {
                 $img->getHandler()->parserTransformHook($this->mParser, $img);
             }
         }
         //TODO
         //$ul = $sk->makeLink( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}", $ut );
         if ($this->mShowBytes) {
             if ($img) {
                 $nb = wfMsgExt('nbytes', array('parsemag', 'escape'), $wgLang->formatNum($img->getSize()));
             } else {
                 $nb = wfMsgHtml('filemissing');
             }
             $nb = "{$nb}<br />\n";
         } else {
             $nb = '';
         }
         $textlink = $this->mShowFilename ? $sk->makeKnownLinkObj($nt, htmlspecialchars($wgLang->truncate($nt->getText(), 20, '...'))) . "<br />\n" : '';
         # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
         # in version 4.8.6 generated crackpot html in its absence, see:
         # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
         if ($i % $this->mPerRow == 0) {
             $s .= "\n\t<tr>";
         }
         $s .= "\n\t\t" . '<td><div class="gallerybox" style="width: ' . ($this->mWidths + 35) . 'px;">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . $text . $nb . "\n\t\t\t</div>" . "\n\t\t</div></td>";
         if ($i % $this->mPerRow == $this->mPerRow - 1) {
             $s .= "\n\t</tr>";
         }
         ++$i;
     }
     if ($i % $this->mPerRow != 0) {
         $s .= "\n\t</tr>";
     }
     $s .= "\n</table>";
     return $s;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:76,代码来源:ImageGallery.php

示例3: toHTML

 /**
  * Return a HTML representation of the image gallery
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  * @return string
  */
 function toHTML()
 {
     if ($this->mPerRow > 0) {
         $maxwidth = $this->mPerRow * ($this->mWidths + $this->getAllPadding());
         $oldStyle = isset($this->mAttribs['style']) ? $this->mAttribs['style'] : '';
         # _width is ignored by any sane browser. IE6 doesn't know max-width
         # so it uses _width instead
         $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
     }
     $attribs = Sanitizer::mergeAttributes(['class' => 'gallery mw-gallery-' . $this->mMode], $this->mAttribs);
     $modules = $this->getModules();
     if ($this->mParser) {
         $this->mParser->getOutput()->addModules($modules);
         $this->mParser->getOutput()->addModuleStyles('mediawiki.page.gallery.styles');
     } else {
         $this->getOutput()->addModules($modules);
         $this->getOutput()->addModuleStyles('mediawiki.page.gallery.styles');
     }
     $output = Xml::openElement('ul', $attribs);
     if ($this->mCaption) {
         $output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
     }
     if ($this->mShowFilename) {
         // Preload LinkCache info for when generating links
         // of the filename below
         $lb = new LinkBatch();
         foreach ($this->mImages as $img) {
             $lb->addObj($img[0]);
         }
         $lb->execute();
     }
     $lang = $this->getRenderLang();
     # Output each image...
     foreach ($this->mImages as $pair) {
         /** @var Title $nt */
         $nt = $pair[0];
         $text = $pair[1];
         # "text" means "caption" here
         $alt = $pair[2];
         $link = $pair[3];
         $descQuery = false;
         if ($nt->getNamespace() === NS_FILE) {
             # Get the file...
             if ($this->mParser instanceof Parser) {
                 # Give extensions a chance to select the file revision for us
                 $options = [];
                 Hooks::run('BeforeParserFetchFileAndTitle', [$this->mParser, $nt, &$options, &$descQuery]);
                 # Fetch and register the file (file title may be different via hooks)
                 list($img, $nt) = $this->mParser->fetchFileAndTitle($nt, $options);
             } else {
                 $img = wfFindFile($nt);
             }
         } else {
             $img = false;
         }
         $params = $this->getThumbParams($img);
         // $pair[4] is per image handler options
         $transformOptions = $params + $pair[4];
         $thumb = false;
         if (!$img) {
             # We're dealing with a non-image, spit out the name and be done with it.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
             if ($this->mParser instanceof Parser) {
                 $this->mParser->addTrackingCategory('broken-file-category');
             }
         } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
             # The image is blacklisted, just show it as a text link.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . Linker::linkKnown($nt, htmlspecialchars($nt->getText())) . '</div>';
         } else {
             $thumb = $img->transform($transformOptions);
             if (!$thumb) {
                 # Error generating thumbnail.
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
             } else {
                 /** @var MediaTransformOutput $thumb */
                 $vpad = $this->getVPad($this->mHeights, $thumb->getHeight());
                 $imageParameters = ['desc-link' => true, 'desc-query' => $descQuery, 'alt' => $alt, 'custom-url-link' => $link];
                 // In the absence of both alt text and caption, fall back on
                 // providing screen readers with the filename as alt text
                 if ($alt == '' && $text == '') {
                     $imageParameters['alt'] = $nt->getText();
                 }
                 $this->adjustImageParameters($thumb, $imageParameters);
                 Linker::processResponsiveImages($img, $thumb, $transformOptions);
                 # Set both fixed width and min-height.
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="width: ' . $this->getThumbDivWidth($thumb->getWidth()) . 'px;">' . '<div style="margin:' . $vpad . 'px auto;">' . $thumb->toHtml($imageParameters) . '</div></div>';
                 // Call parser transform hook
                 /** @var MediaHandler $handler */
                 $handler = $img->getHandler();
//.........这里部分代码省略.........
开发者ID:claudinec,项目名称:galan-wiki,代码行数:101,代码来源:TraditionalImageGallery.php

示例4: linkAttribs

 /**
  * Returns the array of attributes used when linking to the Title $target
  *
  * @param Title $target
  * @param array $attribs
  * @param array $options
  *
  * @return array
  */
 private static function linkAttribs($target, $attribs, $options)
 {
     global $wgUser;
     $defaults = array();
     if (!in_array('noclasses', $options)) {
         # Now build the classes.
         $classes = array();
         if (in_array('broken', $options)) {
             $classes[] = 'new';
         }
         if ($target->isExternal()) {
             $classes[] = 'extiw';
         }
         if (!in_array('broken', $options)) {
             # Avoid useless calls to LinkCache (see r50387)
             $colour = self::getLinkColour($target, $wgUser->getStubThreshold());
             if ($colour !== '') {
                 $classes[] = $colour;
                 # mw-redirect or stub
             }
         }
         if ($classes != array()) {
             $defaults['class'] = implode(' ', $classes);
         }
     }
     # Get a default title attribute.
     if ($target->getPrefixedText() == '') {
         # A link like [[#Foo]].  This used to mean an empty title
         # attribute, but that's silly.  Just don't output a title.
     } elseif (in_array('known', $options)) {
         $defaults['title'] = $target->getPrefixedText();
     } else {
         // This ends up in parser cache!
         $defaults['title'] = wfMessage('red-link-title', $target->getPrefixedText())->inContentLanguage()->text();
     }
     # Finally, merge the custom attribs with the default ones, and iterate
     # over that, deleting all "false" attributes.
     $ret = array();
     $merged = Sanitizer::mergeAttributes($defaults, $attribs);
     foreach ($merged as $key => $val) {
         # A false value suppresses the attribute, and we don't want the
         # href attribute to be overridden.
         if ($key != 'href' && $val !== false) {
             $ret[$key] = $val;
         }
     }
     return $ret;
 }
开发者ID:paladox,项目名称:2,代码行数:57,代码来源:Linker.php

示例5: toHTML

 function toHTML()
 {
     global $wgLang, $mvDefaultAspectRatio;
     $sk = $this->getSkin();
     $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery', 'cellspacing' => '0', 'cellpadding' => '0'), $this->mAttribs);
     $s = Xml::openElement('table', $attribs);
     if ($this->mCaption) {
         $s .= "\n\t<caption>" . htmlspecialchars($this->mCaption) . "</caption>";
     }
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     $i = 0;
     $this->already_named_resource = array();
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # Give extensions a chance to select the file revision for us
         $time = false;
         wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time));
         $img = wfFindFile($nt, array('time' => $time));
         if ($nt->getNamespace() == MV_NS_MVD || $nt->getNamespace() == MV_NS_STREAM || $nt->getNamespace() == MV_NS_SEQUENCE) {
             // @@todo fix sequence embed
             // $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
             $mvTitle = new MV_Title($nt);
             // remap MVD namespace links into the Stream view (so contextual metadata is present)
             if ($nt->getNamespace() == MV_NS_MVD) {
                 $nt = Title::MakeTitle(MV_NS_STREAM, ucfirst($mvTitle->getStreamName()) . '/' . $mvTitle->getTimeRequest());
             }
             $vidH = round($this->mWidths * $mvDefaultAspectRatio);
             $vidRes = $this->mWidths . 'x' . $vidH;
             // print "img url: " . 	$mvTitle->getStreamImageURL();
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: 4px 0; width: ' . htmlspecialchars($this->mWidths + 5) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $sk->makeKnownLinkObj($nt, '<img title="' . htmlspecialchars($mvTitle->getStreamNameText()) . '"' . ' width="160" height="120" src="' . $mvTitle->getStreamImageURL('160x120') . '">') . '</div>' . '</div>' . '<span class="gallerytext" style="float:left">' . $sk->makeKnownLinkObj($nt, $mvTitle->getStreamNameText() . ' ' . $mvTitle->getTimeDesc()) . '</span>' . '</div>';
             $nb = '';
             $textlink = '';
         } else {
             if ($nt->getNamespace() != NS_IMAGE || !$img) {
                 # We're dealing with a non-image, spit out the name and be done with it.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
             } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
                 # The image is blacklisted, just show it as a text link.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . $sk->makeKnownLinkObj($nt, htmlspecialchars($nt->getText())) . '</div>';
             } elseif (!($thumb = $img->transform($params))) {
                 # Error generating thumbnail.
                 $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ($this->mHeights * 1.25 + 2) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
             } else {
                 $vpad = floor((1.25 * $this->mHeights - $thumb->height) / 2) - 2;
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="padding: ' . htmlspecialchars($vpad) . 'px 0; width: ' . htmlspecialchars($this->mWidths + 30) . 'px;">' . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars($this->mWidths) . 'px;">' . $thumb->toHtml(array('desc-link' => true)) . '</div></div>';
                 // Call parser transform hook
                 if ($this->mParser && $img->getHandler()) {
                     $img->getHandler()->parserTransformHook($this->mParser, $img);
                 }
             }
             if ($this->mShowBytes) {
                 if ($img) {
                     $nb = wfMsgExt('nbytes', array('parsemag', 'escape'), $wgLang->formatNum($img->getSize()));
                 } else {
                     $nb = wfMsgHtml('filemissing');
                 }
                 $nb = "{$nb}<br />\n";
             } else {
                 $nb = '';
             }
             $textlink = $this->mShowFilename ? $sk->makeKnownLinkObj($nt, htmlspecialchars($wgLang->truncate($nt->getText(), 20))) . "<br />\n" : '';
         }
         # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
         # in version 4.8.6 generated crackpot html in its absence, see:
         # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
         if ($i % $this->mPerRow == 0) {
             $s .= "\n\t<tr>";
         }
         $s .= "\n\t\t" . '<td><div class="gallerybox" style="width: ' . ($this->mWidths + 10) . 'px;">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . htmlspecialchars($text) . $nb . "\n\t\t\t</div>" . "\n\t\t</div></td>";
         if ($i % $this->mPerRow == $this->mPerRow - 1) {
             $s .= "\n\t</tr>";
         }
         ++$i;
     }
     if ($i % $this->mPerRow != 0) {
         $s .= "\n\t</tr>";
     }
     $s .= "\n</table>";
     return $s;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:81,代码来源:MV_ImageGallery.php

示例6: toHTML

 /**
  * Return a HTML representation of the image Carrousel
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  */
 public function toHTML()
 {
     $car_photos = '';
     $car_slider = '';
     # Output each image...
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # "text" means "caption" here
         $alt = $pair[2];
         $titleLink = $pair[3];
         // Searching the image
         $descQuery = false;
         if ($nt->getNamespace() == NS_FILE) {
             # Get the file...
             if ($this->mParser instanceof Parser) {
                 # Give extensions a chance to select the file revision for us
                 $time = $sha1 = false;
                 wfRunHooks('BeforeParserFetchFileAndTitle', array($this->mParser, $nt, &$time, &$sha1, &$descQuery));
                 # Fetch and register the file (file title may be different via hooks)
                 list($img, $nt) = $this->mParser->fetchFileAndTitle($nt, $time, $sha1);
             } else {
                 $img = wfFindFile($nt);
             }
         } else {
             $img = false;
         }
         $car_photos .= Html::rawElement('li', array(), $this->photoToHTML($img, $nt, $text, $alt, $titleLink, $descQuery));
         $car_slider .= Html::rawElement('li', array(), $this->thumbToHTML($img, $nt, $text, $alt, $descQuery));
     }
     $car_photos = Html::rawElement('ul', array(), $car_photos);
     $photoHeight = $this->mPhotoHeight + self::CAPTIONHEIGHT;
     $car_photos = Html::rawElement('div', array('id' => 'car_photos', 'style' => 'height:' . $photoHeight . 'px'), $car_photos);
     $car_slider = Html::rawElement('ul', array(), $car_slider);
     $car_slider = Html::rawElement('div', array('class' => 'car_slider_window'), $car_slider);
     $car_slider = Html::rawElement('div', array('id' => 'car_slider'), $car_slider);
     $attribs = Sanitizer::mergeAttributes(array('id' => 'carrousel'), $this->mAttribs);
     $output = Html::rawElement('div', $attribs, $car_photos . $car_slider);
     return $output;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:50,代码来源:CarZam.Carrousel.php

示例7: _attribs

 function _attribs($tag, $defaults = array(), $overrides = array())
 {
     $attribs = Sanitizer::validateTagAttributes($this->params, $tag);
     $attribs = Sanitizer::mergeAttributes($defaults, $attribs);
     $attribs = Sanitizer::mergeAttributes($attribs, $overrides);
     return $attribs;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:7,代码来源:Math.php

示例8: renderSlideshow

 /**
  * Return a HTML representation of the image slideshow
  */
 private function renderSlideshow()
 {
     global $wgStylePath;
     wfProfileIn(__METHOD__);
     // don't render empty slideshows
     if (empty($this->mFiles)) {
         wfProfileOut(__METHOD__);
         return '';
     }
     // If we can, render this as a media gallery
     if ($this->canRenderMediaGallery()) {
         $html = $this->renderMediaGallery();
         wfProfileOut(__METHOD__);
         return trim(preg_replace('/\\n+/', ' ', $html));
     }
     /** @var Skin|Linker $sk The Skin object falls back to Linker methods */
     $sk = RequestContext::getMain()->getSkin();
     // slideshow wrapper CSS class
     $class = 'wikia-slideshow clearfix';
     $id = "slideshow-{$this->mData['id']}";
     // do not add button for galleries from templates
     if (isset($this->mData['params']['source']) && $this->mData['params']['source'] == "template") {
         $class .= ' template';
     }
     // support "position" attribute (slideshow alignment)
     switch ($this->getParam('position')) {
         case 'left':
             $class .= ' floatleft';
             break;
         case 'center':
             $class .= ' slideshow-center';
             break;
         case 'right':
             $class .= ' floatright';
             break;
     }
     // wrap image slideshow inside div.slideshow
     $attribs = Sanitizer::mergeAttributes(array('class' => $class, 'data-hash' => $this->mData['hash'], 'data-crop' => $this->mCrop, 'id' => $id), $this->mAttribs);
     //renderSlideshow for WikiaMobile
     if (F::app()->checkSkin('wikiamobile')) {
         $slideshowHtml = $this->renderWikiaMobileMediaGroup();
     } else {
         $slideshowHtml = Xml::openElement('div', $attribs);
         // render slideshow caption
         if ($this->mCaption) {
             $slideshowHtml .= '<div class="wikia-slideshow-caption">' . $this->mCaption . '</div>';
         }
         // fit images inside width:height = 4:3 box
         $this->mHeights = round($this->mWidths * 3 / 4);
         $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
         wfDebug(__METHOD__ . ": slideshow {$params['width']}x{$params['height']}\n");
         $slideshowHtml .= Xml::openElement('div', array('class' => 'wikia-slideshow-wrapper', 'style' => 'width: ' . ($this->mWidths + 10) . 'px'));
         // wrap images inside <div> and <ul>
         $slideshowHtml .= Xml::openElement('div', array('class' => 'wikia-slideshow-images-wrapper accent'));
         $slideshowHtml .= Xml::openElement('ul', array('class' => 'wikia-slideshow-images neutral', 'style' => "height: {$params['height']}px; width: {$params['width']}px"));
         $index = 0;
         foreach ($this->mFiles as $p => $pair) {
             /**
              * @var $nt Title
              */
             $nt = $pair[0];
             $text = $pair[1];
             $link = $pair[2];
             # Give extensions a chance to select the file revision for us
             $time = $descQuery = false;
             wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time, &$descQuery));
             $img = wfFindFile($nt, $time);
             if (WikiaFileHelper::isFileTypeVideo($img)) {
                 continue;
             }
             $thumb = null;
             // let's properly scale image (don't make it bigger than original size) and handle "crop" attribute
             if (is_object($img) && $nt->getNamespace() == NS_FILE) {
                 $thumbParams = WikiaPhotoGalleryHelper::getThumbnailDimensions($img, $params['width'], $params['height'], $this->mCrop);
             }
             $caption = $linkOverlay = '';
             // render caption overlay
             if ($text != '') {
                 $caption = Xml::openElement('span', array('class' => 'wikia-slideshow-image-caption')) . Xml::openElement('span', array('class' => 'wikia-slideshow-image-caption-inner')) . $text . Xml::closeElement('span') . Xml::closeElement('span');
             }
             // parse link
             $linkAttribs = $this->parseLink($nt->getLocalUrl(), $nt->getText(), $link);
             // extra link tag attributes
             $linkAttribs['id'] = "{$id}-{$index}";
             $linkAttribs['style'] = 'width: ' . ($params['width'] - 80) . 'px';
             if ($link == '') {
                 // tooltip to be used for not-linked images
                 $linkAttribs['title'] = wfMessage('wikiaPhotoGallery-slideshow-view-popout-tooltip')->text();
                 $linkAttribs['class'] = 'wikia-slideshow-image';
                 unset($linkAttribs['href']);
             } else {
                 // linked images
                 $linkAttribs['class'] .= ' wikia-slideshow-image';
                 // support |linktext= syntax
                 if ($this->mData['images'][$p]['linktext'] != '') {
                     $linkText = $this->mData['images'][$p]['linktext'];
                 } else {
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:WikiaPhotoGallery.class.php

示例9: toHTML

 /**
  * Return a HTML representation of the image gallery
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  * @return string
  */
 function toHTML()
 {
     if ($this->mPerRow > 0) {
         $maxwidth = $this->mPerRow * ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING + self::GB_BORDERS);
         $oldStyle = isset($this->mAttribs['style']) ? $this->mAttribs['style'] : '';
         # _width is ignored by any sane browser. IE6 doesn't know max-width so it uses _width instead
         $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
     }
     $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery'), $this->mAttribs);
     $output = Xml::openElement('ul', $attribs);
     if ($this->mCaption) {
         $output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
     }
     $lang = $this->getLang();
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     # Output each image...
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # "text" means "caption" here
         $alt = $pair[2];
         $link = $pair[3];
         $descQuery = false;
         if ($nt->getNamespace() == NS_FILE) {
             # Get the file...
             if ($this->mParser instanceof Parser) {
                 # Give extensions a chance to select the file revision for us
                 $options = array();
                 wfRunHooks('BeforeParserFetchFileAndTitle', array($this->mParser, $nt, &$options, &$descQuery));
                 # Fetch and register the file (file title may be different via hooks)
                 list($img, $nt) = $this->mParser->fetchFileAndTitle($nt, $options);
             } else {
                 $img = wfFindFile($nt);
             }
         } else {
             $img = false;
         }
         if (!$img) {
             # We're dealing with a non-image, spit out the name and be done with it.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
         } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
             # The image is blacklisted, just show it as a text link.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . Linker::link($nt, htmlspecialchars($nt->getText()), array(), array(), array('known', 'noclasses')) . '</div>';
         } elseif (!($thumb = $img->transform($params))) {
             # Error generating thumbnail.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
         } else {
             $vpad = (self::THUMB_PADDING + $this->mHeights - $thumb->height) / 2;
             $imageParameters = array('desc-link' => true, 'desc-query' => $descQuery, 'alt' => $alt, 'custom-url-link' => $link);
             # In the absence of both alt text and caption, fall back on providing screen readers with the filename as alt text
             if ($alt == '' && $text == '') {
                 $imageParameters['alt'] = $nt->getText();
             }
             # Set both fixed width and min-height.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="width: ' . ($this->mWidths + self::THUMB_PADDING) . 'px;">' . '<div style="margin:' . $vpad . 'px auto;">' . $thumb->toHtml($imageParameters) . '</div></div>';
             // Call parser transform hook
             if ($this->mParser && $img->getHandler()) {
                 $img->getHandler()->parserTransformHook($this->mParser, $img);
             }
         }
         //TODO
         // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
         // $ul = Linker::link( $linkTarget, $ut );
         if ($this->mShowBytes) {
             if ($img) {
                 $fileSize = htmlspecialchars($lang->formatSize($img->getSize()));
             } else {
                 $fileSize = wfMessage('filemissing')->escaped();
             }
             $fileSize = "{$fileSize}<br />\n";
         } else {
             $fileSize = '';
         }
         $textlink = $this->mShowFilename ? Linker::link($nt, htmlspecialchars($lang->truncate($nt->getText(), $this->mCaptionLength)), array(), array(), array('known', 'noclasses')) . "<br />\n" : '';
         # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
         # in version 4.8.6 generated crackpot html in its absence, see:
         # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
         # Weird double wrapping (the extra div inside the li) needed due to FF2 bug
         # Can be safely removed if FF2 falls completely out of existence
         $output .= "\n\t\t" . '<li class="gallerybox" style="width: ' . ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING) . 'px">' . '<div style="width: ' . ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING) . 'px">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . $text . $fileSize . "\n\t\t\t</div>" . "\n\t\t</div></li>";
     }
     $output .= "\n</ul>";
     return $output;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:95,代码来源:ImageGallery.php

示例10: headElement

 /**
  * @param Skin $sk The given Skin
  * @param bool $includeStyle Unused
  * @return string The doctype, opening "<html>", and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgContLang;
     $userdir = $this->getLanguage()->getDir();
     $sitedir = $wgContLang->getDir();
     $pieces = [];
     $pieces[] = Html::htmlHeader(Sanitizer::mergeAttributes($this->getRlClient()->getDocumentAttributes(), $sk->getHtmlElementAttributes()));
     $pieces[] = Html::openElement('head');
     if ($this->getHTMLTitle() == '') {
         $this->setHTMLTitle($this->msg('pagetitle', $this->getPageTitle())->inContentLanguage());
     }
     if (!Html::isXmlMimeType($this->getConfig()->get('MimeType'))) {
         // Add <meta charset="UTF-8">
         // This should be before <title> since it defines the charset used by
         // text including the text inside <title>.
         // The spec recommends defining XHTML5's charset using the XML declaration
         // instead of meta.
         // Our XML declaration is output by Html::htmlHeader.
         // http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
         // http://www.whatwg.org/html/semantics.html#charset
         $pieces[] = Html::element('meta', ['charset' => 'UTF-8']);
     }
     $pieces[] = Html::element('title', null, $this->getHTMLTitle());
     $pieces[] = $this->getRlClient()->getHeadHtml();
     $pieces[] = $this->buildExemptModules();
     $pieces = array_merge($pieces, array_values($this->getHeadLinksArray()));
     $pieces = array_merge($pieces, array_values($this->mHeadItems));
     $pieces[] = Html::closeElement('head');
     $bodyClasses = [];
     $bodyClasses[] = 'mediawiki';
     # Classes for LTR/RTL directionality support
     $bodyClasses[] = $userdir;
     $bodyClasses[] = "sitedir-{$sitedir}";
     if ($this->getLanguage()->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyClasses[] = 'capitalize-all-nouns';
     }
     // Parser feature migration class
     // The idea is that this will eventually be removed, after the wikitext
     // which requires it is cleaned up.
     $bodyClasses[] = 'mw-hide-empty-elt';
     $bodyClasses[] = $sk->getPageClasses($this->getTitle());
     $bodyClasses[] = 'skin-' . Sanitizer::escapeClass($sk->getSkinName());
     $bodyClasses[] = 'action-' . Sanitizer::escapeClass(Action::getActionName($this->getContext()));
     $bodyAttrs = [];
     // While the implode() is not strictly needed, it's used for backwards compatibility
     // (this used to be built as a string and hooks likely still expect that).
     $bodyAttrs['class'] = implode(' ', $bodyClasses);
     // Allow skins and extensions to add body attributes they need
     $sk->addToBodyAttributes($this, $bodyAttrs);
     Hooks::run('OutputPageBodyAttributes', [$this, $sk, &$bodyAttrs]);
     $pieces[] = Html::openElement('body', $bodyAttrs);
     return self::combineWrappedStrings($pieces);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:59,代码来源:OutputPage.php

示例11: linkAttribs

 /**
  * Returns the array of attributes used when linking to the Title $target
  */
 private function linkAttribs($target, $attribs, $options)
 {
     wfProfileIn(__METHOD__);
     global $wgUser;
     $defaults = array();
     if (!in_array('noclasses', $options)) {
         wfProfileIn(__METHOD__ . '-getClasses');
         # Now build the classes.
         $classes = array();
         if (in_array('broken', $options)) {
             $classes[] = 'new';
         }
         if ($target->isExternal()) {
             $classes[] = 'extiw';
         }
         # Note that redirects never count as stubs here.
         if (!in_array('broken', $options) && $target->isRedirect()) {
             $classes[] = 'mw-redirect';
         } elseif ($target->isContentPage()) {
             # Check for stub.
             $threshold = $wgUser->getOption('stubthreshold');
             if ($threshold > 0 and $target->exists() and $target->getLength() < $threshold) {
                 $classes[] = 'stub';
             }
         }
         if ($classes != array()) {
             $defaults['class'] = implode(' ', $classes);
         }
         wfProfileOut(__METHOD__ . '-getClasses');
     }
     # Get a default title attribute.
     if ($target->getPrefixedText() == '') {
         # A link like [[#Foo]].  This used to mean an empty title
         # attribute, but that's silly.  Just don't output a title.
     } elseif (in_array('known', $options)) {
         $defaults['title'] = $target->getPrefixedText();
     } else {
         $defaults['title'] = wfMsg('red-link-title', $target->getPrefixedText());
     }
     # Finally, merge the custom attribs with the default ones, and iterate
     # over that, deleting all "false" attributes.
     $ret = array();
     $merged = Sanitizer::mergeAttributes($defaults, $attribs);
     foreach ($merged as $key => $val) {
         # A false value suppresses the attribute, and we don't want the
         # href attribute to be overridden.
         if ($key != 'href' and $val !== false) {
             $ret[$key] = $val;
         }
     }
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:56,代码来源:Linker.php

示例12: toHTML

	/**
	 * Return a HTML representation of the image gallery
	 *
	 * For each image in the gallery, display
	 * - a thumbnail
	 * - the image name
	 * - the additional text provided when adding the image
	 * - the size of the image
	 *
	 * @return string
	 */
	function toHTML() {
		if ( $this->mPerRow > 0 ) {
			$maxwidth = $this->mPerRow * ( $this->mWidths + $this->getAllPadding() );
			$oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : '';
			# _width is ignored by any sane browser. IE6 doesn't know max-width so it uses _width instead
			$this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
		}

		$attribs = Sanitizer::mergeAttributes(
			array( 'class' => 'gallery mw-gallery-' . $this->mMode ), $this->mAttribs );

		$modules = $this->getModules();

		if ( $this->mParser ) {
			$this->mParser->getOutput()->addModules( $modules );
		} else {
			$this->getOutput()->addModules( $modules );
		}
		$output = Xml::openElement( 'ul', $attribs );
		if ( $this->mCaption ) {
			$output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
		}

		$lang = $this->getRenderLang();
		# Output each image...
		foreach ( $this->mImages as $pair ) {
			$nt = $pair[0];
			$text = $pair[1]; # "text" means "caption" here
			$alt = $pair[2];
			$link = $pair[3];

			$descQuery = false;
			if ( $nt->getNamespace() === NS_FILE ) {
				# Get the file...
				if ( $this->mParser instanceof Parser ) {
					# Give extensions a chance to select the file revision for us
					$options = array();
					wfRunHooks( 'BeforeParserFetchFileAndTitle',
						array( $this->mParser, $nt, &$options, &$descQuery ) );
					# Fetch and register the file (file title may be different via hooks)
					list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt, $options );
				} else {
					$img = wfFindFile( $nt );
				}
			} else {
				$img = false;
			}

			$params = $this->getThumbParams( $img );
			// $pair[4] is per image handler options
			$transformOptions = $params + $pair[4];

			$thumb = false;

			if ( !$img ) {
				# We're dealing with a non-image, spit out the name and be done with it.
				$thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
					. htmlspecialchars( $nt->getText() ) . '</div>';

				if ( $this->mParser instanceof Parser ) {
					$this->mParser->addTrackingCategory( 'broken-file-category' );
				}
			} elseif ( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
				# The image is blacklisted, just show it as a text link.
				$thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' .
					Linker::link(
						$nt,
						htmlspecialchars( $nt->getText() ),
						array(),
						array(),
						array( 'known', 'noclasses' )
					) .
					'</div>';
			} elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) {
				# Error generating thumbnail.
				$thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">'
					. htmlspecialchars( $img->getLastError() ) . '</div>';
			} else {
				$vpad = $this->getVPad( $this->mHeights, $thumb->getHeight() );

				$imageParameters = array(
					'desc-link' => true,
					'desc-query' => $descQuery,
					'alt' => $alt,
					'custom-url-link' => $link
				);
				# In the absence of both alt text and caption, fall back on providing screen readers with the filename as alt text
				if ( $alt == '' && $text == '' ) {
					$imageParameters['alt'] = $nt->getText();
//.........这里部分代码省略.........
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:101,代码来源:TraditionalImageGallery.php

示例13: toHTML

 /**
  * Return a HTML representation of the image gallery
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  */
 function toHTML()
 {
     global $wgLang;
     $sk = $this->getSkin();
     if ($this->mPerRow > 0) {
         $maxwidth = $this->mPerRow * ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING + self::GB_BORDERS);
         $oldStyle = isset($this->mAttribs['style']) ? $this->mAttribs['style'] : "";
         $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
     }
     $attribs = Sanitizer::mergeAttributes(array('class' => 'gallery'), $this->mAttribs);
     $s = Xml::openElement('ul', $attribs);
     if ($this->mCaption) {
         $s .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
     }
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     $i = 0;
     foreach ($this->mImages as $pair) {
         $nt = $pair[0];
         $text = $pair[1];
         # "text" means "caption" here
         # Give extensions a chance to select the file revision for us
         $time = $descQuery = false;
         wfRunHooks('BeforeGalleryFindFile', array(&$this, &$nt, &$time, &$descQuery));
         if ($nt->getNamespace() == NS_FILE) {
             $img = wfFindFile($nt, array('time' => $time));
         } else {
             $img = false;
         }
         if (!$img) {
             # We're dealing with a non-image, spit out the name and be done with it.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
         } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
             # The image is blacklisted, just show it as a text link.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . $sk->link($nt, htmlspecialchars($nt->getText()), array(), array(), array('known', 'noclasses')) . '</div>';
         } elseif (!($thumb = $img->transform($params))) {
             # Error generating thumbnail.
             $thumbhtml = "\n\t\t\t" . '<div style="height: ' . (self::THUMB_PADDING + $this->mHeights) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
         } else {
             //We get layout problems with the margin, if the image is smaller
             //than the line-height, so we less margin in these cases.
             $minThumbHeight = $thumb->height > 17 ? $thumb->height : 17;
             $vpad = floor((self::THUMB_PADDING + $this->mHeights - $minThumbHeight) / 2);
             $imageParameters = array('desc-link' => true, 'desc-query' => $descQuery);
             # In the absence of a caption, fall back on providing screen readers with the filename as alt text
             if ($text == '') {
                 $imageParameters['alt'] = $nt->getText();
             }
             # Set both fixed width and min-height.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="width: ' . ($this->mWidths + self::THUMB_PADDING) . 'px;">' . '<div style="margin:' . $vpad . 'px auto;">' . $thumb->toHtml($imageParameters) . '</div></div>';
             // Call parser transform hook
             if ($this->mParser && $img->getHandler()) {
                 $img->getHandler()->parserTransformHook($this->mParser, $img);
             }
         }
         //TODO
         // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
         // $ul = $sk->link( $linkTarget, $ut );
         if ($this->mShowBytes) {
             if ($img) {
                 $nb = wfMsgExt('nbytes', array('parsemag', 'escape'), $wgLang->formatNum($img->getSize()));
             } else {
                 $nb = wfMsgHtml('filemissing');
             }
             $nb = "{$nb}<br />\n";
         } else {
             $nb = '';
         }
         $textlink = $this->mShowFilename ? $sk->link($nt, htmlspecialchars($wgLang->truncate($nt->getText(), $this->mCaptionLength)), array(), array(), array('known', 'noclasses')) . "<br />\n" : '';
         # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
         # in version 4.8.6 generated crackpot html in its absence, see:
         # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
         # Weird double wrapping in div needed due to FF2 bug
         # Can be safely removed if FF2 falls completely out of existance
         $s .= "\n\t\t" . '<li class="gallerybox" style="width: ' . ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING) . 'px">' . '<div style="width: ' . ($this->mWidths + self::THUMB_PADDING + self::GB_PADDING) . 'px">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" . $textlink . $text . $nb . "\n\t\t\t</div>" . "\n\t\t</div></li>";
         ++$i;
     }
     $s .= "\n</ul>";
     return $s;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:89,代码来源:ImageGallery.php

示例14: renderFeedSlideshow

 /**
  * Return a HTML representation of the image slideshow for external images taken from feed
  * @author Marooned
  */
 private function renderFeedSlideshow()
 {
     global $wgStylePath, $wgBlankImgUrl;
     wfProfileIn(__METHOD__);
     // don't render empty slideshows
     if (empty($this->mExternalImages)) {
         wfProfileOut(__METHOD__);
         return '';
     }
     // slideshow wrapper CSS class
     $class = 'wikia-slideshow clearfix';
     $id = "slideshow-{$this->mData['id']}";
     // do not add button for galleries from templates
     if (isset($this->mData['params']['source']) && $this->mData['params']['source'] == "template") {
         $class .= ' template';
     }
     // support "position" attribute (slideshow alignment)
     switch ($this->getParam('position')) {
         case 'left':
             $class .= ' floatleft';
             break;
         case 'center':
             $class .= ' slideshow-center';
             break;
         case 'right':
             $class .= ' floatright';
             break;
     }
     // wrap image slideshow inside div.slideshow
     $attribs = Sanitizer::mergeAttributes(array('class' => $class, 'hash' => $this->mData['hash'], 'id' => $id), $this->mAttribs);
     $html = Xml::openElement('div', $attribs);
     // render slideshow caption
     if ($this->mCaption) {
         $html .= '<div class="wikia-slideshow-caption">' . $this->mCaption . '</div>';
     }
     // fit images inside width:height = 4:3 box
     $this->mHeights = round($this->mWidths * 3 / 4);
     $params = array('width' => $this->mWidths, 'height' => $this->mHeights);
     wfDebug(__METHOD__ . ": slideshow {$params['width']}x{$params['height']}\n");
     $html .= Xml::openElement('div', array('class' => 'wikia-slideshow-wrapper', 'style' => 'width: ' . ($this->mWidths + 10) . 'px'));
     // wrap images inside <div> and <ul>
     $html .= Xml::openElement('div', array('class' => 'wikia-slideshow-images-wrapper accent'));
     $html .= Xml::openElement('ul', array('class' => 'wikia-slideshow-images neutral', 'style' => "height: {$params['height']}px; width: {$params['width']}px;"));
     foreach ($this->mExternalImages as $index => $imageData) {
         // Give extensions a chance to select the file revision for us
         $caption = $linkOverlay = '';
         // render caption overlay
         if ($imageData['caption'] != '') {
             $caption = Xml::openElement('span', array('class' => 'wikia-slideshow-image-caption')) . Xml::openElement('span', array('class' => 'wikia-slideshow-image-caption-inner')) . $imageData['caption'] . Xml::closeElement('span') . Xml::closeElement('span');
         }
         // parse link
         $linkAttribs = $this->parseLink($imageData['src'], $imageData['caption'], $imageData['link']);
         // extra link tag attributes
         $linkAttribs['id'] = "{$id}-{$index}";
         $linkAttribs['style'] = 'width: ' . ($params['width'] - 80) . 'px';
         $linkAttribs['class'] = 'wikia-slideshow-image';
         $linkAttribs['target'] = "_blank";
         if ($imageData['link'] == '') {
             // tooltip to be used for not-linked images
             $linkAttribs['title'] = wfMsg('wikiaPhotoGallery-slideshow-view-popout-tooltip');
             unset($linkAttribs['href']);
         } else {
             $linkText = $imageData['link'];
             // add link overlay
             $linkOverlay = Xml::openElement('span', array('class' => 'wikia-slideshow-link-overlay')) . wfMsg('wikiaPhotoGallery-slideshow-view-link-overlay', $linkText) . Xml::closeElement('span');
         }
         // add CSS class so we can show first slideshow image before JS is loaded
         $liAttribs = array('class' => 'wikia-slideshow-from-feed');
         if ($index == 0) {
             $liAttribs['class'] .= ' wikia-slideshow-first-image';
         }
         $html .= Xml::openElement('li', $liAttribs) . Xml::openElement('img', array('data-src' => $imageData['src'])) . Xml::element('a', $linkAttribs, ' ') . $caption . $linkOverlay . '</li>';
     }
     $html .= Xml::closeElement('ul');
     $html .= Xml::closeElement('div');
     // render prev/next buttons
     $top = ($params['height'] >> 1) - 30 + 5;
     $html .= Xml::openElement('div', array('class' => 'wikia-slideshow-prev-next'));
     // prev
     $html .= Xml::openElement('a', array('class' => 'wikia-slideshow-sprite wikia-slideshow-prev', 'style' => "top: {$top}px", 'title' => wfMsg('wikiaPhotoGallery-slideshow-view-prev-tooltip')));
     $html .= Xml::openElement('span');
     $html .= Xml::element('img', array('class' => 'chevron', 'src' => $wgBlankImgUrl));
     $html .= Xml::closeElement('span');
     $html .= Xml::closeElement('a');
     // next
     $html .= Xml::openElement('a', array('class' => 'wikia-slideshow-sprite wikia-slideshow-next', 'style' => "top: {$top}px", 'title' => wfMsg('wikiaPhotoGallery-slideshow-view-next-tooltip')));
     $html .= Xml::openElement('span');
     $html .= Xml::element('img', array('class' => 'chevron', 'src' => $wgBlankImgUrl));
     $html .= Xml::closeElement('span');
     $html .= Xml::closeElement('a');
     $html .= Xml::closeElement('div');
     // render slideshow toolbar
     $html .= Xml::openElement('div', array('class' => 'wikia-slideshow-toolbar clearfix', 'style' => 'display: none'));
     // Pop-out icon, "X of X" counter
     $counterValue = wfMsg('wikiaPhotoGallery-slideshow-view-number', '$1', $index);
     $html .= Xml::openElement('div', array('style' => 'float: left'));
//.........这里部分代码省略.........
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:WikiaPhotoGallery.class.php


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