| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
|---|
| 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 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 null; |
|---|
| 52 | } |
|---|
| 53 | $blocks[] = 'pings_post'; |
|---|
| 54 | } |
|---|