mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
[BUGFIX] Fixe some code style issues
This commit is contained in:
parent
4a52b1e3c4
commit
04d8ce9c11
12 changed files with 95 additions and 48 deletions
|
@ -54,12 +54,11 @@ class Core
|
|||
$possiblePaths = self::getNamespacedPaths($class);
|
||||
}
|
||||
|
||||
foreach($possiblePaths as $path) {
|
||||
if(is_file($path) && Core::is_readable($path)) {
|
||||
foreach ($possiblePaths as $path) {
|
||||
if (is_file($path) && Core::is_readable($path)) {
|
||||
require_once($path);
|
||||
self::executeAutoCall($class);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
debug_event('autoload', "'$class' not found!", 1);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +68,8 @@ class Core
|
|||
* Execute _auto_init if availlable
|
||||
* @param string $class
|
||||
*/
|
||||
private static function executeAutoCall($class) {
|
||||
private static function executeAutoCall($class)
|
||||
{
|
||||
$autocall = array($class, '_auto_init');
|
||||
if (is_callable($autocall)) {
|
||||
call_user_func($autocall);
|
||||
|
@ -83,7 +83,8 @@ class Core
|
|||
* @param array $add
|
||||
* @return array
|
||||
*/
|
||||
private static function insertInArray(array $array, $position, array $add) {
|
||||
private static function insertInArray(array $array, $position, array $add)
|
||||
{
|
||||
return array_slice($array, 0, $position, true) +
|
||||
$add +
|
||||
array_slice($array, $position, null, true);
|
||||
|
@ -94,7 +95,8 @@ class Core
|
|||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
private static function getNamespacedPaths($class) {
|
||||
private static function getNamespacedPaths($class)
|
||||
{
|
||||
$possiblePaths = array();
|
||||
$namespaceParts = explode('\\', $class);
|
||||
$possiblePaths[] = AmpConfig::get('prefix') . '/modules/' . implode('/', $namespaceParts) . '.php';
|
||||
|
@ -111,7 +113,8 @@ class Core
|
|||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
private static function getNonNamespacedPaths($class) {
|
||||
private static function getNonNamespacedPaths($class)
|
||||
{
|
||||
$possiblePaths = array();
|
||||
$possiblePaths[] = AmpConfig::get('prefix') . '/lib/class/' .
|
||||
strtolower($class) . '.class.php';
|
||||
|
|
|
@ -501,3 +501,4 @@ class Preference extends database_object
|
|||
$_SESSION['userdata']['uid'] = $user_id;
|
||||
} // init
|
||||
} // end Preference class
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ class Song extends database_object implements media, library_item
|
|||
/**
|
||||
* Aliases used in insert function
|
||||
*/
|
||||
const aliases = array(
|
||||
public static $aliases = array(
|
||||
'mb_trackid','mbid','mb_albumid','mb_albumid_group','mb_artistid','mb_albumartistid','genre','publisher'
|
||||
);
|
||||
|
||||
|
@ -2026,3 +2026,4 @@ class Song extends database_object implements media, library_item
|
|||
return $deleted;
|
||||
}
|
||||
} // end of song class
|
||||
|
||||
|
|
|
@ -518,9 +518,9 @@ class Update
|
|||
$version[] = array('version' => '370039','description' => $update_string);
|
||||
|
||||
$update_string = "- Add basic metadata tables<br />";
|
||||
$version[] = array('version' => '370040', 'description' => $update_string);
|
||||
$version[] = array('version' => '370040', 'description' => $update_string);
|
||||
|
||||
return $version;
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -417,8 +417,8 @@ class vainfo
|
|||
$info['art'] = $info['art'] ?: trim($tags['art']);
|
||||
|
||||
// Add rest of the tags without typecast to the array
|
||||
foreach($tags as $tag => $value) {
|
||||
if(!isset($info[$tag])) {
|
||||
foreach ($tags as $tag => $value) {
|
||||
if (!isset($info[$tag])) {
|
||||
$info[$tag] = trim($value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,3 +410,4 @@ function create_preference_input($name,$value)
|
|||
|
||||
}
|
||||
} // create_preference_input
|
||||
|
||||
|
|
|
@ -869,3 +869,4 @@ class Catalog_local extends Catalog
|
|||
}
|
||||
}
|
||||
} // end of local catalog class
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ switch ($_REQUEST['action']) {
|
|||
case 'edit_object':
|
||||
// Scrub the data, walk recursive through array
|
||||
$entities = function(&$data) use (&$entities) {
|
||||
foreach($data as $key => $value) {
|
||||
foreach ($data as $key => $value) {
|
||||
$data[$key] = is_array($value) ? $entities($value) : unhtmlentities(scrub_in($value));
|
||||
}
|
||||
return $data;
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
if ($libitem->enabled || Access::check('interface','50')) {
|
||||
?>
|
||||
<td class="cel_play">
|
||||
<span class="cel_play_content"><?php echo '<b>'.$playlist_track.'</b>'; ?></span>
|
||||
<span class="cel_play_content"><?php echo '<b>'.$playlist_track.'</b>';
|
||||
?></span>
|
||||
<div class="cel_play_hover">
|
||||
<?php if (AmpConfig::get('directplay')) {
|
||||
?>
|
||||
|
@ -35,16 +36,21 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $libitem->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $libitem->id);
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cel_song"><?php echo $libitem->f_link; ?></td>
|
||||
<td class="cel_song"><?php echo $libitem->f_link;
|
||||
?></td>
|
||||
<td class="cel_add">
|
||||
<span class="cel_item_add">
|
||||
<?php echo Ajax::button('?action=basket&type=song&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id); ?>
|
||||
<?php echo Ajax::button('?action=basket&type=song&id=' . $libitem->id,'add', T_('Add to temporary playlist'),'playlist_add_' . $libitem->id);
|
||||
?>
|
||||
<?php if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<a id="<?php echo 'add_playlist_'.$libitem->id ?>" onclick="showPlaylistDialog(event, 'song', '<?php echo $libitem->id ?>')">
|
||||
|
@ -52,13 +58,19 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>
|
||||
</a>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="cel_artist"><?php echo $libitem->f_artist_link; ?></td>
|
||||
<td class="cel_album"><?php echo $libitem->f_album_link; ?></td>
|
||||
<td class="cel_tags"><?php echo $libitem->f_tags; ?></td>
|
||||
<td class="cel_time"><?php echo $libitem->f_time; ?></td>
|
||||
<td class="cel_artist"><?php echo $libitem->f_artist_link;
|
||||
?></td>
|
||||
<td class="cel_album"><?php echo $libitem->f_album_link;
|
||||
?></td>
|
||||
<td class="cel_tags"><?php echo $libitem->f_tags;
|
||||
?></td>
|
||||
<td class="cel_time"><?php echo $libitem->f_time;
|
||||
?></td>
|
||||
<?php if (User::is_registered()) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('ratings')) {
|
||||
|
@ -67,6 +79,7 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>_song"><?php Rating::show($libitem->id,'song');
|
||||
?></td>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (AmpConfig::get('userflags')) {
|
||||
|
@ -75,10 +88,13 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>_song"><?php Userflag::show($libitem->id,'song');
|
||||
?></td>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
<td class="cel_action">
|
||||
<?php if (AmpConfig::get('download')) {
|
||||
?>
|
||||
|
@ -89,7 +105,9 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>
|
||||
</a>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
|
@ -97,16 +115,21 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<?php Share::display_ui('song', $libitem->id, false);
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (get_class($playlist) == "Playlist" && $playlist->has_access()) {
|
||||
?>
|
||||
<?php echo Ajax::button('?page=playlist&action=delete_track&playlist_id=' . $playlist->id . '&track_id=' . $object['track_id'],'delete', T_('Delete'),'track_del_' . $object['track_id']);
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php if (Access::check('interface', '50') && get_class($playlist) == "Playlist") {
|
||||
?>
|
||||
|
@ -115,5 +138,6 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
?>
|
||||
</td>
|
||||
<?php
|
||||
|
||||
}
|
||||
} ?>
|
||||
|
|
|
@ -43,6 +43,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
</div>
|
||||
</dd>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -61,9 +62,11 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
</div>
|
||||
</dd>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (AmpConfig::get('waveform')) {
|
||||
?>
|
||||
|
@ -82,6 +85,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
</div>
|
||||
</dd>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php $rowparity = UI::flip_class(); ?>
|
||||
<dt class="<?php echo $rowparity; ?>"><?php echo T_('Action'); ?></dt>
|
||||
|
@ -95,6 +99,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id . '&append=true','play_add', T_('Play last'),'addplay_song_' . $song->id);
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (Stream_Playlist::check_autoplay_next()) {
|
||||
|
@ -102,11 +107,13 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
<?php echo Ajax::button('?page=stream&action=directplay&object_type=song&object_id=' . $song->id . '&playnext=true','play_next', T_('Play next'),'nextplay_song_' . $song->id);
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php echo $song->show_custom_play_actions();
|
||||
?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php echo Ajax::button('?action=basket&type=song&id=' . $song->id,'add', T_('Add to temporary playlist'),'add_song_' . $song->id); ?>
|
||||
<?php if (Access::check('interface','25')) {
|
||||
|
@ -120,6 +127,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>
|
||||
</a>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
|
@ -127,9 +135,11 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
<?php Share::display_ui('song', $song->id, false);
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Access::check_function('download')) {
|
||||
?>
|
||||
|
@ -141,6 +151,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>"><?php echo UI::get_icon('download', T_('Download'));
|
||||
?></a>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50')) {
|
||||
?>
|
||||
|
@ -151,9 +162,11 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>"><?php echo UI::get_icon('statistics', T_('Graphs'));
|
||||
?></a>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Access::check('interface','50') || ($libitem->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) {
|
||||
?>
|
||||
|
@ -162,6 +175,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>
|
||||
</a>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Access::check('interface','75') || ($song->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) {
|
||||
?>
|
||||
|
@ -171,6 +185,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>
|
||||
</span>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<?php if (Catalog::can_remove($song)) {
|
||||
?>
|
||||
|
@ -181,6 +196,7 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
?>
|
||||
</a>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
</dd>
|
||||
<?php
|
||||
|
@ -246,8 +262,8 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
}
|
||||
}
|
||||
|
||||
if(Song::isCustomMetadataEnabled()) {
|
||||
foreach($song->getMetadata() as $metadata) {
|
||||
if (Song::isCustomMetadataEnabled()) {
|
||||
foreach ($song->getMetadata() as $metadata) {
|
||||
$rowparity = UI::flip_class();
|
||||
echo '<dt class="' . $rowparity . '">' . $metadata->getField()->getName() . '</dt>';
|
||||
echo '<dd class="' . $rowparity . '">' . $metadata->getData() . '</dd>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue