From 5f02e4f43cb1423653c156e612da53e4c5938583 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Sat, 26 Jan 2013 00:52:50 -0500 Subject: Move flip_class() from lib/ui.lib.php to UI --- lib/class/ui.class.php | 17 +++++++++++++++++ lib/init-tiny.php | 2 +- lib/ui.lib.php | 23 ----------------------- templates/rightbar.inc.php | 4 ++-- templates/show_access_list.inc.php | 2 +- templates/show_admin_tools.inc.php | 4 ++-- templates/show_albums.inc.php | 4 ++-- templates/show_artists.inc.php | 4 ++-- templates/show_catalogs.inc.php | 4 ++-- templates/show_debug.inc.php | 20 ++++++++++---------- templates/show_democratic_playlist.inc.php | 2 +- templates/show_disabled_songs.inc.php | 4 ++-- templates/show_duplicates.inc.php | 2 +- templates/show_edit_album.inc.php | 6 +++--- templates/show_edit_artist.inc.php | 4 ++-- templates/show_edit_song.inc.php | 16 ++++++++-------- templates/show_flag_row.inc.php | 2 +- templates/show_flagged.inc.php | 2 +- templates/show_ip_history.inc.php | 2 +- templates/show_live_streams.inc.php | 2 +- templates/show_localplay_controllers.inc.php | 4 ++-- templates/show_localplay_instances.inc.php | 2 +- templates/show_localplay_playlist.inc.php | 4 ++-- templates/show_manage_democratic.inc.php | 2 +- templates/show_manage_shoutbox.inc.php | 2 +- templates/show_objects.inc.php | 2 +- templates/show_playlist_songs.inc.php | 2 +- templates/show_playlists.inc.php | 4 ++-- templates/show_plugins.inc.php | 4 ++-- templates/show_preference_admin.inc.php | 2 +- templates/show_preference_box.inc.php | 2 +- templates/show_recently_played.inc.php | 2 +- templates/show_recommended_artists.inc.php | 4 ++-- templates/show_shout_row.inc.php | 2 +- templates/show_shoutbox.inc.php | 2 +- templates/show_smartplaylists.inc.php | 4 ++-- templates/show_song.inc.php | 6 +++--- templates/show_songs.inc.php | 4 ++-- templates/show_user_preferences.inc.php | 2 +- templates/show_users.inc.php | 2 +- templates/show_videos.inc.php | 4 ++-- 41 files changed, 91 insertions(+), 97 deletions(-) diff --git a/lib/class/ui.class.php b/lib/class/ui.class.php index 6c2041f5..b1a54f33 100644 --- a/lib/class/ui.class.php +++ b/lib/class/ui.class.php @@ -25,6 +25,7 @@ class UI { + private static $_classes; private static $_ticker; public function __construct($data) { @@ -45,4 +46,20 @@ class UI { return false; } + + /** + * flip_class + * + * First initialised with an array of two class names. Subsequent calls + * reverse the array then return the first element. + */ + public static function flip_class($classes = null) { + if (is_array($classes)) { + self::$_classes = $array; + } + else { + self::$_classes = array_reverse(self::$_classes); + } + return self::$_classes[0]; + } } diff --git a/lib/init-tiny.php b/lib/init-tiny.php index 01746a98..a54281ed 100644 --- a/lib/init-tiny.php +++ b/lib/init-tiny.php @@ -81,7 +81,7 @@ require_once $prefix . '/lib/class/media.interface.php'; require_once $prefix . '/modules/horde/Browser.php'; /* Set up the flip class */ -flip_class(array('odd','even')); +UI::flip_class(array('odd', 'even')); // Merge GET then POST into REQUEST effectively stripping COOKIE without // depending on a PHP setting change for the effect diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 0b56b221..45c87016 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -48,29 +48,6 @@ function show_confirmation($title,$text,$next_url,$cancel=0,$form_name='confirma } // show_confirmation -/** - * flip_class - * - * First called with an array of 2 class names. Subsequent calls reverse the - * array then return the first element. - * - * @param array $array - * @return mixed void or classname - */ -function flip_class($array=0) { - - static $classes = array(); - - if ($array) { - $classes = $array; - } - else { - $classes = array_reverse($classes); - return $classes[0]; - } - -} // flip_class - /** * access_denied * Throws an error if they try to do something that they aren't allowed to. diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php index 46ff84a7..6296a0cf 100644 --- a/templates/rightbar.inc.php +++ b/templates/rightbar.inc.php @@ -100,7 +100,7 @@ $object->f_link = Random::get_type_name($type); } ?> -
  • +
  • f_link; ?>
  • @@ -108,7 +108,7 @@
  • -
  • +
  • ...
  • diff --git a/templates/show_access_list.inc.php b/templates/show_access_list.inc.php index a671e5bc..7ccbb4a1 100644 --- a/templates/show_access_list.inc.php +++ b/templates/show_access_list.inc.php @@ -61,7 +61,7 @@ $access = new Access($access_id); $access->format(); ?> - + name); ?> f_start; ?> f_end; ?> diff --git a/templates/show_admin_tools.inc.php b/templates/show_admin_tools.inc.php index 03601be1..bfe92113 100644 --- a/templates/show_admin_tools.inc.php +++ b/templates/show_admin_tools.inc.php @@ -35,7 +35,7 @@ $catalogs = Catalog::get_catalogs(); - + name); ?> @@ -55,7 +55,7 @@ $catalogs = Catalog::get_catalogs();