diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/SmartyPlugins | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/SmartyPlugins')
21 files changed, 235 insertions, 264 deletions
diff --git a/core/SmartyPlugins/block.purify.php b/core/SmartyPlugins/block.purify.php index 8768b5aea8..be168dbcdd 100644 --- a/core/SmartyPlugins/block.purify.php +++ b/core/SmartyPlugins/block.purify.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -31,28 +31,25 @@ */ function smarty_block_purify($params, $content, &$smarty) { - if (is_null($content)) - { - return; - } + if (is_null($content)) { + return; + } - $assign = null; + $assign = null; - foreach ($params as $_key => $_val) - { - switch ($_key) - { - case 'assign': - $$_key = (string)$_val; - break; + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'assign': + $$_key = (string)$_val; + break; - default: - $smarty->trigger_error("purify: unknown attribute '$_key'"); - } - } + default: + $smarty->trigger_error("purify: unknown attribute '$_key'"); + } + } - $purifier = Piwik_HTMLPurifier::getInstance(); - $output = $purifier->purify($content); + $purifier = Piwik_HTMLPurifier::getInstance(); + $output = $purifier->purify($content); - return $assign ? $smarty->assign($assign, $output) : $output; + return $assign ? $smarty->assign($assign, $output) : $output; } diff --git a/core/SmartyPlugins/function.ajaxErrorDiv.php b/core/SmartyPlugins/function.ajaxErrorDiv.php index 79521d18af..886873f518 100644 --- a/core/SmartyPlugins/function.ajaxErrorDiv.php +++ b/core/SmartyPlugins/function.ajaxErrorDiv.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,13 +18,10 @@ */ function smarty_function_ajaxErrorDiv($params, &$smarty) { - if(empty($params['id'])) - { - $id = 'ajaxError'; - } - else - { - $id = $params['id']; - } - return '<div class="ajaxError" id="'.$id.'" style="display:none"></div>'; + if (empty($params['id'])) { + $id = 'ajaxError'; + } else { + $id = $params['id']; + } + return '<div class="ajaxError" id="' . $id . '" style="display:none"></div>'; } diff --git a/core/SmartyPlugins/function.ajaxLoadingDiv.php b/core/SmartyPlugins/function.ajaxLoadingDiv.php index 776f928c97..bd64a4f000 100644 --- a/core/SmartyPlugins/function.ajaxLoadingDiv.php +++ b/core/SmartyPlugins/function.ajaxLoadingDiv.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,17 +18,14 @@ */ function smarty_function_ajaxLoadingDiv($params, &$smarty) { - if(empty($params['id'])) - { - $id = 'ajaxLoading'; - } - else - { - $id = $params['id']; - } - return '<div id="'.$id.'" style="display:none">'. - '<div class="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> '. - Piwik_Translate('General_LoadingData') . - ' </div>'. - '</div>'; + if (empty($params['id'])) { + $id = 'ajaxLoading'; + } else { + $id = $params['id']; + } + return '<div id="' . $id . '" style="display:none">' . + '<div class="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> ' . + Piwik_Translate('General_LoadingData') . + ' </div>' . + '</div>'; } diff --git a/core/SmartyPlugins/function.ajaxRequestErrorDiv.php b/core/SmartyPlugins/function.ajaxRequestErrorDiv.php index 5636f5c431..a1d697010e 100644 --- a/core/SmartyPlugins/function.ajaxRequestErrorDiv.php +++ b/core/SmartyPlugins/function.ajaxRequestErrorDiv.php @@ -1,21 +1,21 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ /** - * Outputs the generic Ajax request error div + * Outputs the generic Ajax request error div * will be displayed when the ajax request fails (connectivity, server error, etc) - * - * @return string Html of the div + * + * @return string Html of the div */ function smarty_function_ajaxRequestErrorDiv() { - return '<div id="loadingError">'.Piwik_Translate('General_ErrorRequest').'</div>'; + return '<div id="loadingError">' . Piwik_Translate('General_ErrorRequest') . '</div>'; } diff --git a/core/SmartyPlugins/function.hiddenurl.php b/core/SmartyPlugins/function.hiddenurl.php index 54beff93d3..91b1bbd89b 100644 --- a/core/SmartyPlugins/function.hiddenurl.php +++ b/core/SmartyPlugins/function.hiddenurl.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -12,32 +12,31 @@ /** * Smarty {hiddenurl} function plugin. * Writes an input Hidden field for every parameter in the URL. - * Useful when using GET forms because we need to print the current parameters + * Useful when using GET forms because we need to print the current parameters * in hidden input so they are to the next URL after the form is submitted. * - * + * * Examples: * <pre> * {hiddenurl module="API"} with a URL 'index.php?action=test&module=CoreHome' will output * <input type=hidden name=action value=test> * <input type=hidden name=module value=API> * </pre> - * + * * Set a value to null if you want this value not to be passed in the submitted form. - * - * @param array - * @param Smarty - * @return string + * + * @param array + * @param Smarty + * @return string */ function smarty_function_hiddenurl($params, &$smarty) { - $queryStringModified = Piwik_Url::getCurrentQueryStringWithParametersModified( $params ); - $urlValues = Piwik_Common::getArrayFromQueryString($queryStringModified); - - $out = ''; - foreach($urlValues as $name => $value) - { - $out .= '<input type="hidden" name="'.$name.'" value="'.$value.'" />'; - } - return $out; + $queryStringModified = Piwik_Url::getCurrentQueryStringWithParametersModified($params); + $urlValues = Piwik_Common::getArrayFromQueryString($queryStringModified); + + $out = ''; + foreach ($urlValues as $name => $value) { + $out .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; + } + return $out; } diff --git a/core/SmartyPlugins/function.includeAssets.php b/core/SmartyPlugins/function.includeAssets.php index 4d0169790e..168e1ad5ef 100644 --- a/core/SmartyPlugins/function.includeAssets.php +++ b/core/SmartyPlugins/function.includeAssets.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -24,23 +24,21 @@ */ function smarty_function_includeAssets($params, &$smarty) { - if(!isset($params['type'])) - { - throw new Exception("The smarty function includeAssets needs a 'type' parameter."); - } - - $assetType = strtolower($params['type']); - switch ( $assetType ) - { - case 'css': - - return Piwik_AssetManager::getCssAssets(); - - case 'js': - - return Piwik_AssetManager::getJsAssets(); - - default: - throw new Exception("The smarty function includeAssets 'type' parameter needs to be either 'css' or 'js'."); - } + if (!isset($params['type'])) { + throw new Exception("The smarty function includeAssets needs a 'type' parameter."); + } + + $assetType = strtolower($params['type']); + switch ($assetType) { + case 'css': + + return Piwik_AssetManager::getCssAssets(); + + case 'js': + + return Piwik_AssetManager::getJsAssets(); + + default: + throw new Exception("The smarty function includeAssets 'type' parameter needs to be either 'css' or 'js'."); + } } diff --git a/core/SmartyPlugins/function.loadJavascriptTranslations.php b/core/SmartyPlugins/function.loadJavascriptTranslations.php index 0152e16cf6..38e851ee1e 100644 --- a/core/SmartyPlugins/function.loadJavascriptTranslations.php +++ b/core/SmartyPlugins/function.loadJavascriptTranslations.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -33,29 +33,24 @@ * @throws Exception * @return string */ -function smarty_function_loadJavascriptTranslations($params, &$smarty) +function smarty_function_loadJavascriptTranslations($params, &$smarty) { - static $pluginTranslationsAlreadyLoaded = array(); - if(!isset($params['plugins'])) - { - throw new Exception("The smarty function loadJavascriptTranslations needs a 'plugins' parameter."); - } - if(in_array($params['plugins'], $pluginTranslationsAlreadyLoaded)) - { - return; - } - $pluginTranslationsAlreadyLoaded[] = $params['plugins']; - $jsTranslations = Piwik_Translate::getInstance()->getJavascriptTranslations(explode(' ',$params['plugins'])); - $jsCode = ''; - if( isset($params['disableOutputScriptTag']) ) - { - $jsCode .= $jsTranslations; - } - else - { - $jsCode .= '<script type="text/javascript">'; - $jsCode .= $jsTranslations; - $jsCode .= '</script>'; - } - return $jsCode; + static $pluginTranslationsAlreadyLoaded = array(); + if (!isset($params['plugins'])) { + throw new Exception("The smarty function loadJavascriptTranslations needs a 'plugins' parameter."); + } + if (in_array($params['plugins'], $pluginTranslationsAlreadyLoaded)) { + return; + } + $pluginTranslationsAlreadyLoaded[] = $params['plugins']; + $jsTranslations = Piwik_Translate::getInstance()->getJavascriptTranslations(explode(' ', $params['plugins'])); + $jsCode = ''; + if (isset($params['disableOutputScriptTag'])) { + $jsCode .= $jsTranslations; + } else { + $jsCode .= '<script type="text/javascript">'; + $jsCode .= $jsTranslations; + $jsCode .= '</script>'; + } + return $jsCode; } diff --git a/core/SmartyPlugins/function.logoHtml.php b/core/SmartyPlugins/function.logoHtml.php index acff49b34c..5de794330c 100644 --- a/core/SmartyPlugins/function.logoHtml.php +++ b/core/SmartyPlugins/function.logoHtml.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -24,22 +24,18 @@ */ function smarty_function_logoHtml($params, &$smarty) { - if(!isset($params['metadata']['logo'])) - { - return; - } - $width = $height = $alt = ''; - if(isset($params['metadata']['logoWidth'])) - { - $width = "width=".$params['metadata']['logoWidth']; - } - if(isset($params['metadata']['logoHeight'])) - { - $height = "height=".$params['metadata']['logoHeight']; - } - if(isset($params['alt'])) - { - $alt = "title='".$params['alt']."' alt='".$params['alt']."'"; - } - return " <img $alt $width $height src='".$params['metadata']['logo']."' />"; + if (!isset($params['metadata']['logo'])) { + return; + } + $width = $height = $alt = ''; + if (isset($params['metadata']['logoWidth'])) { + $width = "width=" . $params['metadata']['logoWidth']; + } + if (isset($params['metadata']['logoHeight'])) { + $height = "height=" . $params['metadata']['logoHeight']; + } + if (isset($params['alt'])) { + $alt = "title='" . $params['alt'] . "' alt='" . $params['alt'] . "'"; + } + return " <img $alt $width $height src='" . $params['metadata']['logo'] . "' />"; } diff --git a/core/SmartyPlugins/function.postEvent.php b/core/SmartyPlugins/function.postEvent.php index ff43fd91fe..079822e530 100644 --- a/core/SmartyPlugins/function.postEvent.php +++ b/core/SmartyPlugins/function.postEvent.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -30,13 +30,12 @@ */ function smarty_function_postEvent($params, &$smarty) { - if(!isset($params['name'])) - { - throw new Exception("The smarty function postEvent needs a 'name' parameter."); - } - $eventName = $params['name']; - - $str = ''; - Piwik_PostEvent($eventName, $str); - return $str; + if (!isset($params['name'])) { + throw new Exception("The smarty function postEvent needs a 'name' parameter."); + } + $eventName = $params['name']; + + $str = ''; + Piwik_PostEvent($eventName, $str); + return $str; } diff --git a/core/SmartyPlugins/function.sparkline.php b/core/SmartyPlugins/function.sparkline.php index af1cab0914..af339efc88 100644 --- a/core/SmartyPlugins/function.sparkline.php +++ b/core/SmartyPlugins/function.sparkline.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -16,9 +16,9 @@ */ function smarty_function_sparkline($params, &$smarty = false) { - $src = $params['src']; - $graph = new Piwik_Visualization_Sparkline(); - $width = $graph->getWidth(); - $height = $graph->getHeight(); - return "<img class=\"sparkline\" alt=\"\" src=\"$src\" width=\"$width\" height=\"$height\" />"; + $src = $params['src']; + $graph = new Piwik_Visualization_Sparkline(); + $width = $graph->getWidth(); + $height = $graph->getHeight(); + return "<img class=\"sparkline\" alt=\"\" src=\"$src\" width=\"$width\" height=\"$height\" />"; } diff --git a/core/SmartyPlugins/function.url.php b/core/SmartyPlugins/function.url.php index 9e20e93d1e..ef8ca0bf6c 100644 --- a/core/SmartyPlugins/function.url.php +++ b/core/SmartyPlugins/function.url.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,14 +18,14 @@ * {url module="API"} will rewrite the URL modifying the module GET parameter * {url module="API" method="getKeywords"} will rewrite the URL modifying the parameters module=API method=getKeywords * </pre> - * + * * @see Piwik_Url::getCurrentQueryStringWithParametersModified() * * @param array $params $name=>$value pairs of the parameters to modify in the generated URL * @param Smarty &smarty Smarty object - * @return string Something like index.php?module=X&action=Y + * @return string Something like index.php?module=X&action=Y */ function smarty_function_url($params, &$smarty) { - return Piwik_Common::sanitizeInputValue('index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified( $params )); + return Piwik_Common::sanitizeInputValue('index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified($params)); } diff --git a/core/SmartyPlugins/modifier.inlineHelp.php b/core/SmartyPlugins/modifier.inlineHelp.php index 7cc7531f4a..a0ad93bed4 100644 --- a/core/SmartyPlugins/modifier.inlineHelp.php +++ b/core/SmartyPlugins/modifier.inlineHelp.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -16,11 +16,11 @@ */ function smarty_modifier_inlineHelp($text) { - return - '<div class="ui-widget">'. - '<div class="ui-inline-help ui-state-highlight ui-corner-all">'. - '<span class="ui-icon ui-icon-info" style="float:left;margin-right:.3em;"></span>'. - $text. - '</div>'. - '</div>'; + return + '<div class="ui-widget">' . + '<div class="ui-inline-help ui-state-highlight ui-corner-all">' . + '<span class="ui-icon ui-icon-info" style="float:left;margin-right:.3em;"></span>' . + $text . + '</div>' . + '</div>'; } diff --git a/core/SmartyPlugins/modifier.money.php b/core/SmartyPlugins/modifier.money.php index 7d9eaa7afe..29bd853566 100644 --- a/core/SmartyPlugins/modifier.money.php +++ b/core/SmartyPlugins/modifier.money.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,11 +18,10 @@ */ function smarty_modifier_money($amount) { - if(func_num_args() != 2) - { - throw new Exception('the smarty modifier money expects one parameter: the idSite.'); - } - $idSite = func_get_args(); - $idSite = $idSite[1]; - return Piwik::getPrettyMoney($amount, $idSite); + if (func_num_args() != 2) { + throw new Exception('the smarty modifier money expects one parameter: the idSite.'); + } + $idSite = func_get_args(); + $idSite = $idSite[1]; + return Piwik::getPrettyMoney($amount, $idSite); } diff --git a/core/SmartyPlugins/modifier.stripeol.php b/core/SmartyPlugins/modifier.stripeol.php index aa8bdbbce4..754ce4df06 100644 --- a/core/SmartyPlugins/modifier.stripeol.php +++ b/core/SmartyPlugins/modifier.stripeol.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ diff --git a/core/SmartyPlugins/modifier.sumtime.php b/core/SmartyPlugins/modifier.sumtime.php index cbd50f4618..2573719039 100644 --- a/core/SmartyPlugins/modifier.sumtime.php +++ b/core/SmartyPlugins/modifier.sumtime.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -26,5 +26,5 @@ */ function smarty_modifier_sumtime($numberOfSeconds) { - return Piwik::getPrettyTimeFromSeconds($numberOfSeconds); + return Piwik::getPrettyTimeFromSeconds($numberOfSeconds); } diff --git a/core/SmartyPlugins/modifier.translate.php b/core/SmartyPlugins/modifier.translate.php index 0b25c714dc..6c2fcefca0 100644 --- a/core/SmartyPlugins/modifier.translate.php +++ b/core/SmartyPlugins/modifier.translate.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -27,20 +27,17 @@ */ function smarty_modifier_translate($stringToken) { - if(func_num_args() <= 1) - { - $aValues = array(); - } - else - { - $aValues = func_get_args(); - array_shift($aValues); - } - - try { - $stringTranslated = Piwik_Translate($stringToken, $aValues); - } catch( Exception $e) { - $stringTranslated = $stringToken; - } - return $stringTranslated; + if (func_num_args() <= 1) { + $aValues = array(); + } else { + $aValues = func_get_args(); + array_shift($aValues); + } + + try { + $stringTranslated = Piwik_Translate($stringToken, $aValues); + } catch (Exception $e) { + $stringTranslated = $stringToken; + } + return $stringTranslated; } diff --git a/core/SmartyPlugins/modifier.unescape.php b/core/SmartyPlugins/modifier.unescape.php index 860841422d..971e9eabcc 100644 --- a/core/SmartyPlugins/modifier.unescape.php +++ b/core/SmartyPlugins/modifier.unescape.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -21,7 +21,7 @@ */ function smarty_modifier_unescape($string, $char_set = 'UTF-8') { - return html_entity_decode($string, ENT_QUOTES, $char_set); + return html_entity_decode($string, ENT_QUOTES, $char_set); } /* vim: set expandtab: */ diff --git a/core/SmartyPlugins/modifier.urlRewriteBasicView.php b/core/SmartyPlugins/modifier.urlRewriteBasicView.php index 4de05453e8..023897dcd3 100644 --- a/core/SmartyPlugins/modifier.urlRewriteBasicView.php +++ b/core/SmartyPlugins/modifier.urlRewriteBasicView.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,23 +18,20 @@ */ function smarty_modifier_urlRewriteBasicView($parameters) { - // replace module=X by moduleToLoad=X - // replace action=Y by actionToLoad=Y - $parameters['moduleToLoad'] = $parameters['module']; - unset($parameters['module']); + // replace module=X by moduleToLoad=X + // replace action=Y by actionToLoad=Y + $parameters['moduleToLoad'] = $parameters['module']; + unset($parameters['module']); - if(isset( $parameters['action'])) - { - $parameters['actionToLoad'] = $parameters['action']; - unset($parameters['action']); - } - else - { - $parameters['actionToLoad'] = null; - } - $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters); + if (isset($parameters['action'])) { + $parameters['actionToLoad'] = $parameters['action']; + unset($parameters['action']); + } else { + $parameters['actionToLoad'] = null; + } + $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters); - // add module=CoreHome&action=showInContext - $url = $url . '&module=CoreHome&action=showInContext'; - return Piwik_Common::sanitizeInputValue($url); + // add module=CoreHome&action=showInContext + $url = $url . '&module=CoreHome&action=showInContext'; + return Piwik_Common::sanitizeInputValue($url); } diff --git a/core/SmartyPlugins/modifier.urlRewriteWithParameters.php b/core/SmartyPlugins/modifier.urlRewriteWithParameters.php index 69d8d37484..50ec31cac4 100644 --- a/core/SmartyPlugins/modifier.urlRewriteWithParameters.php +++ b/core/SmartyPlugins/modifier.urlRewriteWithParameters.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -18,7 +18,7 @@ */ function smarty_modifier_urlRewriteWithParameters($parameters) { - $parameters['updated'] = null; - $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters); - return Piwik_Common::sanitizeInputValue($url); + $parameters['updated'] = null; + $url = Piwik_Url::getCurrentQueryStringWithParametersModified($parameters); + return Piwik_Common::sanitizeInputValue($url); } diff --git a/core/SmartyPlugins/outputfilter.ajaxcdn.php b/core/SmartyPlugins/outputfilter.ajaxcdn.php index 2aa7006e48..5852541f04 100644 --- a/core/SmartyPlugins/outputfilter.ajaxcdn.php +++ b/core/SmartyPlugins/outputfilter.ajaxcdn.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -27,24 +27,24 @@ */ function smarty_outputfilter_ajaxcdn($source, &$smarty) { - $jquery_version = Piwik_Config::getInstance()->General['jquery_version']; - $jqueryui_version = Piwik_Config::getInstance()->General['jqueryui_version']; + $jquery_version = Piwik_Config::getInstance()->General['jquery_version']; + $jqueryui_version = Piwik_Config::getInstance()->General['jqueryui_version']; - $pattern = array( - '~<link rel="stylesheet" type="text/css" href="libs/jquery/themes/([^"]*)" />~', - '~<script type="text/javascript" src="libs/jquery/jquery\.js([^"]*)">~', - '~<script type="text/javascript" src="libs/jquery/jquery-ui\.js([^"]*)">~', - '~<script type="text/javascript" src="libs/jquery/jquery-ui-18n\.js([^"]*)">~', - ); + $pattern = array( + '~<link rel="stylesheet" type="text/css" href="libs/jquery/themes/([^"]*)" />~', + '~<script type="text/javascript" src="libs/jquery/jquery\.js([^"]*)">~', + '~<script type="text/javascript" src="libs/jquery/jquery-ui\.js([^"]*)">~', + '~<script type="text/javascript" src="libs/jquery/jquery-ui-18n\.js([^"]*)">~', + ); - // IE7 and IE8 bug: downloads css twice if scheme not specified - $requestMethod = Piwik_Url::getCurrentScheme(); - $replace = array( - '<link rel="stylesheet" type="text/css" href="'.$requestMethod.'://ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/themes/\\1" />', - '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/'.$jquery_version.'/jquery.min.js">', - '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/jquery-ui.min.js">', - '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/i18n/jquery-ui-18n.min.js">', - ); + // IE7 and IE8 bug: downloads css twice if scheme not specified + $requestMethod = Piwik_Url::getCurrentScheme(); + $replace = array( + '<link rel="stylesheet" type="text/css" href="' . $requestMethod . '://ajax.googleapis.com/ajax/libs/jqueryui/' . $jqueryui_version . '/themes/\\1" />', + '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/' . $jquery_version . '/jquery.min.js">', + '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/' . $jqueryui_version . '/jquery-ui.min.js">', + '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/' . $jqueryui_version . '/i18n/jquery-ui-18n.min.js">', + ); - return preg_replace($pattern, $replace, $source); + return preg_replace($pattern, $replace, $source); } diff --git a/core/SmartyPlugins/outputfilter.cachebuster.php b/core/SmartyPlugins/outputfilter.cachebuster.php index 4431ac6230..a51c3af937 100644 --- a/core/SmartyPlugins/outputfilter.cachebuster.php +++ b/core/SmartyPlugins/outputfilter.cachebuster.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package SmartyPlugins */ @@ -30,21 +30,21 @@ */ function smarty_outputfilter_cachebuster($source, &$smarty) { - $tag = 'cb=' . $smarty->get_template_vars('cacheBuster'); + $tag = 'cb=' . $smarty->get_template_vars('cacheBuster'); - $pattern = array( - '~<script type=[\'"]text/javascript[\'"] src=[\'"]([^\'"]+)[\'"]>~', - '~<script src=[\'"]([^\'"]+)[\'"] type=[\'"]text/javascript[\'"]>~', - '~<link rel=[\'"]stylesheet[\'"] type=[\'"]text/css[\'"] href=[\'"]([^\'"]+)[\'"] ?/?>~', - '~(src|href)=\"index.php\?module=([A-Za-z0-9_]+)&action=([A-Za-z0-9_]+)\?cb=~', - ); + $pattern = array( + '~<script type=[\'"]text/javascript[\'"] src=[\'"]([^\'"]+)[\'"]>~', + '~<script src=[\'"]([^\'"]+)[\'"] type=[\'"]text/javascript[\'"]>~', + '~<link rel=[\'"]stylesheet[\'"] type=[\'"]text/css[\'"] href=[\'"]([^\'"]+)[\'"] ?/?>~', + '~(src|href)=\"index.php\?module=([A-Za-z0-9_]+)&action=([A-Za-z0-9_]+)\?cb=~', + ); - $replace = array( - '<script type="text/javascript" src="$1?'. $tag .'">', - '<script type="text/javascript" src="$1?'. $tag .'">', - '<link rel="stylesheet" type="text/css" href="$1?'. $tag .'" />', - '$1="index.php?module=$2&action=$3&cb=', - ); + $replace = array( + '<script type="text/javascript" src="$1?' . $tag . '">', + '<script type="text/javascript" src="$1?' . $tag . '">', + '<link rel="stylesheet" type="text/css" href="$1?' . $tag . '" />', + '$1="index.php?module=$2&action=$3&cb=', + ); - return preg_replace($pattern, $replace, $source); + return preg_replace($pattern, $replace, $source); } |