[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/htsrv/ -> call_plugin.php (source)

   1  <?php
   2  /**

   3   * This file gets used to access {@link Plugin} methods that are marked to be accessible this

   4   * way. See {@link Plugin::GetHtsrvMethods()}.

   5   *

   6   * This file is part of the evoCore framework - {@link http://evocore.net/}

   7   * See also {@link http://sourceforge.net/projects/evocms/}.

   8   *

   9   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

  10   * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.

  11   *

  12   * {@internal License choice

  13   * - If you have received this file as part of a package, please find the license.txt file in

  14   *   the same folder or the closest folder above for complete license terms.

  15   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  16   *   then you must choose one of the following licenses before using the file:

  17   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  18   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  19   * }}

  20   *

  21   * {@internal Open Source relicensing agreement:

  22   * Daniel HAHLER grants Francois PLANQUE the right to license

  23   * Daniel HAHLER's contributions to this file and the b2evolution project

  24   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  25   * }}

  26   *

  27   * @package htsrv

  28   *

  29   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  30   * @author fplanque: Francois PLANQUE

  31   * @author blueyed: Daniel HAHLER

  32   *

  33   * @version $Id: call_plugin.php,v 1.10 2007/07/04 21:11:11 blueyed Exp $

  34   */
  35  
  36  
  37  /**

  38   * Initialize:

  39   * TODO: Don't do a full init!

  40   */
  41  require_once dirname(__FILE__).'/../conf/_config.php';
  42  require_once $inc_path.'_main.inc.php';
  43  
  44  
  45  param( 'plugin_ID', 'integer', true );
  46  param( 'method', 'string', '' );
  47  param( 'params', 'string', null ); // serialized

  48  
  49  if( is_null($params) )
  50  { // Default:
  51      $params = array();
  52  }
  53  else
  54  { // params given. This may result in "false", but this means that unserializing failed.
  55      $params = @unserialize($params);
  56  }
  57  
  58  
  59  if( $plugin_ID )
  60  {
  61      $Plugin = & $Plugins->get_by_ID( $plugin_ID );
  62  
  63      if( ! $Plugin )
  64      {
  65          debug_die( 'Invalid Plugin!' );
  66      }
  67  
  68  
  69      if( method_exists( $Plugin, 'get_htsrv_methods' ) )
  70      { // TODO: get_htsrv_methods is deprecated, but should stay here for transformation! (blueyed, 2006-04-27)
  71          if( ! in_array( $method, $Plugin->get_htsrv_methods() ) )
  72          {
  73              debug_die( 'Call to non-htsrv Plugin method!' );
  74          }
  75      }
  76      else
  77      if( ! in_array( $method, $Plugin->GetHtsrvMethods() ) )
  78      {
  79          debug_die( 'Call to non-htsrv Plugin method!' );
  80      }
  81      elseif( ! method_exists( $Plugin, 'htsrv_'.$method ) )
  82      {
  83          debug_die( 'htsrv method does not exist!' );
  84      }
  85  
  86      // Call the method:

  87      $Plugins->call_method( $Plugin->ID, 'htsrv_'.$method, $params );
  88  }
  89  
  90  
  91  /* {{{ Revision log:

  92   * $Log: call_plugin.php,v $

  93   * Revision 1.10  2007/07/04 21:11:11  blueyed

  94   * $params default to array()

  95   *

  96   * Revision 1.9  2007/04/26 00:11:14  fplanque

  97   * (c) 2007

  98   *

  99   * Revision 1.8  2007/01/18 00:21:16  blueyed

 100   * doc

 101   *

 102   * Revision 1.7  2006/11/24 18:27:22  blueyed

 103   * Fixed link to b2evo CVS browsing interface in file docblocks

 104   *

 105   * Revision 1.6  2006/09/30 20:03:52  blueyed

 106   * Do not debug_die() if Plugins htsrv-method returned false.

 107   *

 108   * Revision 1.5  2006/04/27 20:07:19  blueyed

 109   * Renamed Plugin::get_htsrv_methods() to GetHtsrvMethods() (normalization)

 110   *

 111   * Revision 1.4  2006/04/19 20:13:48  fplanque

 112   * do not restrict to :// (does not catch subdomains, not even www.)

 113   *

 114   * Revision 1.3  2006/03/12 23:08:53  fplanque

 115   * doc cleanup

 116   *

 117   * Revision 1.2  2006/02/28 18:07:55  blueyed

 118   * Path fixes

 119   *

 120   * Revision 1.1  2006/01/28 23:43:35  blueyed

 121   * htsrv method for plugins. See Plugin::get_htsrv_url().

 122   *

 123   * }}}

 124   */
 125  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics