'widget_feedreading_blogroll', 'description' => __('widget_feedreading_blogroll widget description ') ); wp_register_sidebar_widget('widget_feedreading_blogroll', 'Live Blogroll', 'widget_feedreading_blogroll', $widget_ops); register_widget_control('widget_feedreading_blogroll', 'widget_feedreading_blogroll_control'); } /** * Register with options-page */ function feedreading_blogroll_register_options() { if (function_exists('add_options_page')) { add_options_page('Feed reading Blogroll', 'Feed reading Blogroll', 8, basename(__FILE__), 'feedreading_blogroll_options_subpanel'); } } /** * */ function feedreading_blogroll_get_linkcats(){ global $wpdb; $cats = $wpdb->get_results("SELECT $wpdb->terms.term_ID, $wpdb->terms.name FROM $wpdb->terms join $wpdb->term_taxonomy on $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id WHERE $wpdb->term_taxonomy.taxonomy = 'link_category' order by name"); return $cats; } function feedreading_blogroll_vars_are_set(){ if (isset($_POST['linkCssClass']) or isset($_POST['showLastUpdated']) or isset($_POST['showLastPostTitle']) or isset($_POST['feedreadingTitle']) or isset($_POST['showTitle']) or isset($_POST['showIcon']) or isset($_POST['defaultIcon']) or isset($_POST['googleAPIKey']) or isset($_POST['previewButton']) or isset($_POST['linkCats']) or isset($_POST['groupByLinkCats']) or isset($_POST['orderBy']) or isset($_POST['orderDirection']) or isset($_POST['displayStyle'])){ return TRUE; } else { return FALSE; } } /* * read http-data and set options. */ function feedreading_blogroll_setOptions() { $feedreading_blogroll_settings = get_option('feedreading_blogroll_settings'); /* $linkCssClass = $feedreading_blogroll_settings['linkCssClass']; $linkCats = $feedreading_blogroll_settings['linkCats']; $orderBy = $feedreading_blogroll_settings['orderBy']; $orderDirection = $feedreading_blogroll_settings['orderDirection']; $groupByLinkCats = $feedreading_blogroll_settings['groupByLinkCats']; $feedreadingTitle = $feedreading_blogroll_settings['feedreadingTitle']; $displayStyle = $feedreading_blogroll_settings['displayStyle']; $showTitle = $feedreading_blogroll_settings['showTitle']; $defaultIcon = $feedreading_blogroll_settings['defaultIcon']; $showLastUpdated = $feedreading_blogroll_settings['showLastUpdated']; $showLastPostTitle = $feedreading_blogroll_settings['showLastPostTitle']; $showIcon = $feedreading_blogroll_settings['showIcon']; $googleAPIKey = $feedreading_blogroll_settings['googleAPIKey']; $previewButton = $feedreading_blogroll_settings['previewButton'];*/ if (feedreading_blogroll_vars_are_set()) { $feedreading_blogroll_settings['linkCssClass'] = strip_tags(stripslashes($_POST['linkCssClass'])); $feedreading_blogroll_settings['linkCats'] = $_POST['linkCats']; $feedreading_blogroll_settings['groupByLinkCats'] = strip_tags(stripslashes($_POST['groupByLinkCats'])); $feedreading_blogroll_settings['orderBy'] = strip_tags(stripslashes($_POST['orderBy'])); $feedreading_blogroll_settings['orderDirection'] = strip_tags(stripslashes($_POST['orderDirection'])); $feedreading_blogroll_settings['showLastUpdated'] = strip_tags(stripslashes($_POST['showLastUpdated'])); $feedreading_blogroll_settings['showLastPostTitle'] = strip_tags(stripslashes($_POST['showLastPostTitle'])); $feedreading_blogroll_settings['feedreadingTitle'] = strip_tags(stripslashes($_POST['feedreadingTitle'])); $feedreading_blogroll_settings['displayStyle'] = strip_tags(stripslashes($_POST['displayStyle'])); $feedreading_blogroll_settings['showTitle'] = strip_tags(stripslashes($_POST['showTitle'])); $feedreading_blogroll_settings['defaultIcon'] = strip_tags(stripslashes($_POST['defaultIcon'])); $feedreading_blogroll_settings['showIcon'] = strip_tags(stripslashes($_POST['showIcon'])); $feedreading_blogroll_settings['googleAPIKey'] = strip_tags(stripslashes($_POST['googleAPIKey'])); $feedreading_blogroll_settings['previewButton'] = strip_tags(stripslashes($_POST['previewButton'])); update_option('feedreading_blogroll_settings', $feedreading_blogroll_settings); $feedreading_blogroll_settings['flash'] = __('Settings saved.'); } return $feedreading_blogroll_settings; } /* * render the option-panel */ function feedreading_blogroll_options_subpanel(){ if (feedreading_blogroll_vars_are_set()) check_admin_referer('plugin-feed-reading-blogroll-action_option_panel'); $feedreading_blogroll_settings = feedreading_blogroll_setOptions(); $linkCssClass = $feedreading_blogroll_settings['linkCssClass']; $linkCats = $feedreading_blogroll_settings['linkCats']; $orderBy = $feedreading_blogroll_settings['orderBy']; $orderDirection = $feedreading_blogroll_settings['orderDirection']; $groupByLinkCats = $feedreading_blogroll_settings['groupByLinkCats']; $feedreadingTitle = $feedreading_blogroll_settings['feedreadingTitle']; $displayStyle = $feedreading_blogroll_settings['displayStyle']; $showTitle = $feedreading_blogroll_settings['showTitle']; $showLastUpdated = $feedreading_blogroll_settings['showLastUpdated']; $showLastPostTitle = $feedreading_blogroll_settings['showLastPostTitle']; $showIcon = $feedreading_blogroll_settings['showIcon']; $defaultIcon = $feedreading_blogroll_settings['defaultIcon']; $feedreading_blogroll_flash = $feedreading_blogroll_settings['flash']; $googleAPIKey = $feedreading_blogroll_settings['googleAPIKey']; $previewButton = $feedreading_blogroll_settings['previewButton']; $plugins = get_plugins(); $cats = feedreading_blogroll_get_linkcats(); if ($feedreading_blogroll_flash != ''){ ?>

Feed Reading Blogroll

|

/>

name , $feedreading_blogroll_settings['linkCats'])==1){?> checked="checked" /> name); ?>
/>

/>
/>

/>
/>
/>

/>
/>
/>
/>

link_name; $url=$bookmark->link_url; $urlFeed=$bookmark->link_rss; $image=$bookmark->link_image; ?>
  • :
  • :
  • :


name , $feedreading_blogroll_settings['linkCats'])==1){?> checked="checked" /> name); ?>


/>
/>


/> Minimal
/> Classic
/> Blogger(TM)

',''); } /** * */ function feedreading_blogroll_bookmarkArgs($usedForGroupedBookmarks, $cat){ $args=''; $feedreading_blogroll_settings = get_option('feedreading_blogroll_settings'); $feedreadingTitle = $feedreading_blogroll_settings['feedreadingTitle']; $linkCats = $feedreading_blogroll_settings['linkCats']; $orderBy = $feedreading_blogroll_settings['orderBy']; $orderDirection = $feedreading_blogroll_settings['orderDirection']; $catOption =''; $catDelim =''; if (!is_null($linkCats)) { foreach ($linkCats as $l){ $catOption = $catOption.$catDelim.$l; $catDelim =','; } } $args='order='.$orderDirection.'&orderby='.$orderBy; if (!$usedForGroupedBookmarks){ // use all linkcats $args='category_name='.$catOption.'&'.$args; } else { // use single linkcat $args='category_name='.$cat.'&'.$args; } return $args; } /* * render content of widget */ function widget_feedreading_blogroll_content($before_title, $after_title){ $feedreading_blogroll_settings = get_option('feedreading_blogroll_settings'); $groupByLinkCats = strcmp($feedreading_blogroll_settings['groupByLinkCats'],'groupByLinkCats'); $linkCats = $feedreading_blogroll_settings['linkCats']; // fetch bookmarks from wordpress if ( $groupByLinkCats==0){ if (!is_null($linkCats)) { foreach ($linkCats as $linkCat){ $bookmarks = get_bookmarks(feedreading_blogroll_bookmarkArgs(TRUE, $linkCat)); widget_feedreading_blogroll_list($before_title, $after_title, $bookmarks, $linkCat); } } } else { $bookmarks = get_bookmarks(feedreading_blogroll_bookmarkArgs(FALSE,'')); widget_feedreading_blogroll_list($before_title, $after_title, $bookmarks, ''); } } /** * */ function widget_feedreading_blogroll_list($before_title, $after_title, $bookmarks, $title){ $feedreading_blogroll_settings = get_option('feedreading_blogroll_settings'); $linkCssClass = $feedreading_blogroll_settings['linkCssClass']; $showLastUpdated = strcmp($feedreading_blogroll_settings['showLastUpdated'], 'showLastUpdated'); $showIcon = strcmp($feedreading_blogroll_settings['showIcon'], 'showIcon'); $showLastPostTitle = strcmp($feedreading_blogroll_settings['showLastPostTitle'], 'showLastPostTitle'); $showPreviewButton = strcmp($feedreading_blogroll_settings['previewButton'], 'previewButton'); $defaultIcon = $feedreading_blogroll_settings['defaultIcon']; $showTitle = strcmp($feedreading_blogroll_settings['showTitle'],'showTitle'); $displayStyle = $feedreading_blogroll_settings['displayStyle']; if ($title =='') $title = $feedreading_blogroll_settings['feedreadingTitle']; if ($showTitle == 0){ echo $before_title; echo $title; echo $after_title; } ?> link_name; $url=$bookmark->link_url; $urlFeed=$bookmark->link_rss; $image=$bookmark->link_image; $xfn=$bookmark->link_rel; ?> link_name; $url=$bookmark->link_url; $urlFeed=$bookmark->link_rss; $image=$bookmark->link_image; $xfn=$bookmark->link_rel; ?> link_name; $url=$bookmark->link_url; $urlFeed=$bookmark->link_rss; $image=$bookmark->link_image; $xfn=$bookmark->link_rel; ?>