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