Overview

Packages

  • None
  • Wicked

Classes

  • Text_Wiki_Parse_Heading2
  • Text_Wiki_Parse_Toc2
  • Text_Wiki_Render_Latex_Heading2
  • Text_Wiki_Render_Latex_Toc2
  • Text_Wiki_Render_Plain_Heading2
  • Text_Wiki_Render_Plain_Toc2
  • Text_Wiki_Render_Rst
  • Text_Wiki_Render_Rst_Blockquote
  • Text_Wiki_Render_Rst_Bold
  • Text_Wiki_Render_Rst_Code
  • Text_Wiki_Render_Rst_Deflist
  • Text_Wiki_Render_Rst_Emphasis
  • Text_Wiki_Render_Rst_Freelink
  • Text_Wiki_Render_Rst_Heading2
  • Text_Wiki_Render_Rst_Links
  • Text_Wiki_Render_Rst_List
  • Text_Wiki_Render_Rst_Newline
  • Text_Wiki_Render_Rst_Paragraph
  • Text_Wiki_Render_Rst_Raw
  • Text_Wiki_Render_Rst_Toc2
  • Text_Wiki_Render_Rst_Tt
  • Text_Wiki_Render_Rst_Url
  • Text_Wiki_Render_Xhtml_Attribute
  • Text_Wiki_Render_Xhtml_Code2
  • Text_Wiki_Render_Xhtml_Freelink2
  • Text_Wiki_Render_Xhtml_Heading2
  • Text_Wiki_Render_Xhtml_Image2
  • Text_Wiki_Render_Xhtml_Interwiki
  • Text_Wiki_Render_Xhtml_Registrylink
  • Text_Wiki_Render_Xhtml_Toc2
  • Text_Wiki_Render_Xhtml_Url
  • Text_Wiki_Render_Xhtml_Wickedblock
  • Text_Wiki_Render_Xhtml_Wikilink2
  • Wicked
  • Wicked_Api
  • Wicked_Driver
  • Wicked_Driver_Sql
  • Wicked_Exception
  • Wicked_Factory_Driver
  • Wicked_Page
  • Wicked_Page_AddPage
  • Wicked_Page_AllPages
  • Wicked_Page_AttachedFiles
  • Wicked_Page_BackLinks
  • Wicked_Page_DeletePage
  • Wicked_Page_EditPage
  • Wicked_Page_LeastPopular
  • Wicked_Page_LikePages
  • Wicked_Page_MergeOrRename
  • Wicked_Page_MostPopular
  • Wicked_Page_NewPage
  • Wicked_Page_RecentChanges
  • Wicked_Page_RevertPage
  • Wicked_Page_Search
  • Wicked_Page_StandardHistoryPage
  • Wicked_Page_StandardPage
  • Wicked_Page_SyncDiff
  • Wicked_Page_SyncPages
  • Wicked_Sync
  • Wicked_Sync_Wicked
  • Wicked_Test
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
  4:  *
  5:  * See the enclosed file COPYING for license information (GPL). If you
  6:  * did not receive this file, see http://www.horde.org/licenses/gpl.
  7:  *
  8:  * @package Wicked
  9:  */
 10: 
 11: /**
 12:  * @author  Duck <duck@obala.net>
 13:  * @package Wicked
 14:  */
 15: class Wicked_Sync_Wicked extends Wicked_Sync
 16: {
 17:     /**
 18:      *
 19:      * @var Horde_Http_Client
 20:      */
 21:     protected $_client;
 22: 
 23:     public function __construct(array $params = array())
 24:     {
 25:         parent::__construct($params);
 26:         $this->_client = $GLOBALS['injector']->
 27:             getInstance('Horde_Core_Factory_HttpClient')->
 28:             create(array('request.username' => $this->_params['user'],
 29:                          'request.password' => $this->_params['password'])
 30:         );
 31:     }
 32: 
 33:     /**
 34:      * Returns a list of available pages.
 35:      *
 36:      * @return array  An array of all available pages.
 37:      */
 38:     public function listPages()
 39:     {
 40:         return $this->_getData('list');
 41:     }
 42: 
 43:     /**
 44:      * Get the wiki source of a page specified by its name.
 45:      *
 46:      * @param string $name  The name of the page to fetch
 47:      *
 48:      * @return string  Page data.
 49:      * @throws Wicked_Exception
 50:      */
 51:     public function getPageSource($pageName)
 52:     {
 53:         return $this->_getData('getPageSource', array($pageName));
 54:     }
 55: 
 56:     /**
 57:      * Return basic page information.
 58:      *
 59:      * @param string $pageName Page name
 60:      *
 61:      * @return array  Page data.
 62:      * @throws Wicked_Exception
 63:      */
 64:     public function getPageInfo($pageName)
 65:     {
 66:         return $this->_getData('getPageInfo', array($pageName));
 67:     }
 68: 
 69:     /**
 70:      * Return basic pages information.
 71:      *
 72:      * @param array $pages Page names to get info for
 73:      *
 74:      * @return array  Pages data.
 75:      * @throws Wicked_Exception
 76:      */
 77:     public function getMultiplePageInfo($pages = array())
 78:     {
 79:         return $this->_getData('getMultiplePageInfo', array($pages));
 80:     }
 81: 
 82:     /**
 83:      * Return page history.
 84:      *
 85:      * @param string $pagename Page name
 86:      *
 87:      * @return array  An array of page parameters.
 88:      */
 89:     public function getPageHistory($pagename)
 90:     {
 91:         return $this->_getData('getPageHistory', array($pagename));
 92:     }
 93: 
 94:     /**
 95:      * Updates content of a wiki page. If the page does not exist it is
 96:      * created.
 97:      *
 98:      * @param string $pagename Page to edit
 99:      * @param string $text Page content
100:      * @param string $changelog Description of the change
101:      *
102:      * @throws Wicked_Exception
103:      */
104:     public function editPage($pagename, $text, $changelog = '')
105:     {
106:         $this->_getData('edit', array($pagename, $text, $changelog));
107:     }
108: 
109:     /**
110:      * Process remote call
111:      *
112:      * @param string $method Method name to call
113:      * @param array $params Array of parameters
114:      *
115:      * @return mixed
116:      * @throws Wicked_Exception
117:      */
118:     protected function _getData($method, array $params = array())
119:     {
120:         try {
121:             return Horde_Rpc::request(
122:                 'xmlrpc',
123:                 $this->_params['url'],
124:                 $this->_params['prefix'] . '.' . $method,
125:                 $this->_client,
126:                 $params);
127:         } catch (Horde_Http_Client_Exception $e) {
128:             throw new Wicked_Exception($e);
129:         }
130:     }
131: 
132: }
133: 
API documentation generated by ApiGen