Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. http://openasset/Feed/Search?format=rss2&categoryCode=Projects&orderBy=dateUploadedDesc&imageSizes=square&limit=6
  2.  
  3. $oa_is_up = 'http://openasset/Page/Home';
  4. $oa_is_up_headers = @get_headers($oa_is_up);
  5.  
  6. if(!$oa_is_up_headers || $oa_is_up_headers[0] == 'HTTP/1.1 404 Not Found'){
  7.  
  8. //Cannot Display RSS Feed
  9. echo apply_filters( 'widget_feed', $instance[ 'feed' ] );
  10. echo $args['before_widget'] ?>
  11. <p>Cannot display OpenAsset when not connected to server.</p>
  12. <?php echo $args['after_widget'];
  13.  
  14. } else {
  15. //Get RSS feed
  16. $feed = apply_filters( 'widget_feed', $instance[ 'feed' ] );
  17.  
  18. // This is the feed it is pulling
  19. // http://openasset/Feed/Search?format=rss2&categoryCode=Projects&orderBy=dateUploadedDesc&imageSizes=square&limit=6
  20.  
  21. //Read each feed item
  22. $entries = array();
  23. $xml = simplexml_load_file($feed);
  24. $entries = array_merge($entries, $xml->xpath("//item"));
  25.  
  26. //Display feed
  27. echo $args['before_widget'] ?>
  28. <style>
  29. <?php include 'open_asset_feed.css'; ?>
  30. </style>
  31.  
  32. <?php
  33. //Print all the entries
  34. foreach($entries as $entry){
  35. ?>
  36. <div class="oa_wrapper">
  37. <div class="oa_dummy"><a class="oa_image" href="<?= $entry->link ?>" target="_blank">
  38. <?= $entry->description ?>
  39. </a></div>
  40. </div>
  41. <?php
  42. }
  43. ?>
  44. <?php echo $args['after_widget'];
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement