本文整理汇总了PHP中Wiki类的典型用法代码示例。如果您正苦于以下问题:PHP Wiki类的具体用法?PHP Wiki怎么用?PHP Wiki使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wiki类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setup
/**
*
*/
function setup()
{
// set wikilist
require_once WIKI_CLASSES . 'Wiki.php';
$wikipage = new Wiki($this->db);
$this->wikilist = $wikipage->getWikis();
}
开发者ID:Barthak,项目名称:voodoo,代码行数:10,代码来源:WikiFormatter.php
示例2: load
/**
* Loads list of all SiteMatrix wikis
*
* @static
* @access public
* @param Wiki &$wikiClass The Wiki class object
* @return array List of all wikis
* @throws AssertFailure
* @throws DependencyError
* @throws LoggedOut
* @throws MWAPIError
*/
public static function load(Wiki &$wikiClass)
{
if (!array_key_exists('SiteMatrix', $wikiClass->get_extensions())) {
throw new DependencyError("SiteMatrix");
}
$SMres = $wikiClass->apiQuery(array('action' => 'sitematrix'));
$wikis = $SMres['sitematrix'];
//return $wikis;
$retarray = array('raw' => $wikis, 'urls' => array(), 'langs' => array(), 'names' => array(), 'privates' => array());
foreach ($wikis as $site) {
if (is_array($site)) {
if (isset($site['site'])) {
$retarray['langs'][] = $site['code'];
$retarray['names'][$site['code']] = $site['name'];
foreach ($site['site'] as $site2) {
$retarray['urls'][] = $site2['url'];
if (isset($site2['private'])) {
$retarray['privates'][] = $site2;
}
}
} else {
foreach ($site as $site2) {
$sites2['urls'][] = $site2['url'];
if (isset($site2['private'])) {
$retarray['privates'][] = $site2;
}
}
}
}
}
return $retarray;
}
开发者ID:emijrp,项目名称:Peachy,代码行数:44,代码来源:SiteMatrix.php
示例3: __construct
/**
* @param Wiki $wikiClass
* @throws DependencyError
*/
function __construct(Wiki &$wikiClass)
{
if (!array_key_exists('FlaggedRevs', $wikiClass->get_extensions())) {
throw new DependencyError("FlaggedRevs", "http://www.mediawiki.org/wiki/Extension:FlaggedRevs");
}
$this->wiki = $wikiClass;
}
开发者ID:emijrp,项目名称:Peachy,代码行数:11,代码来源:FlaggedRevs.php
示例4: __construct
public function __construct(Wiki &$wikiClass, $repo)
{
$this->wiki = $wikiClass;
$this->repo = $repo;
if (!array_key_exists('CodeReview', $wikiClass->get_extensions())) {
throw new DependencyError("CodeReview", "http://www.mediawiki.org/wiki/Extension:CodeReview");
}
}
开发者ID:emijrp,项目名称:Peachy,代码行数:8,代码来源:CodeReview.php
示例5: loadWiki
/**
* Load a Wiki
* @param int wikiId ID of the Wiki
* @return Wiki the loaded Wiki
*/
public function loadWiki($wikiId)
{
$wiki = new Wiki($this->con, $this->config);
$wiki->load($wikiId);
if ($wiki->hasError()) {
$this->setError($wiki->error, $wiki->errno);
}
return $wiki;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:14,代码来源:class.wikistore.php
示例6: testFindByProjectId
/**
* testFindByProjectId method
*
* @return void
*/
public function testFindByProjectId()
{
$data = $this->Wiki->findByProjectId(1);
$this->assertEqual($data['Wiki']['id'], 1);
foreach ($data['WikiPage'] as $row) {
$this->assertEqual($row['wiki_id'], 1);
}
//$this->assertEqual($data['WikiPage'][1]['title'], "日本語ページ");
}
开发者ID:gildonei,项目名称:candycane,代码行数:14,代码来源:WikiTest.php
示例7: loadWiki
/**
* Load a Wiki
* @param int wikiId ID of the Wiki
* @return Wiki the loaded Wiki
*/
function loadWiki($wikiId) {
$wiki = new Wiki();
if ($wiki->hasError()) {
$this->setError($wiki->error);
}
$wiki->load($wikiId);
return $wiki;
}
开发者ID:nikosv,项目名称:openeclass,代码行数:16,代码来源:class.wikistore.php
示例8: parse
/**
* Parses wikitext and returns parser output. Shortcut for Wiki::parse
*
* @param string $summary Summary to parse. Default null.
* @param string $id Parse the content of this revision
* @param array $prop Properties to retrieve. array( 'text', 'langlinks', 'categories', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'iwlinks', 'wikitext', 'properties' )
* @param string $uselang Code of the language to use in interface messages, etc. (where applicable). Default 'en'.
* @param string $section Only retrieve the content of this section number. Default null.
* @return array
*/
public function parse($summary = null, $id = null, $prop = null, $uselang = 'en', $section = null)
{
if ($prop === null) {
$prop = array('text', 'langlinks', 'categories', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'iwlinks', 'wikitext', 'properties');
}
return $this->wiki->parse(null, null, $summary, false, false, $prop, $uselang, $this->title, $id, null, false, $section);
}
开发者ID:emijrp,项目名称:Peachy,代码行数:17,代码来源:Page.php
示例9: get_instance
/**
* Gets the single instance of the class
*
* @since 1.2.5
* @access public
*/
public static function get_instance()
{
if (is_null(self::$_instance)) {
self::$_instance = new Wiki();
}
return self::$_instance;
}
开发者ID:cabelotaina,项目名称:redelivre,代码行数:13,代码来源:wiki.php
示例10: manager
/**
* Return manager instance
*
* @access protected
* @param void
* @return ProjectLinks
*/
function manager()
{
if (!instance_of($this->manager, 'Wiki')) {
$this->manager = Wiki::instance();
}
return $this->manager;
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:14,代码来源:BaseWikiPage.class.php
示例11: wiki_replace_link_callback
function wiki_replace_link_callback($matches)
{
if (count($matches) < 2) {
return null;
}
if ($matches[1] == 'wiki') {
$rev = Revisions::instance()->getTableName(true);
$page = Wiki::instance()->getTableName(true);
$where1 = 'WHERE page_id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
$where2 = 'WHERE id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
$sql = "SELECT page_id, name FROM {$rev} {$where1} ";
$sql .= "AND revision = ( select revision from {$page} {$where2} )";
//echo $sql;
$row = DB::executeOne($sql);
if (!count($row)) {
return null;
}
$url = get_url($matches[1], 'view', array('id' => $matches[2]));
$url = str_replace('&', '&', $url);
return '"' . $row['name'] . '(' . $row['page_id'] . ')":' . $url;
}
$user = Users::instance()->getTableName(true);
$where1 = 'WHERE id = ' . $matches[2];
$sql = "SELECT id, display_name FROM {$user} {$where1} ";
echo $sql;
$row = DB::executeOne($sql);
if (!count($row)) {
return null;
}
$url = get_url($matches[1], 'card', array('id' => $matches[2]));
$url = str_replace('&', '&', $url);
return '"' . $row['display_name'] . '(' . $row['id'] . ')":' . $url;
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:33,代码来源:wiki.php
示例12: helpAction
public function helpAction()
{
$uri = $this->getRequest()->getParam('uri');
$ns = new Zend_Session_Namespace();
if (!empty($uri)) {
$uri = Shineisp_Commons_UrlRewrites::format($uri);
$data = $this->wiki->getPostbyUri($uri, "w.wiki_id, w.subject as subject, w.views as views, w.creationdate as creationdate, w.content as content, w.metakeywords as metakeywords, w.metadescription as metadescription, wc.category_id as category_id, wc.category as category");
if (isset($data[0])) {
// Set the Metatag information
$this->view->headTitle(" | " . $data[0]['subject']);
if (!empty($data[0]['metakeywords'])) {
$this->view->headMeta()->setName('keywords', $data[0]['metakeywords']);
}
if (!empty($data[0]['metadescription'])) {
$this->view->headMeta()->setName('description', $data[0]['metadescription']);
}
// Getting the Products
$products = Wikilinks::getProductsAttached($data[0]['wiki_id'], $ns->langid);
if (count($products) > 0) {
$this->view->placeholder("right")->append($this->view->partial('wiki/products_reference.phtml', array('products' => $products)));
$this->getHelper('layout')->setLayout('2columns-right');
}
// Update the counter
Wiki::update_views($data[0]['wiki_id']);
$data[0]['content'] = Shineisp_Commons_Contents::chkModule($data[0]['content']);
$data[0]['content'] = Shineisp_Commons_Contents::chkCmsBlocks($data[0]['content'], $ns->lang);
// Send the content to the page
$this->view->headertitle = $this->translator->translate('Wiki page');
$this->view->post = $data[0];
}
}
}
开发者ID:kokkez,项目名称:shineisp,代码行数:32,代码来源:WikiController.php
示例13: wiki_select_page
/**
* Renders select page box
*
* @param string $name Name to use in HTML for the select
* @param Project $project
* @param integer $selected Id of selected element
* @param array $attributes Array of additional attributes
* @return string
*/
function wiki_select_page($name, $project, $selected = null, $attributes = null)
{
if (is_array($attributes)) {
if (!isset($attributes['class'])) {
$attributes['class'] = 'wiki_select_page';
}
} else {
$attributes = array('class' => 'wiki_select_page');
}
// if
$options = array(option_tag(lang('none'), 0));
if (logged_user()->isAdministrator()) {
$pages = Wiki::getAllProjectPages($project);
} else {
$pages = Wiki::getAllProjectPages($project);
}
if (is_array($pages)) {
foreach ($pages as $page) {
$option_attributes = $page->getId() == $selected ? array('selected' => 'selected') : null;
$options[] = option_tag($page->getObjectName(), $page->getId(), $option_attributes);
}
// foreach
}
// if
return select_box($name, $options, $attributes);
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:35,代码来源:wiki.php
示例14: 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
示例15: getPagesList
/**
* Get a list of pages for a project
*
* @param mixed $project
* @return
*/
function getPagesList(Project $project)
{
$sql = 'SELECT p.id, r.name FROM ' . Wiki::instance()->getTableName(true) . ' AS p, ' . Revisions::instance()->getTableName(true) . ' AS r WHERE p.project_id = ' . $project->getId() . ' AND p.id = r.page_id AND r.revision = p.revision AND p.project_sidebar = 0 ORDER BY 2';
$return = array();
foreach ((array) DB::executeAll($sql) as $page) {
$return[] = array('name' => $page['name'], 'view_url' => get_url('wiki', 'view', array('id' => $page['id'])));
}
return $return;
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:15,代码来源:Wiki.class.php
示例16: actionEdit
public function actionEdit($id)
{
$model = Wiki::model()->findByPk($id);
if (!$model) {
$model = new Wiki();
$model->id = $id;
}
if (!empty($_POST['Wiki'])) {
if (!empty($_POST['Wiki']['text'])) {
$model->text = $_POST['Wiki']['text'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $id));
}
} else {
Wiki::model()->deleteByPk($id);
}
}
$this->render('edit', array('model' => $model));
}
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:19,代码来源:DefaultController.php
示例17: create_display_html
protected function create_display_html(WikiPage $page)
{
$owner = $page->get_owner();
$tfe = new TextFormattingEvent($page->body);
send_event($tfe);
global $user;
$edit = "<table><tr>";
$edit .= Wiki::can_edit($user, $page) ? "\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/edit")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='hidden' name='revision' value='" . int_escape($page->revision) . "'>\n\t\t\t\t\t<input type='submit' value='Edit'>\n\t\t\t\t</form></td>\n\t\t\t" : "";
if ($user->is_admin()) {
$edit .= "\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/delete_revision")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='hidden' name='revision' value='" . int_escape($page->revision) . "'>\n\t\t\t\t\t<input type='submit' value='Delete This Version'>\n\t\t\t\t</form></td>\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/delete_all")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='submit' value='Delete All'>\n\t\t\t\t</form></td>\n\t\t\t";
}
$edit .= "</tr></table>";
return "\n\t\t\t<div class='wiki-page'>\n\t\t\t{$tfe->formatted}\n\t\t\t<hr>\n\t\t\t<p class='wiki-footer'>\n\t\t\t\tRevision {$page->revision}\n\t\t\t\tby <a href='" . make_link("user/{$owner->name}") . "'>{$owner->name}</a>\n\t\t\t\tat {$page->date}\n\t\t\t\t{$edit}\n\t\t\t</p>\n\t\t\t</div>\n\t\t";
}
开发者ID:nsuan,项目名称:shimmie2,代码行数:14,代码来源:theme.php
示例18: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$user = \lms_steam::get_current_user();
// Disable caching
// TODO: Work on cache handling. An enabled cache leads to bugs
// if used with the wiki.
\CacheSettings::disable_caching();
if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
include "bad_link.php";
exit;
}
if (!$wiki_container instanceof \steam_container) {
$wiki_doc = $wiki_container;
$wiki_container = $wiki_doc->get_environment();
if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
include "bad_link.php";
exit;
}
}
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
$to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
$wiki_html_handler = new \lms_wiki($wiki_container);
//$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
$content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
$difftext = wiki_diff_html($to, $compare);
$content->setVariable("DIFF_TEXT", $difftext);
$wiki_html_handler->set_main_html($content->get());
$rootlink = \lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
/*$portal->set_page_main(
$headline,
$wiki_html_handler->get_html()
);
$portal->show_html();
*/
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($wiki_html_handler->get_html());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
开发者ID:rolwi,项目名称:koala,代码行数:45,代码来源:Compareversions.class.php
示例19: find_page
/**
* Find the page with the given title
*
* @param string $title Title
* @param array $options Options
* @return array Page data
*/
public function find_page($title, $options = array())
{
$param = array();
if ($title === "") {
$title = $this->field('start_page');
}
$title = Wiki::titleize($title);
$page = $this->WikiPage->find('first', array('conditions' => array('WikiPage.wiki_id' => $this->id, 'WikiPage.title' => $title)));
if (isset($page['WikiPage']['id'])) {
$this->WikiPage->id = $page['WikiPage']['id'];
}
// if !page && !(options[:with_redirect] == false)
// # search for a redirect
// redirect = redirects.find_by_title(title)
// page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
// end
return $page;
}
开发者ID:predominant,项目名称:candycane,代码行数:25,代码来源:wiki.php
示例20: Show
public function Show($parameters)
{
$view = new Zend_View();
$view->addScriptPath('../library/Shineisp/Custom/views');
$limit = 10;
$id = null;
$ns = new Zend_Session_Namespace();
$languageID = Languages::get_language_id($ns->lang);
$translator = Shineisp_Registry::getInstance()->Zend_Translate;
if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
$id = $parameters['category'];
}
if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
$limit = $parameters['limit'];
}
// Get the products
$view->wiki = Wiki::get_items($limit, $id);
return $view->render('wikilist.phtml');
}
开发者ID:kokkez,项目名称:shineisp,代码行数:19,代码来源:Wikilist.php
注:本文中的Wiki类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论