summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 01:35:59 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-26 01:35:59 -0500
commit136f9f58569c6a6b52d6b9589fabf29950178cd7 (patch)
tree2655fbc3acd99489840e0d8c6812a99386f7c593
parentd572c2776f5ab7f66a632f54006dabe2f159c02b (diff)
downloadampache-136f9f58569c6a6b52d6b9589fabf29950178cd7.tar.gz
ampache-136f9f58569c6a6b52d6b9589fabf29950178cd7.tar.bz2
ampache-136f9f58569c6a6b52d6b9589fabf29950178cd7.zip
Move ajax_include() from ui.lib.php to UI
-rw-r--r--lib/class/ui.class.php15
-rw-r--r--lib/ui.lib.php17
-rw-r--r--server/ajax.server.php6
-rw-r--r--server/random.ajax.php8
-rw-r--r--server/stream.ajax.php2
5 files changed, 23 insertions, 25 deletions
diff --git a/lib/class/ui.class.php b/lib/class/ui.class.php
index 021ad67d..f6a36075 100644
--- a/lib/class/ui.class.php
+++ b/lib/class/ui.class.php
@@ -46,6 +46,21 @@ class UI {
}
/**
+ * ajax_include
+ *
+ * Does some trickery with the output buffer to return the output of a
+ * template.
+ */
+ public static function ajax_include($template) {
+ ob_start();
+ require Config::get('prefix') . '/templates/' . $template;
+ $output = ob_get_contents();
+ ob_end_clean();
+
+ return $output;
+ }
+
+ /**
* check_iconv
*
* Checks to see whether iconv is available;
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 577e9ce1..15957626 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -573,23 +573,6 @@ function xml_get_footer($type){
} // xml_get_footer
/**
- * ajax_include
- * This does an ob_start, getcontents, clean
- * on the specified require, only works if you
- * don't need to pass data in
- */
-function ajax_include($include) {
-
- ob_start();
- require_once Config::get('prefix') . '/templates/' . $include;
- $results = ob_get_contents();
- ob_end_clean();
-
- return $results;
-
-} // ajax_include
-
-/**
* toggle_visible
* This is identical to the javascript command that it actually calls
*/
diff --git a/server/ajax.server.php b/server/ajax.server.php
index 46ed92c5..55739b8d 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -91,7 +91,7 @@ switch ($page) {
switch ($_REQUEST['action']) {
case 'refresh_rightbar':
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
/* Controls the editing of objects */
case 'show_edit_object':
@@ -255,7 +255,7 @@ switch ($_REQUEST['action']) {
break;
} // end switch
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
// Handle the users basketcases...
case 'basket':
@@ -331,7 +331,7 @@ switch ($_REQUEST['action']) {
break;
} // end switch
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
/* Setting ratings */
case 'set_rating':
diff --git a/server/random.ajax.php b/server/random.ajax.php
index 9d51ec81..ff149476 100644
--- a/server/random.ajax.php
+++ b/server/random.ajax.php
@@ -37,7 +37,7 @@ switch ($_REQUEST['action']) {
foreach ($songs as $song_id) {
$GLOBALS['user']->playlist->add_object($song_id,'song');
}
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
case 'artist':
$artist_id = Random::artist();
@@ -50,7 +50,7 @@ switch ($_REQUEST['action']) {
foreach ($songs as $song_id) {
$GLOBALS['user']->playlist->add_object($song_id,'song');
}
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
case 'playlist':
$playlist_id = Random::playlist();
@@ -63,7 +63,7 @@ switch ($_REQUEST['action']) {
foreach ($items as $item) {
$GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']);
}
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
break;
case 'advanced_random':
$object_ids = Random::advanced($_POST);
@@ -72,7 +72,7 @@ switch ($_REQUEST['action']) {
foreach ($object_ids as $object_id) {
$GLOBALS['user']->playlist->add_object($object_id,'song');
}
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
// Now setup the browse and show them below!
$browse = new Browse();
diff --git a/server/stream.ajax.php b/server/stream.ajax.php
index 4d981680..516e919f 100644
--- a/server/stream.ajax.php
+++ b/server/stream.ajax.php
@@ -63,7 +63,7 @@ switch ($_REQUEST['action']) {
if (($new == 'localplay' AND $current != 'localplay') OR ($current == 'localplay' AND $new != 'localplay')) {
- $results['rightbar'] = ajax_include('rightbar.inc.php');
+ $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
}
$results['rfc3514'] = '0x0';