Net_Growl
[ class tree: Net_Growl ] [ index: Net_Growl ] [ all elements ]

Source for file udpAdapterNotifyPEARerrors.php

Documentation is available at udpAdapterNotifyPEARerrors.php

  1. <?php
  2. /**
  3.  * Example that send notifications to Growl about PEAR Errors
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * @category Networking
  8.  * @package  Net_Growl
  9.  * @author   Laurent Laville <pear@laurent-laville.org>
  10.  * @author   Bertrand Mansion <bmansion@mamasam.com>
  11.  * @license  http://www.opensource.org/licenses/bsd-license.php  BSD
  12.  * @version  SVN: Release: 2.7.0
  13.  * @link     http://growl.laurent-laville.org/
  14.  * @since    File available since Release 2.0.0RC2
  15.  */
  16.  
  17. require_once 'Net/Growl/Autoload.php';
  18. require_once 'PEAR.php';
  19.  
  20. // Notification Type definitions
  21. define('GROWL_NOTIFY_PEARERROR''PEAR_Error');
  22.  
  23. /**
  24.  * PEAR_Error callback function
  25.  *
  26.  * @param object $error PEAR_Error instance
  27.  *
  28.  * @return void 
  29.  */
  30. function growlErrors($error)
  31. {
  32.     static $app;
  33.  
  34.     if (!isset($app)) {
  35.         $app = new Net_Growl_Application(
  36.             'Net_Growl'array(GROWL_NOTIFY_PEARERROR)
  37.         );
  38.     }
  39.  
  40.     $growl Net_Growl::singleton(
  41.         $appnull
  42.     );
  43.     $growl->publish(
  44.         GROWL_NOTIFY_PEARERROR,
  45.         get_class($error),
  46.         $error->message.' in '.$_SERVER['SCRIPT_NAME'],
  47.         array('sticky' => true)
  48.     );
  49. }
  50.  
  51. if (version_compare(PHP_VERSION'5.3.0''lt')) {
  52.     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK'growlErrors');
  53.     PEAR::raiseError("The expected error you submitted does not exist");
  54. else {
  55.     $pear = new PEAR;
  56.     $pear->setErrorHandling(PEAR_ERROR_CALLBACK'growlErrors');
  57.     $pear->raiseError("The expected error you submitted does not exist");
  58. }

Documentation generated on Tue, 29 Jan 2013 18:30:06 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.