Blended Perspectives is working on a wpmu-menu for feedwordpress.

 

This gives  a summary of all blogs, and the feeds that syndicate into them.

 

Save this as mu-plugins/feedwordpress-syndications.php

 

<?php

/*

Plugin Name: Feedwordpress MU Menu

Plugin URI: http://feedwordpress.pbwiki.com

Description: Shows MU level syndication

Author: Hisham Aziz, Martin Cleaver

Author URI: http://www.blendedperspectives.com

*/

// Hook for adding admin menus

add_action('admin_menu', 'mt_add_pages');

// action function for above hook

function mt_add_pages() {

  // FIXME: this should list all Syndications, if the user is an admin

  //  add_submenu_page(basename(__FILE__), 'All Syndications', 'Options', $manage_options, 'mt_synd_page');

  // Need to add a submenu page under the site admin menu. Need the Site Admin page file

  add_submenu_page('wpmu-admin.php', 'Syndications', 'Syndications', 0, 'hisham', 'mt_synd_page');

}

// mt_synd_page() is the test funtion we are using to display something on the syndication page

function mt_synd_page(){

  echo "<br/>";

  echo "<h2>All FeedWordPress Syndications</h2>";

  global $wpdb;

?>

<table class="widefat">                                                                                                                      

 <thead>                                                                                                                              

  <tr>                                                                                                                         

    <th>Blog Name</th>                                                                                                   

    <th>ID</th>                                                                                                          

    <th>Feed URLs</th>  

    <th>Auto Update</th>

    <th>Last Updated</th>

    <th>Update Frequency</th>

  </tr>   

</thead> 

<?php

 $query = "select blog_id from {$wpdb->blogs}";                                                   

 $results = $wpdb->get_results($query);

 $last = get_option('feedwordpress_last_update_all');

 echo "Time now: ".strftime('%c')."<p/>";

 foreach ($results as $result)

   {

     print row($result->blog_id);

    }

 ?>

</table>

<?php

}

function row($blogid) {

  $bloginfo = get_blog_details($blogid);

  $blogname = $bloginfo->blogname;

  $siteurl =  $bloginfo->siteurl;

  echo   "\t\t\t<tr class=\"alternate\">\r\n".

    "\t\t\t\t<td class=\"name\"><a href='{$siteurl}'>".

    $blogname.

    "</a></td>\r\n".

    "\t\t\t\t<td class=\"vers\">".$blogid."</td>\r\n".

   

    //need to put the code for another column here

    switch_to_blog($blogid);     // plugman.php line 416

  //echo "\t\t\t\t<td class=\"togl\"><a href='{$siteurl}/wp-admin/admin.php?page=feedwordpress/feedwordpress.php'>".syndicate_details()."</a></td></tr>"; // SMELL - how to look up?

  echo syndicate_details($siteurl)."</tr>"; //ending the row here

  restore_current_blog();         

}

function syndicate_details($url) {

  $links = FeedWordPress::syndicated_links(); // Feedwordpress.php line 446

  //  print_r($links);

  $ans = "";

  foreach ($links as $link) { // line 527

   

    if (strlen($link->link_rss) > 0) { // Feedwordpress.php line 527

      $caption='Switch Feed';

      $uri_bits = parse_url($link->link_rss);

      $uri_bits['host'] = preg_replace('/^www\./i', '', $uri_bits['host']);

      $display_uri =

        (isset($uri_bits['user'])?$uri_bits['user'].'@':'')

        .(isset($uri_bits['host'])?$uri_bits['host']:'')

        .(isset($uri_bits['port'])?':'.$uri_bits['port']:'')

        .(isset($uri_bits['path'])?$uri_bits['path']:'')

        .(isset($uri_bits['query'])?'?'.$uri_bits['query']:'');

    }

    if ($ans == "" ){

      $ans = $display_uri;  // FIXME //should be fixed now: Hisham

    }

    else{

      $ans = $ans . "<br/>". $display_uri;

    }

  }

  if ($ans == "") {

    $ans = make_cell("(no feeds)", $url);

  }

  else {

    $ans = make_cell($ans, $url);

  }

  $ans = $ans . make_cell((get_option('feedwordpress_automatic_updates')? "On":"Off"),$url); 

  //$ans = $ans . make_cell(strftime('%c', get_option('feedwordpress_last_update_all')),$url);

  // $ans = $ans . make_cell(get_option('feedwordpress_last_update_all'), $url);

  $ev = get_option('feedwordpress_last_update_all');

  if ( $ev == 0 ){

    $ev = "never";

  }

  else{

    $ev = strftime('%c', $ev);

  }

  $ans = $ans . make_cell($ev, $url);

  $time = (get_option('feedwordpress_freshness')/60);

  if ($time == 0){

    $time = "never";

  }

  $ans = $ans . make_cell($time,$url);

  return $ans;

}

function make_cell($synd, $url)

{

  $add = "\t\t\t\t<td class=\"togl\"><a href='{$url}/wp-admin/admin.php?page=fee

dwordpress/feedwordpress.php'>".$synd."</a></td>"; //this will make each col

  return $add;

}


Page Information

  • 4 months ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts