function closeShowCategory() { global $wgOut, $wgRequest; $from = $wgRequest->getVal('from'); $until = $wgRequest->getVal('until'); $viewer = new CategoryViewer($this->mTitle, $from, $until); $wgOut->addHTML($viewer->getHTML()); }
function finaliseCategoryState() { if ($this->flip) { $this->child_cats = array_reverse($this->child_cats); } parent::finaliseCategoryState(); }
/** * Renders the category-page like view which shows the usage of this * layer page in other pages. * * @since 3.0 */ public function renderUsage() { global $wgOut; $out = ''; $titles = $this->getUsageTitles(); $viewer = new CategoryViewer($this->mTitle, $this->getContext()); $viewer->limit = 9999; // just overwrite the default limit of pages displayed in a normal category // now add apges in sorted order to category viewer: foreach ($titles as $title) { $viewer->addPage($title, $title->getPrefixedText(), null); } //$wgOut->addHTML( $viewer->formatList( $viewer->articles, '' ) ); $out = "<div id=\"mw-pages\">\n"; $out .= '<h2>' . wfMessage('maps-layerpage-usage', $this->mTitle->getText())->text() . "</h2>\n"; if (!empty($viewer->articles)) { $out .= $viewer->formatList($viewer->articles, $viewer->articles_start_char); } else { $out .= wfMessage('maps-layerpage-nousage')->text(); } $out .= "\n</div>"; $wgOut->addHTML($out); }
function formatCategoryList($iStart, $iCount) { for ($i = $iStart; $i < $iStart + $iCount; $i++) { $aArticles[] = $this->mArticles[$i]->mLink; $aArticles_start_char[] = $this->mArticles[$i]->mStartChar; $this->filteredCount = $this->filteredCount + 1; } require_once 'CategoryPage.php'; if (count($aArticles) > ExtDynamicPageList::$categoryStyleListCutoff) { return '__NOTOC____NOEDITSECTION__' . CategoryViewer::columnList($aArticles, $aArticles_start_char); } elseif (count($aArticles) > 0) { // for short lists of articles in categories. return '__NOTOC____NOEDITSECTION__' . CategoryViewer::shortList($aArticles, $aArticles_start_char); } return ''; }
function __construct(Category $category) { parent::__construct($category->getTitle(), RequestContext::getMain()); $this->limit = self::LIMIT; # BAC-265 $this->items = []; $this->count = 0; }
function getHTML() { $s = ''; return $s . parent::getHTML(); }
function pagingLinks($title, $first, $last, $limit, $query = array()) { return parent::pagingLinks($title, $first, $last, $limit, array_merge($query, array('sortkey' => $this->sortkeyName))); }
public function formatCategoryList($iStart, $iCount) { for ($i = $iStart; $i < $iStart + $iCount; $i++) { $aArticles[] = $this->mArticles[$i]->mLink; $aArticles_start_char[] = $this->mArticles[$i]->mStartChar; $this->filteredCount = $this->filteredCount + 1; } if (count($aArticles) > Config::getSetting('categoryStyleListCutoff')) { return "__NOTOC____NOEDITSECTION__" . \CategoryViewer::columnList($aArticles, $aArticles_start_char); } elseif (count($aArticles) > 0) { // for short lists of articles in categories. return "__NOTOC____NOEDITSECTION__" . \CategoryViewer::shortList($aArticles, $aArticles_start_char); } return ''; }
function __construct($title, $from = '', $until = '') { parent::__construct($title, $from, $until); }
<?php $obj = new CategoryViewer(); $output = $obj->edit(); class CategoryViewer { private $config; public function __construct() { $this->config = dirname(__FILE__) . '/config.dat'; } public function edit() { if (empty($_GET['dir'])) { redirect('admin/plugins.php'); } $config = json_decode(file_get_contents($this->config), true); $templates = glob(ROOT . '/template/*', GLOB_ONLYDIR); if ($templates) { foreach ($templates as &$t) { $t = substr(strrchr($t, '/'), 1); } } if (!empty($_POST)) { $errors = ''; if (empty($_POST['template']) || !in_array($_POST['template'], $templates)) { $errors .= '<li>Выберите корректный шаблон</li>'; } if (!empty($errors)) { $_SESSION['form_errors'] = '<ul class="error">' . $errors . '</ul>'; redirect('admin/plugins.php?ac=edit&dir=' . $_GET['dir']);
/** * show the sortkey, when it does not match title name * note that cl_sortkey is empty for CB_RootCond pager * @return sortkey html hint, when the sortkey differs from title name, empty string otherwise */ function addSortkey(Title $title_obj, stdClass $pager_row) { $this->initSortkeyTpl(); $result = ''; if (!empty($pager_row->cl_sortkey) && $title_obj->getText() != $pager_row->cl_sortkey) { // TODO: Get better context $cv = new CategoryViewer($title_obj, RequestContext::getMain()); $this->sortkey_hint = '(' . $cv->getSubcategorySortChar($title_obj, $pager_row->cl_sortkey) . ')'; $result = CB_XML::toText($this->sortkey_hint_tpl); } return $result; }
function __construct($title, $from = '', $until = '') { parent::__construct($title, RequestContext::getMain()); $this->fromSortKey = $from; $this->untilSortKey = $until; }
/** * Executes CategoryViewer::doCategoryQuery() and returns the contents wrapped in a DTO * * @return $ret WikiaMobileCategoryContents The contents of the category */ public function getContents() { parent::doCategoryQuery(); /* if ( $this->count > 0 ) { ksort( $this->items ); } */ $ret = F::build('WikiaMobileCategoryContents', array($this->items, $this->count)); $this->count = $this->items = null; return $ret; }
function __construct($title, $from = '', $until = '', $query = array()) { parent::__construct($title, RequestContext::getMain(), array($from), array($until), $query); $this->from = $from; $this->until = $until; }