| 1 | <?php |
|---|
| 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 | |
|---|
| 12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
|---|
| 13 | |
|---|
| 14 | $_menu['Blog']->addItem(__('Pings'), |
|---|
| 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()); |
|---|
| 19 | |
|---|
| 20 | $__autoload['pingsAdminBehaviors'] = dirname(__FILE__) . '/lib.pings.php'; |
|---|
| 21 | |
|---|
| 22 | $core->addBehavior('adminPostHeaders', array('pingsAdminBehaviors', 'pingJS')); |
|---|
| 23 | $core->addBehavior('adminPostFormItems', array('pingsAdminBehaviors', 'pingsFormItems')); |
|---|
| 24 | $core->addBehavior('adminAfterPostCreate', array('pingsAdminBehaviors', 'doPings')); |
|---|
| 25 | $core->addBehavior('adminAfterPostUpdate', array('pingsAdminBehaviors', 'doPings')); |
|---|
| 26 | |
|---|
| 27 | $core->addBehavior('adminDashboardFavorites', 'pingDashboardFavorites'); |
|---|
| 28 | |
|---|
| 29 | function pingDashboardFavorites($core, $favs) |
|---|
| 30 | { |
|---|
| 31 | $favs->register('pings', array( |
|---|
| 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') |
|---|
| 36 | )); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | $core->addBehavior('adminPageHelpBlock', 'pingsPageHelpBlock'); |
|---|
| 40 | |
|---|
| 41 | function pingsPageHelpBlock($blocks) |
|---|
| 42 | { |
|---|
| 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'; |
|---|
| 54 | } |
|---|