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


PHP SimplePie::enable_order_by_date方法代码示例

本文整理汇总了PHP中SimplePie::enable_order_by_date方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie::enable_order_by_date方法的具体用法?PHP SimplePie::enable_order_by_date怎么用?PHP SimplePie::enable_order_by_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimplePie的用法示例。


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

示例1: tweetimport_import_twitter_feed

function tweetimport_import_twitter_feed($twitter_account)
{
  require_once (ABSPATH . WPINC . '/class-feed.php');

  $feed = new SimplePie();

  $account_parts = explode ('/', $twitter_account['twitter_name'], 2);



  if ($twitter_account['account_type'] == 1): //Account is Favorites
    $feed->set_feed_url(str_replace('#=#USER#=#', $account_parts[0], TWEETIMPORT_API_FAVORITES_URL));
  elseif ($twitter_account['account_type'] == 0 && count($account_parts) == 1): //User timeline
      $feed->set_feed_url(str_replace('#=#USER#=#', $account_parts[0], TWEETIMPORT_API_USER_TIMELINE_URL));
  elseif ($twitter_account['account_type'] == 2 && count($account_parts) == 2): //Account is list
      $feed_url = str_replace('#=#USER#=#', $account_parts[0], TWEETIMPORT_API_LIST_URL);
      $feed_url = str_replace('#=#LIST#=#', $account_parts[1], $feed_url);
      $feed->set_feed_url($feed_url);
  else :
      return '<strong>ERROR: Account information not correct. Account type wrong?</strong>';
  endif;

  $feed->set_useragent('Tweet Import http://skinju.com/wordpress/tweetimport');
  $feed->set_cache_class('WP_Feed_Cache');
  $feed->set_file_class('WP_SimplePie_File');
  $feed->enable_cache(true);
  $feed->set_cache_duration (apply_filters('tweetimport_cache_duration', 880));
  $feed->enable_order_by_date(false);
  $feed->init();
  $feed->handle_content_type();

  if ($feed->error()):
   return '<strong>ERROR: Feed Reading Error.</strong>';
  endif;

  $rss_items = $feed->get_items();

  $imported_count = 0;
  foreach ($rss_items as $item)
  {
    $item = apply_filters ('tweetimport_tweet_before_new_post', $item); //return false to stop processing an item.
    if (!$item) continue;

    $processed_description = $item->get_description();

    //Get the twitter author from the beginning of the tweet text
    $twitter_author = trim(preg_replace("~^(\w+):(.*?)$~", "\\1", $processed_description));

    if ($twitter_account['strip_name'] == 1):
      $processed_description = preg_replace("~^(\w+):(.*?)~i", "\\2", $processed_description);
    endif;

    if ($twitter_account['names_clickable'] == 1):
      $processed_description = preg_replace("~@(\w+)~", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $processed_description);
      $processed_description = preg_replace("~^(\w+):~", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>:", $processed_description);
    endif;

    if ($twitter_account['hashtags_clickable'] == 1):
      if ($twitter_account['hashtags_clickable_twitter'] == 1):
          $processed_description = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $processed_description);
      else:
        $processed_description = preg_replace("/#(\w+)/", "<a href=\"" . skinju_get_tag_link("\\1") . "\">#\\1</a>", $processed_description);
      endif;
    endif;

  $processed_description = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $processed_description);
  $processed_description = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $processed_description);

    $new_post = array('post_title' => trim (substr (preg_replace("~{$account_parts[0]}: ~i", "", $item->get_title()), 0, 25) . '...'),
                      'post_content' => trim ($processed_description),
                      'post_date' => $item->get_date('Y-m-d H:i:s'),
                      'post_author' => $twitter_account['author'],
                      'post_category' => array($twitter_account['category']),
                      'post_status' => 'publish');

    $new_post = apply_filters('tweetimport_new_post_before_create', $new_post); // Offer the chance to manipulate new post data. return false to skip
    if (!$new_post) continue;
    $new_post_id = wp_insert_post($new_post);

    $imported_count++;

    add_post_meta ($new_post_id, 'tweetimport_twitter_author', $twitter_author, true); 
    add_post_meta ($new_post_id, 'tweetimport_date_imported', date ('Y-m-d H:i:s'), true);
    add_post_meta ($new_post_id, 'tweetimport_twitter_id', $item->get_id(), true);
    add_post_meta ($new_post_id, 'tweetimport_twitter_id', $item->get_id(), true);
    add_post_meta ($new_post_id, '_tweetimport_twitter_id_hash', $item->get_id(true), true);
    add_post_meta ($new_post_id, 'tweetimport_twitter_post_uri', $item->get_link(0));
    add_post_meta ($new_post_id, 'tweetimport_author_avatar', $item->get_link(0, 'image'));

    preg_match_all ('~#([A-Za-z0-9_]+)(?=\s|\Z)~', $item->get_description(), $out);
    if ($twitter_account['add_tag']) $out[0][] = $twitter_account['add_tag'];
    wp_set_post_tags($new_post_id, implode (',', $out[0]));
  }

  return $imported_count;
}
开发者ID:robotconscience,项目名称:Robotconscience.com,代码行数:96,代码来源:tweet-import.php

示例2: simplepie

 public static function simplepie($feed_url = NULL)
 {
     if (!$feed_url) {
         return false;
     }
     $data = new SimplePie();
     //*******************************
     // Convert To GeoRSS feed
     // To Disable Uncomment these 3 lines
     //*******************************
     $geocoder = new Geocoder();
     $georss_feed = $geocoder->geocode_feed($feed_url);
     if ($georss_feed == false or empty($georss_feed)) {
         // Our RSS feed pull failed, so let's grab the original RSS feed
         $data->set_feed_url($feed_url);
     } else {
         // Converting our feed to GeoRSS was successful, use that data
         $data->set_raw_data($georss_feed);
     }
     // Uncomment Below to disable geocoding
     //$data->set_feed_url( $feed_url );
     //*******************************
     $data->enable_cache(false);
     $data->enable_order_by_date(true);
     $data->init();
     $data->handle_content_type();
     return $data;
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:28,代码来源:feed.php

示例3: _createSimplePie

 /**
  * _createSimplePie
  *
  * @param   string  &$feed  Params
  *
  * @return	object
  */
 private function _createSimplePie(&$feed)
 {
     include_once JPATH_AUTOTWEET . '/libs/SimplePie_autoloader.php';
     // Process the feed with SimplePie
     $simplePie = new SimplePie();
     $simplePie->set_feed_url($feed->xtform->get('url'));
     $simplePie->set_stupidly_fast(true);
     $simplePie->enable_order_by_date(true);
     if ($feed->xtform->get('encoding', 'utf-8')) {
         $simplePie->set_input_encoding($feed->xtform->get('encoding'));
     }
     if ($feed->xtform->get('force_fsockopen')) {
         $simplePie->force_fsockopen(true);
     }
     $use_sp_cache = EParameter::getComponentParam(CAUTOTWEETNG, 'use_sp_cache', true);
     if ($use_sp_cache && is_writable(JPATH_CACHE)) {
         $simplePie->set_cache_location(JPATH_CACHE);
         $simplePie->enable_cache(true);
     } else {
         $simplePie->enable_cache(false);
     }
     $set_sp_timeout = EParameter::getComponentParam(CAUTOTWEETNG, 'set_sp_timeout', 10);
     if ($set_sp_timeout) {
         $simplePie->set_timeout((int) $set_sp_timeout);
     }
     $simplePie->init();
     return $simplePie;
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:35,代码来源:feedimporter.php

示例4: get_feed

 private function get_feed($feed_url)
 {
     $feed = new SimplePie();
     $feed->set_feed_url($feed_url);
     $feed->enable_order_by_date(true);
     $feed->set_item_limit(3);
     $feed->init();
     $feed->handle_content_type();
     return $feed;
 }
开发者ID:sljm12,项目名称:TestDrive,代码行数:10,代码来源:RssController.php

示例5: fetchRss

 function fetchRss($url)
 {
     $feed = new SimplePie();
     $feed->set_feed_url($url);
     $feed->set_output_encoding("UTF-8");
     $feed->enable_order_by_date(false);
     $feed->set_cache_location(Configure::read('Rss.cache_path'));
     $feed->init();
     return $feed->get_items();
 }
开发者ID:searchfirst,项目名称:Lenore,代码行数:10,代码来源:rss.php

示例6: getFeed

 public function getFeed($refresh = false)
 {
     require_once dirname(__FILE__) . "/../../autoloader.php";
     $feed = new SimplePie();
     $url = "http://www.pinterest.com/taivasogilvy/feed.rss";
     $feed->set_feed_url($url);
     if ($refresh) {
         $feed->enable_cache(false);
     } else {
         $feed->set_cache_location($this->config->cacheFolder);
         $feed->set_cache_duration($this->config->cacheTime);
     }
     $feed->enable_order_by_date(false);
     $feed->init();
     $feed->handle_content_type();
     if ($feed->error()) {
         return false;
     } else {
         return $feed;
     }
 }
开发者ID:NikoHelle,项目名称:HellePhotography2016,代码行数:21,代码来源:Pinterest.php

示例7: getFeedByUrl

 private function getFeedByUrl($url)
 {
     // Create a new instance of the SimplePie object
     $feed = new \SimplePie();
     // Set feed
     $feed->set_feed_url($url);
     // Allow us to change the input encoding from the URL string if we want to. (optional)
     if (!empty($_GET['input'])) {
         $feed->set_input_encoding($_GET['input']);
     }
     // Allow us to choose to not re-order the items by date. (optional)
     if (!empty($_GET['orderbydate']) && $_GET['orderbydate'] == 'false') {
         $feed->enable_order_by_date(false);
     }
     // Trigger force-feed
     if (!empty($_GET['force']) && $_GET['force'] == 'true') {
         $feed->force_feed(true);
     }
     $feed->set_cache_location(dirname(__FILE__) . '/../cache/');
     $feed->init();
     return $feed->get_items(0, 10);
 }
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:22,代码来源:News.php

示例8: simplepie

 public static function simplepie($feed_url = NULL)
 {
     if (!$feed_url) {
         return false;
     }
     $data = new SimplePie();
     //*******************************
     // Convert To GeoRSS feed
     // To Disable Uncomment these 3 lines
     //*******************************
     $geocoder = new Geocoder();
     $georss_feed = $geocoder->geocode_feed($feed_url);
     $data->set_raw_data($georss_feed);
     // Uncomment Below to disable geocoding
     //$data->set_feed_url( $feed_url );
     //*******************************
     $data->enable_cache(false);
     $data->enable_order_by_date(true);
     $data->init();
     $data->handle_content_type();
     return $data;
 }
开发者ID:mewsop,项目名称:Ushahidi_Web,代码行数:22,代码来源:feed.php

示例9: getFeed

 public function getFeed($refresh = false)
 {
     require_once dirname(__FILE__) . "/../../autoloader.php";
     $feed = new SimplePie();
     $url = "http://taivasfi.blogspot.fi/feeds/posts/default";
     $url = "http://blogi.taivas.fi/?feed=rss2";
     $feed->set_feed_url($url);
     if ($refresh) {
         $feed->enable_cache(false);
     } else {
         $feed->set_cache_location($this->config->cacheFolder);
         $feed->set_cache_duration($this->config->cacheTime);
     }
     $feed->enable_order_by_date(false);
     $feed->init();
     $feed->handle_content_type();
     if ($feed->error()) {
         return false;
     } else {
         return $feed;
     }
 }
开发者ID:NikoHelle,项目名称:HellePhotography2016,代码行数:22,代码来源:WordPress.php

示例10: parseFeed

 /**
  * Opens an RSS feed, parses and loads the contents.
  *
  * @param string $url         The URL of the RSS feed
  * @param bool   $nativeOrder If true, disable order by date to preserve native ordering
  * @param bool   $force       Force SimplePie to parse the feed despite errors
  *
  * @return object An object that encapsulates the feed contents and operations on those contents.
  * @throws FeedParserException If opening or parsing feed fails
  **/
 public function parseFeed($url, $nativeOrder = false, $force = false)
 {
     require_once PATH_SYSTEM . '/vendors/SimplePie.php';
     $feed = new SimplePie();
     $feed->set_timeout($this->timeout);
     $feed->set_feed_url($url);
     $feed->enable_order_by_date(!$nativeOrder);
     $feed->force_feed($force);
     if ($this->cacheDuration != null) {
         $feed->set_cache_duration(intval($this->cacheDuration));
     }
     if ($this->cacheDirectory != null) {
         $feed->set_cache_location($this->cacheDirectory);
     }
     if ($this->stripHtmlTags != null) {
         $feed->strip_htmltags($this->stripHtmlTags);
     }
     @$feed->init();
     if ($err = $feed->error()) {
         throw new FeedParserException($err);
     }
     return $feed;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:33,代码来源:FeedParser.php

示例11: getEvents

 function getEvents(&$params)
 {
     jimport('simplepie.simplepie');
     $id = $params->get('google_gid', '');
     $starttime = $params->get('google_orderby', 'starttime');
     $query = '?singleevents=true&orderby=' . $starttime . '&sortorder=a&max-results=' . $params->get('google_maxresults', 25);
     if ($params->get('time_range') != 'time_span' && $params->get('rangespan') == 'all_events') {
         $query .= '&futureevents=true';
     } else {
         $startMin = $params->get('startmin');
         $query .= "&start-min=" . $startMin;
         $startMax = $params->get('startmax', false);
         if ($startMax !== false) {
             $query .= "&start-max=" . $startMax;
         }
     }
     $rss = new SimplePie('http://www.google.com/calendar/feeds/' . $id . '/public/full' . $query, JPATH_CACHE, $params->get('google_gcache', 3600));
     $rss->enable_order_by_date(false);
     $events = array();
     if ($rss->error) {
         return $events['error'] = $rss->error;
     }
     $items = $rss->get_items();
     foreach ($items as $item) {
         $when = $item->get_item_tags('http://schemas.google.com/g/2005', 'when');
         $link = $params->get('google_links') != 'link_no' ? array('internal' => $params->get('google_links') == 'link_internal' ? true : false, 'link' => $item->get_link()) : false;
         $event = new RokMiniEvents_Event($when[0]['attribs']['']['startTime'], $when[0]['attribs']['']['endTime'], $item->get_title(), $item->get_content(), $link);
         $startTime = $when[0]['attribs']['']['startTime'];
         $endTime = $when[0]['attribs']['']['endTime'];
         if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $startTime)) {
             $event->setAllDay(true);
         }
         $events[] = $event;
     }
     return $events;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:36,代码来源:google.php

示例12: SimplePie

The next generation plug-ins now available for testing offer higher performance 
data export. In contrast to the existing COLLADA exporters, these new plug-ins 
do not store the COLLADA document into an intermediate data model but write it 
directly to file. This leads to a dramatic reduction of memory consumption and 
to much better performance.
</p>
<p>
If you find any bugs or experience any problem please write a bug report on
the source forge bug tracker.
</p>
							
							<?php 
$projsummary = new SimplePie();
$projsummary->enable_cache(false);
$projsummary->set_feed_url('http://sourceforge.net/export/rss2_projsummary.php?group_id=136478');
$projsummary->enable_order_by_date(false);
$projsummary->init();
$projsummary->handle_content_type();
if ($projsummary->data) {
    ?>
							
							<div class="psum">
							<p>
							    <?php 
    foreach ($projsummary->get_items() as $item) {
        ?>
								   <?php 
        list($eins, $zwei) = split(':', $item->get_title());
        echo '<strong>' . $eins . ': </strong>';
        echo '<a href="' . $item->get_permalink() . '">' . $zwei . '</a>';
        ?>
开发者ID:caomw,项目名称:OpenCOLLADA,代码行数:31,代码来源:index.php

示例13: get_new_feeds

 /**
  *
  *   //get all the admin feeds in database.
  */
 private function get_new_feeds($category_id)
 {
     //get all the admin feeds in database.
     $dbfeeds = ORM::factory('feed')->select('id', 'feed_url', 'category_id')->where('category_id', $category_id)->find_all();
     if ($category_id == 0) {
         $dbfeeds = ORM::factory('feed')->select('id', 'feed_url', 'category_id')->find_all();
     }
     foreach ($dbfeeds as $dbfeed) {
         //Don't do anything about twitter categories.
         if ($dbfeed->category_id != 11) {
             $url = "";
             $feed = new SimplePie();
             $feed->enable_order_by_date(true);
             if ($dbfeed->category_id == 1) {
                 $url = "http://twitter.com/statuses/user_timeline/" . $dbfeed->feed_url . ".rss";
                 $feed->set_feed_url($url);
                 //	exit(0);
             } else {
                 $url = $dbfeed->feed_url;
                 $feed->set_feed_url($dbfeed->feed_url);
             }
             $feed->set_cache_location(APPPATH . 'cache');
             $feed->set_timeout(10);
             $feed->init();
             //		$channel = $feed->get_feed_tags('', 'channel');
             //		echo " tags=> ".$channel."<br/>";
             // echo "$url :<br/>";
             //	exit(0)
             $max_items = $feed->get_item_quantity();
             $require_new_items = 20;
             $new_item_counter = 0;
             $start = 0;
             for ($i = $start; $i < $max_items && $new_item_counter < $require_new_items; $i++) {
                 $item = $feed->get_item($i);
                 /*				//getting all the feed information.								 
                 						echo "$url:  latitude => ".$item->get_latitude();
                 						echo "   longitude => ".$item->get_longitude();
                 						echo '<a href="' . $feed->get_image_link() . '" title="' . $feed->get_image_title() . '">';
                 						echo '<img src="' . $feed->get_image_url() . '" width="' . $feed->get_image_width() . '" height="' . $feed->get_image_height() . '" />';
                 						echo '</a><br/>Title:'.$item->get_title();
                 						echo '<br/>Description:'.$item->get_description();
                 						echo '<hr/>';
                 								
                 						*/
                 $itemobj = new Feed_Item_Model();
                 $itemobj->feed_id = $dbfeed->id;
                 $itemobj->item_title = $item->get_title();
                 $itemobj->item_description = $item->get_description();
                 $itemobj->item_link = $item->get_permalink();
                 $itemobj->item_date = $item->get_date('Y-m-d h:m:s');
                 if ($author = $item->get_author()) {
                     $itemobj->item_source = $item->get_author()->get_name();
                     //temporary not working.
                 }
                 //echo "in Main Controller $dbfeed->feed_url =>  latitude =".$feed->get_latitude().", longitude =".$feed->get_longitude()."<br/>";
                 //echo "in Main Controller $dbfeed->feed_url =>   get_author() => ".$feed->get_author()."<br/>";
                 $linkCount = ORM::factory('feed_item')->where('item_link', $item->get_permalink())->count_all();
                 if ($linkCount == 0) {
                     $new_item_counter++;
                     //  echo "link:=> ".$item->get_permalink()." is new and has appear ".$linkCount." times <br/>";
                     $itemobj->save();
                 } else {
                     if ($linkCount > 0) {
                         //	echo "link:=> ".$item->get_permalink()." appears ".$linkCount." times <br/>";
                     }
                 }
             }
         }
     }
     //		exit(0);
 }
开发者ID:subiet,项目名称:Swiftriver,代码行数:75,代码来源:main.php

示例14: fetchFeed

 /**
  * Parses a feed with SimplePie
  *
  * @param   boolean     $stupidly_fast    Set fast mode. Best for checks
  * @param   integer     $max              Limit of items to fetch
  * @return  SimplePie_Item    Feed object
  **/
 function fetchFeed($url, $stupidly_fast = false, $max = 0)
 {
     # SimplePie
     if (!class_exists('SimplePie')) {
         require_once WPOINC . 'simplepie/simplepie.class.php';
     }
     $feed = new SimplePie();
     $feed->enable_order_by_date(false);
     // thanks Julian Popov
     $feed->set_feed_url($url);
     $feed->set_item_limit($max);
     $feed->set_stupidly_fast($stupidly_fast);
     $feed->enable_cache(false);
     $feed->init();
     $feed->handle_content_type();
     return $feed;
 }
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:24,代码来源:wpomatic-class-copy-thing.php

示例15: local_delivery

function local_delivery($importer, $data)
{
    $a = get_app();
    logger(__FUNCTION__, LOGGER_TRACE);
    if ($importer['readonly']) {
        // We aren't receiving stuff from this person. But we will quietly ignore them
        // rather than a blatant "go away" message.
        logger('local_delivery: ignoring');
        return 0;
        //NOTREACHED
    }
    // Consume notification feed. This may differ from consuming a public feed in several ways
    // - might contain email or friend suggestions
    // - might contain remote followup to our message
    //		- in which case we need to accept it and then notify other conversants
    // - we may need to send various email notifications
    $feed = new SimplePie();
    $feed->set_raw_data($data);
    $feed->enable_order_by_date(false);
    $feed->init();
    if ($feed->error()) {
        logger('local_delivery: Error parsing XML: ' . $feed->error());
    }
    // Check at the feed level for updated contact name and/or photo
    $name_updated = '';
    $new_name = '';
    $photo_timestamp = '';
    $photo_url = '';
    $contact_updated = '';
    $rawtags = $feed->get_feed_tags(NAMESPACE_DFRN, 'owner');
    // Fallback should not be needed here. If it isn't DFRN it won't have DFRN updated tags
    //	if(! $rawtags)
    //		$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
    if ($rawtags) {
        $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
        if ($elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated']) {
            $name_updated = $elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated'];
            $new_name = $elems['name'][0]['data'];
            // Manually checking for changed contact names
            if ($new_name != $importer['name'] and $new_name != "" and $name_updated <= $importer['name-date']) {
                $name_updated = date("c");
                $photo_timestamp = date("c");
            }
        }
        if (x($elems, 'link') && $elems['link'][0]['attribs']['']['rel'] === 'photo' && $elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated']) {
            if ($photo_timestamp == "") {
                $photo_timestamp = datetime_convert('UTC', 'UTC', $elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated']);
            }
            $photo_url = $elems['link'][0]['attribs']['']['href'];
        }
    }
    if ($photo_timestamp && strlen($photo_url) && $photo_timestamp > $importer['avatar-date']) {
        $contact_updated = $photo_timestamp;
        logger('local_delivery: Updating photo for ' . $importer['name']);
        require_once "include/Photo.php";
        $photos = import_profile_photo($photo_url, $importer['importer_uid'], $importer['id']);
        q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'\n\t\t\tWHERE `uid` = %d AND `id` = %d AND NOT `self`", dbesc(datetime_convert()), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]), intval($importer['importer_uid']), intval($importer['id']));
    }
    if ($name_updated && strlen($new_name) && $name_updated > $importer['name-date']) {
        if ($name_updated > $contact_updated) {
            $contact_updated = $name_updated;
        }
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval($importer['importer_uid']), intval($importer['id']));
        $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d AND `name` != '%s' AND NOT `self`", dbesc(notags(trim($new_name))), dbesc(datetime_convert()), intval($importer['importer_uid']), intval($importer['id']), dbesc(notags(trim($new_name))));
        // do our best to update the name on content items
        if (count($r) and notags(trim($new_name)) != $r[0]['name']) {
            q("UPDATE `item` SET `author-name` = '%s' WHERE `author-name` = '%s' AND `author-link` = '%s' AND `uid` = %d AND `author-name` != '%s'", dbesc(notags(trim($new_name))), dbesc($r[0]['name']), dbesc($r[0]['url']), intval($importer['importer_uid']), dbesc(notags(trim($new_name))));
        }
    }
    if ($contact_updated and $new_name and $photo_url) {
        poco_check($importer['url'], $new_name, NETWORK_DFRN, $photo_url, "", "", "", "", "", $contact_updated, 2, $importer['id'], $importer['importer_uid']);
    }
    // Currently unsupported - needs a lot of work
    $reloc = $feed->get_feed_tags(NAMESPACE_DFRN, 'relocate');
    if (isset($reloc[0]['child'][NAMESPACE_DFRN])) {
        $base = $reloc[0]['child'][NAMESPACE_DFRN];
        $newloc = array();
        $newloc['uid'] = $importer['importer_uid'];
        $newloc['cid'] = $importer['id'];
        $newloc['name'] = notags(unxmlify($base['name'][0]['data']));
        $newloc['photo'] = notags(unxmlify($base['photo'][0]['data']));
        $newloc['thumb'] = notags(unxmlify($base['thumb'][0]['data']));
        $newloc['micro'] = notags(unxmlify($base['micro'][0]['data']));
        $newloc['url'] = notags(unxmlify($base['url'][0]['data']));
        $newloc['request'] = notags(unxmlify($base['request'][0]['data']));
        $newloc['confirm'] = notags(unxmlify($base['confirm'][0]['data']));
        $newloc['notify'] = notags(unxmlify($base['notify'][0]['data']));
        $newloc['poll'] = notags(unxmlify($base['poll'][0]['data']));
        $newloc['sitepubkey'] = notags(unxmlify($base['sitepubkey'][0]['data']));
        /** relocated user must have original key pair */
        /*$newloc['pubkey'] = notags(unxmlify($base['pubkey'][0]['data']));
        		$newloc['prvkey'] = notags(unxmlify($base['prvkey'][0]['data']));*/
        logger("items:relocate contact " . print_r($newloc, true) . print_r($importer, true), LOGGER_DEBUG);
        // update contact
        $r = q("SELECT photo, url FROM contact WHERE id=%d AND uid=%d;", intval($importer['id']), intval($importer['importer_uid']));
        if ($r === false) {
            return 1;
        }
        $old = $r[0];
        $x = q("UPDATE contact SET\n\t\t\t\t\tname = '%s',\n\t\t\t\t\tphoto = '%s',\n\t\t\t\t\tthumb = '%s',\n\t\t\t\t\tmicro = '%s',\n\t\t\t\t\turl = '%s',\n\t\t\t\t\tnurl = '%s',\n\t\t\t\t\trequest = '%s',\n\t\t\t\t\tconfirm = '%s',\n\t\t\t\t\tnotify = '%s',\n\t\t\t\t\tpoll = '%s',\n\t\t\t\t\t`site-pubkey` = '%s'\n\t\t\tWHERE id=%d AND uid=%d;", dbesc($newloc['name']), dbesc($newloc['photo']), dbesc($newloc['thumb']), dbesc($newloc['micro']), dbesc($newloc['url']), dbesc(normalise_link($newloc['url'])), dbesc($newloc['request']), dbesc($newloc['confirm']), dbesc($newloc['notify']), dbesc($newloc['poll']), dbesc($newloc['sitepubkey']), intval($importer['id']), intval($importer['importer_uid']));
//.........这里部分代码省略.........
开发者ID:EmilienB,项目名称:friendica,代码行数:101,代码来源:items.php


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