[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 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 | |
---|
[2815] | 14 | $_menu['Blog']->addItem(__('Pings'), |
---|
| 15 | $core->adminurl->get('admin.plugin.pings'), |
---|
[2849] | 16 | dcPage::getPF('pings/icon.png'), |
---|
[2815] | 17 | preg_match('/'.preg_quote($core->adminurl->get('admin.plugin.pings')).'/',$_SERVER['REQUEST_URI']), |
---|
[0] | 18 | $core->auth->isSuperAdmin()); |
---|
| 19 | |
---|
| 20 | $__autoload['pingsAPI'] = dirname(__FILE__).'/lib.pings.php'; |
---|
| 21 | $__autoload['pingsBehaviors'] = dirname(__FILE__).'/lib.pings.php'; |
---|
| 22 | |
---|
| 23 | # Create settings if they don't exist |
---|
| 24 | if (!array_key_exists('pings',$core->blog->settings->dumpNamespaces())) |
---|
| 25 | { |
---|
| 26 | $default_pings_uris = array( |
---|
| 27 | 'Ping-o-Matic!' => 'http://rpc.pingomatic.com/', |
---|
| 28 | 'Google Blog Search' => 'http://blogsearch.google.com/ping/RPC2' |
---|
| 29 | ); |
---|
[2322] | 30 | |
---|
[0] | 31 | $core->blog->settings->addNamespace('pings'); |
---|
| 32 | $core->blog->settings->pings->put('pings_active',1,'boolean','Activate pings plugin',true,true); |
---|
| 33 | $core->blog->settings->pings->put('pings_uris',serialize($default_pings_uris),'string','Pings services URIs',true,true); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | $core->addBehavior('adminPostHeaders',array('pingsBehaviors','pingJS')); |
---|
[1398] | 37 | $core->addBehavior('adminPostFormItems',array('pingsBehaviors','pingsFormItems')); |
---|
[0] | 38 | $core->addBehavior('adminAfterPostCreate',array('pingsBehaviors','doPings')); |
---|
| 39 | $core->addBehavior('adminAfterPostUpdate',array('pingsBehaviors','doPings')); |
---|
[3] | 40 | |
---|
[2230] | 41 | $core->addBehavior('adminDashboardFavorites','pingDashboardFavorites'); |
---|
[3] | 42 | |
---|
[2230] | 43 | function pingDashboardFavorites($core,$favs) |
---|
[3] | 44 | { |
---|
[2230] | 45 | $favs->register('pings', array( |
---|
| 46 | 'title' => __('Pings'), |
---|
[2815] | 47 | 'url' => $core->adminurl->get('admin.plugin.pings'), |
---|
[2849] | 48 | 'small-icon' => dcPage::getPF('pings/icon.png'), |
---|
| 49 | 'large-icon' => dcPage::getPF('pings/icon-big.png'), |
---|
[2230] | 50 | )); |
---|
[3] | 51 | } |
---|
[2322] | 52 | |
---|
| 53 | $core->addBehavior('adminPageHelpBlock', 'pingsPageHelpBlock'); |
---|
| 54 | |
---|
| 55 | function pingsPageHelpBlock($blocks) |
---|
| 56 | { |
---|
| 57 | $found = false; |
---|
| 58 | foreach($blocks as $block) { |
---|
| 59 | if ($block == 'core_post') { |
---|
| 60 | $found = true; |
---|
| 61 | break; |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | if (!$found) { |
---|
| 65 | return null; |
---|
| 66 | } |
---|
| 67 | $blocks[] = 'pings_post'; |
---|
| 68 | } |
---|