Ejemplo n.º 1
0
 /**
  * Send a webmention payload to a target without parsing HTML
  *
  * @param $sourceURL
  * @param $targetURL
  * @return bool
  */
 static function sendWebmentionPayload($sourceURL, $targetURL)
 {
     // Load webmention-client
     require_once \Idno\Core\Idno::site()->config()->path . '/external/mention-client-php/src/IndieWeb/MentionClient.php';
     $client = new \Idno\Core\MentionClient($sourceURL);
     // $client->sendWebmentionPayload on its own would have no effect
     // because no webmention endpoint has been discovered yet.
     return $client->sendSupportedMentions($targetURL);
 }
Ejemplo n.º 2
0
 /**
  * Pings mentions from a given page to any linked pages
  * @param $pageURL Page URL
  * @param string $text The text to mine for links
  * @return int The number of pings that were sent out
  */
 static function pingMentions($pageURL, $text)
 {
     if ($current_page = site()->currentPage()) {
         if ($nowebmention = $current_page->getInput('nomention')) {
             return true;
         }
     }
     // Load webmention-client
     require_once \Idno\Core\Idno::site()->config()->path . '/external/mention-client-php/src/IndieWeb/MentionClient.php';
     // Proxy connection string provided
     $proxystring = false;
     if (!empty(\Idno\Core\Idno::site()->config()->proxy_string)) {
         $proxystring = \Idno\Core\Idno::site()->config()->proxy_string;
     }
     $client = new \Idno\Core\MentionClient($pageURL, $text, $proxystring);
     return $client->sendSupportedMentions();
 }
Ejemplo n.º 3
0
 /**
  * Pings mentions from a given page to any linked pages
  * @param $pageURL Page URL
  * @param string $text The text to mine for links
  * @return int The number of pings that were sent out
  */
 static function pingMentions($pageURL, $text)
 {
     // There's no point in sending webmentions to private resources
     if (!Idno::site()->config()->isPublicSite()) {
         return false;
     }
     if ($current_page = \Idno\Core\Idno::site()->currentPage()) {
         if ($nowebmention = $current_page->getInput('nomention') || defined('KNOWN_NOMENTION')) {
             return true;
         }
     }
     // Load webmention-client
     require_once \Idno\Core\Idno::site()->config()->path . '/external/mention-client-php/src/IndieWeb/MentionClient.php';
     // Proxy connection string provided
     $proxystring = false;
     if (!empty(\Idno\Core\Idno::site()->config()->proxy_string)) {
         $proxystring = \Idno\Core\Idno::site()->config()->proxy_string;
     }
     $client = new \Idno\Core\MentionClient($pageURL, $text, $proxystring);
     return $client->sendSupportedMentions();
 }