*
* @var array
*/
- var $_params = array();
+ protected $_params = array();
/**
* VFS object for storing attachments.
*
* @var VFS
*/
- var $_vfs;
+ protected $_vfs;
/**
* Constructs a new Wicked driver object.
*
* @param array $params A hash containing connection parameters.
*/
- function __construct($params = array())
+ public function __construct($params = array())
{
$this->_params = $params;
}
*
* @throws Wicked_Exception
*/
- function getVFS()
+ public function getVFS()
{
if (!$this->_vfs) {
try {
abstract function renamePage($pagename, $newname);
- function getPageId($pagename)
+ public function getPageId($pagename)
{
$pages = $this->getPages();
$ids = array_flip($pages);
return isset($ids[$pagename]) ? $ids[$pagename] : false;
}
- function getPage($pagename)
+ public function getPage($pagename)
{
return array();
}
- function getPageById($id)
+ public function getPageById($id)
{
return array();
}
- function getSpecialPages()
+ public function getSpecialPages()
{
static $pages;
if (isset($pages)) {
return $pages;
}
- function getPages($special = true)
+ public function getPages($special = true)
{
return array();
}
- function pageExists($pagename)
+ public function pageExists($pagename)
{
return in_array($pagename, $this->getPages());
}
*
* @throws Wicked_Exception
*/
- function attachFile($file, $data)
+ public function attachFile($file, $data)
{
$vfs = $this->getVFS();
if (!isset($file['change_author'])) {
*
* @throws Wicked_Exception
*/
- function removeAttachment($pageId, $attachment, $version = null)
+ public function removeAttachment($pageId, $attachment, $version = null)
{
$vfs = $this->getVFS();
$path = WICKED_VFS_ATTACH_PATH . '/' . $pageId;
*
* @throws Wicked_Exception
*/
- function removeAllAttachments($pageId)
+ public function removeAllAttachments($pageId)
{
$vfs = $this->getVFS();
if (!$vfs->isFolder(WICKED_VFS_ATTACH_PATH, $pageId)) {
* @return boolean The new version of the file attached
* @throws Wicked_Exception
*/
- abstract function _attachFile($file);
+ abstract protected function _attachFile($file);
/**
* Retrieves the contents of an attachment.
* @return string The file's contents.
* @throws Wicked_Exception
*/
- function getAttachmentContents($pageId, $filename, $version)
+ public function getAttachmentContents($pageId, $filename, $version)
{
$vfs = $this->getVFS();
$path = WICKED_VFS_ATTACH_PATH . '/' . $pageId;
abstract function removeVersion($pagename, $version);
- function removeAllVersions($pagename)
+ public function removeAllVersions($pagename)
{
/* When deleting a page, also delete all its attachments. */
$this->removeAllAttachments($this->getPageId($pagename));
*
* @return string The backend's charset
*/
- function getCharset()
+ public function getCharset()
{
return 'UTF-8';
}
* @return Wicked_Driver The newly created concrete Wicked_Driver instance.
* @throws Wicked_Exception
*/
- function factory($driver = null, $params = null)
+ public function factory($driver = null, $params = null)
{
if ($driver === null) {
$driver = $GLOBALS['conf']['storage']['driver'];
*
* @var Horde_Db_Adapter
*/
- var $_db;
+ protected $_db;
/**
* Retrieves the page of a particular name from the database.
* @return array
* @throws Wicked_Exception
*/
- function retrieveByName($pagename)
+ public function retrieveByName($pagename)
{
$where = 'page_name = ' . $this->_db->quoteString($this->_convertToDriver($pagename));
* @return array The page hash.
* @throws Wicked_Exception
*/
- function retrieveHistory($pagename, $version)
+ public function retrieveHistory($pagename, $version)
{
if (empty($version) or !preg_match('/^[0-9]+\.[0-9]+$/', $version)) {
throw new Wicked_Exception('invalid version number');
return $this->_retrieve($this->_params['historytable'], $where);
}
- function getPage($pagename)
+ public function getPage($pagename)
{
$where = 'page_name = ' . $this->_db->quoteString($this->_convertToDriver($pagename));
return $this->_retrieve($this->_params['table'], $where);
}
- function getPageById($id)
+ public function getPageById($id)
{
$where = 'page_id = ' . (int)$id;
return $this->_retrieve($this->_params['table'], $where);
}
- function getAllPages()
+ public function getAllPages()
{
return $this->_retrieve($this->_params['table'], '', 'page_name');
}
- function getHistory($pagename)
+ public function getHistory($pagename)
{
$where = 'page_name = ' . $this->_db->quoteString($this->_convertToDriver($pagename)) .
' ORDER BY page_majorversion DESC, page_minorversion DESC';
* @return array Pages.
* @throws Wicked_Exception
*/
- function getRecentChanges($days = 3)
+ public function getRecentChanges($days = 3)
{
$where = 'version_created > ' . (time() - (86400 * $days));
$result = $this->_retrieve($this->_params['table'],
* @return array Pages.
* @throws Wicked_Exception
*/
- function mostPopular($limit = 10)
+ public function mostPopular($limit = 10)
{
return $this->_retrieve($this->_params['table'], '', 'page_hits DESC', $limit);
}
* @return array Pages.
* @throws Wicked_Exception
*/
- function leastPopular($limit = 10)
+ public function leastPopular($limit = 10)
{
return $this->_retrieve($this->_params['table'], '', 'page_hits ASC', $limit);
}
- function searchTitles($searchtext)
+ public function searchTitles($searchtext)
{
require_once 'Horde/SQL.php';
$searchtext = $this->_convertToDriver($searchtext);
* @return array A list of pages.
* @throws Wicked_Exception
*/
- function searchText($searchtext, $title = true)
+ public function searchText($searchtext, $title = true)
{
require_once 'Horde/SQL/Keywords.php';
$searchtext = $this->_convertToDriver($searchtext);
return $this->_retrieve($this->_params['table'], $where);
}
- function getBackLinks($pagename)
+ public function getBackLinks($pagename)
{
$where = 'page_text LIKE ' . $this->_db->quoteString('%' . $this->_convertToDriver($pagename) . '%');
$pages = $this->_retrieve($this->_params['table'], $where);
return $pages;
}
- function getMatchingPages($searchtext, $matchType = Wicked_Page::MATCH_ANY)
+ public function getMatchingPages($searchtext, $matchType = Wicked_Page::MATCH_ANY)
{
$searchtext = Horde_String::lower($searchtext);
return $this->_retrieve($this->_params['table'], implode(' OR ', $clauses));
}
- function getLikePages($pagename)
+ public function getLikePages($pagename)
{
if (Horde_String::isUpper($pagename, 'UTF-8')) {
$firstword = $pagename;
* files.
* @throws Wicked_Exception
*/
- function getAttachedFiles($pageId, $allversions = false)
+ public function getAttachedFiles($pageId, $allversions = false)
{
$where = 'page_id = ' . (int)$pageId;
$data = $this->_retrieve($this->_params['attachmenttable'], $where);
return $data;
}
- function _getAttachedFiles_usort($a, $b)
+ protected function _getAttachedFiles_usort($a, $b)
{
$res = strcmp($a['attachment_name'], $b['attachment_name']);
if ($res != 0) {
*
* @throws Wicked_Exception
*/
- function removeAttachment($pageId, $attachment, $version = null)
+ public function removeAttachment($pageId, $attachment, $version = null)
{
/* Try to delete from the VFS first. */
parent::removeAttachment($pageId, $attachment, $version);
*
* @throws Wicked_Exception
*/
- function removeAllAttachments($pageId)
+ public function removeAllAttachments($pageId)
{
/* Try to delete from the VFS first. */
$result = parent::removeAllAttachments($pageId);
* @return string The new version of the file attached.
* @throws Wicked_Exception
*/
- function _attachFile($file)
+ protected function _attachFile($file)
{
$where = 'page_id = ' . intval($file['page_id']) .
' AND attachment_name = ' . $this->_db->quoteString($file['attachment_name']);
*
* @throws Wicked_Exception
*/
- function logPageView($pagename)
+ public function logPageView($pagename)
{
$query = 'UPDATE ' . $this->_params['table'] .
' SET page_hits = page_hits + 1 WHERE page_name = ?';
*
* @throws Wicked_Exception
*/
- function newPage($pagename, $text)
+ public function newPage($pagename, $text)
{
if (!strlen($pagename)) {
throw new Wicked_Exception(_("Page name must not be empty"));
*
* @throws Wicked_Exception
*/
- function renamePage($pagename, $newname)
+ public function renamePage($pagename, $newname)
{
$query = 'UPDATE ' . $this->_params['table'] .
' SET page_name = ? WHERE page_name = ?';
return $this->updateText($newname, $newPage['page_text'], $changelog, true);
}
- function updateText($pagename, $text, $changelog, $minorchange)
+ public function updateText($pagename, $text, $changelog, $minorchange)
{
if (!$this->pageExists($pagename)) {
return $this->newPage($pagename, $text);
$this->_db->update($query, $values);
}
- function getPages($special = true, $no_cache = false)
+ public function getPages($special = true, $no_cache = false)
{
static $pageNames;
if (!isset($pageNames) || $no_cache) {
/**
*/
- function removeVersion($pagename, $version)
+ public function removeVersion($pagename, $version)
{
list($major, $minor) = explode('.', $version);
/**
*/
- function removeAllVersions($pagename)
+ public function removeAllVersions($pagename)
{
$this->_pageNames = null;
*
* @return array | object Either an array of pages or PEAR::Error.
*/
- function _retrieve($table, $sqlWhere, $orderBy = null, $limit = null)
+ protected function _retrieve($table, $sqlWhere, $orderBy = null, $limit = null)
{
$query = sprintf('SELECT * FROM %s%s%s',
$table,
*
* @return string The backend's charset
*/
- function getCharset()
+ public function getCharset()
{
return $this->_params['charset'];
}
*
* @return mixed The converted value.
*/
- function _convertFromDriver($value)
+ protected function _convertFromDriver($value)
{
return Horde_String::convertCharset($value, $this->getCharset(), 'UTF-8');
}
*
* @return mixed The converted value.
*/
- function _convertToDriver($value)
+ protected function _convertToDriver($value)
{
return Horde_String::convertCharset($value, 'UTF-8', $this->getCharset());
}
*
* @throws Wicked_Exception
*/
- function connect()
+ public function connect()
{
try {
$this->_db = $GLOBALS['injector']->getInstance('Horde_Db_Adapter');
*
* @var array
*/
- var $supportedModes = array();
+ public $supportedModes = array();
/**
* Instance of a Text_Wiki processor.
*
* @var Text_Wiki
*/
- var $_proc;
+ protected $_proc;
/**
* The loaded page info.
*
* @var array
*/
- var $_page;
+ protected $_page;
/**
* Is this a validly loaded page?
*
* @return boolean True if we've loaded data, false otherwise.
*/
- function isValid()
+ public function isValid()
{
return !empty($this->_page);
}
*
* @return integer The permissions bitmask.
*/
- function getPermissions($pageName = null)
+ public function getPermissions($pageName = null)
{
global $wicked;
*
* @return boolean True if the mode is allowed.
*/
- function allows($mode)
+ public function allows($mode)
{
global $browser;
*
* @return boolean True or false
*/
- function supports($mode)
+ public function supports($mode)
{
return !empty($this->supportedModes[$mode]);
}
* @return Wicked_Page The current page.
* @throws Wicked_Exception
*/
- function getCurrentPage()
+ public function getCurrentPage()
{
return Wicked_Page::getPage(rtrim(Horde_Util::getFormData('page'), '/'),
Horde_Util::getFormData('version'),
* @return Wicked_Page The requested page.
* @throws Wicked_Exception
*/
- function getPage($pagename, $pagever = null, $referrer = null)
+ public function getPage($pagename, $pagever = null, $referrer = null)
{
global $conf, $notification, $wicked;
return new Wicked_Page_AddPage($pagename);
}
- function versionCreated()
+ public function versionCreated()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function formatVersionCreated()
+ public function formatVersionCreated()
{
try {
$v = $this->versionCreated();
return _("Never");
}
- function author()
+ public function author()
{
if (isset($this->_page['change_author'])) {
$modify = $this->_page['change_author'];
return $modify;
}
- function hits()
+ public function hits()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function version()
+ public function version()
{
throw new Wicked_Exception(_("Unsupported"));
}
* is the first version.
* @throws Wicked_Exception
*/
- function previousVersion()
+ public function previousVersion()
{
global $wicked;
$history[$i]['page_minorversion']);
}
- function isOld()
+ public function isOld()
{
return false;
}
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
// Get content first, it might throw an exception.
$inner = $this->displayContents(false);
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
- function preDisplay($mode, $params)
+ public function preDisplay($mode, $params)
{
}
* @return string The content.
* @throws Wicked_Exception
*/
- function block()
+ public function block()
{
return $this->displayContents(true);
}
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
throw new Wicked_Exception(_("Unsupported"));
}
/**
* Renders this page in remove mode.
*/
- function remove()
+ public function remove()
{
throw new Wicked_Exception(_("Unsupported"));
}
/**
* Renders this page in history mode.
*/
- function history()
+ public function history()
{
throw new Wicked_Exception(_("Unsupported"));
}
/**
* Renders this page in diff mode.
*/
- function diff()
+ public function diff()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function &getProcessor($output_format = 'Xhtml')
+ public function &getProcessor($output_format = 'Xhtml')
{
if (isset($this->_proc)) {
return $this->_proc;
return $this->_proc;
}
- function render($mode, $params = null)
+ public function render($mode, $params = null)
{
switch ($mode) {
case Wicked::MODE_CONTENT:
}
}
- function isLocked()
+ public function isLocked()
{
return false;
}
- function lock()
+ public function lock()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function unlock()
+ public function unlock()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function updateText($newtext, $changelog, $minorchange)
+ public function updateText($newtext, $changelog, $minorchange)
{
throw new Wicked_Exception(_("Unsupported"));
}
- function getText()
+ public function getText()
{
throw new Wicked_Exception(_("Unsupported"));
}
- function pageName()
+ public function pageName()
{
return null;
}
- function referrer()
+ public function referrer()
{
return null;
}
- function pageUrl($linkpage = null, $actionId = null)
+ public function pageUrl($linkpage = null, $actionId = null)
{
$params = array('page' => $this->pageName());
if ($this->referrer()) {
return Horde_Util::addParameter($url, $params);
}
- function pageTitle()
+ public function pageTitle()
{
return $this->pageName();
}
- function handleAction()
+ public function handleAction()
{
throw new Wicked_Exception(_("Unsupported"));
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true);
/**
*
* @var string
*/
- var $_newpage;
+ protected $_newpage;
/**
* Cached search results.
* @var array
*/
- var $_results;
+ protected $_results;
- function __construct($newpage)
+ public function __construct($newpage)
{
$this->_newpage = $newpage;
$this->_results = $GLOBALS['wicked']->searchTitles($newpage);
/**
* Bail out if there's no page name.
*/
- function preDisplay()
+ public function preDisplay()
{
if (!strlen($this->referrer())) {
$GLOBALS['notification']->push(_("Page name must not be empty"));
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
try {
$templates = $GLOBALS['wicked']->getMatchingPages('Template', Wicked_Page::MATCH_ENDS);
require WICKED_TEMPLATES . '/edit/create.inc';
}
- function pageName()
+ public function pageName()
{
return 'AddPage';
}
- function pageTitle()
+ public function pageTitle()
{
return sprintf(_("Add Page: %s"), $this->referrer());
}
- function referrer()
+ public function referrer()
{
return $this->_newpage;
}
/**
* Display modes supported by this page.
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
*
* @return string The page content.
*/
- function content()
+ public function content()
{
return $GLOBALS['wicked']->getAllPages();
}
* @return string The page contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$template = $GLOBALS['injector']->createInstance('Horde_Template');
$pages = array();
return $contents;
}
- function pageName()
+ public function pageName()
{
return 'AllPages';
}
- function pageTitle()
+ public function pageTitle()
{
return _("All Pages");
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_EDIT => true,
Wicked::MODE_REMOVE => true,
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
/**
* Constructor.
*/
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
*
* @throws Wicked_Exception
*/
- function content()
+ public function content()
{
global $wicked, $notification;
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
global $registry, $wicked, $notification, $conf;
echo $template->fetch(WICKED_TEMPLATES . '/display/AttachedFiles.html');
}
- function pageName()
+ public function pageName()
{
return 'AttachedFiles';
}
- function pageTitle()
+ public function pageTitle()
{
return sprintf(_("Attached Files: %s"), $this->referrer());
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
/**
* Retrieves the form fields and processes the attachment.
*/
- function handleAction()
+ public function handleAction()
{
global $notification, $wicked, $registry, $conf;
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true);
/**
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
* @return string The contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$summaries = $GLOBALS['wicked']->getBackLinks($this->_referrer);
Horde::addScriptFile('tables.js', 'horde', true);
return ob_get_clean();
}
- function pageName()
+ public function pageName()
{
return 'BackLinks';
}
- function pageTitle()
+ public function pageTitle()
{
return sprintf(_("Backlinks: %s"), $this->referrer());
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
*
* @var array
*/
- var $supportedModes = array(Wicked::MODE_DISPLAY => true);
+ public $supportedModes = array(Wicked::MODE_DISPLAY => true);
/**
* The page that we're confirming deletion for.
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
* Send them back whence they came if they aren't allowed to
* delete this page.
*/
- function preDisplay()
+ public function preDisplay()
{
$page = Wicked_Page::getPage($this->referrer());
if (!$page->allows(Wicked::MODE_REMOVE)) {
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
$version = Horde_Util::getFormData('version');
$page = Wicked_Page::getPage($this->referrer(), $version);
<?php
}
- function pageName()
+ public function pageName()
{
return 'DeletePage';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Delete Page");
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
- function handleAction()
+ public function handleAction()
{
$pagename = $this->referrer();
$page = Wicked_Page::getPage($pagename);
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true,
Wicked::MODE_EDIT => true);
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
if ($GLOBALS['conf']['lock']['driver'] != 'none') {
*
* @return boolean True if the mode is allowed.
*/
- function allows($mode)
+ public function allows($mode)
{
if ($mode == Wicked::MODE_EDIT) {
$page = Wicked_Page::getPage($this->referrer());
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
* Send them back whence they came if they aren't allowed to edit
* this page.
*/
- function preDisplay()
+ public function preDisplay()
{
if (!$this->allows(Wicked::MODE_EDIT)) {
Wicked::url($this->referrer(), true)->redirect();
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
$page = Wicked_Page::getPage($this->referrer());
$page_text = Horde_Util::getFormData('page_text');
require WICKED_TEMPLATES . '/edit/standard.inc';
}
- function pageName()
+ public function pageName()
{
return 'EditPage';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Edit Page");
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
- function isLocked()
+ public function isLocked()
{
$page = Wicked_Page::getPage($this->referrer());
return $page->isLocked();
}
- function getLockRequestor()
+ public function getLockRequestor()
{
$page = Wicked_Page::getPage($this->referrer());
return $page->getLockRequestor();
}
- function getLockTime()
+ public function getLockTime()
{
$page = Wicked_Page::getPage($this->referrer());
return $page->getLockTime();
}
- function handleAction()
+ public function handleAction()
{
global $notification, $conf;
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
*
* @return string The page contents.
*/
- function content($numPages = 10)
+ public function content($numPages = 10)
{
return $GLOBALS['wicked']->leastPopular($numPages);
}
* @return string The content.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$template = $GLOBALS['injector']->createInstance('Horde_Template');
$pages = array();
return $content;
}
- function pageName()
+ public function pageName()
{
return 'LeastPopular';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Least Popular");
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true);
/**
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
* @return string The contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$referrer = $this->referrer();
$summaries = $GLOBALS['wicked']->getLikePages($referrer);
return ob_get_clean();
}
- function pageName()
+ public function pageName()
{
return 'LikePages';
}
- function pageTitle()
+ public function pageTitle()
{
return sprintf(_("Similar Pages: %s"), $this->referrer());
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_EDIT => true,
Wicked::MODE_DISPLAY => true);
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
/**
* Validation errors.
*
* @var string
*/
- var $_errors = array();
+ protected $_errors = array();
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
*
* @return boolean True if the mode is allowed.
*/
- function allows($mode)
+ public function allows($mode)
{
if ($mode == Wicked::MODE_EDIT) {
if (!parent::allows(Wicked::MODE_REMOVE)) {
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
global $wicked, $registry, $notification;
return true;
}
- function pageName()
+ public function pageName()
{
return 'MergeOrRename';
}
- function pageTitle()
+ public function pageTitle()
{
return sprintf(_("Merge/Rename: %s"), $this->referrer());
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
/**
* Retrieve the form fields and process the merge or rename.
*/
- function handleAction()
+ public function handleAction()
{
global $wicked, $notification, $registry;
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
*
* @return string The page content.
*/
- function content($numPages = 10)
+ public function content($numPages = 10)
{
return $GLOBALS['wicked']->mostPopular($numPages);
}
* @return string The content.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$template = $GLOBALS['injector']->createInstance('Horde_Template');
$pages = array();
return $contents;
}
- function pageName()
+ public function pageName()
{
return 'MostPopular';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Most Popular");
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true,
Wicked::MODE_EDIT => true);
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
/**
* Page template to use.
*
* @var string
*/
- var $_template = null;
+ protected $_template = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
$this->_template = Horde_Util::getFormData('template');
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
* Send them back whence they came if they aren't allowed to edit
* this page.
*/
- function preDisplay()
+ public function preDisplay()
{
if (!strlen($this->referrer())) {
$GLOBALS['notification']->push(_("Page name must not be empty"));
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
// Load the page template.
if ($this->_template) {
return true;
}
- function pageName()
+ public function pageName()
{
return 'NewPage';
}
- function pageTitle()
+ public function pageTitle()
{
return _("New Page");
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
- function handleAction()
+ public function handleAction()
{
global $notification, $wicked;
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
* @return string The page content.
* @throws Wicked_Exception
*/
- function content()
+ public function content()
{
global $wicked;
* @return string The contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$template = $GLOBALS['injector']->createInstance('Horde_Template');
$template->set('changes', $this->content());
return $template->fetch(WICKED_TEMPLATES . '/display/RecentChanges.html');
}
- function pageName()
+ public function pageName()
{
return 'RecentChanges';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Recent Changes");
}
*
* @var array
*/
- var $supportedModes = array(Wicked::MODE_DISPLAY => true);
+ public $supportedModes = array(Wicked::MODE_DISPLAY => true);
/**
* The page that we're confirming reversion for.
*
* @var string
*/
- var $_referrer = null;
+ protected $_referrer = null;
- function __construct($referrer)
+ public function __construct($referrer)
{
$this->_referrer = $referrer;
}
*
* @return integer The permissions bitmask.
*/
- function getPermissions()
+ public function getPermissions()
{
return parent::getPermissions($this->referrer());
}
* Send them back whence they came if they aren't allowed to
* edit this page.
*/
- function preDisplay()
+ public function preDisplay()
{
$page = Wicked_Page::getPage($this->referrer());
if (!$page->allows(Wicked::MODE_EDIT)) {
*
* @throws Wicked_Exception
*/
- function display()
+ public function display()
{
$version = Horde_Util::getFormData('version');
$page = Wicked_Page::getPage($this->referrer(), $version);
<?php
}
- function pageName()
+ public function pageName()
{
return 'RevertPage';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Revert Page");
}
- function referrer()
+ public function referrer()
{
return $this->_referrer;
}
- function handleAction()
+ public function handleAction()
{
global $notification;
* Display modes supported by this page.
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
*
* @var array
*/
- var $_results = array();
+ protected $_results = array();
/**
* Renders this page in content mode.
*
* @return string The page content.
*/
- function content($searchtext = '')
+ public function content($searchtext = '')
{
if (empty($searchtext)) {
return array();
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
- function preDisplay($mode, $params)
+ public function preDisplay($mode, $params)
{
$this->_results = $this->content($params);
}
*
* @throws Wicked_Exception
*/
- function display($searchtext)
+ public function display($searchtext)
{
global $notification;
return true;
}
- function getContext($page, $searchtext)
+ public function getContext($page, $searchtext)
{
if (preg_match('/.{0,100}' . preg_quote($searchtext, '/') . '.{0,100}/i', $page->getText(), $context)) {
return preg_replace('/' . preg_quote($searchtext, '/') . '/i', '<span class="match">' . htmlspecialchars($searchtext) . '</span>', htmlspecialchars($context[0]));
return '';
}
- function pageName()
+ public function pageName()
{
return 'Search';
}
- function pageTitle()
+ public function pageTitle()
{
return _("Search");
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true,
Wicked::MODE_EDIT => false,
Wicked::MODE_REMOVE => true,
*
* @throws Wicked_Exception
*/
- function __construct($pagename, $version = null)
+ public function __construct($pagename, $version = null)
{
if (empty($version)) {
parent::__construct($pagename);
$this->_page = $pages[0];
}
- function isOld()
+ public function isOld()
{
return true;
}
- function pageUrl($linkpage = null, $actionId = null)
+ public function pageUrl($linkpage = null, $actionId = null)
{
return Horde_Util::addParameter(parent::pageUrl($linkpage, $actionId), 'version', $this->version());
}
*
* @var array
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_DISPLAY => true,
Wicked::MODE_EDIT => true,
Wicked::MODE_REMOVE => true,
*
* @var Horde_Lock
*/
- var $_locks = null;
+ protected $_locks = null;
/**
* Lock information if this page is currently locked.
*
* @var array
*/
- var $_lock = null;
+ protected $_lock = null;
/**
* Constructs a standard page class to represent a wiki page.
*
* @param string $pagename The name of the page to represent.
*/
- function __construct($pagename)
+ public function __construct($pagename)
{
if (is_array($pagename)) {
$this->_page = $pagename;
*
* @return boolean True if the mode is allowed.
*/
- function allows($mode)
+ public function allows($mode)
{
switch ($mode) {
case Wicked::MODE_EDIT:
/**
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
$wiki = $this->getProcessor();
$text = $wiki->transform($this->getText());
*
* @throws Wicked_Exception
*/
- function history()
+ public function history()
{
try {
$summaries = $GLOBALS['wicked']->getHistory($this->pageName());
require WICKED_TEMPLATES . '/history/footer.inc';
}
- function isLocked($owner = null)
+ public function isLocked($owner = null)
{
if (empty($this->_lock)) {
return false;
/**
* @throws Wicked_Exception
*/
- function lock()
+ public function lock()
{
if ($this->_locks) {
$id = $this->_locks->setLock(Wicked::lockUser(), 'wicked', $this->pageName(), $GLOBALS['conf']['wicked']['lock']['time'] * 60, Horde_Lock::TYPE_EXCLUSIVE);
}
}
- function unlock()
+ public function unlock()
{
if ($this->_locks && $this->_lock) {
$this->_locks->clearLock($this->_lock['lock_id']);
}
}
- function getLockRequestor()
+ public function getLockRequestor()
{
$requestor = $this->_lock['lock_owner'];
if ($requestor) {
return _("a guest");
}
- function getLockTime()
+ public function getLockTime()
{
$time = ceil(($this->_lock['lock_expiry_timestamp'] - time()) / 60);
return sprintf(ngettext("%d minute", "%d minutes", $time), $time);
/**
* @throws Wicked_Exception
*/
- function updateText($newtext, $changelog, $minorchange)
+ public function updateText($newtext, $changelog, $minorchange)
{
$version = $this->version();
$result = $GLOBALS['wicked']->updateText($this->pageName(), $newtext,
$this->_page['page_text'] = $newtext;
}
- function pageID()
+ public function pageID()
{
return isset($this->_page['page_id']) ? $this->_page['page_id'] : '';
}
- function pageName()
+ public function pageName()
{
return isset($this->_page['page_name'])
? $this->_page['page_name']
: '';
}
- function getText()
+ public function getText()
{
return isset($this->_page['page_text'])
? $this->_page['page_text']
: '';
}
- function versionCreated()
+ public function versionCreated()
{
return isset($this->_page['version_created'])
? $this->_page['version_created']
: '';
}
- function hits()
+ public function hits()
{
return !empty($this->_page['page_hits'])
? $this->_page['page_hits']
: 0;
}
- function changeLog()
+ public function changeLog()
{
return $this->_page['change_log'];
}
- function version()
+ public function version()
{
if (isset($this->_page['page_majorversion']) &&
isset($this->_page['page_minorversion'])) {
}
}
- function diff($version)
+ public function diff($version)
{
require WICKED_TEMPLATES . '/diff/diff.inc';
}
* `before the beginning' (empty).
* @param string $renderer The diff renderer.
*/
- function getDiff($version, $renderer = 'unified')
+ public function getDiff($version, $renderer = 'unified')
{
if (is_null($version)) {
$old_page_text = '';
/**
* Display modes supported by this page.
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true,
Wicked::MODE_DISPLAY => true);
/**
* Sync driver
*/
- var $_sync;
+ protected $_sync;
/**
* Working page
*/
- var $_pageName;
+ protected $_pageName;
- function __construct()
+ public function __construct()
{
parent::__construct();
$this->_pageName = Horde_Util::getGet('sync_page');
*
* @throws Wicked_Exception
*/
- function content()
+ public function content()
{
if (!$this->_loadSyncDriver()) {
throw new Wicked_Exception(_("Synchronization is disabled"));
* @return string The page contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
return $this->content();
}
/**
* Page name
*/
- function pageName()
+ public function pageName()
{
return 'SyncDiff';
}
/**
* Page title
*/
- function pageTitle()
+ public function pageTitle()
{
return _("Sync Diff");
}
*
* @throws Wicked_Exception
*/
- function _getSameVersion()
+ protected function _getSameVersion()
{
$local = $GLOBALS['wicked']->getHistory($this->_pageName);
$info = $this->getLocalPageInfo($this->_pageName);
/**
* Display modes supported by this page.
*/
- var $supportedModes = array(
+ public $supportedModes = array(
Wicked::MODE_CONTENT => true);
/**
* Sync driver
*/
- var $_sync;
+ protected $_sync;
/**
* Constructor
*
* @throws Wicked_Exception
*/
- function __construct()
+ public function __construct()
{
$this->_loadSyncDriver();
* @return string The page content.
* @throws Wicked_Exception
*/
- function content()
+ public function content()
{
global $wicked;
* @return string The contents.
* @throws Wicked_Exception
*/
- function displayContents($isBlock)
+ public function displayContents($isBlock)
{
return $this->content();
}
/**
* Page name
*/
- function pageName()
+ public function pageName()
{
return 'SyncPages';
}
/**
* Page title
*/
- function pageTitle()
+ public function pageTitle()
{
return _("Sync Pages");
}
/**
* Prepare page link
*/
- function _viewLink($pageName, $local = true)
+ protected function _viewLink($pageName, $local = true)
{
if ($local) {
return '<a href="' . Wicked::url($pageName) . '" target="_blank">' . _("View local") . '</a>';
*
* @throws Wicked_Exception
*/
- function _syncForm()
+ protected function _syncForm()
{
require_once 'Horde/Form.php';
*
* @param boolean $local Get local or remote info
*/
- function getLocalPageInfo($pageName)
+ public function getLocalPageInfo($pageName)
{
$page = Wicked_Page::getPage($pageName);
return array(
*
* @throws Wicked_Exception
*/
- function getRemotePageInfo($pageName)
+ public function getRemotePageInfo($pageName)
{
if (!isset($_SESSION['wicked']['sync']['pages'][$pageName])) {
$_SESSION['wicked']['sync']['pages'][$pageName] = $this->_sync->getPageInfo($pageName);
*
* @throws Wicked_Exception
*/
- function download($pageName)
+ public function download($pageName)
{
$text = $this->_sync->getPageSource($pageName);
$page = Wicked_Page::getPage($pageName);
/**
* Upload local page to remote server
*/
- function upload($pageName)
+ public function upload($pageName)
{
$page = Wicked_Page::getPage($pageName);
$content = $page->getText();
/**
* Load sync driver
*/
- function _loadSyncDriver()
+ protected function _loadSyncDriver()
{
if ($this->_sync) {
return true;
*
* @var array
*/
- var $_params = array();
+ protected $_params = array();
/**
* Attempts to return a concrete Wicked_Sync instance based on $driver.
* @return Wicked_Sync The newly created concrete Wicked_Sync
* instance, or false on an error.
*/
- function factory($driver = 'Wicked', $params = array())
+ public function factory($driver = 'Wicked', $params = array())
{
$driver = Horde_String::ucfirst(basename($driver));
$class = 'Wicked_Sync_' . $driver;
*
* @param array $params A hash containing connection parameters.
*/
- function __construct($params = array())
+ public function __construct($params = array())
{
$this->_params = $params;
}
*
* @return array An array of all available pages.
*/
- var $_client;
+ protected $_client;
/**
* Returns a list of available pages.
*
* @return array An array of all available pages.
*/
- function listPages()
+ public function listPages()
{
return $this->_getData('list');
}
* @return string Page data.
* @throws Wicked_Exception
*/
- function getPageSource($pageName)
+ public function getPageSource($pageName)
{
return $this->_getData('getPageSource', array($pageName));
}
* @return array Page data.
* @throws Wicked_Exception
*/
- function getPageInfo($pageName)
+ public function getPageInfo($pageName)
{
return $this->_getData('getPageInfo', array($pageName));
}
* @return array Pages data.
* @throws Wicked_Exception
*/
- function getMultiplePageInfo($pages = array())
+ public function getMultiplePageInfo($pages = array())
{
return $this->_getData('getMultiplePageInfo', array($pages));
}
*
* @return array An array of page parameters.
*/
- function getPageHistory($pagename)
+ public function getPageHistory($pagename)
{
return $this->_getData('getPageHistory', array($pagename));
}
*
* @throws Wicked_Exception
*/
- function editPage($pagename, $text, $changelog = '', $minorchange = false)
+ public function editPage($pagename, $text, $changelog = '', $minorchange = false)
{
$this->_getData('edit', array($pagename, $text, $changelog, $minorchange));
}
* @return mixed
* @throws Wicked_Exception
*/
- function _getData($method, $params = array())
+ protected function _getData($method, $params = array())
{
try {
return Horde_Rpc::request(
*
* @package Wicked
*/
-class Text_Wiki_Parse_Attribute extends Text_Wiki_Parse {
-
+class Text_Wiki_Parse_Attribute extends Text_Wiki_Parse
+{
/**
* The regular expression used to find source text matching this rule (this
* is set in the constructor).
*
* @var string
*/
- var $regex;
+ public $regex;
- function Text_Wiki_Parse_Attribute(&$obj)
+ public function __construct(&$obj)
{
parent::Text_Wiki_Parse($obj);
* @return A delimited token number to be used as a placeholder in
* the source text.
*/
- function process(&$matches)
+ public function process(&$matches)
{
$options = array('attributes' => array());
return $this->wiki->addToken($this->rule, $options);
}
-
}
*
* @package Wicked
*/
-class Text_Wiki_Parse_Code2 extends Text_Wiki_Parse_Code {
- var $regex = ';^<code(\s[^>]*)?>(.*?)\n</code>(\s|$);msi';
+class Text_Wiki_Parse_Code2 extends Text_Wiki_Parse_Code
+{
+ public $regex = ';^<code(\s[^>]*)?>(.*?)\n</code>(\s|$);msi';
}
*
* @package Wicked
*/
-class Text_Wiki_Parse_Registrylink extends Text_Wiki_Parse {
-
+class Text_Wiki_Parse_Registrylink extends Text_Wiki_Parse
+{
/**
* The regular expression used to find registry links.
*
*
* @var string
*/
- var $regex = "/\[\[link (.*)\]\]/sU";
+ public $regex = "/\[\[link (.*)\]\]/sU";
/**
* Generates a token entry for the matched text. Token options are:
* @return A delimited token number to be used as a placeholder in
* the source text.
*/
- function process(&$matches)
+ public function process(&$matches)
{
@list($title, $call) = explode('|', $matches[1], 2);
$opts = explode(' ', trim($call));
'method' => $method,
'args' => $args));
}
-
}
*
* @package Wicked
*/
-class Text_Wiki_Parse_Wickedblock extends Text_Wiki_Parse {
-
+class Text_Wiki_Parse_Wickedblock extends Text_Wiki_Parse
+{
/**
* The regular expression used to find blocks.
*
*
* @var string
*/
- var $regex = "/\[\[block (.*)?\]\]/sU";
+ public $regex = "/\[\[block (.*)?\]\]/sU";
/**
* Generates a token entry for the matched text. Token options are:
* @return A delimited token number to be used as a placeholder in
* the source text.
*/
- function process(&$matches)
+ public function process(&$matches)
{
}
-
}
/**
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Attribute extends Text_Wiki_Render {
-
+class Text_Wiki_Render_Xhtml_Attribute extends Text_Wiki_Render
+{
/**
* Renders a token into text matching the requested format.
*
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
$output = '<table width="100%" class="attributes"><tbody>';
return $output;
}
-
}
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
$type = $options['attr']['type'];
*
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Image2 extends Text_Wiki_Render {
-
- var $conf = array(
+class Text_Wiki_Render_Xhtml_Image2 extends Text_Wiki_Render
+{
+ public $conf = array(
'base' => '',
'url_base' => null,
'css' => null,
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
if (!isset($options['attr']['alt'])) {
$options['attr']['alt'] = $options['src'];
*
* @return string The text rendered from the token options.
*/
- function _token($options)
+ protected function _token($options)
{
// note the image source
$src = $options['src'];
return $output;
}
-
}
/**
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
-
- var $conf = array(
+class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render
+{
+ public $conf = array(
'sites' => array(
'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
'Advogato' => 'http://advogato.org/%s',
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
$site = $options['site'];
$page = $options['page'];
return '<a' . $target . ' href="' . Horde::externalUrl($href) . '">' . $text . '</a>';
}
-
}
*
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Registrylink extends Text_Wiki_Render {
-
+class Text_Wiki_Render_Xhtml_Registrylink extends Text_Wiki_Render
+{
/**
* Renders a token into text matching the requested format.
*
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
try {
$link = new Horde_Url($GLOBALS['registry']->link($options['method'], $options['args']));
return $link->link() . $options['title'] . '</a>';
}
-
}
/**
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
-
- var $conf = array(
+class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render
+{
+ public $conf = array(
'css_list' => null,
'css_item' => null,
'title' => '<strong>Table of Contents</strong>',
'div_id' => 'toc',
);
- var $_last_level = null;
+ protected $_last_level = null;
/**
* Renders a token into text matching the requested format.
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
// type, id, level, count, attr.
extract($options);
return '</a>';
}
}
-
}
/**
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
-
- var $conf = array(
+class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render
+{
+ public $conf = array(
'target' => '_blank'
);
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
// Create local variables from the options array (text, href,
// type).
return $output;
}
-
}
*
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Wickedblock extends Text_Wiki_Render {
-
+class Text_Wiki_Render_Xhtml_Wickedblock extends Text_Wiki_Render
+{
/**
* Renders a token into text matching the requested format.
*
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
}
-
}
/**
* @package Wicked
*/
-class Text_Wiki_Render_Xhtml_Wikilink2 extends Text_Wiki_Render_Xhtml_Wikilink {
-
+class Text_Wiki_Render_Xhtml_Wikilink2 extends Text_Wiki_Render_Xhtml_Wikilink
+{
/**
* Renders a token into XHTML.
*
*
* @return string The text rendered from the token options.
*/
- function token($options)
+ public function token($options)
{
// make nice variable names (page, anchor, text)
extract($options);
}
return $output;
}
-
}
* Driver we are testing
* @var object
*/
- var $wicked;
+ public $wicked;
function setUp()
{