当前位置: 首页>>代码示例>>PHP>>正文


PHP Core\Webmention类代码示例

本文整理汇总了PHP中Idno\Core\Webmention的典型用法代码示例。如果您正苦于以下问题:PHP Webmention类的具体用法?PHP Webmention怎么用?PHP Webmention使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Webmention类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveDataFromInput

 function saveDataFromInput()
 {
     $page = Idno::site()->currentPage();
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->likeof = $page->getInput('like-of');
     if ($this->likeof) {
         foreach ((array) $this->likeof as $likeofurl) {
             $this->syndicatedto = Webmention::addSyndicatedReplyTargets($likeofurl, $this->syndicatedto);
         }
     }
     $this->description = $page->getInput('description');
     if (empty($this->description)) {
         $result = \IdnoPlugins\Reactions\Pages\Fetch::fetch($this->likeof);
         if (!empty($result['description'])) {
             $this->description = $result['description'];
         }
     }
     $this->setAccess($page->getInput('access'));
     Idno::site()->logging()->log("saving like. new: {$new}");
     if ($this->publish($new)) {
         Idno::site()->logging()->log("sending webmentions from {$this->getURL()} to {$this->likeof}");
         Webmention::sendWebmentionPayload($this->getURL(), $this->likeof);
     }
     return true;
 }
开发者ID:kylewm,项目名称:KnownReactions,代码行数:29,代码来源:Like.php

示例2: testAddSyndicatedReplyTargets

    function testAddSyndicatedReplyTargets()
    {
        // test u-syndication
        $doc = <<<EOD
<div class="h-entry">
  <span class="p-name e-content">This is a post</span>
  <a class="u-url" href="http://foo.bar/post">permalink</a>
  <a class="u-syndication" href="https://twitter.com/foobar/12345">on Twitter</a>
  <a class="u-syndication" href="https://www.facebook.com/foobar/posts/12345">on Facebook</a>
</div>
EOD;
        $result = Webmention::addSyndicatedReplyTargets('http://foo.bar/post', [], ['response' => 200, 'content' => $doc]);
        $this->assertEquals(['https://twitter.com/foobar/12345', 'https://www.facebook.com/foobar/posts/12345'], $result);
        // test rel-syndication
        $doc = <<<EOD
<head>
  <link rel="syndication" href="https://twitter.com/foobar/12345" />
  <link rel="syndication" href="https://www.facebook.com/foobar/posts/12345" />
</head>
<body>
  <div class="h-entry">
    <span class="p-name e-content">This is a post</span>
    <a class="u-url" href="http://foo.bar/post">permalink</a>
  </div>
</body>
EOD;
        $result = Webmention::addSyndicatedReplyTargets('http://foo.bar/post', [], ['response' => 200, 'content' => $doc]);
        $this->assertEquals(['https://twitter.com/foobar/12345', 'https://www.facebook.com/foobar/posts/12345'], $result);
    }
开发者ID:smartboyathome,项目名称:Known,代码行数:29,代码来源:WebmentionTest.php

示例3: saveDataFromInput

 function saveDataFromInput()
 {
     $page = Idno::site()->currentPage();
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->repostof = $page->getInput('repost-of');
     if ($this->repostof) {
         foreach ((array) $this->repostof as $repostofurl) {
             $this->syndicatedto = Webmention::addSyndicatedReplyTargets($repostofurl, $this->syndicatedto);
         }
     }
     $this->description = $page->getInput('description');
     $this->body = $page->getInput('body');
     if (empty($this->description) && empty($this->body)) {
         $result = \IdnoPlugins\Reactions\Pages\Fetch::fetch($this->repostof);
         if (isset($result['description'])) {
             $this->description = $result['description'];
         }
         if (isset($result['content'])) {
             $this->body = $result['content'];
         }
     }
     $this->setAccess($page->getInput('access'));
     if ($this->publish($new)) {
         Webmention::sendWebmentionPayload($this->getURL(), $this->repostof);
     }
     return true;
 }
开发者ID:kylewm,项目名称:KnownReactions,代码行数:31,代码来源:Repost.php

示例4: postContent

 function postContent()
 {
     $body = strip_tags($this->getInput('body'));
     $name = strip_tags($this->getInput('name'));
     $url = trim($this->getInput('url'));
     $url2 = trim($this->getInput('url-2'));
     $validator = $this->getInput('validator');
     if (!empty($url2)) {
         $this->deniedContent();
     }
     $this->referrerGatekeeper();
     if (!empty($body) && !empty($name) && !empty($validator)) {
         if ($object = Entity::getByUUID($validator)) {
             if ($url = Webservice::sanitizeURL($url)) {
                 if ($content = Webservice::get($url)) {
                     if ($content['response'] == '200') {
                         $icon = Webmention::getIconFromWebsiteContent($content['content'], $url);
                     }
                 }
             }
             if (empty($icon)) {
                 $bn = hexdec(substr(md5($url), 0, 15));
                 $number = 1 + $bn % 5;
                 $icon = \Idno\Core\site()->config()->url . 'gfx/users/default-' . str_pad($number, 2, '0', STR_PAD_LEFT) . '.png';
             }
             $object->addAnnotation('reply', $name, $url, $icon, $body);
             $this->forward($object->getDisplayURL());
         }
     }
 }
开发者ID:emory,项目名称:Known,代码行数:30,代码来源:Post.php

示例5: saveDataFromInput

 /**
  * Saves changes to this object based on user input
  * @return bool
  */
 function saveDataFromInput()
 {
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->title = \Idno\Core\site()->currentPage()->getInput('title');
     $this->body = \Idno\Core\site()->currentPage()->getInput('body');
     $this->setAccess('PUBLIC');
     // Get photo
     if ($new) {
         if (!empty($_FILES['photo']['tmp_name'])) {
             if (\Idno\Entities\File::isImage($_FILES['photo']['tmp_name'])) {
                 if ($photo = \Idno\Entities\File::createFromFile($_FILES['photo']['tmp_name'], $_FILES['photo']['name'], $_FILES['photo']['type'], true)) {
                     $this->attachFile($photo);
                     if ($thumbnail = \Idno\Entities\File::createThumbnailFromFile($_FILES['photo']['tmp_name'], $_FILES['photo']['name'])) {
                         $this->thumbnail = \Idno\Core\site()->config()->url . 'file/' . $thumbnail;
                         $this->thumbnail_id = substr($thumbnail, 0, strpos($thumbnail, '/'));
                     }
                 } else {
                     \Idno\Core\site()->session()->addMessage('Image wasn\'t attached.');
                 }
             } else {
                 \Idno\Core\site()->session()->addMessage('This doesn\'t seem to be an image ..');
             }
         } else {
             \Idno\Core\site()->session()->addMessage('We couldn\'t access your image. Please try again.');
             return false;
         }
     }
     if ($this->save()) {
         if ($new) {
             $this->addToFeed();
         }
         // Add it to the Activity Streams feed
         \Idno\Core\Webmention::pingMentions($this->getURL(), \Idno\Core\site()->template()->parseURLs($this->getDescription()));
         \Idno\Core\site()->session()->addMessage('Your photo was successfully saved.');
         return true;
     } else {
         return false;
     }
 }
开发者ID:phpsource,项目名称:idno,代码行数:47,代码来源:Photo.php

示例6: post

 function post()
 {
     parse_str(trim(file_get_contents("php://input")), $vars);
     // Check that both source and target are non-empty
     if (!empty($vars['source']) && !empty($vars['target']) && $vars['source'] != $vars['target']) {
         $source = urldecode($vars['source']);
         $target = urldecode($vars['target']);
         // Get the page handler for target
         if ($page = \Idno\Core\site()->getPageHandler($target)) {
             // Check that source exists, parse it for mf2 content,
             // and ensure that it genuinely mentions this page
             if ($source_content = \Idno\Core\Webmention::getPageContent($source)) {
                 if (substr_count($source_content['content'], $target) || $source_content['response'] == 410) {
                     $source_mf2 = \Idno\Core\Webmention::parseContent($source_content['content']);
                     // Set source and target information as input variables
                     $page->setPermalink();
                     if ($page->webmentionContent($source, $target, $source_content, $source_mf2)) {
                         $this->setResponse(202);
                         // Webmention received a-ok.
                         exit;
                     } else {
                         $error = 'target_not_supported';
                         $error_text = 'This is not webmentionable.';
                     }
                 } else {
                     $error = 'no_link_found';
                     $error_text = 'The source URI does not contain a link to the target URI.';
                     error_log('No link from ' . $source . ' to ' . $target);
                 }
             } else {
                 $error = 'source_not_found';
                 $error_text = 'The source content could not be obtained.';
                 error_log('No content from ' . $source);
             }
         } else {
             $error = 'target_not_found';
             $error_text = 'The target page does not exist.';
         }
     }
     $this->setResponse(400);
     // Webmention failed.
     echo json_encode(['error' => $error, 'error_text' => $error_text]);
 }
开发者ID:phpsource,项目名称:idno,代码行数:43,代码来源:Endpoint.php

示例7: getContent

 function getContent()
 {
     if (!\Idno\Core\site()->session()->isLoggedIn()) {
         $this->setResponse(401);
         $this->forward('/session/login');
     }
     $url = $this->getInput('share_url');
     $title = $this->getInput('share_title');
     $share_type = 'note';
     if ($content = \Idno\Core\Webmention::getPageContent($url)) {
         if ($mf2 = \Idno\Core\Webmention::parseContent($content['content'])) {
             if (substr_count($content['content'], 'h-entry') == 1) {
                 $share_type = 'reply';
                 if (substr_count($content['content'], 'h-event') == 1) {
                     $share_type = 'rsvp';
                 }
             }
         }
     }
     $content_type = \Idno\Common\ContentType::getRegisteredForIndieWebPostType($share_type);
     if (!empty($content_type)) {
         if ($page = \Idno\Core\site()->getPageHandler('/' . $content_type->camelCase($content_type->getEntityClassName()) . '/edit')) {
             if ($share_type == 'note' && !substr_count($url, 'twitter.com')) {
                 $page->setInput('body', $title . ' ' . $url);
             } else {
                 $page->setInput('url', $url);
                 if (substr_count($url, 'twitter.com')) {
                     preg_match("|https?://(www\\.)?twitter\\.com/(#!/)?@?([^/]*)|", $url, $matches);
                     if (!empty($matches[3])) {
                         $page->setInput('body', '@' . $matches[3] . ' ');
                     }
                 }
             }
             $page->setInput('hidenav', true);
             $page->get();
         }
     } else {
         $t = \Idno\Core\site()->template();
         $body = $t->__(['share_type' => $share_type, 'content_type' => $content_type])->draw('firefox/share');
         $t->__(['title' => 'Share', 'body' => $body, 'hidenav' => true])->drawPage();
     }
 }
开发者ID:phpsource,项目名称:idno,代码行数:42,代码来源:Share.php

示例8: saveDataFromInput

 /**
  * Saves changes to this object based on user input
  * @return bool
  */
 function saveDataFromInput()
 {
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     $this->title = \Idno\Core\site()->currentPage()->getInput('title');
     $this->body = \Idno\Core\site()->currentPage()->getInput('body');
     $this->setAccess('PUBLIC');
     // Get video
     if ($new) {
         if (!empty($_FILES['video']['tmp_name'])) {
             if (true) {
                 if ($video = \Idno\Entities\File::createFromFile($_FILES['video']['tmp_name'], $_FILES['video']['name'], $_FILES['video']['type'], true)) {
                     $this->attachFile($video);
                 } else {
                     \Idno\Core\site()->session()->addMessage('Video wasn\'t attached.');
                 }
             } else {
                 \Idno\Core\site()->session()->addMessage('This doesn\'t seem to be a video ..');
             }
         } else {
             \Idno\Core\site()->session()->addMessage('We couldn\'t access your video. Please try again.');
             return false;
         }
     }
     if ($this->save()) {
         if ($new) {
             $this->addToFeed();
         }
         // Add it to the Activity Streams feed
         \Idno\Core\Webmention::pingMentions($this->getURL(), \Idno\Core\site()->template()->parseURLs($this->getDescription()));
         \Idno\Core\site()->session()->addMessage('Your video was successfully saved.');
         return true;
     } else {
         return false;
     }
 }
开发者ID:phpsource,项目名称:idno,代码行数:43,代码来源:Video.php

示例9: deleteData

 function deleteData()
 {
     if ($this->getAccess() == 'PUBLIC') {
         \Idno\Core\Webmention::pingMentions($this->getURL(), \Idno\Core\Idno::site()->template()->parseURLs($this->getDescription()));
     }
 }
开发者ID:smartboyathome,项目名称:Known,代码行数:6,代码来源:Event.php

示例10: saveDataFromInput

 /**
  * Saves changes to this object based on user input
  * @return bool
  */
 function saveDataFromInput()
 {
     if (empty($this->_id)) {
         $new = true;
     } else {
         $new = false;
     }
     if ($new) {
         if (!\Idno\Core\Idno::site()->triggerEvent("file/upload", [], true)) {
             return false;
         }
     }
     $this->title = \Idno\Core\Idno::site()->currentPage()->getInput('title');
     $this->body = \Idno\Core\Idno::site()->currentPage()->getInput('body');
     $this->tags = \Idno\Core\Idno::site()->currentPage()->getInput('tags');
     $access = \Idno\Core\Idno::site()->currentPage()->getInput('access');
     $this->setAccess($access);
     if ($time = \Idno\Core\Idno::site()->currentPage()->getInput('created')) {
         if ($time = strtotime($time)) {
             $this->created = $time;
         }
     }
     // Get photo
     if ($new) {
         if (!empty($_FILES['photo']['tmp_name'])) {
             if (\Idno\Entities\File::isImage($_FILES['photo']['tmp_name']) || \Idno\Entities\File::isSVG($_FILES['photo']['tmp_name'], $_FILES['photo']['name'])) {
                 // Extract exif data so we can rotate
                 if (is_callable('exif_read_data') && $_FILES['photo']['type'] == 'image/jpeg') {
                     try {
                         if (function_exists('exif_read_data')) {
                             if ($exif = exif_read_data($_FILES['photo']['tmp_name'])) {
                                 $this->exif = base64_encode(serialize($exif));
                                 // Yes, this is rough, but exif contains binary data that can not be saved in mongo
                             }
                         }
                     } catch (\Exception $e) {
                         $exif = false;
                     }
                 } else {
                     $exif = false;
                 }
                 if ($photo = \Idno\Entities\File::createFromFile($_FILES['photo']['tmp_name'], $_FILES['photo']['name'], $_FILES['photo']['type'], true, true)) {
                     $this->attachFile($photo);
                     // Now get some smaller thumbnails, with the option to override sizes
                     $sizes = \Idno\Core\Idno::site()->events()->dispatch('photo/thumbnail/getsizes', new \Idno\Core\Event(array('sizes' => array('large' => 800, 'medium' => 400, 'small' => 200))));
                     $eventdata = $sizes->data();
                     foreach ($eventdata['sizes'] as $label => $size) {
                         $filename = $_FILES['photo']['name'];
                         // Experiment: let's not save thumbnails for GIFs, in order to enable animated GIF posting.
                         if ($_FILES['photo']['type'] != 'image/gif') {
                             if ($thumbnail = \Idno\Entities\File::createThumbnailFromFile($_FILES['photo']['tmp_name'], "{$filename}_{$label}", $size, false)) {
                                 $varname = "thumbnail_{$label}";
                                 $this->{$varname} = \Idno\Core\Idno::site()->config()->url . 'file/' . $thumbnail;
                                 $varname = "thumbnail_{$label}_id";
                                 $this->{$varname} = substr($thumbnail, 0, strpos($thumbnail, '/'));
                             }
                         }
                     }
                 } else {
                     \Idno\Core\Idno::site()->session()->addErrorMessage('Image wasn\'t attached.');
                 }
             } else {
                 \Idno\Core\Idno::site()->session()->addErrorMessage('This doesn\'t seem to be an image ..');
             }
         } else {
             \Idno\Core\Idno::site()->session()->addErrorMessage('We couldn\'t access your image. Please try again.');
             return false;
         }
     }
     if ($this->save($new)) {
         \Idno\Core\Webmention::pingMentions($this->getURL(), \Idno\Core\Idno::site()->template()->parseURLs($this->getTitle() . ' ' . $this->getDescription()));
         return true;
     } else {
         return false;
     }
 }
开发者ID:jirkadus,项目名称:Known,代码行数:80,代码来源:Photo.php

示例11: deleteData

 function deleteData()
 {
     \Idno\Core\Webmention::pingMentions($this->getURL(), \Idno\Core\Idno::site()->template()->parseURLs($this->getTitle() . ' ' . $this->getDescription()));
 }
开发者ID:jirkadus,项目名称:Known,代码行数:4,代码来源:Checkin.php

示例12: getFeedDetails

 /**
  * Given the URL of a website, returns a single linked array containing the URL and title of a feed
  * (whether Microformats or RSS / Atom). The function will attempt to discover RSS and Atom feeds in
  * the page if this is an HTML site. Returns false if there is no feed.
  * @param $url
  * @return array|false
  */
 function getFeedDetails($url)
 {
     if (!filter_var($url, FILTER_VALIDATE_URL)) {
         return false;
     }
     $client = new Webservice();
     if ($result = $client->get($url)) {
         $feed = array();
         if (!empty($result['content'])) {
             $feed['webmention'] = Webmention::supportsMentions($url, $result['content']);
             if ($html = @\DOMDocument::loadHTML($result['content'])) {
                 $xpath = new \DOMXpath($html);
                 $title = $xpath->query('//title')->item(0)->nodeValue;
                 if ($xpath->query("//*[contains(concat(' ', @class, ' '), ' h-entry ')]")->length > 0) {
                     $feed['type'] = 'mf2';
                     $feed['url'] = $url;
                     if (!empty($title)) {
                         $feed['title'] = $title;
                     }
                     return $feed;
                 }
                 if ($rss_url = $this->findXMLFeedURL($html)) {
                     $feed['type'] = 'xml';
                     $feed['url'] = $rss_url;
                     if (!empty($title)) {
                         $feed['title'] = $title;
                     }
                     return $feed;
                 }
             }
             if ($xml = @simplexml_load_string($result['content'])) {
                 if (!empty($xml->rss->channel->item) || !empty($xml->feed) || !empty($xml->channel->item)) {
                     $feed['type'] = 'xml';
                     $feed['url'] = $url;
                     if (!empty($xml->rss->channel->title)) {
                         $feed['title'] = $xml->rss->channel->title;
                     } else {
                         if (!empty($xml->channel->title)) {
                             $feed['title'] = $xml->channel->title;
                         } else {
                             if (!empty($xml->title)) {
                                 $feed['title'] = $xml->title;
                             }
                         }
                     }
                     return $feed;
                 }
             }
         }
     }
     return false;
 }
开发者ID:sintoris,项目名称:Known,代码行数:59,代码来源:Reader.php

示例13: getActionTypeFromHTML

 /**
  * Given content, returns the type of action you can respond with
  * @param $content
  * @return string
  */
 static function getActionTypeFromHTML($content)
 {
     $share_type = 'comment';
     if ($mf2 = \Idno\Core\Webmention::parseContent($content['content'])) {
         if (!empty($mf2['items'])) {
             foreach ($mf2['items'] as $item) {
                 if (!empty($item['type'])) {
                     if (in_array('h-entry', $item['type'])) {
                         $share_type = 'reply';
                     }
                     if (in_array('h-event', $item['type'])) {
                         $share_type = 'rsvp';
                     }
                 }
             }
         }
     }
     return $share_type;
 }
开发者ID:d6-9b,项目名称:Known,代码行数:24,代码来源:Webmention.php

示例14: getContent

 function getContent()
 {
     $this->gatekeeper();
     $url = $this->getInput('share_url');
     $title = $this->getInput('share_title');
     $type = $this->getInput('share_type');
     // Provide a hook to a URL shortener (TODO: Tidy this up when #237 is merged)
     $event = new \Idno\Core\Event();
     $event->setResponse($url);
     \Idno\Core\site()->events()->dispatch('url/shorten', $event);
     $url = $event->response();
     if (!in_array($type, ['note', 'reply', 'rsvp', 'like'])) {
         $share_type = 'note';
         if ($content = \Idno\Core\Webservice::get($url)) {
             if ($mf2 = \Idno\Core\Webmention::parseContent($content['content'])) {
                 if (!empty($mf2['items'])) {
                     foreach ($mf2['items'] as $item) {
                         if (!empty($item['type'])) {
                             if (in_array('h-entry', $item['type'])) {
                                 $share_type = 'reply';
                             }
                             if (in_array('h-event', $item['type'])) {
                                 $share_type = 'rsvp';
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $share_type = $type;
     }
     $content_type = \Idno\Common\ContentType::getRegisteredForIndieWebPostType($share_type);
     $hide_nav = false;
     if ($this->getInput('via') == 'ff_social') {
         $hide_nav = true;
     }
     if (!empty($content_type)) {
         if ($page = \Idno\Core\site()->getPageHandler('/' . $content_type->camelCase($content_type->getEntityClassName()) . '/edit')) {
             if ($share_type == 'note') {
                 $page->setInput('body', $title . ' ' . $url);
             } else {
                 $page->setInput('url', $url);
                 if (substr_count($url, 'twitter.com')) {
                     preg_match("|https?://(www\\.)?twitter\\.com/(#!/)?@?([^/]*)|", $url, $matches);
                     if (!empty($matches[3])) {
                         $page->setInput('body', '@' . $matches[3] . ' ');
                     }
                 }
             }
             $page->setInput('hidenav', $hide_nav);
             $page->setInput('sharing', true);
             $page->setInput('share_type', $share_type);
             $page->get();
         }
     } else {
         $t = \Idno\Core\site()->template();
         $body = $t->__(['share_type' => $share_type, 'content_type' => $content_type, 'sharing' => true])->draw('entity/share');
         $t->__(['title' => 'Share', 'body' => $body, 'hidenav' => $hide_nav])->drawPage();
     }
 }
开发者ID:avewrigley,项目名称:idno,代码行数:61,代码来源:Share.php

示例15: post

 function post()
 {
     parse_str(trim(file_get_contents("php://input")), $vars);
     // Check that both source and target are non-empty
     if (!empty($vars['source']) && !empty($vars['target']) && $vars['source'] != $vars['target']) {
         $source = $vars['source'];
         $target = $vars['target'];
         // Remove anchors from target URL, but save them to '#' input so we can still reference them later
         if (strpos($target, '#')) {
             list($target, $fragment) = explode('#', $target, 2);
             if (!empty($fragment)) {
                 $this->setInput('#', $fragment);
             }
         }
         // Get the page handler for target
         if ($page = \Idno\Core\Idno::site()->getPageHandler($target)) {
             // First of all, make sure the target page isn't the source page. Let's not webmention ourselves!
             $webmention_ok = true;
             if (\Idno\Common\Entity::isLocalUUID($source)) {
                 if ($source_page = \Idno\Core\Idno::site()->getPageHandler($source)) {
                     if ($source_page == $page) {
                         $webmention_ok = false;
                     }
                 }
             }
             // Check that source exists, parse it for mf2 content,
             // and ensure that it genuinely mentions this page
             if ($webmention_ok) {
                 if ($source_content = \Idno\Core\Webservice::get($source)) {
                     if (substr_count($source_content['content'], $target) || $source_content['response'] == 410) {
                         $source_mf2 = \Idno\Core\Webmention::parseContent($source_content['content'], $source);
                         // Set source and target information as input variables
                         $page->setPermalink();
                         if ($page->webmentionContent($source, $target, $source_content, $source_mf2)) {
                             $this->setResponse(202);
                             // Webmention received a-ok.
                             exit;
                         } else {
                             $error = 'target_not_supported';
                             $error_text = 'This is not webmentionable.';
                         }
                     } else {
                         $error = 'no_link_found';
                         $error_text = 'The source URI does not contain a link to the target URI.';
                         \Idno\Core\Idno::site()->logging->warning('No link from ' . $source . ' to ' . $target);
                     }
                 } else {
                     $error = 'source_not_found';
                     $error_text = 'The source content for ' . $source . ' could not be obtained.';
                     \Idno\Core\Idno::site()->logging->warning('No content from ' . $source);
                 }
             } else {
                 $error = 'target_not_supported';
                 $error_text = 'A page can\'t webmention itself.';
             }
         } else {
             $error = 'target_not_found';
             $error_text = 'The target page ' . $target . ' does not exist.';
             \Idno\Core\Idno::site()->logging()->error('Could not find handler for ' . $target);
         }
     }
     $this->setResponse(400);
     // Webmention failed.
     if (empty($error)) {
         $error = 'unknown_error';
         $error_text = 'Not all the required webmention variables were set.';
     }
     echo json_encode(array('error' => $error, 'error_text' => $error_text));
 }
开发者ID:knownunknowns,项目名称:Known,代码行数:69,代码来源:Endpoint.php


注:本文中的Idno\Core\Webmention类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。