[0] | 1 | <?php |
---|
[3731] | 2 | /** |
---|
| 3 | * @brief pings, a plugin for Dotclear 2 |
---|
| 4 | * |
---|
| 5 | * @package Dotclear |
---|
| 6 | * @subpackage Plugins |
---|
| 7 | * |
---|
| 8 | * @copyright Olivier Meunier & Association Dotclear |
---|
| 9 | * @copyright GPL-2.0-only |
---|
| 10 | */ |
---|
| 11 | |
---|
[3730] | 12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
[0] | 13 | |
---|
[2815] | 14 | $_menu['Blog']->addItem(__('Pings'), |
---|
[3730] | 15 | $core->adminurl->get('admin.plugin.pings'), |
---|
| 16 | dcPage::getPF('pings/icon.png'), |
---|
| 17 | preg_match('/' . preg_quote($core->adminurl->get('admin.plugin.pings')) . '/', $_SERVER['REQUEST_URI']), |
---|
| 18 | $core->auth->isSuperAdmin()); |
---|
[0] | 19 | |
---|
[3730] | 20 | $__autoload['pingsAdminBehaviors'] = dirname(__FILE__) . '/lib.pings.php'; |
---|
[0] | 21 | |
---|
[3874] | 22 | $core->addBehavior('adminPostHeaders', ['pingsAdminBehaviors', 'pingJS']); |
---|
| 23 | $core->addBehavior('adminPostFormItems', ['pingsAdminBehaviors', 'pingsFormItems']); |
---|
| 24 | $core->addBehavior('adminAfterPostCreate', ['pingsAdminBehaviors', 'doPings']); |
---|
| 25 | $core->addBehavior('adminAfterPostUpdate', ['pingsAdminBehaviors', 'doPings']); |
---|
[3] | 26 | |
---|
[3730] | 27 | $core->addBehavior('adminDashboardFavorites', 'pingDashboardFavorites'); |
---|
[3] | 28 | |
---|
[3730] | 29 | function pingDashboardFavorites($core, $favs) |
---|
[3] | 30 | { |
---|
[3874] | 31 | $favs->register('pings', [ |
---|
[3730] | 32 | 'title' => __('Pings'), |
---|
| 33 | 'url' => $core->adminurl->get('admin.plugin.pings'), |
---|
| 34 | 'small-icon' => dcPage::getPF('pings/icon.png'), |
---|
| 35 | 'large-icon' => dcPage::getPF('pings/icon-big.png') |
---|
[3874] | 36 | ]); |
---|
[3] | 37 | } |
---|
[2322] | 38 | |
---|
| 39 | $core->addBehavior('adminPageHelpBlock', 'pingsPageHelpBlock'); |
---|
| 40 | |
---|
| 41 | function pingsPageHelpBlock($blocks) |
---|
| 42 | { |
---|
[3730] | 43 | $found = false; |
---|
| 44 | foreach ($blocks as $block) { |
---|
| 45 | if ($block == 'core_post') { |
---|
| 46 | $found = true; |
---|
| 47 | break; |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | if (!$found) { |
---|
| 51 | return; |
---|
| 52 | } |
---|
| 53 | $blocks[] = 'pings_post'; |
---|
[2322] | 54 | } |
---|