本文整理汇总了PHP中saveWikiText函数的典型用法代码示例。如果您正苦于以下问题:PHP saveWikiText函数的具体用法?PHP saveWikiText怎么用?PHP saveWikiText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveWikiText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_sort
public function test_sort()
{
saveWikiText('title1', 'test', 'test');
$title = new Title('title1');
$title->setTitle('This is a title');
saveWikiText('title2', 'test', 'test');
$title = new Title('title2');
$title->setTitle('This is a title');
saveWikiText('title3', 'test', 'test');
$title = new Title('title3');
$title->setTitle('Another Title');
$this->loadSchemaJSON('pageschema');
$this->saveData('test1', 'pageschema', array('singletitle' => 'title1'));
$this->saveData('test2', 'pageschema', array('singletitle' => 'title2'));
$this->saveData('test3', 'pageschema', array('singletitle' => 'title3'));
$search = new Search();
$search->addSchema('pageschema');
$search->addColumn('%pageid%');
$search->addColumn('singletitle');
$search->addSort('singletitle', true);
/** @var Value[][] $result */
$result = $search->execute();
$this->assertEquals(3, count($result));
$this->assertEquals('test3', $result[0][0]->getValue());
$this->assertEquals('test1', $result[1][0]->getValue());
$this->assertEquals('test2', $result[2][0]->getValue());
}
示例2: test_p_set_metadata_during_rendering
function test_p_set_metadata_during_rendering()
{
global $EVENT_HANDLER;
$this->id = 'test:p_set_metadata_during_rendering';
$this->active = true;
// write the wiki page so it exists and needs to be rendered
saveWikiText($this->id, 'Test ' . time(), 'Test data setup');
$EVENT_HANDLER->register_hook('PARSER_METADATA_RENDER', 'BEFORE', $this, 'helper_set_metadata', array('test_before_set' => 'test'));
$EVENT_HANDLER->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'helper_set_metadata', array('test_after_set' => 'test'));
$EVENT_HANDLER->register_hook('PARSER_HANDLER_DONE', 'BEFORE', $this, 'helper_inject_test_instruction');
// Change the global plugin controller so this test can be a fake syntax plugin
global $plugin_controller;
$this->plugin_controller = $plugin_controller;
$plugin_controller = $this;
// the actual rendering, all hooks should be executed here
$newMeta = p_get_metadata($this->id);
// restore the plugin controller
$plugin_controller = $this->plugin_controller;
// assert that all three calls to p_set_metadata have been successful
$this->assertEqual($newMeta['test_before_set'], 'test');
$this->assertEqual($newMeta['test_after_set'], 'test');
$this->assertEqual($newMeta['test_during_rendering'], 'test');
// clean up
$this->active = false;
// make sure the saved metadata is the one that has been rendered
$this->assertEqual($newMeta, p_get_metadata($this->id));
saveWikiText($this->id, '', 'Test data remove');
}
示例3: test_parameters
function test_parameters()
{
saveWikiText('test:links', '[[wiki:syntax?do=export_raw]] [[:web:scripts:add_vhost.sh?do=export_raw]]', 'Init tests');
idx_addPage('test:links');
$this->assertEquals(array('test:links'), ft_backlinks('wiki:syntax'));
$this->assertEquals(array('test:links'), ft_backlinks('web:scripts:add_vhost.sh'));
}
示例4: handle_approve
function handle_approve(&$event, $param)
{
global $ID, $REV;
if (!$this->can_approve()) {
return;
}
if ($event->data == 'show' && isset($_GET['approve'])) {
//Add or remove the new line from the end of the page. Silly but needed.
$content = rawWiki($ID, '');
if (substr($content, -1) == "\n") {
$content = substr($content, 0, -1);
} else {
$content .= "\n";
}
saveWikiText($ID, $content, APPROVED);
header('Location: ?id=' . $ID);
}
/*czytacze wydzą najnowszą zatwierdzaną*/
$last = $this->find_lastest_approved();
/*użytkownik może tylko czytać i jednocześnie istnieje jakaś zatwierdzona strona*/
if (auth_quickaclcheck($ID) <= AUTH_READ && $last != -1) {
/*najnowsza zatwierdzona nie jest najnowszą*/
/*i jednocześnie znajdujemy się w stronach nowszych niż aktualna zatwierdzona*/
if ($last != 0 && ($REV > $last || $REV == 0)) {
$REV = $last;
}
}
}
示例5: test_media_in_deleted_pages
public function test_media_in_deleted_pages()
{
saveWikiText('test:internalmedia_usage', '{{internalmedia.png}} {{..:internal media.png}}', 'Test initialization');
idx_addPage('test:internalmedia_usage');
saveWikiText('test:internalmedia_usage', '', 'Deleted');
$this->assertEquals(array(), ft_mediause('internal_media.png'));
$this->assertEquals(array(), ft_mediause('test:internalmedia.png'));
}
示例6: setUp
public function setUp()
{
parent::setUp();
saveWikiText('testpage', 'Foo bar baz.', 'Test initialization');
saveWikiText('notfound', 'Foon barn bazn.', 'Test initialization');
idx_addPage('testpage');
idx_addPage('notfound');
}
示例7: setUp
/**
* Create some page namespace structure
*/
function setUp()
{
$pages = array('animals:mammals:bear:brownbear', 'animals:mammals:bear:blackbear', 'animals:mammals:cute:otter', 'animals:mammals:cute:cat', 'animals:mammals:cute:dog', 'animals:insects:butterfly:fly', 'animals:insects:butterfly:moth', 'animals:monkey', 'humans:programmers:andi', 'humans:programmers:joe', 'humans:programmers:john', 'yeti');
foreach ($pages as $page) {
saveWikiText($page, $page, 'test setup');
}
parent::setUp();
}
示例8: test_no_aprroved_banner
/**
* @coversNothing
*/
public function test_no_aprroved_banner()
{
global $conf;
$conf['plugin']['publish']['hide_approved_banner'] = 1;
saveWikiText('foo', 'bar', 'foobar');
$request = new TestRequest();
$response = $request->get(array(), '/doku.php?id=foo&publish_approve=1');
$this->assertTrue(strpos($response->getContent(), '<div class="approval') === false, 'The approved banner is still showing even so it is supposed not to show.');
}
示例9: test_relation_references_without_link
public function test_relation_references_without_link()
{
$text = "My page without a link.";
$id = "source";
saveWikiText($id, $text, 'Created');
self::assertEquals(null, p_get_metadata($id, 'relation references', METADATA_RENDER_UNLIMITED));
$text .= DOKU_LF . "~~META:relation references=foo~~";
saveWikiText($id, $text, 'Updated');
self::assertEquals(array('foo' => false), p_get_metadata($id, 'relation references', METADATA_RENDER_UNLIMITED));
}
示例10: test_media_in_footnotes
public function test_media_in_footnotes() {
saveWikiText('test:media_footnotes', '(({{footnote.png?20x50}} [[foonote|{{:footlink.png}}]]))', 'Test initialization');
idx_addPage('test:media_footnotes');
$query = array('test:footnote.png', 'footlink.png');
$this->assertEquals(array(
'test:footnote.png' => array('test:media_footnotes'),
'footlink.png' => array('test:media_footnotes')
), idx_get_indexer()->lookupKey('relation_media', $query));
}
示例11: setUp
public function setUp()
{
parent::setUp();
saveWikiText('foo', "====== Page-Heading ======", 'summary');
$req = new TestRequest();
$req->get(array(), '/doku.php?id=foo');
saveWikiText('testpage', "---- dataentry Testentry ----\n" . "test1_title: foo|bar\n" . "----\n", 'summary');
//trigger save to db
$req = new TestRequest();
$req->get(array(), '/doku.php?id=testpage');
}
示例12: test_PageLockedByYou
public function test_PageLockedByYou()
{
$page_id = 'test:main';
$GLOBALS['INPUT']->server->set('REMOTE_USER', 'testuser');
saveWikiText($page_id, 'some text', 'some summary');
lock($page_id);
$json = $this->doCall($page_id, null, 'testuser');
$this->assertInstanceOf('\\stdClass', $json);
$this->assertObjectHasAttribute('error', $json);
$this->assertRegExp("/^\\d{2}:\\d{2}:\\d{2} Page is locked by You. You cannot delete page during edit.\$/", $json->error);
}
示例13: setUp
public function setUp()
{
$this->pluginsEnabled[] = 'tag';
parent::setUp();
saveWikiText('tagged_page', '{{tag>mytag test2tag}}', 'Test');
saveWikiText('negative_page', '{{tag>negative_tag mytag}}', 'Test setup');
saveWikiText('third_page', '{{tag>third_tag}}', 'Test setup');
idx_addPage('tagged_page');
idx_addPage('negative_page');
idx_addPage('third_page');
}
示例14: setUp
public function setUp()
{
global $conf;
$this->pluginsEnabled[] = 'tag';
parent::setUp();
$conf['plugin']['tag']['sortkey'] = 'ns';
$this->helper = plugin_load('helper', 'tag');
foreach ($this->pages as $page) {
saveWikiText($page, '{{tag>mytag}}', 'Test');
idx_addPage($page);
}
}
示例15: test_renameOkay
/**
* @covers action_plugin_move_rename::renameOkay
*/
function test_renameOkay()
{
global $conf;
global $USERINFO;
$conf['superuser'] = 'john';
$_SERVER['REMOTE_USER'] = 'john';
$USERINFO['grps'] = array('admin', 'user');
saveWikiText('wiki:foo:start', '[[..:..:one_ns_up:]]', 'Test setup');
idx_addPage('wiki:foo:start');
$move_rename = new action_plugin_move_rename();
$this->assertTrue($move_rename->renameOkay('wiki:foo:start'));
}