本文整理汇总了PHP中Wiki类的典型用法代码示例。如果您正苦于以下问题:PHP Wiki类的具体用法?PHP Wiki怎么用?PHP Wiki使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wiki类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
*
*/
function setup()
{
// set wikilist
require_once WIKI_CLASSES . 'Wiki.php';
$wikipage = new Wiki($this->db);
$this->wikilist = $wikipage->getWikis();
}
示例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;
}
示例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;
}
示例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");
}
}
示例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;
}
示例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'], "日本語ページ");
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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];
}
}
}
示例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);
}
示例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);
}
示例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;
}