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


PHP Wiki::instance方法代码示例

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


在下文中一共展示了Wiki::instance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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('&amp;', '&', $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('&amp;', '&', $url);
    return '"' . $row['display_name'] . '(' . $row['id'] . ')":' . $url;
}
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:33,代码来源:wiki.php

示例3: 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

示例4: wiki_replace_link_callback

/**
 * Replaces wiki links in format [wiki:{PAGE_ID}] with a textile link to the page
 * 
 * @param mixed $content
 * @return
 */
function wiki_replace_link_callback($matches)
{
    //print_r($matches);
    if (count($matches) >= 2) {
        if (is_numeric($matches[1])) {
            $object_id = $matches[1];
            $object = Wiki::instance()->findById($object_id);
            if ($object instanceof WikiPage) {
                if ($matches[2] == ',content') {
                    $revision = $object->getLatestRevision();
                    return do_textile(plugin_manager()->apply_filters('wiki_text', $revision->getContent()));
                }
                return '<a href="' . externalUrl($object->getViewUrl()) . '" title="' . lang('wiki page') . "({$object_id})" . '">' . $object->getObjectName() . '</a>';
            }
        }
    }
    return '<del>' . lang('invalid reference', $matches[0]) . '</del>';
}
开发者ID:bklein01,项目名称:Project-Pier,代码行数:24,代码来源:wiki.php

示例5: define

    define('USE_WIKITTEN_LOGO', true);
}
if (!defined('USE_DARK_THEME')) {
    define('USE_DARK_THEME', false);
}
if (!defined('USE_PAGE_METADATA')) {
    define('USE_PAGE_METADATA', true);
}
if (!defined('ENABLE_EDITING')) {
    define('ENABLE_EDITING', false);
}
define('PLUGINS', __DIR__ . DIRECTORY_SEPARATOR . 'plugins');
$request_uri = parse_url($_SERVER['REQUEST_URI']);
$request_uri = explode("/", $request_uri['path']);
$script_name = explode("/", dirname($_SERVER['SCRIPT_NAME']));
$app_dir = array();
foreach ($request_uri as $key => $value) {
    if (isset($script_name[$key]) && $script_name[$key] == $value) {
        $app_dir[] = $script_name[$key];
    }
}
define('APP_DIR', rtrim(implode('/', $app_dir), "/"));
$https = false;
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
    $https = true;
}
define('BASE_URL', "http" . ($https ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . APP_DIR);
unset($config_file, $request_uri, $script_name, $app_dir, $https);
require_once __DIR__ . DIRECTORY_SEPARATOR . 'wiki.php';
Wiki::instance()->dispatch();
开发者ID:datkinson,项目名称:Wikitten,代码行数:30,代码来源:index.php

示例6: paginate

 /**
  * This function will return paginated result. Result is an array where first element is 
  * array of returned object and second populated pagination object that can be used for 
  * obtaining and rendering pagination data using various helpers.
  * 
  * Items and pagination array vars are indexed with 0 for items and 1 for pagination
  * because you can't use associative indexing with list() construct
  *
  * @access public
  * @param array $arguments Query argumens (@see find()) Limit and offset are ignored!
  * @param integer $items_per_page Number of items per page
  * @param integer $current_page Current page number
  * @return array
  */
 function paginate($arguments = null, $items_per_page = 10, $current_page = 1)
 {
     if (isset($this) && instance_of($this, 'Wiki')) {
         return parent::paginate($arguments, $items_per_page, $current_page);
     } else {
         return Wiki::instance()->paginate($arguments, $items_per_page, $current_page);
     }
     // if
 }
开发者ID:469306621,项目名称:Languages,代码行数:23,代码来源:BaseWiki.class.php


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