Format code using php-cs-fixer
This commit is contained in:
parent
43d7dc92cd
commit
d52c6184b9
352 changed files with 17473 additions and 17041 deletions
|
@ -7,9 +7,10 @@
|
|||
*/
|
||||
class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
protected $_bootstrap = null;
|
||||
protected $_bootstrap;
|
||||
|
||||
public function __construct($boostrap) {
|
||||
public function __construct($boostrap)
|
||||
{
|
||||
$this->_bootstrap = $boostrap;
|
||||
}
|
||||
|
||||
|
@ -17,7 +18,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
* Start the session depending on which controller your request is going to.
|
||||
* We start the session explicitly here so that we can avoid starting sessions
|
||||
* needlessly for (stateless) requests to the API.
|
||||
* @param Zend_Controller_Request_Abstract $request
|
||||
*
|
||||
* @throws Zend_Session_Exception
|
||||
*/
|
||||
public function routeShutdown(Zend_Controller_Request_Abstract $request)
|
||||
|
@ -27,15 +28,15 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
//List of controllers where we don't need a session, and we don't need
|
||||
//all the standard HTML / JS boilerplate.
|
||||
if (!in_array($controller, array(
|
||||
"index", //Radio Page
|
||||
"api",
|
||||
"auth",
|
||||
"error",
|
||||
"upgrade",
|
||||
"embed",
|
||||
"feeds"
|
||||
))
|
||||
if (!in_array($controller, [
|
||||
'index', //Radio Page
|
||||
'api',
|
||||
'auth',
|
||||
'error',
|
||||
'upgrade',
|
||||
'embed',
|
||||
'feeds',
|
||||
])
|
||||
) {
|
||||
//Start the session
|
||||
Zend_Session::start();
|
||||
|
@ -54,7 +55,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
}
|
||||
|
||||
// Skip upgrades and task management when running unit tests
|
||||
if (getenv("AIRTIME_UNIT_TEST") != 1) {
|
||||
if (getenv('AIRTIME_UNIT_TEST') != 1) {
|
||||
$taskManager = TaskManager::getInstance();
|
||||
|
||||
// Run the upgrade on each request (if it needs to be run)
|
||||
|
@ -66,7 +67,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
// Piggyback the TaskManager onto API calls. This provides guaranteed consistency
|
||||
// (there is at least one API call made from pypo to Airtime every 7 minutes) and
|
||||
// greatly reduces the chances of lock contention on cc_pref while the TaskManager runs
|
||||
if ($controller == "api") {
|
||||
if ($controller == 'api') {
|
||||
$taskManager->runTasks();
|
||||
}
|
||||
}
|
||||
|
@ -81,29 +82,29 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
$view = $this->_bootstrap->getResource('view');
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$view->headScript()->appendScript("var baseUrl = '$baseUrl';");
|
||||
$view->headScript()->appendScript("var baseUrl = '{$baseUrl}';");
|
||||
$this->_initTranslationGlobals($view);
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
if (!is_null($user)) {
|
||||
$userType = $user->getType();
|
||||
} else {
|
||||
$userType = "";
|
||||
$userType = '';
|
||||
}
|
||||
$view->headScript()->appendScript("var userType = '$userType';");
|
||||
$view->headScript()->appendScript("var userType = '{$userType}';");
|
||||
|
||||
// Dropzone also accept file extensions and doesn't correctly extract certain mimetypes (eg. FLAC - try it),
|
||||
// so we append the file extensions to the list of mimetypes and that makes it work.
|
||||
$mimeTypes = FileDataHelper::getAudioMimeTypeArray();
|
||||
$fileExtensions = array_values($mimeTypes);
|
||||
foreach($fileExtensions as &$extension) {
|
||||
foreach ($fileExtensions as &$extension) {
|
||||
$extension = '.' . $extension;
|
||||
}
|
||||
$view->headScript()->appendScript("var acceptedMimeTypes = " . json_encode(array_merge(array_keys($mimeTypes), $fileExtensions)) . ";");
|
||||
$view->headScript()->appendScript('var acceptedMimeTypes = ' . json_encode(array_merge(array_keys($mimeTypes), $fileExtensions)) . ';');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a global namespace to hold a session token for CSRF prevention
|
||||
* Create a global namespace to hold a session token for CSRF prevention.
|
||||
*/
|
||||
protected function _initCsrfNamespace()
|
||||
{
|
||||
|
@ -131,7 +132,7 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
/**
|
||||
* Ideally, globals should be written to a single js file once
|
||||
* from a php init function. This will save us from having to
|
||||
* reinitialize them every request
|
||||
* reinitialize them every request.
|
||||
*/
|
||||
private function _initTranslationGlobals()
|
||||
{
|
||||
|
@ -142,18 +143,18 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
//Each page refresh or tab open has uniqID, not to be used for security
|
||||
$view->headScript()->appendScript("var UNIQID = '" . uniqid() . "';");
|
||||
|
||||
$track_type_options = array();
|
||||
$track_type_options = [];
|
||||
$track_types = Application_Model_Tracktype::getTracktypes();
|
||||
|
||||
array_multisort(array_map(function($element) {
|
||||
|
||||
array_multisort(array_map(function ($element) {
|
||||
return $element['type_name'];
|
||||
}, $track_types), SORT_ASC, $track_types);
|
||||
|
||||
|
||||
foreach ($track_types as $key => $tt) {
|
||||
$track_type_options[$tt['code']] = $tt['type_name'];
|
||||
}
|
||||
$ttarr = json_encode($track_type_options, JSON_FORCE_OBJECT);
|
||||
$view->headScript()->appendScript("var TRACKTYPES = " . $ttarr . ";");
|
||||
$view->headScript()->appendScript('var TRACKTYPES = ' . $ttarr . ';');
|
||||
}
|
||||
|
||||
protected function _initHeadLink()
|
||||
|
@ -164,14 +165,15 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$view->headLink(array('rel' => 'icon', 'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'], 'type' => 'image/x-icon'), 'PREPEND')
|
||||
$view->headLink(['rel' => 'icon', 'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'], 'type' => 'image/x-icon'], 'PREPEND')
|
||||
->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/qtip/jquery.qtip.min.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/styles.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/masterpanel.css?' . $CC_CONFIG['airtime_version'])
|
||||
->appendStylesheet($baseUrl . 'css/tipsy/jquery.tipsy.css?' . $CC_CONFIG['airtime_version']);
|
||||
->appendStylesheet($baseUrl . 'css/tipsy/jquery.tipsy.css?' . $CC_CONFIG['airtime_version'])
|
||||
;
|
||||
}
|
||||
|
||||
protected function _initHeadScript()
|
||||
|
@ -200,20 +202,21 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
->appendFile($baseUrl . 'locale/general-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'locale/datatables-translation-table?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
|
||||
->appendScript("$.i18n.setDictionary(general_dict)")
|
||||
->appendScript("var baseUrl='$baseUrl'");
|
||||
->appendScript('$.i18n.setDictionary(general_dict)')
|
||||
->appendScript("var baseUrl='{$baseUrl}'")
|
||||
;
|
||||
|
||||
//These timezones are needed to adjust javascript Date objects on the client to make sense to the user's set timezone
|
||||
//or the server's set timezone.
|
||||
$serverTimeZone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
|
||||
$now = new DateTime("now", $serverTimeZone);
|
||||
$offset = $now->format("Z") * -1;
|
||||
$now = new DateTime('now', $serverTimeZone);
|
||||
$offset = $now->format('Z') * -1;
|
||||
$view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
|
||||
|
||||
if (class_exists("Zend_Auth", false) && Zend_Auth::getInstance()->hasIdentity()) {
|
||||
if (class_exists('Zend_Auth', false) && Zend_Auth::getInstance()->hasIdentity()) {
|
||||
$userTimeZone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||
$now = new DateTime("now", $userTimeZone);
|
||||
$offset = $now->format("Z") * -1;
|
||||
$now = new DateTime('now', $userTimeZone);
|
||||
$offset = $now->format('Z') * -1;
|
||||
$view->headScript()->appendScript("var userTimezoneOffset = {$offset}; //in seconds");
|
||||
}
|
||||
|
||||
|
@ -225,16 +228,17 @@ class PageLayoutInitPlugin extends Zend_Controller_Plugin_Abstract
|
|||
->appendFile($baseUrl . 'js/tipsy/jquery.tipsy.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
|
||||
->appendFile($baseUrl . 'js/airtime/common/common.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
->appendFile($baseUrl . 'js/airtime/common/audioplaytest.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
->appendFile($baseUrl . 'js/airtime/common/audioplaytest.js?' . $CC_CONFIG['airtime_version'], 'text/javascript')
|
||||
;
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if (!is_null($user)) {
|
||||
$userType = $user->getType();
|
||||
} else {
|
||||
$userType = "";
|
||||
$userType = '';
|
||||
}
|
||||
|
||||
$view->headScript()->appendScript("var userType = '$userType';");
|
||||
$view->headScript()->appendScript("var userType = '{$userType}';");
|
||||
}
|
||||
|
||||
protected function _initViewHelpers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue