Dotclear

source: plugins/daInstaller/_admin.php @ 1046:24b905e118ac

Revision 1046:24b905e118ac, 1.8 KB checked in by franck <carnet.franck.paul@…>, 13 years ago (diff)

Add daInstaller plugin to the distribution, closes #1359

Line 
1<?php
2# ***** BEGIN LICENSE BLOCK *****
3# This file is part of daInstaller, a plugin for DotClear2.
4# Copyright (c) 2008-2011 Tomtom, Pep and contributors, for DotAddict.org.
5# All rights reserved.
6#
7# ***** END LICENSE BLOCK *****
8if (!defined('DC_CONTEXT_ADMIN')) { return; }
9
10/**
11 * Callback to add an icon on Dotclear2's dashboard. Trying to do so the "smart way".
12 * If updates are available, let's notify that fact !
13 *
14 */
15function adminDashboardFavs($core,$favs)
16{
17     if ($core->auth->isSuperAdmin())
18     {
19          $id = 'dainstaller';
20          $title = __('DotAddict.org Installer');
21          $link  = 'plugin.php?p=daInstaller';
22          $icon  = 'index.php?pf=daInstaller/icon.png';
23          $icon_big  = 'index.php?pf=daInstaller/icon-big.png';
24          $favs[$id] = new ArrayObject(array($id,$title,$link,$icon,$icon_big,null,null,null));
25     }
26}
27function adminDashboardFavsIcon($core,$name,$icon)
28{
29     if ($name === 'dainstaller') {
30          $daInstaller = new daInstaller($core);
31          if ($daInstaller->check()) {
32               $upd_plugins = $daInstaller->getModules('plugins',true);
33               $upd_themes = $daInstaller->getModules('themes',true);
34               if (
35                    (is_array($upd_plugins) && count($upd_plugins)) ||
36                    (is_array($upd_themes) && count($upd_themes))
37               ) {
38                    $icon[0] .= '<br />'.__('Updates are available');
39                    $icon[1] .= '&amp;tab=update';
40                    $icon[2] = 'index.php?pf=daInstaller/icon-big-update.png';
41               }
42          }
43     }
44}
45
46$core->addBehavior('adminDashboardFavs','adminDashboardFavs');
47$core->addBehavior('adminDashboardFavsIcon','adminDashboardFavsIcon');
48
49$_menu['System']->addItem(
50     __('DotAddict.org Installer'),
51     'plugin.php?p=daInstaller',
52     'index.php?pf=daInstaller/icon.png',
53     preg_match('/plugin.php\?p=daInstaller(&.*)?$/',
54     $_SERVER['REQUEST_URI']),
55     $core->auth->isSuperAdmin()
56);
57
58?>
Note: See TracBrowser for help on using the repository browser.

Sites map