$pager = new Horde_Ui_Pager('page', $vars, $params);
- // Note that we can't use Horde_Util::bufferOutput() here since the include
- // file would be included inside that method's scope, and not this one.
+ // Note that we can't use Horde_Util::bufferOutput() here since the
+ // include file would be included inside that method's scope, and not
+ // this one.
ob_start();
if (!empty($this->view->api)) {
- $includes = new Horde_Script_Files();
- $includes->_add('prototype.js', 'horde', true, true);
+ $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files');
+ $includes->add('prototype.js', 'horde', true, true);
$includes->includeFiles();
}
/* Output js/css here if we are calling via the api */
if (!empty($this->view->api)) {
Ansel::attachStylesheet('lightbox.css', true);
- $includes = new Horde_Script_Files();
- $includes->_add('accesskeys.js', 'horde', true, true);
- $includes->_add('effects.js', 'horde', true, true);
- $includes->_add('lightbox.js', 'ansel', true, true);
+ $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files');
+ $includes->add('accesskeys.js', 'horde', true, true);
+ $includes->add('effects.js', 'horde', true, true);
+ $includes->add('lightbox.js', 'ansel', true, true);
$includes->includeFiles();
}
/* Output the js if we are calling via the api */
if (!empty($this->_params['api'])) {
- $includes = new Horde_Script_Files();
- $includes->_add('prototype.js', 'horde', true, true);
- $includes->_add('effects.js', 'horde',true, true);
- $includes->_add('stripe.js', 'horde', true, true);
+ $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files');
+ $includes->add('prototype.js', 'horde', true, true);
+ $includes->add('effects.js', 'horde',true, true);
+ $includes->add('stripe.js', 'horde', true, true);
$includes->includeFiles();
}
static public function addScriptFile($file, $app = null,
$options = array())
{
- $hsf = Horde_Script_Files::singleton();
+ $hsf = $GLOBALS['injector']->getInstance('Horde_Script_Files');
if (empty($options['external'])) {
$hsf->add($file, $app, isset($options['direct']) ? $options['direct'] : true, !empty($options['full']));
} else {
$driver = empty($conf['cachejs'])
? 'none'
: $conf['cachejsparams']['driver'];
- $hsf = Horde_Script_Files::singleton();
+ $hsf = $GLOBALS['injector']->getInstance('Horde_Script_Files');
if ($driver == 'none') {
$hsf->includeFiles();
class Horde_Script_Files
{
/**
- * The singleton instance.
- *
- * @var Horde_Script_Files
- */
- static protected $_instance;
-
- /**
* The list of script files to add.
*
* @var array
protected $_included = array();
/**
- * Singleton.
- */
- static public function singleton()
- {
- if (!self::$_instance) {
- self::$_instance = new self();
- }
-
- return self::$_instance;
- }
-
- /**
* Adds the javascript code to the output (if output has already started)
* or to the list of script files to include.
*