Ignore:
Timestamp:
Aug 20, 2008, 1:58:35 AM (16 years ago)
Author:
rvelices
Message:
  • ws can include php file before invoking web call method
  • remove "Pierrick ..." from some languages
  • tags - small change to avoid increasing number of urls
  • added a missing closedir
  • remove some unnecessary class names and inexisting rel attributes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_core.inc.php

    r2299 r2478  
    345345  var $_responseFormat;
    346346
    347   var $_methods;
    348   var $_methodSignatures;
     347  var $_methods = array();
    349348
    350349  function PwgServer()
    351350  {
    352     $methods = array();
    353351  }
    354352
     
    436434  function addMethod($methodName, $callback, $params=array(), $description, $include_file='')
    437435  {
    438     $this->_methods[$methodName] = $callback;
    439     $this->_methodDescriptions[$methodName] = $description;
    440 
    441436    if (!is_array($params))
    442437    {
     
    470465      }
    471466    }
    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      );
    473474  }
    474475
     
    480481  function getMethodDescription($methodName)
    481482  {
    482     $desc = @$this->_methodDescriptions[$methodName];
     483    $desc = @$this->_methods[$methodName]['description'];
    483484    return isset($desc) ? $desc : '';
    484485  }
     
    486487  function getMethodSignature($methodName)
    487488  {
    488     $signature = @$this->_methodSignatures[$methodName];
     489    $signature = @$this->_methods[$methodName]['signature'];
    489490    return isset($signature) ? $signature : array();
    490491  }
     
    518519  function invoke($methodName, $params)
    519520  {
    520     $callback = @$this->_methods[$methodName];
    521 
    522     if ( $callback==null )
     521    $method = @$this->_methods[$methodName];
     522
     523    if ( $method==null )
    523524    {
    524525      return new PwgError(WS_ERR_INVALID_METHOD, 'Method name "'.$methodName.'" is not valid');
     
    526527
    527528    // parameter check and data coercion !
    528     $signature = @$this->_methodSignatures[$methodName];
     529    $signature = $method['signature'];
    529530    $missing_params = array();
    530531    foreach($signature as $name=>$options)
     
    571572    if ( strtolower( get_class($result) )!='pwgerror')
    572573    {
    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) );
    574579    }
    575580    return $result;
Note: See TracChangeset for help on using the changeset viewer.