本文整理汇总了PHP中WikiPage类的典型用法代码示例。如果您正苦于以下问题:PHP WikiPage类的具体用法?PHP WikiPage怎么用?PHP WikiPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WikiPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: efSharedHelpArticleCreation
/**
* @param WikiPage $article
* @param $user
* @param $text
* @param $summary
* @param $minoredit
* @param $watchthis
* @param $sectionanchor
* @param $flags
* @param $revision
* @param Status $status
* @param $baseRevId
* @return bool
*/
function efSharedHelpArticleCreation(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{
global $wgCityId, $wgHelpWikiId;
// only run on help wikis
if ($wgCityId !== $wgHelpWikiId) {
return true;
}
// not likely if we got here, but... healthy paranoia ;)
if (wfReadOnly()) {
return true;
}
if ($article->mTitle->getNamespace() !== NS_HELP) {
return true;
}
if (!$status->isOK()) {
return true;
}
if (!($flags & EDIT_NEW)) {
return true;
}
$talkTitle = Title::newFromText($article->mTitle->getText(), NS_HELP_TALK);
if ($talkTitle->exists()) {
return true;
}
$talkArticle = new Article($talkTitle);
$redir = $article->getRedirectTarget();
if ($redir) {
$target = $redir->getTalkNsText() . ':' . $redir->getText();
$talkArticle->doEdit("#REDIRECT [[{$target}]]", wfMsgForContent('sharedhelp-autotalkcreate-summary'));
} else {
$talkArticle->doEdit('{{talkheader}}', wfMsgForContent('sharedhelp-autotalkcreate-summary'));
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:48,代码来源:SharedHelpArticleCreation.php
示例2: onArticleRollbackComplete
/**
* @desc Purge the contributors data to guarantee that it will be refreshed next time it is required
*
* @param WikiPage $wikiPage
* @param User $user
* @param $revision
* @param $current
* @return bool
*/
public static function onArticleRollbackComplete(WikiPage $wikiPage, User $user, $revision, $current)
{
$articleId = $wikiPage->getId();
$key = MercuryApi::getTopContributorsKey($articleId, MercuryApiController::NUMBER_CONTRIBUTORS);
WikiaDataAccess::cachePurge($key);
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:MercuryApiHooks.class.php
示例3: execute
function execute()
{
global $wgParser;
$wgParser->parse(' ', Title::newMainPage(), new ParserOptions());
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('page', '*', array('page_namespace' => HACL_NS_ACL), __METHOD__);
$titles = array();
foreach ($res as $row) {
$titles[] = Title::newFromRow($row);
}
$quiet = $this->hasOption('quiet');
$seen = array();
foreach ($titles as $title) {
$page = new WikiPage($title);
$pf = IACLParserFunctions::instance($title);
IACLParserFunctions::parse($page->getText(), $title);
$errors = $pf->consistencyCheckStatus(false);
$errors = array_merge($errors, $pf->errors);
if ($pf->def) {
if (isset($seen[$pf->def['key']])) {
$errors[] = "Duplicate definition! Previous one is " . $seen[$pf->def['key']];
}
$seen[$pf->def['key']] = "{$title}";
}
IACLParserFunctions::destroyInstance($pf);
if ($errors) {
print "Errors on {$title}:\n";
foreach ($errors as $e) {
print "\t{$e}\n";
}
} elseif (!$quiet) {
print "OK {$title}\n";
}
}
}
开发者ID:hermannschwaerzlerUIBK,项目名称:IntraACL,代码行数:35,代码来源:checkErrors.php
示例4: create_wiki
function create_wiki($gid = false, $wikiName = 'New wiki')
{
$creatorId = claro_get_current_user_id();
$tblList = claro_sql_get_course_tbl();
$config = array();
$config["tbl_wiki_properties"] = $tblList["wiki_properties"];
$config["tbl_wiki_pages"] = $tblList["wiki_pages"];
$config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
$config["tbl_wiki_acls"] = $tblList["wiki_acls"];
$con = Claroline::getDatabase();
$acl = array();
if ($gid) {
$acl = WikiAccessControl::defaultGroupWikiACL();
} else {
$acl = WikiAccessControl::defaultCourseWikiACL();
}
$wiki = new Wiki($con, $config);
$wiki->setTitle($wikiName);
$wiki->setDescription('This is a sample wiki');
$wiki->setACL($acl);
$wiki->setGroupId($gid);
$wikiId = $wiki->save();
$wikiTitle = $wiki->getTitle();
$mainPageContent = sprintf("This is the main page of the Wiki %s. Click on edit to modify the content.", $wikiTitle);
$wikiPage = new WikiPage($con, $config, $wikiId);
$wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true);
}
开发者ID:rhertzog,项目名称:lcs,代码行数:27,代码来源:lib.createwiki.php
示例5: getTransformedContent
private function getTransformedContent(WikiPage $wiki_page, WikiPageVersion $version, WikiRequest $request)
{
$dbi = $request->_dbi;
$page_db = $dbi->getPage($wiki_page->getPagename());
$revision = $page_db->getRevision($version->getVersionId());
return $revision->getTransformedContent();
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:WikiPageVersionContentFormatter.php
示例6: export
/**
* Export a whole Wiki to a single HTML String
* @return string Wiki content in HTML
*/
public function export()
{
$pageList = $this->wiki->allPagesByCreationDate();
$result = $this->_htmlHeader();
$result .= '<h1>' . $this->wiki->getTitle() . '</h1>' . "\n";
foreach ($pageList as $page) {
$wikiPage = new WikiPage($this->wiki->getDatabaseConnection(), $this->wiki->getConfig(), $this->wiki->getWikiId());
$wikiPage->loadPage($page['title']);
$this->setOpt('note_prefix', $page['title']);
if ($wikiPage->hasError()) {
$result .= '<h2><a name="' . $this->_makePageTitleAnchor($page['title']) . '">' . $page['title'] . '</a></h2>' . "\n";
$result .= get_lang("Could not load page %page", array('%page' => $page['title'])) . "\n";
$wikiPage = null;
} else {
$pgTitle = $wikiPage->getTitle();
if ('__MainPage__' === $pgTitle) {
$pgTitle = get_lang('Main page');
}
$result .= '<h2><a name="' . $this->_makePageTitleAnchor($page['title']) . '">' . $pgTitle . '</a></h2>' . "\n";
$content = $wikiPage->getContent();
$result .= $this->render($content) . "\n";
$wikiPage = null;
}
}
$result .= $this->_htmlFooter();
return $result;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:class.wiki2xhtmlexport.php
示例7: do_sitemap
function do_sitemap($formatter, $options)
{
global $DBInfo;
# get page list
if ($formater->group) {
$group_pages = $DBInfo->getLikePages($formater->group);
foreach ($group_pages as $page) {
$all_pages[] = str_replace($formatter->group, '', $page);
}
} else {
$all_pages = $DBInfo->getPageLists();
}
usort($all_pages, 'strcasecmp');
$items = '';
// empty string
# process page list
$zone = '+00:00';
foreach ($all_pages as $page) {
$url = qualifiedUrl($formatter->link_url(_rawurlencode($page)));
$p = new WikiPage($page);
$t = $p->mtime();
$date = gmdate("Y-m-d\\TH:i:s", $t) . $zone;
// W3C datetime format
$item = "<url>\n";
$item .= " <loc>" . $url . "</loc>\n";
$item .= " <lastmod>" . $date . "</lastmod>\n";
$item .= "</url>\n";
$items .= $item;
}
# process output
$out = $items;
if ($options['oe'] and strtolower($options['oe']) != $DBInfo->charset) {
$charset = $options['oe'];
if (function_exists('iconv')) {
$new = iconv($DBInfo->charset, $charset, $items);
if (!$new) {
$charset = $DBInfo->charset;
}
if ($new) {
$out = $new;
}
}
} else {
$charset = $DBInfo->charset;
}
$head = <<<HEAD
<?xml version="1.0" encoding="{$charset}"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9"
url="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
HEAD;
$foot = <<<FOOT
</urlset>
FOOT;
# output
header("Content-Type: text/xml");
print $head . $out . $foot;
}
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:60,代码来源:sitemap.php
示例8: findTitle
/**
* Assuming the user's interface language is fi. Given input Page, it
* returns Page/fi if it exists, otherwise Page. Given input Page/de,
* it returns Page/fi if it exists, otherwise Page/de if it exists,
* otherwise Page.
*
* @param string $par
* @return Title|null
*/
public function findTitle($par)
{
// base = title without language code suffix
// provided = the title as it was given
$base = $provided = Title::newFromText($par);
if ($base && strpos($par, '/') !== false) {
$pos = strrpos($par, '/');
$basepage = substr($par, 0, $pos);
$code = substr($par, $pos + 1);
if (strlen($code) && Language::isKnownLanguageTag($code)) {
$base = Title::newFromText($basepage);
}
}
if (!$base) {
return null;
}
if ($base->isRedirect()) {
$page = new WikiPage($base);
$base = $page->getRedirectTarget();
}
$uiCode = $this->getLanguage()->getCode();
$proposed = $base->getSubpage($uiCode);
if ($uiCode !== $this->getConfig()->get('LanguageCode') && $proposed && $proposed->exists()) {
return $proposed;
} elseif ($provided && $provided->exists()) {
return $provided;
} else {
return $base;
}
}
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:39,代码来源:SpecialMyLanguage.php
示例9: getDefinitions
public function getDefinitions()
{
$groups = MessageGroups::getAllGroups();
$keys = array();
/**
* @var $g MessageGroup
*/
foreach ($groups as $g) {
$states = $g->getMessageGroupStates()->getStates();
foreach (array_keys($states) as $state) {
$keys["Translate-workflow-state-{$state}"] = $state;
}
}
$defs = TranslateUtils::getContents(array_keys($keys), $this->getNamespace());
foreach ($keys as $key => $state) {
if (!isset($defs[$key])) {
// @todo Use jobqueue
$title = Title::makeTitleSafe($this->getNamespace(), $key);
$page = new WikiPage($title);
$content = ContentHandler::makeContent($state, $title);
$page->doEditContent($content, wfMessage('translate-workflow-autocreated-summary', $state)->inContentLanguage()->text(), 0, false, FuzzyBot::getUser());
} else {
// Use the wiki translation as definition if available.
// getContents returns array( content, last author )
list($content, ) = $defs[$key];
$keys[$key] = $content;
}
}
return $keys;
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:30,代码来源:WorkflowStatesMessageGroup.php
示例10: getFromattedUgroupsThatCanReadWikiPage
public function getFromattedUgroupsThatCanReadWikiPage(WikiPage $wiki_page)
{
$project = $this->project_manager->getProject($wiki_page->getGid());
$ugroup_ids = $this->permission_manager->getAuthorizedUgroupIds($wiki_page->getId(), self::WIKI_PERMISSION_READ);
$ugroup_ids = $this->filterWikiPagePermissionsAccordingToService($project, $ugroup_ids);
$ugroup_ids = $this->filterWikiPagePermissionsAccordingToProject($project, $ugroup_ids);
return $this->literalizer->ugroupIdsToString($ugroup_ids, $project);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:PermissionsManager.class.php
示例11: testGetContentHandler
/**
* @covers WikiPage::getContentHandler
*/
public function testGetContentHandler()
{
$page = $this->createPage("WikiPageTest_testGetContentHandler", "some text", CONTENT_MODEL_JAVASCRIPT);
// NOTE: since the content model is not recorded in the database,
// we expect to get the default, namely CONTENT_MODEL_WIKITEXT
$page = new WikiPage($page->getTitle());
$this->assertEquals('WikitextContentHandler', get_class($page->getContentHandler()));
}
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:11,代码来源:WikiPageTestContentHandlerUseDB.php
示例12: SaveWikiVersion
protected function SaveWikiVersion()
{
$objWikiPage = new WikiPage();
$objWikiPage->Content = trim($this->txtContent->Text);
$objWikiPage->CompileHtml();
$objWikiVersion = $this->objWikiItem->CreateNewVersion(trim($this->txtTitle->Text), $objWikiPage, 'Save', array(), QApplication::$Person, null);
return $objWikiVersion;
}
开发者ID:qcodo,项目名称:qcodo-website,代码行数:8,代码来源:EditWikiPageForm.class.php
示例13: saveWikiPage
public function saveWikiPage(WikiPage $wikiPage)
{
$wikiPagePath = $wikiPage->getPath();
$wikiPageFilename = $this->getWikiPageFilename($wikiPagePath);
$wikiPageSource = $wikiPage->getSource();
$this->saveWikiPageSource($wikiPageFilename, $wikiPageSource);
return $wikiPage;
}
开发者ID:project-wiki,项目名称:project-wiki,代码行数:8,代码来源:WikiPageFileMapper.php
示例14: protectMessageInPrNamespaces
/**
* Protects a message entry in the PRAd namespace.
* The protection lasts for infinity and acts for group
* @ref $wgPromoterProtectGroup
*
* This really is intended only for use on the original source language
* because those messages are set via the PR UI; not the translate UI.
*
* @param WikiPage $page Page containing the message to protect
* @param User $user User doing the protection (ie: the last one to edit the page)
*/
protected function protectMessageInPrNamespaces($page, $user)
{
global $wgPromoterProtectGroup;
if (!$page->getTitle()->getRestrictions('edit')) {
$var = false;
$page->doUpdateRestrictions(array('edit' => $wgPromoterProtectGroup, 'move' => $wgPromoterProtectGroup), array('edit' => 'infinity', 'move' => 'infinity'), $var, 'Auto protected by Promoter -- Only edit via Special:Promoter.', $user);
}
}
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:19,代码来源:AdMessage.php
示例15: __construct
/**
* Constructor
*
* @param WikiPage $page Page we are updating
* @throws MWException
*/
function __construct(WikiPage $page)
{
parent::__construct(false);
// no implicit transaction
$this->mPage = $page;
if (!$page->exists()) {
throw new MWException("Page ID not known, perhaps the page doesn't exist?");
}
}
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:15,代码来源:LinksDeletionUpdate.php
示例16: RemovePage
function RemovePage(&$request)
{
global $WikiTheme;
$page = $request->getPage();
$pagelink = WikiLink($page);
if ($request->getArg('cancel')) {
$request->redirect(WikiURL($page));
// noreturn
}
$current = $page->getCurrentRevision();
if (!$current or !($version = $current->getVersion())) {
$html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
} elseif (!$request->isPost() || !$request->getArg('verify')) {
$removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
$cancelB = Button('submit:cancel', _("Cancel"), 'button');
// use generic wiki button look
$html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
$sample = HTML::div(array('class' => 'transclusion'));
// simple and fast preview expanding only newlines
foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
$sample->pushContent($s, HTML::br());
}
$html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
} elseif ($request->getArg('currentversion') != $version) {
$html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s. Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
} else {
// Codendi specific: remove the deleted wiki page from ProjectWantedPages
$projectPageName = 'ProjectWantedPages';
$pagename = $page->getName();
$dbi = $request->getDbh();
require_once PHPWIKI_DIR . "/lib/loadsave.php";
$pagehandle = $dbi->getPage($projectPageName);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$meta = $current->_data;
}
$text = str_replace("* [{$pagename}]", "", $text);
$meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
$meta['author'] = user_getname();
$pagehandle->save($text, $version + 1, $meta);
//Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
require_once 'common/wiki/lib/WikiPage.class.php';
$wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
$wiki_page->resetPermissions();
// Real delete.
//$pagename = $page->getName();
$dbi = $request->getDbh();
$dbi->deletePage($pagename);
$dbi->touch();
$link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
$html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
}
GeneratePage($html, _("Remove Page"));
}
开发者ID:nterray,项目名称:tuleap,代码行数:57,代码来源:removepage.php
示例17: export
/**
* Export a whole Wiki to a single HTML String
* @return string Wiki content in HTML
*/
public function export()
{
global $langWikiMainPage, $langWikiPageNotLoaded;
$pageList = $this->wiki->allPagesByCreationDate();
$result = $this->_htmlHeader();
$result .= '<h1>' . $this->wiki->getTitle() . '</h1>' . "\n";
foreach ( $pageList as $page )
{
$wikiPage = new WikiPage($this->wiki->getWikiId());
$wikiPage->loadPage($page->title);
$this->setOpt('note_prefix', $page->title);
if ( $wikiPage->hasError() )
{
$result .= '<h2><a name="'
. $this->_makePageTitleAnchor($page->title).'">'
. $page->title
. '</a></h2>'
. "\n"
;
$result .= sprintf($langWikiPageNotLoaded,$page->title);
$wikiPage = null;
}
else
{
$pgTitle = $wikiPage->getTitle();
if ( '__MainPage__' === $pgTitle )
{
$pgTitle = $langWikiMainPage;
}
$result .= '<h2><a name="'
. $this->_makePageTitleAnchor($page->title) .'">'
. $pgTitle
.'</a></h2>'
. "\n"
;
$content = $wikiPage->getContent();
$result .= $this->render($content) . "\n";
$wikiPage = null;
}
}
$result .= $this->_htmlFooter();
return $result;
}
开发者ID:nikosv,项目名称:openeclass,代码行数:61,代码来源:class.wiki2xhtmlexport.php
示例18: getEditInfo
/**
* @since 2.2
*/
public function getEditInfo(Title $title)
{
$this->page = new \WikiPage($title);
if (class_exists('WikitextContent')) {
$content = $this->page->getRevision()->getContent();
$format = $content->getContentHandler()->getDefaultFormat();
return $this->page->prepareContentForEdit($content, null, null, $format);
}
return $this->page->prepareTextForEdit($this->page->getRevision()->getRawText(), null, null);
}
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:13,代码来源:PageReader.php
示例19: onArticleSaveComplete
/**
* Refresh cache when article is edited
*
* @param WikiPage $article
*/
static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{
wfProfileIn(__METHOD__);
$articleId = $article->getId();
// tell service to invalidate cached data for edited page
$service = new self($articleId);
$service->regenerateData();
wfDebug(__METHOD__ . ": cache cleared for page #{$articleId}\n");
wfProfileOut(__METHOD__);
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:PageStatsService.class.php
示例20: onPageContentSave
static function onPageContentSave(WikiPage &$wikiPage, User &$user, Content &$content, &$summary, $isMinor, $isWatch, $section, &$flags, Status &$status)
{
// get the current tags from the page
/////////////////////////////////////
$CurrentReferences;
preg_match_all(self::GetLabelsRegex, $wikiPage->getText(), $matches);
// build it as a "set"
foreach (array_merge($matches[2], $matches[3]) as $toAdd) {
if ($toAdd != '') {
$CurrentReferences[$toAdd] = 1;
}
}
// get the old tags from the database
/////////////////////////////////////
$OldReferences;
if (($rev = $wikiPage->getRevision()) != null && ($prevRev = $rev->getPrevious()) != null) {
preg_match_all(self::GetLabelsRegex, $prevRev->getText(), $matches);
// build it as a "set"
foreach (array_merge($matches[2], $matches[3]) as $toAdd) {
if ($toAdd != '') {
$OldReferences[$toAdd] = 1;
}
}
}
// Resolve differences
//////////////////////
$DB = wfGetDB(DB_MASTER);
$DB->begin();
// start a transaction
// start with the newOnes and make sure that the database is compatable, and remove them
foreach (array_keys($CurrentReferences) as $RefToMakeSureExists) {
if (isset($OldReferences[$RefToMakeSureExists])) {
// if it is already in the array, then we don't have to worry about it; delete it
unset($OldReferences[$RefToMakeSureExists]);
} else {
// if it doesn't exist, we need to add it
try {
$DB->insert(ContentReferencerTableName, array('reference_name' => $RefToMakeSureExists, 'reference_page_name' => (string) $wikiPage->getTitle()));
} catch (Exception $e) {
die($e->getMessage());
}
}
}
// now, anything left in $OldReferences has been deleted. Let's remove it from the database
foreach (array_keys($OldReferences) as $RefToDelete) {
try {
$DB->delete(ContentReferencerTableName, "reference_name='{$RefToDelete}'");
} catch (Exception $e) {
die($e->getMessage());
}
}
$DB->commit();
// end the transaction
}
开发者ID:WikiToLearn,项目名称:ContentReferencer,代码行数:54,代码来源:ContentReferencerHooks.php
注:本文中的WikiPage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论