Your IP : 216.73.216.108


Current Path : /home/m/a/g/magalijoj/www/blog/inc/core/
Upload File :
Current File : /home/m/a/g/magalijoj/www/blog/inc/core/class.dc.rest.php

<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2005 Olivier Meunier. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# DotClear is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****

/**
@ingroup DC_CORE
@brief Dotclear REST server extension

This class extends restServer to handle dcCore instance in each rest mehod call.
Instance of this class is provided by dcCore $rest.
*/
class dcRestServer extends restServer
{
	public $core;		///< dcCore instance
	
	/**
	Object constructor.
	
	@param	core		<b>dcCore</b>		dcCore instance
	*/
	public function __construct(&$core)
	{
		parent::__construct();
		
		$this->core =& $core;
	}
	
	/**
	Rest method call.
	
	@param	name		<b>string</b>		Method name
	@param	get		<b>array</b>		GET parameters copy
	@param	post		<b>array</b>		POST parameters copy
	@return	<b>mixed</b>	Rest method result
	*/
	protected function callFunction($name,$get,$post)
	{
		if (isset($this->functions[$name])) {
			return call_user_func($this->functions[$name],$this->core,$get,$post);
		}
	}
}
?>