Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_weblogping
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28691
Modified Files:
serendipity_event_weblogping.php
Log Message:
Allow insertion of superseding weblog ping services. Those meta-services
send pings to other services, which make it redundant to send a ping there.
Currently implemented is the blogbot.de (beta) service, which sends ping to
all but the yahoo service.
Index: serendipity_event_weblogping.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_weblogping/serendipity_event_weblogping.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- serendipity_event_weblogping.php 9 Feb 2004 15:12:55 -0000 1.1
+++ serendipity_event_weblogping.php 25 Feb 2004 08:44:17 -0000 1.2
@@ -6,6 +6,7 @@
@define('PLUGIN_EVENT_WEBLOGPING_SENDINGPING', 'Sende XML-RPC ping zu %s');
@define('PLUGIN_EVENT_WEBLOGPING_TITLE', 'Einträge ankündigen');
@define('PLUGIN_EVENT_WEBLOGPING_DESC', '(via XML-RPC ping)');
+ @define('PLUGIN_EVENT_WEBLOGPING_SUPERSEDES', '(ersetzt %s)');
break;
case 'en':
@@ -15,6 +16,7 @@
@define('PLUGIN_EVENT_WEBLOGPING_SENDINGPING', 'Sending XML-RPC ping to host %s');
@define('PLUGIN_EVENT_WEBLOGPING_TITLE', 'Announce entries');
@define('PLUGIN_EVENT_WEBLOGPING_DESC', '(via XML-RPC ping)');
+ @define('PLUGIN_EVENT_WEBLOGPING_SUPERSEDES', '(supersedes %s)');
break;
}
@@ -73,6 +75,13 @@
'name' => 'Yahoo!',
'host' => 'api.my.yahoo.com',
'path' => '/RPC2'
+ ),
+
+ array(
+ 'name' => 'Blogbot.de',
+ 'host' => 'xmlrpc.blogbot.de',
+ 'path' => '/',
+ 'supersedes' => 'blo.gs, blogrolling.com, technorati.com, weblogs.com, blogg.de'
)
);
@@ -111,9 +120,22 @@
// Detect if the current checkbox needs to be saved. We use the field chk_timestamp to see,
// if the form has already been submitted and individual changes shall be preserved
$selected = (($serendipity['POST']['chk_timestamp'] && $serendipity['POST']['announce_entries_' . $service['name']]) || (!isset($serendipity['POST']['chk_timestamp']) && $this->get_config($service['name']) == 'true') ? 'checked="checked"' : '');
+
+ $onclick = '';
+ if (!empty($service['supersedes'])) {
+ $onclick = 'onclick="';
+ $supersedes = explode(', ', $service['supersedes']);
+ foreach($supersedes AS $sid => $servicename) {
+ $onclick .= 'document.getElementById(\'serendipity[announce_entries_' . $servicename . ']\').checked = false; ';
+ }
+ $onclick .= '"';
+ }
+
+ $title = sprintf(PLUGIN_EVENT_WEBLOGPING_SENDINGPING, $service['name'])
+ . (!empty($service['supersedes']) ? ' ' . sprintf(PLUGIN_EVENT_WEBLOGPING_SUPERSEDES, $service['supersedes']) : '');
?>
- <input style="margin: 0px; padding: 0px; vertical-align: bottom;" type="checkbox" name="serendipity[announce_entries_<?php echo $service['name']; ?>]" id="serendipity[announce_entries_<?php echo $service['name']; ?>]" value="true" <?php echo $selected; ?> />
- <label style="vertical-align: bottom; margin: 0px; padding: 0px;" for="serendipity[announce_entries_<?php echo $service['name']; ?>]"> <?php echo $service['name']; ?> </label>
+ <input <?php echo $onclick; ?> style="margin: 0px; padding: 0px; vertical-align: bottom;" type="checkbox" name="serendipity[announce_entries_<?php echo $service['name']; ?>]" id="serendipity[announce_entries_<?php echo $service['name']; ?>]" value="true" <?php echo $selected; ?> />
+ <label title="<?php echo $title; ?>" style="vertical-align: bottom; margin: 0px; padding: 0px;" for="serendipity[announce_entries_<?php echo $service['name']; ?>]"> <?php echo $service['name']; ?> </label>
<?php
}
?>
@@ -122,7 +144,18 @@
return true;
break;
- case 'backend_publish':
+ case 'backend_publish':
+ // First cycle through list of services to remove superseding services which may have been checked
+ foreach ($this->services as $index => $service) {
+ if (!empty($service['supersedes']) && isset($serendipity['POST']['announce_entries_' . $service['name']])) {
+ $supersedes = explode(', ', $service['supersedes']);
+ foreach($supersedes AS $sid => $servicename) {
+ // A service has been checked that is superseded by another checked meta-service. Remove that service from the list of services to be ping'd
+ unset($serendipity['POST']['announce_entries_' . $servicename]);
+ }
+ }
+ }
+
foreach ($this->services as $index => $service) {
if (isset($serendipity['POST']['announce_entries_' . $service['name']])) {
printf(PLUGIN_EVENT_WEBLOGPING_SENDINGPING . '...<br />', $service['host']);
|