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


PHP WikiPage类代码示例

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


在下文中一共展示了WikiPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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