Changeset 2478 for trunk/include/ws_core.inc.php
- Timestamp:
- Aug 20, 2008, 1:58:35 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_core.inc.php
r2299 r2478 345 345 var $_responseFormat; 346 346 347 var $_methods; 348 var $_methodSignatures; 347 var $_methods = array(); 349 348 350 349 function PwgServer() 351 350 { 352 $methods = array();353 351 } 354 352 … … 436 434 function addMethod($methodName, $callback, $params=array(), $description, $include_file='') 437 435 { 438 $this->_methods[$methodName] = $callback;439 $this->_methodDescriptions[$methodName] = $description;440 441 436 if (!is_array($params)) 442 437 { … … 470 465 } 471 466 } 472 $this->_methodSignatures[$methodName] = $params; 467 468 $this->_methods[$methodName] = array( 469 'callback' => $callback, 470 'description' => $description, 471 'signature' => $params, 472 'include' => $include_file, 473 ); 473 474 } 474 475 … … 480 481 function getMethodDescription($methodName) 481 482 { 482 $desc = @$this->_method Descriptions[$methodName];483 $desc = @$this->_methods[$methodName]['description']; 483 484 return isset($desc) ? $desc : ''; 484 485 } … … 486 487 function getMethodSignature($methodName) 487 488 { 488 $signature = @$this->_method Signatures[$methodName];489 $signature = @$this->_methods[$methodName]['signature']; 489 490 return isset($signature) ? $signature : array(); 490 491 } … … 518 519 function invoke($methodName, $params) 519 520 { 520 $ callback= @$this->_methods[$methodName];521 522 if ( $ callback==null )521 $method = @$this->_methods[$methodName]; 522 523 if ( $method==null ) 523 524 { 524 525 return new PwgError(WS_ERR_INVALID_METHOD, 'Method name "'.$methodName.'" is not valid'); … … 526 527 527 528 // parameter check and data coercion ! 528 $signature = @$this->_methodSignatures[$methodName];529 $signature = $method['signature']; 529 530 $missing_params = array(); 530 531 foreach($signature as $name=>$options) … … 571 572 if ( strtolower( get_class($result) )!='pwgerror') 572 573 { 573 $result = call_user_func_array($callback, array($params, &$this) ); 574 if ( !empty($method['include']) ) 575 { 576 include_once( $method['include'] ); 577 } 578 $result = call_user_func_array($method['callback'], array($params, &$this) ); 574 579 } 575 580 return $result;
Note: See TracChangeset
for help on using the changeset viewer.