Ejemplo n.º 1
0
 public function __construct($config)
 {
     $this->_config = $config;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $config['webhook_url']);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     $this->_curl = $ch;
     \App::registerEvent('playlist_fetch_song', array($this, 'notifySongInPlaylistAdd'));
     \App::registerEvent('playlist_fetch', array($this, 'notifyPlaylistFetch'));
     \App::registerEvent('download_cache_miss', array($this, 'onDownloadCacheMiss'));
 }
Ejemplo n.º 2
0
 public function testEvent()
 {
     App::registerEvent('testEvent', array($this, 'sampleEventHandler'));
     App::dispatchEvent('testEvent', array('var1' => 1, 'var2' => 2));
 }