Format code using php-cs-fixer
This commit is contained in:
parent
43d7dc92cd
commit
d52c6184b9
352 changed files with 17473 additions and 17041 deletions
|
@ -6,37 +6,37 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_tunein.phtml'))
|
||||
));
|
||||
$this->setDecorators([
|
||||
['ViewScript', ['viewScript' => 'form/preferences_tunein.phtml']],
|
||||
]);
|
||||
|
||||
$enableTunein = new Zend_Form_Element_Checkbox("enable_tunein");
|
||||
$enableTunein->setDecorators(array(
|
||||
$enableTunein = new Zend_Form_Element_Checkbox('enable_tunein');
|
||||
$enableTunein->setDecorators([
|
||||
'ViewHelper',
|
||||
'Errors',
|
||||
'Label'
|
||||
));
|
||||
$enableTunein->addDecorator('Label', array('class' => 'enable-tunein'));
|
||||
$enableTunein->setLabel(_("Push metadata to your station on TuneIn?"));
|
||||
'Label',
|
||||
]);
|
||||
$enableTunein->addDecorator('Label', ['class' => 'enable-tunein']);
|
||||
$enableTunein->setLabel(_('Push metadata to your station on TuneIn?'));
|
||||
$enableTunein->setValue(Application_Model_Preference::getTuneinEnabled());
|
||||
$this->addElement($enableTunein);
|
||||
|
||||
$tuneinStationId = new Zend_Form_Element_Text("tunein_station_id");
|
||||
$tuneinStationId->setLabel(_("Station ID:"));
|
||||
$tuneinStationId = new Zend_Form_Element_Text('tunein_station_id');
|
||||
$tuneinStationId->setLabel(_('Station ID:'));
|
||||
$tuneinStationId->setValue(Application_Model_Preference::getTuneinStationId());
|
||||
$tuneinStationId->setAttrib("class", "input_text");
|
||||
$tuneinStationId->setAttrib('class', 'input_text');
|
||||
$this->addElement($tuneinStationId);
|
||||
|
||||
$tuneinPartnerKey = new Zend_Form_Element_Text("tunein_partner_key");
|
||||
$tuneinPartnerKey->setLabel(_("Partner Key:"));
|
||||
$tuneinPartnerKey = new Zend_Form_Element_Text('tunein_partner_key');
|
||||
$tuneinPartnerKey->setLabel(_('Partner Key:'));
|
||||
$tuneinPartnerKey->setValue(Application_Model_Preference::getTuneinPartnerKey());
|
||||
$tuneinPartnerKey->setAttrib("class", "input_text");
|
||||
$tuneinPartnerKey->setAttrib('class', 'input_text');
|
||||
$this->addElement($tuneinPartnerKey);
|
||||
|
||||
$tuneinPartnerId = new Zend_Form_Element_Text("tunein_partner_id");
|
||||
$tuneinPartnerId->setLabel(_("Partner Id:"));
|
||||
$tuneinPartnerId = new Zend_Form_Element_Text('tunein_partner_id');
|
||||
$tuneinPartnerId->setLabel(_('Partner Id:'));
|
||||
$tuneinPartnerId->setValue(Application_Model_Preference::getTuneinPartnerId());
|
||||
$tuneinPartnerId->setAttrib("class", "input_text");
|
||||
$tuneinPartnerId->setAttrib('class', 'input_text');
|
||||
$this->addElement($tuneinPartnerId);
|
||||
}
|
||||
|
||||
|
@ -49,18 +49,18 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
|||
// with the commercial flag set to true, which removes the metadata
|
||||
// from the station on TuneIn. After that, and if the test request
|
||||
// succeeds, we will make another request with the real metadata.
|
||||
if ($data["enable_tunein"]) {
|
||||
$credentialsQryStr = "?partnerId=".$data["tunein_partner_id"]."&partnerKey=".$data["tunein_partner_key"]."&id=".$data["tunein_station_id"];
|
||||
$commercialFlagQryStr = "&commercial=true";
|
||||
if ($data['enable_tunein']) {
|
||||
$credentialsQryStr = '?partnerId=' . $data['tunein_partner_id'] . '&partnerKey=' . $data['tunein_partner_key'] . '&id=' . $data['tunein_station_id'];
|
||||
$commercialFlagQryStr = '&commercial=true';
|
||||
|
||||
$metadata = Application_Model_Schedule::getCurrentPlayingTrack();
|
||||
|
||||
if (is_null($metadata)) {
|
||||
$qryStr = $credentialsQryStr . $commercialFlagQryStr;
|
||||
} else {
|
||||
$metadata["artist"] = empty($metadata["artist"]) ? "n/a" : $metadata["artist"];
|
||||
$metadata["title"] = empty($metadata["title"]) ? "n/a" : $metadata["title"];
|
||||
$metadataQryStr = "&artist=" . $metadata["artist"] . "&title=" . $metadata["title"];
|
||||
$metadata['artist'] = empty($metadata['artist']) ? 'n/a' : $metadata['artist'];
|
||||
$metadata['title'] = empty($metadata['title']) ? 'n/a' : $metadata['title'];
|
||||
$metadataQryStr = '&artist=' . $metadata['artist'] . '&title=' . $metadata['title'];
|
||||
|
||||
$qryStr = $credentialsQryStr . $metadataQryStr;
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
|||
|
||||
$xmlData = curl_exec($ch);
|
||||
if (curl_error($ch)) {
|
||||
Logging::error("Failed to reach TuneIn: ". curl_errno($ch)." - ". curl_error($ch) . " - " . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
|
||||
if (curl_error($ch) == "The requested URL returned error: 403 Forbidden") {
|
||||
$this->getElement("enable_tunein")->setErrors(array(_("Invalid TuneIn Settings. Please ensure your TuneIn settings are correct and try again.")));
|
||||
Logging::error('Failed to reach TuneIn: ' . curl_errno($ch) . ' - ' . curl_error($ch) . ' - ' . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
|
||||
if (curl_error($ch) == 'The requested URL returned error: 403 Forbidden') {
|
||||
$this->getElement('enable_tunein')->setErrors([_('Invalid TuneIn Settings. Please ensure your TuneIn settings are correct and try again.')]);
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
@ -83,10 +83,10 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
|||
|
||||
if ($valid) {
|
||||
$xmlObj = new SimpleXMLElement($xmlData);
|
||||
if (!$xmlObj || $xmlObj->head->status != "200") {
|
||||
$this->getElement("enable_tunein")->setErrors(array(_("Invalid TuneIn Settings. Please ensure your TuneIn settings are correct and try again.")));
|
||||
if (!$xmlObj || $xmlObj->head->status != '200') {
|
||||
$this->getElement('enable_tunein')->setErrors([_('Invalid TuneIn Settings. Please ensure your TuneIn settings are correct and try again.')]);
|
||||
$valid = false;
|
||||
} else if ($xmlObj->head->status == "200") {
|
||||
} elseif ($xmlObj->head->status == '200') {
|
||||
Application_Model_Preference::setLastTuneinMetadataUpdate(time());
|
||||
$valid = true;
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ class Application_Form_TuneInPreferences extends Zend_Form_SubForm
|
|||
if (!$valid) {
|
||||
// Set values to what the user entered since the form is invalid so they
|
||||
// don't have to enter in the values again and can see what they entered.
|
||||
$this->getElement("enable_tunein")->setValue($data["enable_tunein"]);
|
||||
$this->getElement("tunein_partner_key")->setValue($data["tunein_partner_key"]);
|
||||
$this->getElement("tunein_partner_id")->setValue($data["tunein_partner_id"]);
|
||||
$this->getElement("tunein_station_id")->setValue($data["tunein_station_id"]);
|
||||
$this->getElement('enable_tunein')->setValue($data['enable_tunein']);
|
||||
$this->getElement('tunein_partner_key')->setValue($data['tunein_partner_key']);
|
||||
$this->getElement('tunein_partner_id')->setValue($data['tunein_partner_id']);
|
||||
$this->getElement('tunein_station_id')->setValue($data['tunein_station_id']);
|
||||
}
|
||||
|
||||
return $valid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue