當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Webservice::sanitizeURL方法代碼示例

本文整理匯總了PHP中Idno\Core\Webservice::sanitizeURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP Webservice::sanitizeURL方法的具體用法?PHP Webservice::sanitizeURL怎麽用?PHP Webservice::sanitizeURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Idno\Core\Webservice的用法示例。


在下文中一共展示了Webservice::sanitizeURL方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: getFeedObject

 /**
  * Retrieves a feed object for the given URL, or creates one if it's new to the system
  * @param $url
  * @param $update Set to true in order to refresh saved feed details. False by default.
  * @return bool|false|\Idno\Common\Entity|Feed
  */
 function getFeedObject($url, $update = false)
 {
     $wc = new Webservice();
     $url = $wc->sanitizeURL($url);
     if ($feed_details = $this->getFeedDetails($url)) {
         if ($feed_array = Feed::get(array('feed_url' => $feed_details['url']))) {
             foreach ($feed_array as $feed_item) {
                 $feed = $feed_item;
                 break;
             }
         } else {
             $feed = new Feed();
         }
         if ($feed->getID() && !$update) {
             return $feed;
         }
         $feed->url = $url;
         if (!empty($feed_details['title'])) {
             $feed->setTitle($feed_details['title']);
         }
         if (!empty($feed_details['type'])) {
             $feed->setType($feed_details['type']);
         }
         if (!empty($feed_details['url'])) {
             $feed->setFeedURL($feed_details['url']);
             if ($feed->save()) {
                 return $feed;
             }
         }
     }
     return false;
 }
開發者ID:sintoris,項目名稱:Known,代碼行數:38,代碼來源:Reader.php


注:本文中的Idno\Core\Webservice::sanitizeURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。