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


PHP DifferenceEngine::addHeader方法代码示例

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


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

示例1: execute

    function execute($par)
    {
        $request = $this->getRequest();
        $output = $this->getOutput();
        $this->setHeaders();
        $this->checkPermissions();
        $inputValue = htmlspecialchars($request->getText('page', $par));
        $pagenamePlaceholder = $this->msg('pp-pagename-placeholder')->escaped();
        $prepareButtonValue = $this->msg('pp-prepare-button-label')->escaped();
        $saveButtonValue = $this->msg('pp-save-button-label')->escaped();
        $cancelButtonValue = $this->msg('pp-cancel-button-label')->escaped();
        $summaryValue = $this->msg('pp-save-summary')->inContentLanguage()->escaped();
        $output->addModules('ext.translate.special.pagepreparation');
        $output->addModuleStyles('jquery.uls.grid');
        $out = '';
        $diff = new DifferenceEngine($this->getContext());
        $diffHeader = $diff->addHeader(" ", $this->msg('pp-diff-old-header')->escaped(), $this->msg('pp-diff-new-header')->escaped());
        $out = <<<HTML
<div class="grid">
\t<form class="mw-tpp-sp-form row" name="mw-tpp-sp-input-form" action="">
\t\t<input id="pp-summary" type="hidden" value="{$summaryValue}" />
\t\t<input name="page" id="page" class="mw-searchInput mw-ui-input"
\t\t\tplaceholder="{$pagenamePlaceholder}" value="{$inputValue}"/>
\t\t<button id="action-prepare" class="mw-ui-button mw-ui-primary" type="button">
\t\t\t{$prepareButtonValue}</button>
\t\t<button id="action-save" class="mw-ui-button mw-ui-constructive hide" type="button">
\t\t\t{$saveButtonValue}</button>
\t\t<button id="action-cancel" class="mw-ui-button mw-ui-quiet hide" type="button">
\t\t\t{$cancelButtonValue}</button>
\t</form>
\t<div class="messageDiv hide"></div>
\t<div class="divDiff hide">
\t\t{$diffHeader}
\t</div>
</div>
HTML;
        $output->addHTML($out);
    }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:38,代码来源:SpecialPagePreparation.php

示例2: diffWikitext

 protected function diffWikitext($title, $wikitext)
 {
     $apiParams = array('action' => 'query', 'prop' => 'revisions', 'titles' => $title->getPrefixedDBkey(), 'rvdifftotext' => $this->pstWikitext($title, $wikitext));
     $api = new ApiMain(new DerivativeRequest($this->getRequest(), $apiParams, false), false);
     $api->execute();
     if (defined('ApiResult::META_CONTENT')) {
         $result = $api->getResult()->getResultData(null, array('BC' => array(), 'Types' => array()));
     } else {
         $result = $api->getResultData();
     }
     if (!isset($result['query']['pages'][$title->getArticleID()]['revisions'][0]['diff']['*'])) {
         return array('result' => 'fail');
     }
     $diffRows = $result['query']['pages'][$title->getArticleID()]['revisions'][0]['diff']['*'];
     if ($diffRows !== '') {
         $context = new DerivativeContext($this->getContext());
         $context->setTitle($title);
         $engine = new DifferenceEngine($context);
         return array('result' => 'success', 'diff' => $engine->addHeader($diffRows, $context->msg('currentrev')->parse(), $context->msg('yourtext')->parse()));
     } else {
         return array('result' => 'nochanges');
     }
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:23,代码来源:ApiVisualEditor.php

示例3: showDetails

 /**
  * @param $id
  * @return mixed
  */
 function showDetails($id)
 {
     $out = $this->getOutput();
     $dbr = wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow(array('abuse_filter_log', 'abuse_filter'), '*', array('afl_id' => $id), __METHOD__, array(), array('abuse_filter' => array('LEFT JOIN', 'af_id=afl_filter')));
     if (!$row) {
         return;
     }
     if (AbuseFilter::decodeGlobalName($row->afl_filter)) {
         $filter_hidden = null;
     } else {
         $filter_hidden = $row->af_hidden;
     }
     if (!self::canSeeDetails($row->afl_filter, $filter_hidden)) {
         $out->addWikiMsg('abusefilter-log-cannot-see-details');
         return;
     }
     if (self::isHidden($row) && !self::canSeeHidden()) {
         $out->addWikiMsg('abusefilter-log-details-hidden');
         return;
     }
     $output = Xml::element('legend', null, $this->msg('abusefilter-log-details-legend', $id)->text());
     $output .= Xml::tags('p', null, $this->formatRow($row, false));
     // Load data
     $vars = AbuseFilter::loadVarDump($row->afl_var_dump);
     // Diff, if available
     if ($vars && $vars->getVar('action')->toString() == 'edit') {
         $old_wikitext = $vars->getVar('old_wikitext')->toString();
         $new_wikitext = $vars->getVar('new_wikitext')->toString();
         $diffEngine = new DifferenceEngine($this->getContext());
         $diffEngine->showDiffStyle();
         // Note: generateDiffBody has been deprecated in favour of generateTextDiffBody in 1.21 but we can't use it for b/c
         $formattedDiff = $diffEngine->generateDiffBody($old_wikitext, $new_wikitext);
         $formattedDiff = $diffEngine->addHeader($formattedDiff, '', '');
         $output .= Xml::tags('h3', null, $this->msg('abusefilter-log-details-diff')->parse());
         $output .= $formattedDiff;
     }
     $output .= Xml::element('h3', null, $this->msg('abusefilter-log-details-vars')->text());
     // Build a table.
     $output .= AbuseFilter::buildVarDumpTable($vars);
     if (self::canSeePrivate()) {
         // Private stuff, like IPs.
         $header = Xml::element('th', null, $this->msg('abusefilter-log-details-var')->text()) . Xml::element('th', null, $this->msg('abusefilter-log-details-val')->text());
         $output .= Xml::element('h3', null, $this->msg('abusefilter-log-details-private')->text());
         $output .= Xml::openElement('table', array('class' => 'wikitable mw-abuselog-private', 'style' => 'width: 80%;')) . Xml::openElement('tbody');
         $output .= $header;
         // IP address
         $output .= Xml::tags('tr', null, Xml::element('td', array('style' => 'width: 30%;'), $this->msg('abusefilter-log-details-ip')->text()) . Xml::element('td', null, $row->afl_ip));
         $output .= Xml::closeElement('tbody') . Xml::closeElement('table');
     }
     $output = Xml::tags('fieldset', null, $output);
     $out->addHTML($output);
 }
开发者ID:aahashderuffy,项目名称:extensions,代码行数:57,代码来源:SpecialAbuseLog.php

示例4: diffUndo

 public static function diffUndo(array $args, array $named)
 {
     if (count($args) !== 1) {
         throw new WrongNumberArgumentsException($args, 'one');
     }
     list($diffContent) = $args;
     $differenceEngine = new \DifferenceEngine();
     $multi = $differenceEngine->getMultiNotice();
     $notice = '';
     if ($diffContent === '') {
         $notice = '<div class="mw-diff-empty">' . wfMessage('diff-empty')->parse() . "</div>\n";
     }
     $differenceEngine->showDiffStyle();
     return self::html($differenceEngine->addHeader($diffContent, wfMessage('flow-undo-latest-revision'), wfMessage('flow-undo-your-text'), $multi, $notice));
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:15,代码来源:TemplateHelper.php

示例5: getLegend

 protected function getLegend()
 {
     $text = $this->diff->addHeader('', $this->msg('translate-smg-left')->escaped(), $this->msg('translate-smg-right')->escaped());
     return Html::rawElement('div', array('class' => "mw-translate-smg-header"), $text);
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:5,代码来源:SpecialManageGroups.php

示例6: getDiffRow

 /**
  * @param $msg
  * @param $old
  * @param $new
  * @return string
  */
 function getDiffRow($msg, $old, $new)
 {
     if (!is_array($old)) {
         $old = explode("\n", preg_replace("/\\\r\\\n?/", "\n", $old));
     }
     if (!is_array($new)) {
         $new = explode("\n", preg_replace("/\\\r\\\n?/", "\n", $new));
     }
     $diffEngine = new DifferenceEngine($this->getContext());
     $diffEngine->showDiffStyle();
     // We can't use $diffEngine->generateDiffBody since it doesn't allow custom formatters
     $diff = new Diff($old, $new);
     $formatter = new TableDiffFormatterFullContext();
     $formattedDiff = $diffEngine->addHeader($formatter->format($diff), '', '');
     return Xml::tags('tr', null, Xml::tags('th', null, $this->msg($msg)->parse()) . Xml::tags('td', array('colspan' => 2), $formattedDiff)) . "\n";
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:22,代码来源:AbuseFilterViewDiff.php


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