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


PHP Html::element方法代码示例

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


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

示例1: render

 public static function render($input, $args, $parser, $frame)
 {
     // Disable cache so that CSS will get loaded.
     $parser->disableCache();
     // If this call is contained in a transcluded page or template,
     // or if the input is empty, display nothing.
     if (!$frame->title->equals($parser->getTitle()) || $input == '') {
         return;
     }
     // TODO: Do processing here, like parse to an array
     $error_msg = null;
     // Recreate the top-level <PageSchema> tag, with whatever
     // attributes it contained, because that was actually a tag-
     // function call, as opposed to a real XML tag.
     $input = Xml::tags('PageSchema', $args, $input);
     if ($xml_object = PageSchemas::validateXML($input, $error_msg)) {
         // Store the XML in the page_props table
         $parser->getOutput()->setProperty('PageSchema', $input);
         // Display the schema on the screen
         global $wgOut, $wgScriptPath;
         $wgOut->addStyle($wgScriptPath . '/extensions/PageSchemas/PageSchemas.css');
         $text = PageSchemas::displaySchema($xml_object);
     } else {
         // Store error message in the page_props table
         $parser->getOutput()->setProperty('PageSchema', $error_msg);
         $text = Html::element('p', null, "The (incorrect) XML definition for this template is:") . "\n";
         $text .= Html::element('pre', null, $input);
     }
     return $text;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:30,代码来源:PageSchemas.hooks.php

示例2: executeWhenAvailable

 /**
  * Render the special page and redirect the user to the editor (if page exists)
  * @param string $subpage The name of the page to edit
  */
 public function executeWhenAvailable($subpage)
 {
     if (!is_string($subpage)) {
         $this->showPageNotFound();
         return;
     } else {
         $title = Title::newFromText($subpage);
         if (is_null($title)) {
             $this->showPageNotFound();
             return;
         }
     }
     $data = $this->getRequest()->getValues();
     unset($data['title']);
     // Remove the title of the special page
     $section = (int) $this->getRequest()->getVal('section', 0);
     $output = $this->getOutput();
     $output->addModules('mobile.special.mobileeditor.scripts');
     $output->setPageTitle($this->msg('mobile-frontend-editor-redirect-title')->text());
     $context = MobileContext::singleton();
     $articleUrl = $context->getMobileUrl($title->getFullURL($data));
     $targetUrl = $articleUrl . '#/editor/' . $section;
     $html = Html::openElement('div', array('id' => 'mw-mf-editor', 'data-targeturl' => $targetUrl)) . Html::openElement('noscript') . MobileUI::errorBox($this->msg('mobile-frontend-editor-unavailable')->text()) . Html::openElement('p') . Html::element('a', array('href' => $title->getLocalUrl()), $this->msg('returnto', $title->getText())->text()) . Html::closeElement('noscript') . Html::closeElement('div');
     // #mw-mf-editorunavailable
     $output->addHTML($html);
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:30,代码来源:SpecialMobileEditor.php

示例3: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     $this->requireLogin('prefsnologintext2');
     $this->checkReadOnly();
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $out->addModules('mediawiki.special.preferences');
     $out->addModuleStyles('mediawiki.special.preferences.styles');
     if ($this->getRequest()->getCheck('success')) {
         $out->wrapWikiMsg(Html::rawElement('div', array('class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success'), Html::element('p', array(), '$1')), 'savedprefs');
     }
     $this->addHelpLink('Help:Preferences');
     // Load the user from the master to reduce CAS errors on double post (T95839)
     $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
     $htmlForm = Preferences::getFormObject($user, $this->getContext());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $sectionTitles = $htmlForm->getPreferenceSections();
     $prefTabs = '';
     foreach ($sectionTitles as $key) {
         $prefTabs .= Html::rawElement('li', array('role' => 'presentation', 'class' => $key === 'personal' ? 'selected' : null), Html::rawElement('a', array('id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => $key === 'personal' ? 'true' : 'false', 'tabIndex' => $key === 'personal' ? 0 : -1), $htmlForm->getLegend($key)));
     }
     $out->addHTML(Html::rawElement('ul', array('id' => 'preftoc', 'role' => 'tablist'), $prefTabs));
     $htmlForm->show();
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:31,代码来源:SpecialPreferences.php

示例4: render

 private function render($parser, $params)
 {
     if (count($params) > 1) {
         $rating = $params[1];
     } else {
         $rating = 0;
     }
     if (count($params) > 2) {
         $max = $params[2];
     } else {
         $max = $GLOBALS['SemanticRating_DefaultMax'];
     }
     $output = Html::openElement('span', array('style' => 'white-space:nowrap;'));
     if ($rating < 0) {
         $rating = 0;
     } elseif ($rating > $max) {
         $rating = $max;
     }
     $i = 1;
     while ($i <= $rating) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'yellowstar.png'));
         $i++;
     }
     if ($rating - $i + 1 != 0) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'halfstar.png'));
         $i++;
     }
     while ($i <= $max) {
         $output .= Html::element('img', array('src' => $this->imagepath . 'greystar.png'));
         $i++;
     }
     $output .= Html::closeElement('span');
     return $output;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:34,代码来源:SemanticRatingHtmlRenderer.php

示例5: execute

 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     $code = $wgRequest->getVal('verify');
     if ($code !== null) {
         $dbw = wfGetDB(DB_MASTER);
         $row = $dbw->selectRow('email_capture', array('ec_verified'), array('ec_code' => $code), __METHOD__);
         if ($row && !$row->ec_verified) {
             $dbw->update('email_capture', array('ec_verified' => 1), array('ec_code' => $code), __METHOD__);
             if ($dbw->affectedRows()) {
                 $wgOut->addWikiMsg('emailcapture-success');
             } else {
                 $wgOut->addWikiMsg('emailcapture-failure');
             }
         } elseif ($row && $row->ec_verified) {
             $wgOut->addWikiMsg('emailcapture-already-confirmed');
         } else {
             $wgOut->addWikiMsg('emailcapture-invalid-code');
         }
     } else {
         // Show simple form for submitting verification code
         $o = Html::openElement('form', array('action' => $this->getTitle()->getFullUrl(), 'method' => 'post'));
         $o .= Html::element('p', array(), wfMsg('emailcapture-instructions'));
         $o .= Html::openElement('blockquote');
         $o .= Html::element('label', array('for' => 'emailcapture-verify'), wfMsg('emailcapture-verify')) . ' ';
         $o .= Html::input('verify', '', 'text', array('id' => 'emailcapture-verify', 'size' => 32)) . ' ';
         $o .= Html::input('submit', wfMsg('emailcapture-submit'), 'submit');
         $o .= Html::closeElement('blockquote');
         $o .= Html::closeElement('form');
         $wgOut->addHtml($o);
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:33,代码来源:SpecialEmailCapture.php

示例6: getResultText

 /**
  * Return serialised results in specified format.
  * Implemented by subclasses.
  */
 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $html = '';
     $id = uniqid();
     // build an array of article IDs contained in the result set
     $objects = array();
     foreach ($res->getResults() as $key => $object) {
         $objects[] = array($object->getTitle()->getArticleId());
         $html .= $key . ': ' . $object->getSerialization() . "<br>\n";
     }
     // build an array of data about the printrequests
     $printrequests = array();
     foreach ($res->getPrintRequests() as $key => $printrequest) {
         $data = $printrequest->getData();
         if ($data instanceof SMWPropertyValue) {
             $name = $data->getDataItem()->getKey();
         } else {
             $name = null;
         }
         $printrequests[] = array($printrequest->getMode(), $printrequest->getLabel(), $name, $printrequest->getOutputFormat(), $printrequest->getParameters());
     }
     // write out results and query params into JS arrays
     // Define the srf_filtered_values array
     SMWOutputs::requireScript('srf_slideshow', Html::inlineScript('srf_slideshow = {};'));
     SMWOutputs::requireScript('srf_slideshow' . $id, Html::inlineScript('srf_slideshow["' . $id . '"] = ' . json_encode(array($objects, $this->params['template'], $this->params['delay'] * 1000, $this->params['height'], $this->params['width'], $this->params['nav controls'], $this->params['effect'], json_encode($printrequests))) . ';'));
     SMWOutputs::requireResource('ext.srf.slideshow');
     if ($this->params['nav controls']) {
         SMWOutputs::requireResource('jquery.ui.slider');
     }
     return Html::element('div', array('id' => $id, 'class' => 'srf-slideshow ' . $id . ' ' . $this->params['class']));
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:35,代码来源:SRF_SlideShow.php

示例7: makeInputForm

 /**
  * Input form for entering a category
  */
 function makeInputForm()
 {
     $form = '';
     $form .= Html::openElement('form', array('name' => 'ajaxtest', 'method' => 'GET', 'action' => $this->getTitle()->getLocalUrl()));
     $form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_text', 'id' => 'ajaxtest_text', 'value' => '', 'size' => '64')) . ' ';
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'usestring'), 'use string value');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'usestring', 'id' => 'usestring'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'httpcache'), 'use http cache');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'httpcache', 'id' => 'httpcache'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'lastmod'), 'use last modified');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'lastmod', 'id' => 'lastmod'));
     $form .= Html::element('br');
     $form .= Html::element('label', array('for' => 'error'), 'trigger error');
     $form .= Html::element('input', array('type' => 'checkbox', 'name' => 'error', 'id' => 'error'));
     $form .= Html::element('br');
     $form .= Html::openElement('select', array('name' => 'ajaxtest_target', 'id' => 'ajaxtest_target'));
     $form .= Html::element('option', array('value' => 'function'), "function");
     $form .= Html::element('option', array('value' => 'element'), "element");
     $form .= Html::element('option', array('value' => 'input'), "input");
     $form .= Html::closeElement('select');
     $form .= Html::element('input', array('type' => 'button', 'onclick' => 'doAjaxTest();', 'value' => 'TEST'));
     $form .= Html::element('input', array('type' => 'button', 'onclick' => 'clearAjaxTest();', 'value' => 'CLEAR'));
     # $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'getElementById("ajaxtest_out").value= getElementById("ajaxtest_text").value;', 'value' => 'DUMMY' ) );
     $form .= Html::closeElement('form');
     $form .= Html::element('hr');
     $form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_out', 'id' => 'ajaxtest_out', 'value' => '', 'size' => '64')) . ' ';
     $form .= Html::element('p', array('id' => 'ajaxtest_area'));
     $form .= Html::element('hr');
     $form .= Html::element('p', array('id' => 'sajax_debug'));
     return $form;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:37,代码来源:AjaxTestPage.php

示例8: getConnectForm

 public function getConnectForm()
 {
     if ($this->getVar('wgDBserver') == 'localhost') {
         $this->parent->setVar('wgDBserver', '');
     }
     return $this->getTextBox('wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox('config-db-host-oracle-help')) . Html::openElement('fieldset') . Html::element('legend', array(), wfMsg('config-db-wiki-settings')) . $this->getTextBox('wgDBprefix', 'config-db-prefix') . $this->getTextBox('_OracleDefTS', 'config-oracle-def-ts') . $this->getTextBox('_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox('config-db-oracle-help')) . Html::closeElement('fieldset') . $this->parent->getWarningBox(wfMsg('config-db-account-oracle-warn')) . $this->getInstallUserBox() . $this->getWebUserBox();
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:7,代码来源:OracleInstaller.php

示例9: execute

 /**
  * Show the special page
  * @param string|null $par
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->addModuleStyles('mediawiki.special');
     $out->addHTML(\Html::openElement('table', array('class' => 'wikitable mw-listgrouprights-table')) . '<tr>' . \Html::element('th', null, $this->msg('listgrants-grant')->text()) . \Html::element('th', null, $this->msg('listgrants-rights')->text()) . '</tr>');
     foreach ($this->getConfig()->get('GrantPermissions') as $grant => $rights) {
         $descs = array();
         $rights = array_filter($rights);
         // remove ones with 'false'
         foreach ($rights as $permission => $granted) {
             $descs[] = $this->msg('listgrouprights-right-display', \User::getRightDescription($permission), '<span class="mw-listgrants-right-name">' . $permission . '</span>')->parse();
         }
         if (!count($descs)) {
             $grantCellHtml = '';
         } else {
             sort($descs);
             $grantCellHtml = '<ul><li>' . implode("</li>\n<li>", $descs) . '</li></ul>';
         }
         $id = \Sanitizer::escapeId($grant);
         $out->addHTML(\Html::rawElement('tr', array('id' => $id), "<td>" . $this->msg("grant-{$grant}")->escaped() . "</td>" . "<td>" . $grantCellHtml . '</td>'));
     }
     $out->addHTML(\Html::closeElement('table'));
 }
开发者ID:Gomyul,项目名称:mediawiki,代码行数:29,代码来源:SpecialListgrants.php

示例10: genContributionScoreTable

 /**
  * Function generates Contribution Scores tables in HTML format (not wikiText)
  *
  * @param $days int Days in the past to run report for
  * @param $limit int Maximum number of users to return (default 50)
  * @param $title Title (default null)
  * @param $options array of options (default none; nosort/notools)
  * @return Html Table representing the requested Contribution Scores.
  */
 function genContributionScoreTable($days, $limit, $title = null, $options = 'none')
 {
     global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName;
     $opts = explode(',', strtolower($options));
     $dbr = wfGetDB(DB_SLAVE);
     $userTable = $dbr->tableName('user');
     $userGroupTable = $dbr->tableName('user_groups');
     $revTable = $dbr->tableName('revision');
     $ipBlocksTable = $dbr->tableName('ipblocks');
     $sqlWhere = "";
     $nextPrefix = "WHERE";
     if ($days > 0) {
         $date = time() - 60 * 60 * 24 * $days;
         $dateString = $dbr->timestamp($date);
         $sqlWhere .= " {$nextPrefix} rev_timestamp > '{$dateString}'";
         $nextPrefix = "AND";
     }
     if ($wgContribScoreIgnoreBlockedUsers) {
         $sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
         $nextPrefix = "AND";
     }
     if ($wgContribScoreIgnoreBots) {
         $sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
     }
     $sqlMostPages = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY page_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
     $sqlMostRevs = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY rev_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
     $sql = "SELECT user_id, " . "user_name, " . "user_real_name, " . "page_count, " . "rev_count, " . "page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " . "FROM {$userTable} u JOIN (({$sqlMostPages}) UNION ({$sqlMostRevs})) s ON (user_id=rev_user) " . "ORDER BY wiki_rank DESC " . "LIMIT {$limit}";
     $res = $dbr->query($sql);
     $sortable = in_array('nosort', $opts) ? '' : ' sortable';
     $output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" . "<tr class='header'>\n" . Html::element('th', array(), $this->msg('contributionscores-score')->text()) . Html::element('th', array(), $this->msg('contributionscores-pages')->text()) . Html::element('th', array(), $this->msg('contributionscores-changes')->text()) . Html::element('th', array(), $this->msg('contributionscores-username')->text());
     $altrow = '';
     $lang = $this->getLanguage();
     foreach ($res as $row) {
         // Use real name if option used and real name present.
         if ($wgContribScoresUseRealName && $row->user_real_name !== '') {
             $userLink = Linker::userLink($row->user_id, $row->user_name, $row->user_real_name);
         } else {
             $userLink = Linker::userLink($row->user_id, $row->user_name);
         }
         $output .= Html::closeElement('tr');
         $output .= "<tr class='{$altrow}'>\n<td class='content'>" . $lang->formatNum(round($row->wiki_rank, 0)) . "\n</td><td class='content'>" . $lang->formatNum($row->page_count) . "\n</td><td class='content'>" . $lang->formatNum($row->rev_count) . "\n</td><td class='content'>" . $userLink;
         # Option to not display user tools
         if (!in_array('notools', $opts)) {
             $output .= Linker::userToolLinks($row->user_id, $row->user_name);
         }
         $output .= Html::closeElement('td') . "\n";
         if ($altrow == '' && empty($sortable)) {
             $altrow = 'odd ';
         } else {
             $altrow = '';
         }
     }
     $output .= Html::closeElement('tr');
     $output .= Html::closeElement('table');
     $dbr->freeResult($res);
     if (!empty($title)) {
         $output = Html::rawElement('table', array('style' => 'border-spacing: 0; padding: 0', 'class' => 'contributionscores-wrapper', 'lang' => htmlspecialchars($lang->getCode()), 'dir' => $lang->getDir()), "\n" . "<tr>\n" . "<td style='padding: 0px;'>{$title}</td>\n" . "</tr>\n" . "<tr>\n" . "<td style='padding: 0px;'>{$output}</td>\n" . "</tr>\n");
     }
     return $output;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:69,代码来源:ContributionScores_body.php

示例11: getForm

    /**
     * Get the captcha form.
     * @return string
     */
    function getForm(OutputPage $out)
    {
        global $wgReCaptchaSiteKey;
        // Insert reCAPTCHA script.
        // See https://developers.google.com/recaptcha/docs/faq
        $out->addHeadItem('g-recaptchascript', '<script src="https://www.google.com/recaptcha/api.js" async defer></script>');
        $output = Html::element('div', array('class' => array('g-recaptcha', 'mw-confirmedit-captcha-fail' => !!$this->error), 'data-sitekey' => $wgReCaptchaSiteKey));
        $htmlUrlencoded = htmlspecialchars(urlencode($wgReCaptchaSiteKey));
        $output .= <<<HTML
<noscript>
  <div style="width: 302px; height: 422px;">
    <div style="width: 302px; height: 422px; position: relative;">
      <div style="width: 302px; height: 422px; position: absolute;">
        <iframe src="https://www.google.com/recaptcha/api/fallback?k={$htmlUrlencoded}"
                frameborder="0" scrolling="no"
                style="width: 302px; height:422px; border-style: none;">
        </iframe>
      </div>
      <div style="width: 300px; height: 60px; border-style: none;
                  bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;
                  background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">
        <textarea id="g-recaptcha-response" name="g-recaptcha-response"
                  class="g-recaptcha-response"
                  style="width: 250px; height: 40px; border: 1px solid #c1c1c1;
                         margin: 10px 25px; padding: 0px; resize: none;" >
        </textarea>
      </div>
    </div>
  </div>
</noscript>
HTML;
        return $output;
    }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:37,代码来源:ReCaptchaNoCaptcha.class.php

示例12: execute

 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     parent::execute($subPage);
     $out = $this->getOutput();
     if (trim($subPage) === '') {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Institutions')->getLocalURL());
     } else {
         $out->setPageTitle(wfMsgExt('ep-institution-title', 'parsemag', $this->subPage));
         $org = EPOrg::selectRow(null, array('name' => $this->subPage));
         if ($org === false) {
             $this->displayNavigation();
             if ($this->getUser()->isAllowed('ep-org')) {
                 $out->addWikiMsg('ep-institution-create', $this->subPage);
                 EPOrg::displayAddNewControl($this->getContext(), array('name' => $this->subPage));
             } else {
                 $out->addWikiMsg('ep-institution-none', $this->subPage);
             }
         } else {
             $links = array();
             if ($this->getUser()->isAllowed('ep-org')) {
                 $links[wfMsg('ep-institution-nav-edit')] = SpecialPage::getTitleFor('EditInstitution', $this->subPage);
             }
             $this->displayNavigation($links);
             $this->displaySummary($org);
             $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-courses')));
             EPCourse::displayPager($this->getContext(), array('org_id' => $org->getId()));
             if ($this->getUser()->isAllowed('ep-course')) {
                 $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-add-course')));
                 EPCourse::displayAddNewControl($this->getContext(), array('org' => $org->getId()));
             }
         }
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:40,代码来源:SpecialInstitution.php

示例13: execute

    function execute($category)
    {
        global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses;
        if (!$wgUser->isAllowed('generatepages')) {
            $wgOut->permissionRequired('generatepages');
            return;
        }
        $this->setHeaders();
        $param = $wgRequest->getText('param');
        if (!empty($param) && !empty($category)) {
            // Generate the pages!
            $this->generatePages($param, $wgRequest->getArray('page'));
            $text = Html::element('p', null, wfMessage('ps-generatepages-success')->parse());
            $wgOut->addHTML($text);
            return true;
        }
        if ($category == "") {
            // No category listed.
            // TODO - show an error message.
            return true;
        }
        // Standard "generate pages" form, with category name set.
        // Check for a valid category, with a page schema defined.
        $pageSchemaObj = new PSSchema($category);
        if (!$pageSchemaObj->isPSDefined()) {
            $text = Html::element('p', null, wfMessage('ps-generatepages-noschema')->parse());
            $wgOut->addHTML($text);
            return true;
        }
        $text = Html::element('p', null, wfMessage('ps-generatepages-desc')->parse()) . "\n";
        $text .= '<form method="post">';
        $text .= Html::input('param', $category, 'hidden') . "\n";
        $text .= '<div id="ps_check_all_check_none">
		<input type="button" id="ps_check_all" value="' . wfMessage('powersearch-toggleall')->parse() . '" />
		<input type="button" id="ps_check_none" value="' . wfMessage('powersearch-togglenone')->parse() . '" />
		</div><br/>';
        $wgOut->addModules('ext.pageschemas.generatepages');
        // This hook will set an array of strings, with each value
        // as a title of a page to be created.
        $pageList = array();
        foreach ($wgPageSchemasHandlerClasses as $psHandlerClass) {
            $pagesFromHandler = call_user_func(array($psHandlerClass, "getPagesToGenerate"), $pageSchemaObj);
            foreach ($pagesFromHandler as $page) {
                $pageList[] = $page;
            }
        }
        foreach ($pageList as $page) {
            if (!$page instanceof Title) {
                continue;
            }
            $pageName = PageSchemas::titleString($page);
            $text .= Html::input('page[]', $pageName, 'checkbox', array('checked' => true));
            $text .= "\n" . Linker::link($page) . "<br />\n";
        }
        $text .= "<br />\n";
        $text .= Html::input(null, wfMessage('generatepages')->parse(), 'submit');
        $text .= "\n</form>";
        $wgOut->addHTML($text);
        return true;
    }
开发者ID:whysasse,项目名称:kmwiki,代码行数:60,代码来源:PS_GeneratePages.php

示例14: execute

 function execute($par)
 {
     $request = $this->getRequest();
     $output = $this->getOutput();
     $this->setHeaders();
     $this->checkPermissions();
     $output->addModules('ext.translate.special.pagemigration');
     $output->addModuleStyles('jquery.uls.grid');
     # Get request data from, e.g.
     $param = $request->getText('param');
     # Do stuff
     # ...
     $out = '';
     $out .= Html::openElement('div', array('class' => 'grid'));
     $out .= Html::openElement('div', array('class' => 'mw-tpm-sp-error row', 'id' => 'mw-tpm-sp-error-div'));
     $out .= Html::element('div', array('class' => 'mw-tpm-sp-error__message five columns hide'));
     $out .= Html::closeElement('div');
     $out .= Html::openElement('form', array('class' => 'mw-tpm-sp-form row', 'id' => 'mw-tpm-sp-primary-form'));
     $out .= Html::element('input', array('id' => 'pm-summary', 'type' => 'hidden', 'value' => $this->msg('pm-summary-import')->inContentLanguage()->text()));
     $out .= Html::element('input', array('id' => 'title', 'class' => 'mw-searchInput', 'placeholder' => $this->msg('pm-pagename-placeholder')->text()));
     $out .= Html::element('input', array('id' => 'language', 'type' => 'text', 'placeholder' => $this->msg('pm-langcode-placeholder')->text()));
     $out .= Html::element('input', array('id' => 'action-import', 'class' => 'mw-ui-button mw-ui-primary', 'type' => 'button', 'value' => $this->msg('pm-import-button-label')->text()));
     $out .= Html::element('input', array('id' => 'action-save', 'class' => 'mw-ui-button mw-ui-constructive hide', 'type' => 'button', 'value' => $this->msg('pm-savepages-button-label')->text()));
     $out .= Html::element('input', array('id' => 'action-cancel', 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button', 'value' => $this->msg('pm-cancel-button-label')->text()));
     $out .= Html::closeElement('form');
     $out .= Html::openElement('div', array('class' => 'mw-tpm-sp-unit-listing'));
     $out .= Html::closeElement('div');
     $out .= Html::closeElement('div');
     $output->addHTML($out);
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:SpecialPageMigration.php

示例15: getHTML

    public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
    {
        global $sfgTabIndex, $sfgFieldNum;
        global $wgOut;
        $scripts = array("https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false");
        $scriptsHTML = '';
        foreach ($scripts as $script) {
            $scriptsHTML .= Html::linkedScript($script);
        }
        $wgOut->addHeadItem($scriptsHTML, $scriptsHTML);
        $wgOut->addModules('ext.semanticforms.maps');
        $parsedCurValue = SFOpenLayersInput::parseCoordinatesString($cur_value);
        $coordsInput = Html::element('input', array('type' => 'text', 'class' => 'sfCoordsInput', 'name' => $input_name, 'value' => $parsedCurValue, 'size' => 40));
        $mapUpdateButton = Html::element('input', array('type' => 'button', 'class' => 'sfUpdateMap', 'value' => wfMessage('sf-maps-setmarker')->parse()), null);
        $addressLookupInput = Html::element('input', array('type' => 'text', 'class' => 'sfAddressInput', 'size' => 40, 'placeholder' => wfMessage('sf-maps-enteraddress')->parse()), null);
        $addressLookupButton = Html::element('input', array('type' => 'button', 'class' => 'sfLookUpAddress', 'value' => wfMessage('sf-maps-lookupcoordinates')->parse()), null);
        $mapCanvas = Html::element('div', array('class' => 'sfMapCanvas', 'style' => 'height: 500px; width: 500px;'), 'Map goes here...');
        $fullInputHTML = <<<END
<div style="padding-bottom: 10px;">
{$coordsInput}
{$mapUpdateButton}
</div>
<div style="padding-bottom: 10px;">
{$addressLookupInput}
{$addressLookupButton}
</div>
{$mapCanvas}

END;
        $text = Html::rawElement('div', array('class' => 'sfGoogleMapsInput'), $fullInputHTML);
        return $text;
    }
开发者ID:whysasse,项目名称:kmwiki,代码行数:32,代码来源:SF_GoogleMapsInput.php


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