source: extensions/autoupdate/plugins_update.php @ 4711

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

[Plugin][Piwigo Auto Upgrade]
If gallery and plugins are up to date, display note on admin homepage only one time for each session.
Allow to disable notification for plugins you don't want to update.

File size: 1.6 KB
Line 
1<?php
2
3load_language('plugin.lang', dirname(__FILE__).'/');
4
5function autoupdate_plugins_update_filter($content, &$smarty)
6{
7  $search = '<a href="{$plugin.URL_DOWNLOAD}">{\'plugins_download\'|@translate}</a>';
8  $replacement = '  <a href="{$plugin.URL_DOWNLOAD}">{\'plugins_download\'|@translate}</a><br>
9    <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>
10    <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>';
11
12  return str_replace($search, $replacement, $content);; 
13}
14
15$script_head = '
16<script type="text/javascript">
17function autoupdate_ignore(name, bool, id) {
18  jQuery.post(
19    "'.PHPWG_ROOT_PATH.'plugins/autoupdate/remote.php",
20    { "autoupdate_ignore[]": [name, bool] },
21    function(data) {
22      if (data == "ok") {
23        jQuery("#au_ignore_"+id+"_"+bool).hide();
24        jQuery("#au_ignore_"+id+"_"+!bool).show();
25      }
26    }
27  );
28}
29</script>
30';
31
32//$template->delete_compiled_templates();
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.