/** * Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class) */ function testStaticFunctions() { $this->assertEquals(WikiPage::selectFields(), Article::selectFields(), "Article static functions"); $this->assertEquals(true, is_callable("Article::onArticleCreate"), "Article static functions"); $this->assertEquals(true, is_callable("Article::onArticleDelete"), "Article static functions"); $this->assertEquals(true, is_callable("ImagePage::onArticleEdit"), "Article static functions"); $this->assertTrue(is_string(CategoryPage::getAutosummary('', '', 0)), "Article static functions"); }
function view() { global $wgOut, $wgRequest, $wgUser, $wgTitle, $wgHooks; if (!$wgTitle->exists()) { parent::view(); return; } if (count($wgRequest->getVal('diff')) > 0) { return Article::view(); } $restAction = $wgRequest->getVal('restaction'); if ($restAction == 'pull-chunk') { $wgOut->setArticleBodyOnly(true); $start = $wgRequest->getInt('start'); if (!$start) { return; } $categoryViewer = new WikihowCategoryViewer($wgTitle); $this->catStream = new WikihowArticleStream($categoryViewer, $start); $html = $this->catStream->getChunks(4, WikihowCategoryPage::SINGLE_WIDTH, WikihowCategoryPage::SINGLE_SPACING, WikihowCategoryPage::SINGLE_HEIGHT); $ret = json_encode(array('html' => $html)); $wgOut->addHTML($ret); } else { $wgOut->setRobotPolicy('index,follow', 'Category Page'); $wgOut->setPageTitle($wgTitle->getText()); $from = $wgRequest->getVal('from'); $until = $wgRequest->getVal('until'); $viewer = new WikihowCategoryViewer($this->mTitle, $from, $until); $viewer->clearState(); $viewer->doQuery(); $viewer->finaliseCategoryState(); if ($wgRequest->getVal('viewMode', 0)) { $wgOut->addHtml('<div class="section minor_section">'); $wgOut->addHtml('<ul><li>'); $wgOut->addHtml(implode("</li>\n<li>", $viewer->articles)); $wgOut->addHtml('</li></ul>'); $wgOut->addHtml('</div>'); } else { $wgHooks['BeforePageDisplay'][] = array('WikihowCategoryPage::addCSSAndJs'); $categoryViewer = new WikihowCategoryViewer($wgTitle); $this->catStream = new WikihowArticleStream($categoryViewer, 0); $html = $this->catStream->getChunks(self::STARTING_CHUNKS, WikihowCategoryPage::SINGLE_WIDTH, WikihowCategoryPage::SINGLE_SPACING, WikihowCategoryPage::SINGLE_HEIGHT); $wgOut->addHTML($html); } $sk = $wgUser->getSkin(); $subCats = $viewer->shortListRD($viewer->children, $viewer->children_start_char); if ($subCats != "") { $subCats = "<h3>{$this->mTitle->getText()}</h3>{$subCats}"; $sk->addWidget($subCats); } $furtherEditing = $viewer->getArticlesFurtherEditing($viewer->articles, $viewer->article_info); if ($furtherEditing != "") { } $sk->addWidget($furtherEditing); } }
/** * Handler for CategoryPageView hook * Add JavaScript to the page if there are images in the category * @param CategoryPage $catPage * @return bool */ public static function getModulesForCategory(&$catPage) { $title = $catPage->getTitle(); $cat = Category::newFromTitle($title); if ($cat->getFileCount() > 0) { $out = $catPage->getContext()->getOutput(); return self::getModules($out); } return true; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TextField::create('OldSCID')); $fields->addFieldToTab('Root.Main', TextField::create('OldMCID')); $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldAddExistingAutocompleter('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(10), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()); $gridField = new GridField("Products", "Products list:", $this->Products(), $gridFieldConfig); $fields->addFieldToTab("Root.Products", $gridField); return $fields; }
/** * Checks all the conditions and returns if the gallery should be embedded in current category * @return bool */ public function isActive() { if ($this->galleryActive === null) { $rawText = $this->categoryPage->getRawText(); $mw = MagicWord::get(CATGALLERY_DISABLED); $disabled = 0 < $mw->match($rawText); $mw = MagicWord::get(CATGALLERY_ENABLED); $enabled = !$disabled && 0 < $mw->match($rawText); $this->galleryActive = !$disabled && ($enabled || $this->confEnabledByDefault); } return $this->galleryActive; }
/** * Checks for the existence of the backwards compatibility static functions * (forwarders to WikiPage class) * * @covers Article::selectFields * @covers Article::onArticleCreate * @covers Article::onArticleDelete * @covers Article::onArticleEdit * @covers Article::getAutosummary */ public function testStaticFunctions() { $this->hideDeprecated('Article::selectFields'); $this->hideDeprecated('Article::getAutosummary'); $this->hideDeprecated('WikiPage::getAutosummary'); $this->hideDeprecated('CategoryPage::getAutosummary'); // Inherited from Article $this->assertEquals(WikiPage::selectFields(), Article::selectFields(), "Article static functions"); $this->assertEquals(true, is_callable("Article::onArticleCreate"), "Article static functions"); $this->assertEquals(true, is_callable("Article::onArticleDelete"), "Article static functions"); $this->assertEquals(true, is_callable("ImagePage::onArticleEdit"), "Article static functions"); $this->assertTrue(is_string(CategoryPage::getAutosummary('', '', 0)), "Article static functions"); }
/** * Shortcut to get the Title object from the page * @return Title */ final public function getTitle() { return $this->page->getTitle(); }
$output = $texFolderMatrix . $args['mode'] . ".tex"; if ($args['output'] != '') { $output = $texFolderMatrix . $args['output'] . ".tex"; } var_dump($output); $ilist = array(); $tlist = array(); if ($args['ilist'] != '') { $ilist = file(realpath($args['ilist']), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } if ($args['tlist'] != '') { $tlist = file(realpath($args['tlist']), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } $wiki = new Wiki(); $features = $wiki->getFeaturePages(); $catImpl = new CategoryPage("101implementation"); $impl = $catImpl->getImplementations(); $technologies = $wiki->getTechnologyPages(); if ($args['mode'] == 'matrixif') { buildImplementationFeaturesMatrix($impl, $features, $output, $ilist); } else { if ($args['mode'] == 'matrixis') { buildImplSpacesMatrix($impl, $ilist, $output); } else { if ($args['mode'] == 'matrixts') { buildTechnicalSpacesMatrix($technologies, $tlist, $output); } } } } else { die('the following params are supported: --mode=ontology|content|matrixif|matrixis|matrixts|singlePage' . PHP_EOL);
include_once 'html.php'; include '_pageClass/HomePage.php'; include '_pageClass/ProductPage.php'; include '_pageClass/CategoryPage.php'; include '_pageClass/CategoriesPage.php'; switch ($currentPage) { case 'home-page': $obj = new HomePage(); $module = $obj->module(); break; case 'product-page': $obj = new ProductPage(); $module = $obj->module($params); break; case 'category-page': $obj = new CategoryPage(); $module = $obj->module($params, $catType); break; case 'categories-page': $obj = new CategoriesPage(); $module = $obj->module($params, $catType); break; } $data['current-page'] = $currentPage; if ($currentPage == 'product-page') { $data['product-detail'] = $module['productDetail']; $data['spin-content'] = $module['spinContent']; } $seoTags = $module['seoTags']; //$header = Html::get( 'main', 'header', $data ); //$footer = Html::get( 'main', 'footer', $data );
/** * @param CategoryPage $categoryPage * @return bool */ public function onCategoryPageView(CategoryPage &$categoryPage) { $this->wf->profileIn(__METHOD__); if ($this->app->checkSkin('wikiamobile')) { //lets do some local caching $out = $this->wg->Out; $title = $categoryPage->getTitle(); $text = $title->getText(); //converting categoryArticle to Article to avoid circular reference in CategoryPage::view F::build('Article', array($title))->view(); //add scripts that belongs only to category pages $scripts = F::build('AssetsManager', array(), 'getInstance')->getURL(array('wikiamobile_categorypage_js')); //this is going to be additional call but at least it won't be loaded on every page foreach ($scripts as $s) { $out->addScript('<script src="' . $s . '"></script>'); } //set proper titles for a page $out->setPageTitle($text . ' <span id=catTtl>' . $this->wf->MsgForContent('wikiamobile-categories-tagline') . '</span>'); $out->setHTMLTitle($text); //render lists: exhibition and alphabetical $params = array('categoryPage' => $categoryPage); $out->addHTML($this->app->renderView('WikiaMobileCategoryService', 'categoryExhibition', $params)); $out->addHTML($this->app->renderView('WikiaMobileCategoryService', 'alphabeticalList', $params)); $this->wf->profileOut(__METHOD__); return false; } $this->wf->profileOut(__METHOD__); return true; }
private static function doCategoryAction($request) { switch (self::$requestedAction) { case "Edit": require_once 'admin/common.php'; CategoryPage::showEditCategoryForm(self::$currentID); break; case "Posts": //echo "<p><font color='green'>REQUEST TO LOAD post which category is " . $request["categoryname"] . ".</font></p>"; //DEBUG require_once 'search/SearchManager.php'; $posts = SearchManager::searchBy(array("Post"), array("category" => self::$currentID), array("limit" => 4, "order" => "DESC", "by" => array("ps_creationDate")), true); require_once "post/PostPage.php"; foreach ($posts as $p) { PostPage::showPost($p, self::$post_options); } break; case "Delete": require_once 'admin/common.php'; $cat = AdminCategoryManager::deleteCategory(self::$currentID); header("location: "); break; case "New": require_once 'admin/common.php'; CategoryPage::showNewCategoryForm(); break; case "Search": default: require_once 'search/SearchPage.php'; SearchPage::showCategorySearchForm(); break; } }