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
|
@ -32,7 +32,7 @@ abstract class DatabaseObject
|
|||
{
|
||||
protected $id;
|
||||
//private $originalData;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array Stores relation between SQL field name and class name so we
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -188,7 +188,7 @@ class Dba
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function fetch_object($resource, $class = 'stdClass', $finish = true)
|
||||
public static function fetch_object($resource, $class = 'stdClass', $finish = true)
|
||||
{
|
||||
if (!$resource) {
|
||||
return array();
|
||||
|
|
|
@ -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'
|
||||
);
|
||||
|
||||
|
@ -870,7 +870,7 @@ class Song extends database_object implements media, library_item
|
|||
} else {
|
||||
$newSongData = $new_song->$key;
|
||||
}
|
||||
|
||||
|
||||
// If it's a stringie thing
|
||||
if (in_array($key, $string_array)) {
|
||||
$songData = self::clean_string_field_value($songData);
|
||||
|
@ -898,12 +898,12 @@ class Song extends database_object implements media, library_item
|
|||
private static function clean_string_field_value($value)
|
||||
{
|
||||
$value = trim(stripslashes(preg_replace('/\s+/', ' ', $value)));
|
||||
|
||||
|
||||
// Strings containing only UTF-8 BOM = empty string
|
||||
if (strlen($value) == 2 && (ord($value[0]) == 0xFF || ord($value[0]) == 0xFE)) {
|
||||
$value = "";
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ class vainfo
|
|||
* 3. title.[date].Season #[#] Episode #[#].ext
|
||||
* 4. title.[date].###.ext (maximum of 9 seasons)
|
||||
* parse directory path for name, season and episode numbers
|
||||
* /TV shows/show name [(year)]/[season ]##/##.Episode.Title.ext
|
||||
* /TV shows/show name [(year)]/[season ]##/##.Episode.Title.ext
|
||||
* parse movie names:
|
||||
* title.[date].ext
|
||||
* /movie title [(date)]/title.ext
|
||||
|
|
|
@ -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')) {
|
||||
?>
|
||||
|
@ -34,31 +35,42 @@ 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
|
||||
|
||||
}
|
||||
?>
|
||||
<?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 ?>')">
|
||||
<?php echo UI::get_icon('playlist_add', T_('Add to existing playlist'));
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
} ?>
|
||||
<?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')) {
|
||||
|
@ -66,7 +78,8 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<td class="cel_rating" id="rating_<?php echo $libitem->id;
|
||||
?>_song"><?php Rating::show($libitem->id,'song');
|
||||
?></td>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (AmpConfig::get('userflags')) {
|
||||
|
@ -74,11 +87,14 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<td class="cel_userflag" id="userflag_<?php echo $libitem->id;
|
||||
?>_song"><?php Userflag::show($libitem->id,'song');
|
||||
?></td>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
} ?>
|
||||
<td class="cel_action">
|
||||
<?php if (AmpConfig::get('download')) {
|
||||
?>
|
||||
|
@ -88,25 +104,32 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<?php echo UI::get_icon('download', T_('Download'));
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?php if (Access::check('interface', '25')) {
|
||||
?>
|
||||
<?php if (AmpConfig::get('share')) {
|
||||
?>
|
||||
<?php Share::display_ui('song', $libitem->id, false);
|
||||
?>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<?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
|
||||
} ?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php if (Access::check('interface', '50') && get_class($playlist) == "Playlist") {
|
||||
?>
|
||||
|
@ -114,6 +137,7 @@ if ($libitem->enabled || Access::check('interface','50')) {
|
|||
<?php echo UI::get_icon('drag', T_('Reorder'));
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
<?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
|
||||
|
@ -241,13 +257,13 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
|
|||
|
||||
foreach ($songprops as $key => $value) {
|
||||
if (trim($value)) {
|
||||
$rowparity = UI::flip_class();
|
||||
echo "<dt class=\"".$rowparity."\">" . T_($key) . "</dt><dd class=\"".$rowparity."\">" . $value . "</dd>";
|
||||
$rowparity = UI::flip_class();
|
||||
echo "<dt class=\"".$rowparity."\">" . T_($key) . "</dt><dd class=\"".$rowparity."\">" . $value . "</dd>";
|
||||
}
|
||||
}
|
||||
|
||||
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