[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/libs/Request/ -> Listener.php (source)

   1  <?php
   2  // +-----------------------------------------------------------------------+

   3  // | Copyright (c) 2002-2003, Richard Heyes                                |

   4  // | All rights reserved.                                                  |

   5  // |                                                                       |

   6  // | Redistribution and use in source and binary forms, with or without    |

   7  // | modification, are permitted provided that the following conditions    |

   8  // | are met:                                                              |

   9  // |                                                                       |

  10  // | o Redistributions of source code must retain the above copyright      |

  11  // |   notice, this list of conditions and the following disclaimer.       |

  12  // | o Redistributions in binary form must reproduce the above copyright   |

  13  // |   notice, this list of conditions and the following disclaimer in the |

  14  // |   documentation and/or other materials provided with the distribution.|

  15  // | o The names of the authors may not be used to endorse or promote      |

  16  // |   products derived from this software without specific prior written  |

  17  // |   permission.                                                         |

  18  // |                                                                       |

  19  // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |

  20  // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |

  21  // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |

  22  // | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |

  23  // | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |

  24  // | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |

  25  // | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |

  26  // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |

  27  // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |

  28  // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |

  29  // | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |

  30  // |                                                                       |

  31  // +-----------------------------------------------------------------------+

  32  // | Author: Alexey Borzov <avb@php.net>                                  |

  33  // +-----------------------------------------------------------------------+

  34  //

  35  // $Id: Listener.php,v 1.2 2003/10/26 10:28:29 avb Exp $

  36  //

  37  
  38  /**

  39   * This class implements the Observer part of a Subject-Observer

  40   * design pattern. It listens to the events sent by a 

  41   * HTTP_Request or HTTP_Response instance.

  42   *

  43   * @package HTTP_Request

  44   * @author  Alexey Borzov <avb@php.net>

  45   * @version $Revision: 1.2 $

  46   */
  47  class HTTP_Request_Listener 
  48  {
  49     /**

  50      * A listener's identifier

  51      * @var string

  52      */
  53      var $_id;
  54  
  55     /**

  56      * Constructor, sets the object's identifier

  57      *

  58      * @access public

  59      */
  60      function HTTP_Request_Listener()
  61      {
  62          $this->_id = md5(uniqid('http_request_', 1));
  63      }
  64  
  65  
  66     /**

  67      * Returns the listener's identifier

  68      *

  69      * @access public

  70      * @return string

  71      */
  72      function getId()
  73      {
  74          return $this->_id;
  75      }
  76  
  77  
  78     /**

  79      * This method is called when Listener is notified of an event

  80      *

  81      * @access   public

  82      * @param    object  an object the listener is attached to

  83      * @param    string  Event name

  84      * @param    mixed   Additional data

  85      * @abstract

  86      */
  87      function update(&$subject, $event, $data = null)
  88      {
  89          echo "Notified of event: '$event'\n";
  90          if (null !== $data) {
  91              echo "Additional data: ";
  92              var_dump($data);
  93          }
  94      }
  95  }
  96  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics