File: Notifications_Growl.php

package info (click to toggle)
spotweb 20130826%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,132 kB
  • ctags: 11,281
  • sloc: php: 31,367; xml: 1,009; sh: 148; makefile: 83
file content (24 lines) | stat: -rwxr-xr-x 805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
define('GROWL_SOCK', 'fsock');
require_once "lib/notifications/growl/class.growl.php"; // https://github.com/tylerhall/php-growl

class Notifications_Growl extends Notifications_abs {
	private $_connection;
	var $growlObj;

	function __construct($appName, array $dataArray) {
		$this->growlObj = new Growl($appName);
		$this->_connection = array('address' => $dataArray['host'], 'password' => $dataArray['password']);
	} # ctor

	function register() {
		$this->growlObj->addNotification('Single');
		$this->growlObj->addNotification('Multi');
		$this->growlObj->register($this->_connection);
	} # register

	function sendMessage($type, $title, $body, $sourceUrl) {
		$this->growlObj->notify($this->_connection, $type, $title, $body);
	} # sendMessage

} # Notifications_Growl