Exemple #1
0
 public function notify($action = 'LOAD')
 {
     $followers = SMOBTools::followers();
     if ($followers) {
         // Publish new feed to the hub
         //@TODO: should the hub_url be stored somewhere?
         $hub_url = HUB_URL_PUBLISH;
         $topic_url = SMOB_ROOT . 'me' . FEED_URL_PATH;
         // Reusing do_curl function
         $feed = urlencode($topic_url);
         $result = SMOBTools::do_curl($hub_url, $postfields = "hub.mode=publish&hub.url={$feed}");
         // all good -- anything in the 200 range
         if (substr($result[2], 0, 1) == "2") {
             error_log("DEBUG: {$topic_url} was successfully published to hubsub {$hub_url}", 0);
         }
         error_log("DEBUG: Server answer: " . join(' ', $result), 0);
         if ($action == 'LOAD') {
             print '<li>Notification sent to your followers !</li>';
         } elseif ($action == 'DELETE FROM') {
             print '<li>Delete notification sent to your followers !</li>';
         } else {
             return;
         }
     }
 }
Exemple #2
0
 private function followers()
 {
     return SMOBTemplate::users($this->type, SMOBTools::followers());
 }