diff options
author | Fabian Becker <halfdan@xnorfz.de> | 2013-04-06 22:36:01 +0400 |
---|---|---|
committer | Fabian Becker <halfdan@xnorfz.de> | 2013-04-06 22:36:01 +0400 |
commit | cd4308103ca7f497ee85495c41e649e956afae51 (patch) | |
tree | 21748f07f365573bf755fba8b6177ca6489b1bc3 | |
parent | 7920c2c56c4be2444c9f650bd8abb7b5cb5fd2ce (diff) |
Remove Smarty plugins
21 files changed, 0 insertions, 757 deletions
diff --git a/core/SmartyPlugins/block.purify.php b/core/SmartyPlugins/block.purify.php deleted file mode 100644 index be168dbcdd..0000000000 --- a/core/SmartyPlugins/block.purify.php +++ /dev/null @@ -1,55 +0,0 @@ -<?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 - */ - -/** - * Smarty - HTML Purifier block plugin - * - * File: block.purify.php<br> - * Type: block<br> - * Name: purify<br> - * Date: Oct 20, 2010<br> - * Purpose: Purify template output.<br> - * Install: Drop into the plugin directory, call - * <code>{purify}HTML fragment{/purify}</code> - * from template. - * - * @param array $params - * <pre> - * Params: assign: string (null) - * </pre> - * @param string $content - * @param Smarty - * @return string purified content - */ -function smarty_block_purify($params, $content, &$smarty) -{ - if (is_null($content)) { - return; - } - - $assign = null; - - foreach ($params as $_key => $_val) { - switch ($_key) { - case 'assign': - $$_key = (string)$_val; - break; - - default: - $smarty->trigger_error("purify: unknown attribute '$_key'"); - } - } - - $purifier = Piwik_HTMLPurifier::getInstance(); - $output = $purifier->purify($content); - - return $assign ? $smarty->assign($assign, $output) : $output; -} diff --git a/core/SmartyPlugins/function.ajaxErrorDiv.php b/core/SmartyPlugins/function.ajaxErrorDiv.php deleted file mode 100644 index 886873f518..0000000000 --- a/core/SmartyPlugins/function.ajaxErrorDiv.php +++ /dev/null @@ -1,27 +0,0 @@ -<?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 error div (displayed when ajax requests are throwing exceptions and returning error messages) - * - * @param array $params array([id] => ID of the HTML div, defaults to ajaxError) - * @param $smarty - * @return string Html of the error message div, hidden by default - */ -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>'; -} diff --git a/core/SmartyPlugins/function.ajaxLoadingDiv.php b/core/SmartyPlugins/function.ajaxLoadingDiv.php deleted file mode 100644 index bd64a4f000..0000000000 --- a/core/SmartyPlugins/function.ajaxLoadingDiv.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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 Loading div (displayed when ajax requests are triggered) - * - * @param array $params array([id] => ID of the HTML div, defaults to ajaxLoading) - * @param $smarty - * @return string Html of the Loading... div - */ -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>'; -} diff --git a/core/SmartyPlugins/function.ajaxRequestErrorDiv.php b/core/SmartyPlugins/function.ajaxRequestErrorDiv.php deleted file mode 100644 index a1d697010e..0000000000 --- a/core/SmartyPlugins/function.ajaxRequestErrorDiv.php +++ /dev/null @@ -1,21 +0,0 @@ -<?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 - * will be displayed when the ajax request fails (connectivity, server error, etc) - * - * @return string Html of the div - */ -function smarty_function_ajaxRequestErrorDiv() -{ - return '<div id="loadingError">' . Piwik_Translate('General_ErrorRequest') . '</div>'; -} diff --git a/core/SmartyPlugins/function.hiddenurl.php b/core/SmartyPlugins/function.hiddenurl.php deleted file mode 100644 index 91b1bbd89b..0000000000 --- a/core/SmartyPlugins/function.hiddenurl.php +++ /dev/null @@ -1,42 +0,0 @@ -<?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 - */ - -/** - * 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 - * 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 - */ -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; -} diff --git a/core/SmartyPlugins/function.includeAssets.php b/core/SmartyPlugins/function.includeAssets.php deleted file mode 100644 index 168e1ad5ef..0000000000 --- a/core/SmartyPlugins/function.includeAssets.php +++ /dev/null @@ -1,44 +0,0 @@ -<?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 - */ - -/** - * Sends AssetManager.getCssFiles or AssetManager.getJsFiles events, gathers assets and include them. - * - * Examples: - * <pre> - * {includeAssets type="css"} - * </pre> - * - * @param array $params array([type] => the type of the assets to include) - * @param $smarty - * @throws Exception - * @return - */ -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'."); - } -} diff --git a/core/SmartyPlugins/function.loadJavascriptTranslations.php b/core/SmartyPlugins/function.loadJavascriptTranslations.php deleted file mode 100644 index 38e851ee1e..0000000000 --- a/core/SmartyPlugins/function.loadJavascriptTranslations.php +++ /dev/null @@ -1,56 +0,0 @@ -<?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 - */ - -/** - * Load translation strings suffixed with _js for a given list of modules. - * This function needs to be called when you want to i18n the user interface. - * - * How to use the function in smarty templates: - * {loadJavascriptTranslations plugins='SitesManager CoreHome General'} - * - * This will load the javascript translations array for the modules specified as parameters. - * Only translations string with their ids suffixed with '_js' will be loaded - * Note: You can specify disableOutputScriptTag=1 and the returned value won't be enclosed in Javascript tags. - * - * You can then translate strings in javascript by calling the javascript function: - * _pk_translate('MY_TRANSLATION_STRING_js') - * - * _pk_translate does NOT support printf() arguments, but you can call: - * sprintf(_pk_translate('MyPlugin_numberOfEggs_js'),'ten') - * where you would have the following in your translation file plugins/MyPlugin/lang/en.php: - * 'MyPlugin_numberOfEggs_js' => 'There are %s eggs.' - * - * @param array $params - * @param $smarty - * @throws Exception - * @return string - */ -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; -} diff --git a/core/SmartyPlugins/function.logoHtml.php b/core/SmartyPlugins/function.logoHtml.php deleted file mode 100644 index 5de794330c..0000000000 --- a/core/SmartyPlugins/function.logoHtml.php +++ /dev/null @@ -1,41 +0,0 @@ -<?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 - */ - -/** - * Smarty {logoHtml} function plugin. - * Generates an img tag with the specified attributes - * - * Example: - * <pre> - * {logoHtml metadata=$row.metadata alt=$row.columns.label} - * </pre> - * - * @param array $params attributes to be set - * @param $smarty - * @return string HTML IMG tag - */ -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'] . "' />"; -} diff --git a/core/SmartyPlugins/function.postEvent.php b/core/SmartyPlugins/function.postEvent.php deleted file mode 100644 index 079822e530..0000000000 --- a/core/SmartyPlugins/function.postEvent.php +++ /dev/null @@ -1,41 +0,0 @@ -<?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 - */ - -/** - * Posts an event from a smarty template. This event can then be hooked by another plugin. - * The event will be posted along with a string value that plugins can edit. - * This is useful to allow other plugins to add content at a specific entry point in the template. - * This string will be returned by the smarty function. - * - * Examples: - * <pre> - * {postEvent name="template_footerUserCountry"} - * </pre> - * - * Plugins can then hook on this event by using the Piwik_AddAction function: - * Piwik_AddAction('template_footerUserCountry', 'functionToHookOnThisEvent'); - * - * @param $params array([name] => The name of the event) - * @param $smarty - * @throws Exception - * @return string The string eventually modified by the plugins listening to this event - */ -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; -} diff --git a/core/SmartyPlugins/function.sparkline.php b/core/SmartyPlugins/function.sparkline.php deleted file mode 100644 index af339efc88..0000000000 --- a/core/SmartyPlugins/function.sparkline.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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 - */ - -/** - * @param array $params array([src] => src url of the image) - * @param bool $smarty - * @return string IMG HTML tag - */ -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\" />"; -} diff --git a/core/SmartyPlugins/function.url.php b/core/SmartyPlugins/function.url.php deleted file mode 100644 index ef8ca0bf6c..0000000000 --- a/core/SmartyPlugins/function.url.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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 - */ - -/** - * Smarty {url} function plugin. - * Generates a piwik URL with the specified parameters modified. - * - * Examples: - * <pre> - * {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 - */ -function smarty_function_url($params, &$smarty) -{ - return Piwik_Common::sanitizeInputValue('index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified($params)); -} diff --git a/core/SmartyPlugins/modifier.inlineHelp.php b/core/SmartyPlugins/modifier.inlineHelp.php deleted file mode 100644 index a0ad93bed4..0000000000 --- a/core/SmartyPlugins/modifier.inlineHelp.php +++ /dev/null @@ -1,26 +0,0 @@ -<?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 - */ - -/** - * Displays inline help using the jquery UI CSS - * @param string $text - * @return string - */ -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>'; -} diff --git a/core/SmartyPlugins/modifier.money.php b/core/SmartyPlugins/modifier.money.php deleted file mode 100644 index 29bd853566..0000000000 --- a/core/SmartyPlugins/modifier.money.php +++ /dev/null @@ -1,27 +0,0 @@ -<?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 - */ - -/** - * Prints money, given the currency symbol. - * - * @param $amount - * @throws Exception - * @return string The amount with the currency symbol - */ -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); -} diff --git a/core/SmartyPlugins/modifier.stripeol.php b/core/SmartyPlugins/modifier.stripeol.php deleted file mode 100644 index 754ce4df06..0000000000 --- a/core/SmartyPlugins/modifier.stripeol.php +++ /dev/null @@ -1,30 +0,0 @@ -<?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 - */ - -/** - * Smarty stripeol modifier plugin - * - * Type: modifier<br> - * Name: stripeol<br> - * Purpose: Replace all end-of-line characters with platform specific string.<br> - * Example: {$var|stripeol} - * Date: March 10th, 2010 - * - * @param string - * @param string - * @return string - */ -function smarty_modifier_stripeol($text) -{ - return preg_replace('!(\r\n|\r|\n)!', PHP_EOL, $text); -} - -/* vim: set expandtab: */ diff --git a/core/SmartyPlugins/modifier.sumtime.php b/core/SmartyPlugins/modifier.sumtime.php deleted file mode 100644 index 2573719039..0000000000 --- a/core/SmartyPlugins/modifier.sumtime.php +++ /dev/null @@ -1,30 +0,0 @@ -<?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 - */ - -/** - * Returns a string that displays the number of days and hours from a number of seconds - * - * How to use: - * {4200|sumtime} will display '1h 10min' - * - * Examples: - * - 10 gives "10s" - * - 4200 gives "1h 10min" - * - 86400 gives "1 day" - * - 90600 gives "1 day 1h" (it is exactly 1day 1h 10min but we truncate) - * - * @param int $numberOfSeconds - * @return string - */ -function smarty_modifier_sumtime($numberOfSeconds) -{ - return Piwik::getPrettyTimeFromSeconds($numberOfSeconds); -} diff --git a/core/SmartyPlugins/modifier.translate.php b/core/SmartyPlugins/modifier.translate.php deleted file mode 100644 index 6c2fcefca0..0000000000 --- a/core/SmartyPlugins/modifier.translate.php +++ /dev/null @@ -1,43 +0,0 @@ -<?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 - */ - -/** - * Translates in the currently selected language the specified translation $stringToken - * Translations strings are located either in /lang/xx.php or within the plugin lang directory. - * - * Usage: - * {'General_Unknown'|translate} will be translated as 'Unknown' (see the entry in /lang/en.php) - * - * Usage with multiple substrings to be replaced in the translation string: - * - in lang/en.php you would find: - * 'VisitorInterest_BetweenXYMinutes' => '%1s-%2s min', - * - in the smarty template you would then translate the string, passing the two parameters: - * {'VisitorInterest_BetweenXYMinutes'|translate:$min:$max} - * - * @param $stringToken - * @return string The translated string, with optional substrings parameters replaced - */ -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; -} diff --git a/core/SmartyPlugins/modifier.unescape.php b/core/SmartyPlugins/modifier.unescape.php deleted file mode 100644 index 971e9eabcc..0000000000 --- a/core/SmartyPlugins/modifier.unescape.php +++ /dev/null @@ -1,27 +0,0 @@ -<?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 - */ - -/** - * Smarty unescape modifier plugin - * - * Type: modifier<br> - * Name: unescape<br> - * Purpose: Unescape the string - * @param string $string - * @param string $char_set - * @return string - */ -function smarty_modifier_unescape($string, $char_set = 'UTF-8') -{ - 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 deleted file mode 100644 index 023897dcd3..0000000000 --- a/core/SmartyPlugins/modifier.urlRewriteBasicView.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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 - */ - -/** - * Rewrites the given URL so that it looks like a URL that can be loaded directly. - * Useful for users who don't handle javascript / ajax, they can still use piwik with these rewritten URLs. - * - * @param array $parameters - * @return string - */ -function smarty_modifier_urlRewriteBasicView($parameters) -{ - // 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); - - // 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 deleted file mode 100644 index 50ec31cac4..0000000000 --- a/core/SmartyPlugins/modifier.urlRewriteWithParameters.php +++ /dev/null @@ -1,24 +0,0 @@ -<?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 - */ - -/** - * Rewrites the given URL and modify the given parameters. - * @see Piwik_Url::getCurrentQueryStringWithParametersModified() - * - * @param $parameters - * @return string - */ -function smarty_modifier_urlRewriteWithParameters($parameters) -{ - $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 deleted file mode 100644 index 5852541f04..0000000000 --- a/core/SmartyPlugins/outputfilter.ajaxcdn.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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 - */ - -/** - * Smarty AJAX Libraries CDN outputfilter plugin - * - * File: outputfilter.ajaxcdn.php<br> - * Type: outputfilter<br> - * Name: ajaxcdn<br> - * Date: Oct 13, 2009<br> - * Purpose: use AJAX Libraries Content Distribution Network<br> - * Install: Drop into the plugin directory, call - * <code>$smarty->load_filter('output','ajaxcdn');</code> - * from application. - * - * @param string - * @param Smarty - * @return mixed - */ -function smarty_outputfilter_ajaxcdn($source, &$smarty) -{ - $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([^"]*)">~', - ); - - // 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); -} diff --git a/core/SmartyPlugins/outputfilter.cachebuster.php b/core/SmartyPlugins/outputfilter.cachebuster.php deleted file mode 100644 index a51c3af937..0000000000 --- a/core/SmartyPlugins/outputfilter.cachebuster.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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 - */ - -/** - * Smarty cachebuster outputfilter plugin - * - * File: outputfilter.cachebuster.php<br> - * Type: outputfilter<br> - * Name: cachebuster<br> - * Date: May 27, 2009<br> - * Purpose: add cache busting string to URLs - * of external CSS stylesheets and - * JavaScript scripts<br> - * Install: Drop into the plugin directory, call - * <code>$smarty->assign('tag', 'some_unique_tag');</code> - * <code>$smarty->load_filter('output','cachebuster');</code> - * from application. - * - * @param string - * @param Smarty - * @return mixed - */ -function smarty_outputfilter_cachebuster($source, &$smarty) -{ - $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=~', - ); - - $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); -} |