| [ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 class pingsAPI extends xmlrpcClient 24 { 25 public static function doPings($srv_uri,$site_name,$site_url) 26 { 27 $o = new self($srv_uri); 28 $o->timeout = 3; 29 30 $rsp = $o->query('weblogUpdates.ping',$site_name,$site_url); 31 32 if (isset($rsp['flerror']) && $rsp['flerror']) { 33 throw new Exception($rsp['message']); 34 } 35 36 return true; 37 } 38 } 39 40 class pingsBehaviors 41 { 42 public static function pingJS() 43 { 44 return dcPage::jsLoad('index.php?pf=pings/post.js'); 45 } 46 47 public static function pingsForm(&$post) 48 { 49 $core =& $GLOBALS['core']; 50 if (!$core->blog->settings->pings_active) { 51 return; 52 } 53 54 $pings_uris = @unserialize($core->blog->settings->pings_uris); 55 if (empty($pings_uris) || !is_array($pings_uris)) { 56 return; 57 } 58 59 if (!empty($_POST['pings_do']) && is_array($_POST['pings_do'])) { 60 $pings_do = $_POST['pings_do']; 61 } else { 62 $pings_do = array(); 63 } 64 65 echo '<h3 class="ping-services">'.__('Pings:').'</h3>'; 66 foreach ($pings_uris as $k => $v) 67 { 68 echo 69 '<p class="ping-services"><label class="classic">'. 70 form::checkbox(array('pings_do[]'),html::escapeHTML($v),in_array($v,$pings_do)).' '. 71 html::escapeHTML($k).'</label></p>'; 72 } 73 } 74 75 public static function doPings(&$cur,&$post_id) 76 { 77 if (empty($_POST['pings_do']) || !is_array($_POST['pings_do'])) { 78 return; 79 } 80 81 $core =& $GLOBALS['core']; 82 if (!$core->blog->settings->pings_active) { 83 return; 84 } 85 86 $pings_uris = @unserialize($core->blog->settings->pings_uris); 87 if (empty($pings_uris) || !is_array($pings_uris)) { 88 return; 89 } 90 91 foreach ($_POST['pings_do'] as $uri) 92 { 93 if (in_array($uri,$pings_uris)) { 94 try { 95 pingsAPI::doPings($uri,$core->blog->name,$core->blog->url); 96 } catch (Exception $e) {} 97 } 98 } 99 } 100 } 101 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |