source: extensions/autoupdate/trunk/plugins_update.php @ 6181

Last change on this file since 6181 was 6181, checked in by patdenice, 14 years ago

Update language keys.
Code cleaning.

File size: 1.7 KB
Line 
1<?php
2
3function autoupdate_plugins_update_filter($content, &$smarty)
4{
5  $l_key = version_compare(PHPWG_VERSION, '2.1', '<') ? 'plugins_download' : 'Download file';
6
7  $search = '<a href="{$plugin.URL_DOWNLOAD}">{\''.$l_key.'\'|@translate}</a>';
8
9  $replacement = '  <a href="{$plugin.URL_DOWNLOAD}">{\''.$l_key.'\'|@translate}</a><br>
10    <a href="#" onClick="autoupdate_ignore(\'{$plugin.EXT_NAME}\', true, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_true" {if $plugin.EXT_NAME|@in_array:$AU_IGNORE_LIST}style="display: none;"{/if}>{\'Don\\\'t notify on admin homepage\'|@translate}</a>
11    <a href="#" onClick="autoupdate_ignore(\'{$plugin.EXT_NAME}\', false, {$smarty.foreach.plugins_loop.index}); return false;" id="au_ignore_{$smarty.foreach.plugins_loop.index}_false" {if !$plugin.EXT_NAME|@in_array:$AU_IGNORE_LIST}style="display: none;"{/if}>{\'Notify on admin homepage\'|@translate}</a>';
12
13  return str_replace($search, $replacement, $content);; 
14}
15
16$script_head = '
17<script type="text/javascript">
18function autoupdate_ignore(name, bool, id) {
19  jQuery.post(
20    "'.PHPWG_ROOT_PATH.'plugins/autoupdate/remote.php",
21    { "autoupdate_ignore'.(version_compare(PHPWG_VERSION, '2.1', '<') ? '[]' : '').'": [name, bool] },
22    function(data) {
23      if (data == "ok") {
24        jQuery("#au_ignore_"+id+"_"+bool).hide();
25        jQuery("#au_ignore_"+id+"_"+!bool).show();
26      }
27    }
28  );
29}
30</script>
31';
32
33$template->block_html_head('', $script_head, $smarty, $repeat);
34$template->set_prefilter('plugins', 'autoupdate_plugins_update_filter');
35$template->assign('AU_IGNORE_LIST', unserialize($conf['autoupdate_ignore_list']));
36
37?>
Note: See TracBrowser for help on using the repository browser.