source: extensions/autoupdate/branches/2.0/plugins_update.php @ 9623

Last change on this file since 9623 was 9623, checked in by patdenice, 13 years ago

Create branch 2.0

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