Ejemplo n.º 1
0
 /**
  * Method to handle and parse request to PuSH Feed Hub Callbacks
  *
  * @param object $wp Pass WordPress Object by reference
  */
 public function tls_hub_callback_parser(&$wp)
 {
     $pushfeed_url = $_SERVER['REQUEST_URI'];
     // Check if pushfeed is in the URL
     if (strpos($pushfeed_url, 'pushfeed') || preg_match('/pushfeed/', $pushfeed_url)) {
         $pushfeed_url_array = explode('/', $pushfeed_url);
         // Get subscription_id from the URL
         $subscription_id = array_pop($pushfeed_url_array);
         if (empty($subscription_id)) {
             $subscription_id = array_pop($pushfeed_url_array);
         }
         //Make sure the subscription ID matches the one in the database otherwise service 404
         if ($this->current_options['subscription_id'] != $subscription_id) {
             header('HTTP/1.1 404 "Not Found"', null, 404);
             exit;
         }
         $this->hubSubscriber->handleRequest();
         exit;
     }
 }