Skip to content

Commit

Permalink
Make smartmobile init code public, so mobile init params can be easil…
Browse files Browse the repository at this point in the history
…y added at any time.
  • Loading branch information
slusarz committed Feb 3, 2014
1 parent d759c82 commit af05e8e
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions framework/Core/lib/Horde/PageOutput.php
Expand Up @@ -87,6 +87,16 @@ class Horde_PageOutput
*/
public $sidebar = true;

/**
* Smartmobile init code that needs to be output before jquery.mobile.js
* is loaded.
*
* @since 2.12.0
*
* @var array
*/
public $smartmobileInit = array();

/**
* Load the topbar in this page?
*
Expand All @@ -101,14 +111,6 @@ class Horde_PageOutput
*/
protected $_compress = false;

/**
* Smartmobile init code that needs to be output before jquery.mobile.js
* is loaded.
*
* @var array
*/
protected $_smartmobileInit = array();

/**
* View mode.
*
Expand Down Expand Up @@ -189,12 +191,12 @@ public function includeScriptFiles()
return;
}

if (!empty($this->_smartmobileInit)) {
if (!empty($this->smartmobileInit)) {
echo Horde::wrapInlineScript(array(
'var horde_jquerymobile_init = function() {' .
implode('', $this->_smartmobileInit) . '};'
implode('', $this->_martmobileInit) . '};'
));
$this->_smartmobileInit = array();
$this->smartmobileInit = array();
}

$all_scripts = $jsvars = $tmp = array();
Expand Down Expand Up @@ -707,7 +709,8 @@ public function disableCompression()
* - body_class: (string)
* - body_id: (string)
* - html_id: (string)
* - smartmobileinit: (string)
* - smartmobileinit: (string) (@deprecated; use $this->smartmobileInit
* instead)
* - stylesheet_opts: (array)
* - title: (string)
* - view: (integer)
Expand Down Expand Up @@ -765,7 +768,7 @@ public function header(array $opts = array())
$this->addScriptFile(new Horde_Script_File_JsFramework($val, 'horde'));
}

$this->_smartmobileInit = array_merge(array(
$this->smartmobileInit = array_merge(array(
'$.mobile.page.prototype.options.backBtnText = "' . Horde_Core_Translation::t("Back") .'";',
'$.mobile.dialog.prototype.options.closeBtnText = "' . Horde_Core_Translation::t("Close") .'";',
'$.mobile.loader.prototype.options.text = "' . Horde_Core_Translation::t("loading") . '";'
Expand Down

0 comments on commit af05e8e

Please sign in to comment.