mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
Fix for PSR0 compatibility
Not sure how relevant it is.
This commit is contained in:
parent
2bb142eeb8
commit
3c508686ca
4 changed files with 17 additions and 18 deletions
1
.php_cs
1
.php_cs
|
@ -15,7 +15,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||||
|
|
||||||
return Symfony\CS\Config\Config::create()
|
return Symfony\CS\Config\Config::create()
|
||||||
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||||
->fixers(array('-psr0'))
|
|
||||||
->finder($finder)
|
->finder($finder)
|
||||||
->setUsingCache(true)
|
->setUsingCache(true)
|
||||||
;
|
;
|
||||||
|
|
|
@ -22,11 +22,11 @@ class UPnPDevice
|
||||||
*/
|
*/
|
||||||
private function restoreDescriptionUrl($descriptionUrl)
|
private function restoreDescriptionUrl($descriptionUrl)
|
||||||
{
|
{
|
||||||
debug_event('upnpdevice', 'readDescriptionUrl: ' . $descriptionUrl, 5);
|
debug_event('UPnPDevice', 'readDescriptionUrl: ' . $descriptionUrl, 5);
|
||||||
$this->_settings = json_decode(Session::read('upnp_dev_' . $descriptionUrl), true);
|
$this->_settings = json_decode(Session::read('upnp_dev_' . $descriptionUrl), true);
|
||||||
|
|
||||||
if ($this->_settings['descriptionURL'] == $descriptionUrl) {
|
if ($this->_settings['descriptionURL'] == $descriptionUrl) {
|
||||||
debug_event('upnpdevice', 'service Urls restored from session.', 5);
|
debug_event('UPnPDevice', 'service Urls restored from session.', 5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -34,14 +34,14 @@ class UPnPDevice
|
||||||
|
|
||||||
private function parseDescriptionUrl($descriptionUrl)
|
private function parseDescriptionUrl($descriptionUrl)
|
||||||
{
|
{
|
||||||
debug_event('upnpdevice', 'parseDescriptionUrl: ' . $descriptionUrl, 5);
|
debug_event('UPnPDevice', 'parseDescriptionUrl: ' . $descriptionUrl, 5);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $descriptionUrl);
|
curl_setopt($ch, CURLOPT_URL, $descriptionUrl);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
//!!debug_event('upnpdevice', 'parseDescriptionUrl response: ' . $response, 5);
|
//!!debug_event('UPnPDevice', 'parseDescriptionUrl response: ' . $response, 5);
|
||||||
|
|
||||||
$responseXML = simplexml_load_string($response);
|
$responseXML = simplexml_load_string($response);
|
||||||
$services = $responseXML->device->serviceList->service;
|
$services = $responseXML->device->serviceList->service;
|
||||||
|
@ -92,9 +92,9 @@ class UPnPDevice
|
||||||
'Connection: close',
|
'Connection: close',
|
||||||
'Content-Length: ' . mb_strlen($body),
|
'Content-Length: ' . mb_strlen($body),
|
||||||
);
|
);
|
||||||
//debug_event('upnpdevice', 'sendRequestToDevice Met: ' . $method . ' | ' . $controlUrl, 5);
|
//debug_event('UPnPDevice', 'sendRequestToDevice Met: ' . $method . ' | ' . $controlUrl, 5);
|
||||||
//debug_event('upnpdevice', 'sendRequestToDevice Body: ' . $body, 5);
|
//debug_event('UPnPDevice', 'sendRequestToDevice Body: ' . $body, 5);
|
||||||
//debug_event('upnpdevice', 'sendRequestToDevice Hdr: ' . print_r($header, true), 5);
|
//debug_event('UPnPDevice', 'sendRequestToDevice Hdr: ' . print_r($header, true), 5);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $controlUrl);
|
curl_setopt($ch, CURLOPT_URL, $controlUrl);
|
||||||
|
@ -107,7 +107,7 @@ class UPnPDevice
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
//debug_event('upnpdevice', 'sendRequestToDevice response: ' . $response, 5);
|
//debug_event('UPnPDevice', 'sendRequestToDevice response: ' . $response, 5);
|
||||||
|
|
||||||
$headers = array();
|
$headers = array();
|
||||||
$tmp = explode("\r\n\r\n", $response);
|
$tmp = explode("\r\n\r\n", $response);
|
||||||
|
@ -124,14 +124,14 @@ class UPnPDevice
|
||||||
/*
|
/*
|
||||||
$lastHeaders = $headers[count($headers) - 1];
|
$lastHeaders = $headers[count($headers) - 1];
|
||||||
$responseCode = $this->getResponseCode($lastHeaders);
|
$responseCode = $this->getResponseCode($lastHeaders);
|
||||||
debug_event('upnpdevice', 'sendRequestToDevice responseCode: ' . $responseCode, 5);
|
debug_event('UPnPDevice', 'sendRequestToDevice responseCode: ' . $responseCode, 5);
|
||||||
if ($responseCode == 500)
|
if ($responseCode == 500)
|
||||||
{
|
{
|
||||||
debug_event('upnpdevice', 'sendRequestToDevice HTTP-Code 500 - Create error response', 5);
|
debug_event('UPnPDevice', 'sendRequestToDevice HTTP-Code 500 - Create error response', 5);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_event('upnpdevice', 'sendRequestToDevice HTTP-Code OK - Create response', 5);
|
debug_event('UPnPDevice', 'sendRequestToDevice HTTP-Code OK - Create response', 5);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class UPnPDevice
|
||||||
'NT: upnp:event',
|
'NT: upnp:event',
|
||||||
'TIMEOUT: Second-180',
|
'TIMEOUT: Second-180',
|
||||||
);
|
);
|
||||||
debug_event('upnpdevice', 'Subscribe with: ' . print_r($header, true), 5);
|
debug_event('UPnPDevice', 'Subscribe with: ' . print_r($header, true), 5);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $eventUrl);
|
curl_setopt($ch, CURLOPT_URL, $eventUrl);
|
||||||
|
@ -201,7 +201,7 @@ class UPnPDevice
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
curl_close( $ch );
|
curl_close( $ch );
|
||||||
debug_event('upnpdevice', 'Subscribe response: ' . $response, 5);
|
debug_event('UPnPDevice', 'Subscribe response: ' . $response, 5);
|
||||||
|
|
||||||
$lines = explode("\r\n", trim($response));
|
$lines = explode("\r\n", trim($response));
|
||||||
foreach($lines as $line) {
|
foreach($lines as $line) {
|
||||||
|
@ -211,7 +211,7 @@ class UPnPDevice
|
||||||
|
|
||||||
if ($key == 'SID')
|
if ($key == 'SID')
|
||||||
{
|
{
|
||||||
debug_event('upnpdevice', 'Subscribtion SID: ' . $value, 5);
|
debug_event('UPnPDevice', 'Subscribtion SID: ' . $value, 5);
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ class UPnPDevice
|
||||||
'SID: ' . $sid,
|
'SID: ' . $sid,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug_event('upnpdevice', 'Unsubscribe from SID: ' . $sid . ' with: ' . "\n" . print_r($header, true), 5);
|
debug_event('UPnPDevice', 'Unsubscribe from SID: ' . $sid . ' with: ' . "\n" . print_r($header, true), 5);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $eventUrl);
|
curl_setopt($ch, CURLOPT_URL, $eventUrl);
|
|
@ -69,8 +69,8 @@ class UPnPPlayer
|
||||||
*/
|
*/
|
||||||
public function __construct($name = "noname", $description_url = "http://localhost")
|
public function __construct($name = "noname", $description_url = "http://localhost")
|
||||||
{
|
{
|
||||||
require_once AmpConfig::get('prefix') . '/modules/localplay/upnp/upnpdevice.php';
|
require_once AmpConfig::get('prefix') . '/modules/localplay/upnp/UPnPDevice.php';
|
||||||
require_once AmpConfig::get('prefix') . '/modules/localplay/upnp/upnpplaylist.php';
|
require_once AmpConfig::get('prefix') . '/modules/localplay/upnp/UPnPPlaylist.php';
|
||||||
|
|
||||||
debug_event('upnpPlayer', 'constructor: ' . $name . ' | ' . $description_url, 5);
|
debug_event('upnpPlayer', 'constructor: ' . $name . ' | ' . $description_url, 5);
|
||||||
$this->_description_url = $description_url;
|
$this->_description_url = $description_url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue