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


PHP OutputPage::addHTML方法代码示例

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


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

示例1: show

 /**
  * Perform a book information request and output the result
  * if available, or an error if appropriate
  *
  * @param string $isbn ISBN to be queried
  * @param OutputPage $output OutputPage object to use
  */
 public static function show($isbn, $output)
 {
     if (self::isValidISBN($isbn)) {
         $result = BookInformationCache::get($isbn);
         if ($result === false) {
             $driver = self::getDriver();
             if ($driver !== false) {
                 $result = $driver->submitRequest($isbn);
                 if ($result->isCacheable()) {
                     BookInformationCache::set($isbn, $result);
                 }
             } else {
                 $output->addHTML(self::makeError('nodriver'));
                 return;
             }
         }
         if ($result->getResponseCode() == BookInformationResult::RESPONSE_OK) {
             $output->addHTML(self::makeResult($result));
         } elseif ($result->getResponseCode() == BookInformationResult::RESPONSE_NOSUCHITEM) {
             $output->addHTML(self::makeError('nosuchitem'));
         } else {
             $output->addHTML(self::makeError('noresponse'));
         }
     } else {
         $output->addHTML(self::makeError('invalidisbn'));
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:34,代码来源:Worker.php

示例2: doModLangs

 /**
  * @param $group MessageGroup
  */
 public function doModLangs($group)
 {
     global $wgLang;
     $languages = array_keys(Language::getLanguageNames(false));
     $modified = $codes = array();
     foreach ($languages as $code) {
         if ($code === 'en') {
             continue;
         }
         $cache = new MessageGroupCache($group, $code);
         if ($cache->isValid()) {
             continue;
         }
         $link = $this->skin->link($this->getTitle(), htmlspecialchars(TranslateUtils::getLanguageName($code, false, $wgLang->getCode()) . " ({$code})"), array(), array('group' => $group->getId(), 'language' => $code));
         if (!$cache->exists()) {
             $modified[] = wfMsgHtml('translate-manage-modlang-new', $link);
         } else {
             $modified[] = $link;
         }
         $codes[] = $code;
     }
     if (count($modified)) {
         $this->out->addWikiMsg('translate-manage-modlangs', $wgLang->formatNum(count($modified)));
         if ($this->user->isAllowed('translate-manage')) {
             $this->out->addHTML($this->rebuildButton($group, $codes, 'import'));
         }
         $this->out->addHTML('<ul><li>' . implode("</li>\n<li>", $modified) . '</li></ul>');
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:SpecialManageGroups.php

示例3: showEditFormFields

 /**
  * Show error message for missing or incorrect captcha on EditPage.
  * @param EditPage $editPage
  * @param OutputPage $out
  */
 function showEditFormFields(&$editPage, &$out)
 {
     $page = $editPage->getArticle()->getPage();
     if (!isset($page->ConfirmEdit_ActivateCaptcha)) {
         return;
     }
     unset($page->ConfirmEdit_ActivateCaptcha);
     $out->addHTML(Html::openElement('div', array('id' => 'mw-confirmedit-error-area', 'class' => 'errorbox')) . Html::element('strong', array(), $out->msg('errorpagetitle')->text()) . Html::element('div', array('id' => 'errorbox-body'), $out->msg('captcha-sendemail-fail')->text()) . Html::closeElement('div'));
     $this->showEditCaptcha = true;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:15,代码来源:Captcha.php

示例4: showEditFormFields

 /**
  * Show error message for missing or incorrect captcha on EditPage.
  * @param EditPage $editPage
  * @param OutputPage $out
  */
 function showEditFormFields(&$editPage, &$out)
 {
     $page = $editPage->getArticle()->getPage();
     if (!isset($page->ConfirmEdit_ActivateCaptcha)) {
         return;
     }
     if ($this->action !== 'edit') {
         unset($page->ConfirmEdit_ActivateCaptcha);
         $out->addWikiText($this->getMessage($this->action));
         $out->addHTML($this->getForm($out));
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:17,代码来源:Captcha.php

示例5: outputResults

 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use [unused]
  * @param DatabaseBase $dbr (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     if ($num > 0) {
         $gallery = new ImageGallery();
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         for ($i = 0; $i < $num && ($row = $dbr->fetchObject($res)); $i++) {
             $namespace = isset($row->namespace) ? $row->namespace : NS_FILE;
             $title = Title::makeTitleSafe($namespace, $row->title);
             if ($title instanceof Title && $title->getNamespace() == NS_FILE) {
                 $gallery->add($title, $this->getCellHtml($row));
             }
         }
         $out->addHTML($gallery->toHtml());
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:27,代码来源:ImageQueryPage.php

示例6: outputResults

 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param Database $dbr Database (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     if ($num > 0) {
         $gallery = new ImageGallery();
         $gallery->useSkin($skin);
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         for ($i = 0; $i < $num && ($row = $dbr->fetchObject($res)); $i++) {
             $image = $this->prepareImage($row);
             if ($image) {
                 $gallery->add($image->getTitle(), $this->getCellHtml($row));
             }
         }
         $out->addHTML($gallery->toHtml());
     }
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:27,代码来源:ImageQueryPage.php

示例7: outputResults

 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use [unused]
  * @param DatabaseBase $dbr (read) connection to use
  * @param ResultWrapper $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     if ($num > 0) {
         $gallery = ImageGalleryBase::factory(false, $this->getContext());
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         $i = 0;
         foreach ($res as $row) {
             $i++;
             $namespace = isset($row->namespace) ? $row->namespace : NS_FILE;
             $title = Title::makeTitleSafe($namespace, $row->title);
             if ($title instanceof Title && $title->getNamespace() == NS_FILE) {
                 $gallery->add($title, $this->getCellHtml($row));
             }
             if ($i === $num) {
                 break;
             }
         }
         $out->addHTML($gallery->toHtml());
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:32,代码来源:ImageQueryPage.php

示例8: showOptions

 /**
  * Show options for the log list
  *
  * @param $types string or Array
  * @param $user String
  * @param $page String
  * @param $pattern String
  * @param $year Integer: year
  * @param $month Integer: month
  * @param $filter: array
  * @param $tagFilter: array?
  */
 public function showOptions($types = array(), $user = '', $page = '', $pattern = '', $year = '', $month = '', $filter = null, $tagFilter = '')
 {
     global $wgScript, $wgMiserMode;
     $action = $wgScript;
     $title = SpecialPage::getTitleFor('Log');
     $special = $title->getPrefixedDBkey();
     // For B/C, we take strings, but make sure they are converted...
     $types = $types === '' ? array() : (array) $types;
     $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
     $html = Html::hidden('title', $special);
     // Basic selectors
     $html .= $this->getTypeMenu($types) . "\n";
     $html .= $this->getUserInput($user) . "\n";
     $html .= $this->getTitleInput($page) . "\n";
     $html .= $this->getExtraInputs($types) . "\n";
     // Title pattern, if allowed
     if (!$wgMiserMode) {
         $html .= $this->getTitlePattern($pattern) . "\n";
     }
     // date menu
     $html .= Xml::tags('p', null, Xml::dateMenu($year, $month));
     // Tag filter
     if ($tagSelector) {
         $html .= Xml::tags('p', null, implode('&#160;', $tagSelector));
     }
     // Filter links
     if ($filter) {
         $html .= Xml::tags('p', null, $this->getFilterLinks($filter));
     }
     // Submit button
     $html .= Xml::submitButton(wfMsg('allpagessubmit'));
     // Fieldset
     $html = Xml::fieldset(wfMsg('log'), $html);
     // Form wrapping
     $html = Xml::tags('form', array('action' => $action, 'method' => 'get'), $html);
     $this->out->addHTML($html);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:49,代码来源:LogEventsList.php

示例9: showLogExtract

 /**
  * Show protection long extracts for this page
  *
  * @param OutputPage $out
  * @access private
  */
 function showLogExtract(&$out)
 {
     # Show relevant lines from the protection log:
     $protectLogPage = new LogPage('protect');
     $out->addHTML(Xml::element('h2', null, $protectLogPage->getName()->text()));
     LogEventsList::showLogExtract($out, 'protect', $this->mTitle);
     # Let extensions add other relevant log extracts
     Hooks::run('ProtectionForm::showLogExtract', [$this->mArticle, $out]);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:15,代码来源:ProtectionForm.php

示例10: showHtmlPreview

 /**
  * Wraps the provided html code in a div and outputs it to the page
  *
  * @param Title $title
  * @param ParserOutput $pout
  * @param OutputPage $out
  */
 private function showHtmlPreview(Title $title, ParserOutput $pout, OutputPage $out)
 {
     $lang = $title->getPageViewLanguage();
     $out->addHTML("<h2>" . $this->msg('expand_templates_preview')->escaped() . "</h2>\n");
     $out->addHTML(Html::openElement('div', array('class' => 'mw-content-' . $lang->getDir(), 'dir' => $lang->getDir(), 'lang' => $lang->getHtmlCode())));
     $out->addParserOutputContent($pout);
     $out->addHTML(Html::closeElement('div'));
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:15,代码来源:SpecialExpandTemplates.php

示例11: showHtmlPreview

 /**
  * Render the supplied wiki text and append to the page as a preview
  *
  * @param Title $title
  * @param string $text
  * @param OutputPage $out
  */
 private function showHtmlPreview($title, $text, $out)
 {
     global $wgParser;
     $pout = $wgParser->parse($text, $title, new ParserOptions());
     $out->addHTML("<h2>" . wfMsgHtml('expand_templates_preview') . "</h2>\n");
     global $wgRawHtml, $wgRequest, $wgUser;
     if ($wgRawHtml) {
         // To prevent cross-site scripting attacks, don't show the preview if raw HTML is
         // allowed and a valid edit token is not provided (bug 71111). However, MediaWiki
         // does not currently provide logged-out users with CSRF protection; in that case,
         // do not show the preview unless anonymous editing is allowed.
         if ($wgUser->isAnon() && !$wgUser->isAllowed('edit')) {
             $error = array('expand_templates_preview_fail_html_anon');
         } elseif (!$wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
             $error = array('expand_templates_preview_fail_html');
         } else {
             $error = false;
         }
         if ($error) {
             $out->wrapWikiMsg("<div class='previewnote'>\n\$1\n</div>", $error);
             return;
         }
     }
     $out->addHTML($pout->getText());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:ExpandTemplates_body.php

示例12: editPageShowEditFormFields

 /**
  * EditPage::showEditForm:fields hook
  *
  * Adds the event fields to the edit form
  *
  * @param EditPage $editPage the current EditPage object.
  * @param OutputPage $outputPage object.
  * @return bool
  */
 public static function editPageShowEditFormFields($editPage, $outputPage)
 {
     if ($editPage->contentModel !== CONTENT_MODEL_WIKITEXT) {
         return true;
     }
     $req = $outputPage->getContext()->getRequest();
     $editingStatsId = $req->getVal('editingStatsId');
     if (!$editingStatsId || !$req->wasPosted()) {
         $editingStatsId = self::getEditingStatsId();
     }
     $outputPage->addHTML(Xml::element('input', array('type' => 'hidden', 'name' => 'editingStatsId', 'id' => 'editingStatsId', 'value' => $editingStatsId)));
     return true;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:22,代码来源:WikiEditor.hooks.php

示例13: viewHook

 /**
  * Hook into Article::view() to provide syntax highlighting for
  * custom CSS and JavaScript pages
  *
  * @param string $text
  * @param Title $title
  * @param OutputPage $output
  * @return bool
  */
 public static function viewHook($text, $title, $output)
 {
     // Determine the language
     preg_match('!\\.(css|js)$!u', $title->getText(), $matches);
     $lang = $matches[1] == 'css' ? 'css' : 'javascript';
     // Attempt to format
     $geshi = self::prepare($text, $lang);
     if ($geshi instanceof GeSHi) {
         $out = $geshi->parse_code();
         if (!$geshi->error()) {
             // Done
             $output->addHeadItem("source-{$lang}", self::buildHeadItem($geshi));
             $output->addHTML("<div dir=\"ltr\">{$out}</div>");
             return false;
         }
     }
     // Bottle out
     return true;
 }
开发者ID:akoehn,项目名称:wikireader,代码行数:28,代码来源:SyntaxHighlight_GeSHi.class.php

示例14: showHtmlPreview

 /**
  * Wraps the provided html code in a div and outputs it to the page
  *
  * @param Title $title
  * @param string $html
  * @param OutputPage $out
  */
 private function showHtmlPreview(Title $title, $html, OutputPage $out)
 {
     $lang = $title->getPageViewLanguage();
     $out->addHTML("<h2>" . $this->msg('expand_templates_preview')->escaped() . "</h2>\n");
     global $wgRawHtml;
     if ($wgRawHtml) {
         $request = $this->getRequest();
         $user = $this->getUser();
         // To prevent cross-site scripting attacks, don't show the preview if raw HTML is
         // allowed and a valid edit token is not provided (bug 71111). However, MediaWiki
         // does not currently provide logged-out users with CSRF protection; in that case,
         // do not show the preview unless anonymous editing is allowed.
         if ($user->isAnon() && !$user->isAllowed('edit')) {
             $error = array('expand_templates_preview_fail_html_anon');
         } elseif (!$user->matchEditToken($request->getVal('wpEditToken'), '', $request)) {
             $error = array('expand_templates_preview_fail_html');
         } else {
             $error = false;
         }
         if ($error) {
             $out->wrapWikiMsg("<div class='previewnote'>\n\$1\n</div>", $error);
             return;
         }
     }
     $out->addHTML(Html::openElement('div', array('class' => 'mw-content-' . $lang->getDir(), 'dir' => $lang->getDir(), 'lang' => $lang->getHtmlCode())));
     $out->addHTML($html);
     $out->addHTML(Html::closeElement('div'));
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:35,代码来源:SpecialExpandTemplates.php

示例15: onEditPageShowEditFormFields

 /**
  * Called when the normal wikitext editor is shown.
  * Inserts a 'veswitched' hidden field if requested by the client
  *
  * @param $editPage EditPage
  * @param $output OutputPage
  * @return boolean true
  */
 public static function onEditPageShowEditFormFields(EditPage $editPage, OutputPage $output)
 {
     $request = $output->getRequest();
     if ($request->getBool('veswitched')) {
         $output->addHTML(Xml::input('veswitched', false, '1', array('type' => 'hidden')));
     }
     return true;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:16,代码来源:VisualEditor.hooks.php


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