style(legacy): format files (#1946)

This commit is contained in:
Jonas L 2022-07-07 20:01:15 +02:00 committed by GitHub
parent eb19283d96
commit 4d393fa14e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 775 additions and 565 deletions

View file

@ -25,7 +25,8 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setLabel(_('Custom Username'))
->setFilters(['StringTrim'])
->setValidators([
new ConditionalNotEmpty(['cb_custom_auth' => '1']), ]);
new ConditionalNotEmpty(['cb_custom_auth' => '1']),
]);
$this->addElement($custom_username);
// custom password
@ -37,7 +38,8 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setLabel(_('Custom Password'))
->setFilters(['StringTrim'])
->setValidators([
new ConditionalNotEmpty(['cb_custom_auth' => '1']), ]);
new ConditionalNotEmpty(['cb_custom_auth' => '1']),
]);
$this->addElement($custom_password);
$showSourceParams = parse_url(Application_Model_Preference::GetLiveDJSourceConnectionURL());

View file

@ -106,9 +106,11 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden'
if (
$element->getType() != 'Zend_Form_Element_Hidden'
// We should still be able to remove the show logo
&& $element->getName() != 'add_show_logo_current_remove') {
&& $element->getName() != 'add_show_logo_current_remove'
) {
$element->setAttrib('disabled', 'disabled');
}
}

View file

@ -37,7 +37,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
$notEmptyValidator,
$dateValidator, ])
$dateValidator,
])
->setDecorators(['ViewHelper']);
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@ -64,7 +65,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
$notEmptyValidator,
$dateValidator, ])
$dateValidator,
])
->setDecorators(['ViewHelper']);
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@ -77,7 +79,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
$notEmptyValidator,
$regexValidator, ])
$regexValidator,
])
->setDecorators(['ViewHelper']);
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
@ -173,10 +176,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
} elseif ($showStartDateTime == $showEndDateTime) {
$this->getElement('add_show_duration')->setErrors([_('Cannot have duration 00h 00m')]);
$valid = false;
} elseif (intval($duration->format('%d')) > 0
&& (intval($duration->format('%h')) > 0
|| intval($duration->format('%i')) > 0
|| intval($duration->format('%s')) > 0)) {
} elseif (
intval($duration->format('%d')) > 0
&& (intval($duration->format('%h')) > 0
|| intval($duration->format('%i')) > 0
|| intval($duration->format('%s')) > 0)
) {
$this->getElement('add_show_duration')->setErrors([_('Cannot have duration greater than 24h')]);
$valid = false;
}

View file

@ -17,7 +17,8 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@ -31,7 +32,8 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -45,7 +47,8 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@ -59,7 +62,8 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);

View file

@ -198,7 +198,8 @@ class Application_Form_EditAudioMD extends Zend_Form
->setFilters(['StringTrim'])
->setValidators([
new Zend_Validate_StringLength(['min' => 0, 'max' => 8]),
new Zend_Validate_Digits(), ]);
new Zend_Validate_Digits(),
]);
$this->addElement($bpm);
// Add copyright field

View file

@ -18,7 +18,8 @@ class Application_Form_EditUser extends Zend_Form
$notDemoValidator = new Application_Validate_NotDemoValidate();
$this->setDecorators([
['ViewScript', ['viewScript' => 'form/edit-user.phtml', 'currentUser' => $currentUser->getLogin()]], ]);
['ViewScript', ['viewScript' => 'form/edit-user.phtml', 'currentUser' => $currentUser->getLogin()]],
]);
$this->setAttrib('id', 'current-user-form');
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');

View file

@ -127,7 +127,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$podcast_album_override->setValue(Application_Model_Preference::GetPodcastAlbumOverride());
$podcast_album_override->setDescription(_('Enabling this feature will cause podcast episode tracks to have their Artist, Title, and Album metatags set from podcast feed values. Note that enabling this feature is recommended in order to ensure reliable scheduling of episodes via smartblocks.'));
$podcast_album_override->setSeparator(' '); // No <br> between radio buttons
$podcast_album_override->addDecorator('HtmlTag', ['tag' => 'dd',
$podcast_album_override->addDecorator('HtmlTag', [
'tag' => 'dd',
'id' => 'podcastAlbumOverride-element',
'class' => 'radio-inline-list',
]);
@ -142,7 +143,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$podcast_auto_smartblock->setValue(Application_Model_Preference::GetPodcastAutoSmartblock());
$podcast_auto_smartblock->setDescription(_('If this option is enabled, a new smartblock and playlist matching the newest track of a podcast will be generated immediately upon creation of a new podcast. Note that the "Overwrite Podcast Episode Metatags" feature must also be enabled in order for smartblocks to reliably find episodes.'));
$podcast_auto_smartblock->setSeparator(' '); // No <br> between radio buttons
$podcast_auto_smartblock->addDecorator('HtmlTag', ['tag' => 'dd',
$podcast_auto_smartblock->addDecorator('HtmlTag', [
'tag' => 'dd',
'id' => 'podcastAutoSmartblock-element',
'class' => 'radio-inline-list',
]);
@ -162,7 +164,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
to external widgets that can be embedded in your website.'));
$third_party_api->setSeparator(' '); // No <br> between radio buttons
// $third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list')));
$third_party_api->addDecorator('HtmlTag', ['tag' => 'dd',
$third_party_api->addDecorator('HtmlTag', [
'tag' => 'dd',
'id' => 'thirdPartyApi-element',
'class' => 'radio-inline-list',
]);
@ -219,7 +222,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$feature_preview_mode->setValue(Application_Model_Preference::GetFeaturePreviewMode());
$feature_preview_mode->setDescription(_('Enable this to opt-in to test new features.'));
$feature_preview_mode->setSeparator(' '); // No <br> between radio buttons
$feature_preview_mode->addDecorator('HtmlTag', ['tag' => 'dd',
$feature_preview_mode->addDecorator('HtmlTag', [
'tag' => 'dd',
'id' => 'featurePreviewMode-element',
'class' => 'radio-inline-list',
]);

View file

@ -29,8 +29,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$transition_fade = new Zend_Form_Element_Text('transition_fade');
$transition_fade->setLabel(_('Switch Transition Fade (s):'))
->setFilters(['StringTrim'])
->addValidator('regex', false, ['/^\d*(\.\d+)?$/',
'messages' => _('Please enter a time in seconds (eg. 0.5)'), ])
->addValidator('regex', false, [
'/^\d*(\.\d+)?$/',
'messages' => _('Please enter a time in seconds (eg. 0.5)'),
])
->setValue($defaultFade);
$this->addElement($transition_fade);
@ -85,7 +87,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$masterSourceMount->setLabel(_('Master Source Mount:'))
->setValue($m_mount)
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ]);
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
]);
$this->addElement($masterSourceMount);
$showSourceParams = parse_url(Application_Model_Preference::GetLiveDJSourceConnectionURL());
@ -112,7 +115,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$showSourceMount->setLabel(_('Show Source Mount:'))
->setValue($l_mount)
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ]);
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
]);
$this->addElement($showSourceMount);
}
@ -126,7 +130,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$this->setDecorators(
[
['ViewScript',
[
'ViewScript',
[
'viewScript' => 'form/preferences_livestream.phtml',
'master_source_host' => isset($masterSourceHost) ? Application_Model_Preference::GetMasterDJSourceConnectionURL() : '',

View file

@ -40,7 +40,8 @@ class Application_Form_Login extends Zend_Form
->setAttribs([
'autofocus' => 'true',
'class' => 'input_text',
'required' => 'true', ])
'required' => 'true',
])
->setValue((isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) ? 'admin' : '')
->addFilter('StringTrim')
->setDecorators(['ViewHelper'])

View file

@ -15,8 +15,10 @@ class Application_Form_PasswordChange extends Zend_Form
'label' => _('Password'),
'required' => true,
'filters' => ['stringTrim'],
'validators' => [$notEmptyValidator,
$stringLengthValidator, ],
'validators' => [
$notEmptyValidator,
$stringLengthValidator,
],
'decorators' => [
'ViewHelper',
],

View file

@ -12,7 +12,8 @@ class Application_Form_PodcastPreferences extends Zend_Form_SubForm
_('Private'),
]);
$stationPodcastPrivacy->setSeparator(' ');
$stationPodcastPrivacy->addDecorator('HtmlTag', ['tag' => 'dd',
$stationPodcastPrivacy->addDecorator('HtmlTag', [
'tag' => 'dd',
'id' => 'stationPodcastPrivacy-element',
'class' => 'radio-inline-list',
]);

View file

@ -5,7 +5,8 @@ class Application_Form_SetupLanguageTimezone extends Zend_Form_SubForm
public function init()
{
$this->setDecorators([
['ViewScript', ['viewScript' => 'form/setup-lang-timezone.phtml']], ]);
['ViewScript', ['viewScript' => 'form/setup-lang-timezone.phtml']],
]);
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');

View file

@ -19,7 +19,8 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@ -33,7 +34,8 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -47,7 +49,8 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@ -61,7 +64,8 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);

View file

@ -17,7 +17,8 @@ class Application_Form_ShowListenerStat extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@ -31,7 +32,8 @@ class Application_Form_ShowListenerStat extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -45,7 +47,8 @@ class Application_Form_ShowListenerStat extends Zend_Form_SubForm
->setFilters(['StringTrim'])
->setValidators([
'NotEmpty',
['date', false, ['YYYY-MM-DD']], ])
['date', false, ['YYYY-MM-DD']],
])
->setDecorators(['ViewHelper']);
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@ -59,7 +62,8 @@ class Application_Form_ShowListenerStat extends Zend_Form_SubForm
->setValidators([
'NotEmpty',
['date', false, ['HH:mm']],
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);

View file

@ -235,7 +235,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
Application_Common_DateHelper::UTCStringToUserTimezoneString($constraint['value']);
if (isset($constraint['extra'])) {
$constraint['extra'] =
Application_Common_DateHelper::UTCStringToUserTimezoneString($constraint['extra']);
Application_Common_DateHelper::UTCStringToUserTimezoneString($constraint['extra']);
}
}
}
@ -382,8 +382,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
// The challenge here is that datetime
if (isset($criteriaKeys[$i])) {
$modifierTest = (string) $storedCrit['crit'][$criteriaKeys[$i]][$j]['modifier'];
if (isset($criteriaType) && $criteriaType == 'tt'
&& preg_match('/is|is not/', $modifierTest) == 1) {
if (
isset($criteriaType) && $criteriaType == 'tt'
&& preg_match('/is|is not/', $modifierTest) == 1
) {
$criteriaValue = new Zend_Form_Element_Select('sp_criteria_value_' . $i . '_' . $j);
$criteriaValue->setAttrib('class', 'input_select sp_input_select')->setDecorators(['viewHelper']);
@ -411,13 +413,17 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
// this is used below to test whether the datetime select should be shown or hidden
$relativeDateTime = false;
$modifierTest = (string) $storedCrit['crit'][$criteriaKeys[$i]][$j]['modifier'];
if (isset($criteriaType) && $criteriaType == 'd'
&& preg_match('/before|after|between/', $modifierTest) == 1) {
if (
isset($criteriaType) && $criteriaType == 'd'
&& preg_match('/before|after|between/', $modifierTest) == 1
) {
// set relativeDatetime boolean to true so that the datetime select is displayed below
$relativeDateTime = true;
$criteriaValue->setValue(filter_var($storedCrit['crit'][$criteriaKeys[$i]][$j]['value'], FILTER_SANITIZE_NUMBER_INT));
} elseif (isset($criteriaType) && $criteriaType == 'tt'
&& preg_match('/is|is not/', $modifierTest) == 1) {
} elseif (
isset($criteriaType) && $criteriaType == 'tt'
&& preg_match('/is|is not/', $modifierTest) == 1
) {
// set relativeDatetime boolean to true so that the datetime select is displayed below
$relativeDateTime = false;
@ -449,9 +455,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteriaDatetimeSelect->setAttrib('disabled', 'disabled');
}
// check if the value is stored and it is a relative datetime field
if (isset($criteriaKeys[$i], $storedCrit['crit'][$criteriaKeys[$i]][$j]['value'], $criteriaType)
&& $criteriaType == 'd'
&& preg_match('/before|after|between/', $modifierTest) == 1) {
if (
isset($criteriaKeys[$i], $storedCrit['crit'][$criteriaKeys[$i]][$j]['value'], $criteriaType)
&& $criteriaType == 'd'
&& preg_match('/before|after|between/', $modifierTest) == 1
) {
// need to remove any leading numbers stored in the database
$dateTimeSelectValue = preg_replace('/[0-9]+/', '', $storedCrit['crit'][$criteriaKeys[$i]][$j]['value']);
// need to strip white from front and ago from the end to match with the value of the time unit select dropdown
@ -489,8 +497,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteriaExtraDatetimeSelect->setAttrib('class', 'input_select sp_input_select')
->setDecorators(['viewHelper']);
if (isset($criteriaKeys[$i], $storedCrit['crit'][$criteriaKeys[$i]][$j]['extra'])
&& $modifierTest == 'between') {
if (
isset($criteriaKeys[$i], $storedCrit['crit'][$criteriaKeys[$i]][$j]['extra'])
&& $modifierTest == 'between'
) {
// need to remove the leading numbers stored in the database
$extraDateTimeSelectValue = preg_replace('/[0-9]+/', '', $storedCrit['crit'][$criteriaKeys[$i]][$j]['extra']);
// need to strip white from front and ago from the end to match with the value of the time unit select dropdown
@ -505,8 +515,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteriaExtraDatetimeSelect->setAttrib('disabled', 'disabled');
}
$this->addElement($criteriaExtraDatetimeSelect);
}// for
}// for
} // for
} // for
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
$repeatTracks->setDecorators(['viewHelper'])
@ -576,8 +586,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$this->addElement($shuffle);
$this->setDecorators([
['ViewScript', ['viewScript' => 'form/smart-block-criteria.phtml', 'openOption' => $openSmartBlockOption,
'criteriasLength' => $numElements, 'modRowMap' => $modRowMap, ]],
['ViewScript', [
'viewScript' => 'form/smart-block-criteria.phtml', 'openOption' => $openSmartBlockOption,
'criteriasLength' => $numElements, 'modRowMap' => $modRowMap,
]],
]);
}
@ -889,8 +901,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
}
}
} elseif ($column->getType() == PropelColumnTypes::INTEGER
&& $d['sp_criteria_field'] != 'owner_id') {
} elseif (
$column->getType() == PropelColumnTypes::INTEGER
&& $d['sp_criteria_field'] != 'owner_id'
) {
if (!is_numeric($d['sp_criteria_value'])) {
$element->addError(_('The value has to be numeric'));
$isValid = false;
@ -912,9 +926,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$element->addError(_('Value cannot be empty'));
$isValid = false;
}
}// end foreach
}// for loop
}// if
} // end foreach
} // for loop
} // if
return $isValid;
}

View file

@ -81,8 +81,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$output = new Zend_Form_Element_Select('output');
$output->setLabel(_('Service Type:'))
->setMultiOptions(['icecast' => 'Icecast', 'shoutcast' => 'SHOUTcast'])
->setValue($useDefaults ? $streamDefaults['output'] :
(isset($setting[$prefix . '_output']) ? $setting[$prefix . '_output'] : 'icecast'))
->setValue($useDefaults ? $streamDefaults['output'] : (isset($setting[$prefix . '_output']) ? $setting[$prefix . '_output'] : 'icecast'))
->setDecorators(['ViewHelper']);
$this->addElement($output);
@ -96,18 +95,17 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$host = new Zend_Form_Element_Text('host');
$host->setLabel(_('Server'))
->setValue($useDefaults ? $streamDefaults['host'] :
(isset($setting[$prefix . '_host']) ? $setting[$prefix . '_host'] : ''))
->setValue($useDefaults ? $streamDefaults['host'] : (isset($setting[$prefix . '_host']) ? $setting[$prefix . '_host'] : ''))
->setValidators([
['regex', false, ['/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$host->setAttrib('alt', 'domain');
$this->addElement($host);
$port = new Zend_Form_Element_Text('port');
$port->setLabel(_('Port'))
->setValue($useDefaults ? $streamDefaults['port'] :
(isset($setting[$prefix . '_port']) ? $setting[$prefix . '_port'] : ''))
->setValue($useDefaults ? $streamDefaults['port'] : (isset($setting[$prefix . '_port']) ? $setting[$prefix . '_port'] : ''))
->setValidators([new Zend_Validate_Between(['min' => 0, 'max' => 99999])])
->addValidator('regex', false, ['pattern' => '/^[0-9]+$/', 'messages' => ['regexNotMatch' => _('Only numbers are allowed.')]])
->setDecorators(['ViewHelper']);
@ -115,10 +113,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$pass = new Zend_Form_Element_Text('pass');
$pass->setLabel(_('Password'))
->setValue($useDefaults ? $streamDefaults['pass'] :
(isset($setting[$prefix . '_pass']) ? $setting[$prefix . '_pass'] : ''))
->setValue($useDefaults ? $streamDefaults['pass'] : (isset($setting[$prefix . '_pass']) ? $setting[$prefix . '_pass'] : ''))
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$pass->setAttrib('alt', 'regular_text');
$this->addElement($pass);
@ -133,7 +131,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$url->setLabel(_('URL'))
->setValue(isset($setting[$prefix . '_url']) ? $setting[$prefix . '_url'] : '')
->setValidators([
['regex', false, ['/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$url->setAttrib('alt', 'url');
$this->addElement($url);
@ -152,20 +151,20 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$mount = new Zend_Form_Element_Text('mount');
$mount->setLabel(_('Mount Point'))
->setValue($useDefaults ? $streamDefaults['mount'] :
(isset($setting[$prefix . '_mount']) ? $setting[$prefix . '_mount'] : ''))
->setValue($useDefaults ? $streamDefaults['mount'] : (isset($setting[$prefix . '_mount']) ? $setting[$prefix . '_mount'] : ''))
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$mount->setAttrib('alt', 'regular_text');
$this->addElement($mount);
$user = new Zend_Form_Element_Text('user');
$user->setLabel(_('Username'))
->setValue($useDefaults ? $streamDefaults['user'] :
(isset($setting[$prefix . '_user']) ? $setting[$prefix . '_user'] : ''))
->setValue($useDefaults ? $streamDefaults['user'] : (isset($setting[$prefix . '_user']) ? $setting[$prefix . '_user'] : ''))
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$user->setAttrib('alt', 'regular_text');
$this->addElement($user);
@ -174,7 +173,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$adminUser->setLabel(_('Admin User'))
->setValue(Application_Model_StreamSetting::getAdminUser($prefix))
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$adminUser->setAttrib('alt', 'regular_text');
$this->addElement($adminUser);
@ -183,7 +183,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$adminPass->setLabel(_('Admin Password'))
->setValue(Application_Model_StreamSetting::getAdminPass($prefix))
->setValidators([
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]], ])
['regex', false, ['/^[^ &<>]+$/', 'messages' => _('Invalid character entered')]],
])
->setDecorators(['ViewHelper']);
$adminPass->setAttrib('alt', 'regular_text');
$this->addElement($adminPass);
@ -191,10 +192,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$liquidsoap_error_msg = '<div class="stream-status status-info"><p>' . _('Getting information from the server...') . '</p></div>';
$this->setDecorators([
['ViewScript', ['viewScript' => 'form/stream-setting-form.phtml',
['ViewScript', [
'viewScript' => 'form/stream-setting-form.phtml',
'stream_number' => $stream_number,
'enabled' => $enable->getValue(),
'liquidsoap_error_msg' => $liquidsoap_error_msg, ]],
'liquidsoap_error_msg' => $liquidsoap_error_msg,
]],
]);
}
@ -236,7 +239,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
if (Application_Model_Preference::getUsingCustomStreamSettings()) {
$element->setAttrib('disabled', null);
} elseif (!(in_array($element->getName(), static::$customizable)
|| $element->getType() == 'Zend_Form_Element_Hidden')) {
|| $element->getType() == 'Zend_Form_Element_Hidden')) {
$element->setAttrib('disabled', 'disabled');
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* custom filter for image uploads.
*

View file

@ -1,4 +1,5 @@
<?php
/**
* Check if a field is empty but only when specific fields have specific values.
*