' . t('These are the settings for the FeedBurner module. Once you have everything set, check out your site\'s FeedBurner feeds.', array('@link' => url('admin/build/feedburner'))) . '
'; return $output; case 'admin/build/feedburner': $output = '' . t('This is the FeedBurner site feed redirection building page. Make sure to check out the FeedBurner settings.', array('@link' => url('admin/settings/feedburner'))) . '
'; return $output; } } /** * Implementation of hook_perm(). */ function feedburner_perm() { return array('administer FeedBurner', 'view FeedFlare'); } /** * Implementation of hook_menu(). */ function feedburner_menu() { $items['admin/build/feedburner'] = array( 'title' => 'FeedBurner', 'description' => 'Change site feed redirections to FeedBurner.', 'page callback' => 'feedburner_build_overview', 'page arguments' => array('site'), 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); $items['admin/build/feedburner/list'] = array( 'title' => 'Feeds', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); foreach (_feedburner_get_feed_categories() as $category => $options) { if (!isset($option['module']) || module_exists($options['module'])) { $items['admin/build/feedburner/list/' . $category] = array( 'title' => drupal_ucfirst($category), 'type' => isset($options['default']) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, 'weight' => isset($options['default']) ? -10 : 0, 'page callback' => 'feedburner_build_overview', 'page arguments' => array($category), 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); } } $items['admin/build/feedburner/burn'] = array( 'title' => 'Burn feed', 'type' => MENU_LOCAL_TASK, 'page callback' => 'drupal_get_form', 'page arguments' => array('feedburner_burn_form'), 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); $items['admin/build/feedburner/unburn'] = array( 'title' => 'Unburn feed', 'type' => MENU_CALLBACK, 'page callback' => 'drupal_get_form', 'page arguments' => array('feedburner_unburn_form'), 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); $items['admin/settings/feedburner'] = array( 'title' => 'FeedBurner', 'description' => 'Administer FeedBurner integration.', 'page callback' => 'drupal_get_form', 'page arguments' => array('feedburner_settings_form'), 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); $items['admin/feedburner/autocomplete'] = array( 'page callback' => 'feedburner_autocomplete', 'type' => MENU_CALLBACK, 'access arguments' => array('administer FeedBurner'), 'file' => 'feedburner.admin.inc', ); //$items['admin/feedburner/verify'] = array( // 'page callback' => '_feedburner_verify', // 'type' => MENU_CALLBACK, // 'access arguments' => array('administer FeedBurner'), // 'file' => 'feedburner.admin.inc', //); $items['feedburner/feedflare'] = array( 'page callback' => 'feedburner_feedflare', 'type' => MENU_CALLBACK, 'access callback' => TRUE, 'file' => 'feedburner.admin.inc', ); return $items; } /** * Implementation of hook_boot(). */ function feedburner_boot() { drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); $path = _feedburner_get_path(); _feedburner_check_redirect($path); } /** * Implementation of hook_nodeapi(). * * Inserts FeedFlare into nodes. */ function feedburner_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { if ($op == 'view' && $node->build_mode != NODE_BUILD_PREVIEW && user_access('view FeedFlare')) { $display = $teaser ? 'teaser' : ($page ? 'page' : NULL); $feedflare_display = variable_get('feedburner_feedflare_display', array('page')); if (in_array($display, $feedflare_display) && $feedflare = _feedburner_get_feedflare($node->nid, $node->type)) { $node->content['feedflare'] = array( '#value' => $feedflare, '#weight' => 10, ); } } } /** * Implementation of hook_user(). * * Displays, validates and saves an option to redirect a user's blog feed. */ function feedburner_user($op, &$edit, &$account, $category = NULL) { if ($op == 'form' && $category == 'account' && user_access('create blog entries') && variable_get('feedburner_blogs', 0)) { $user_blog_url = 'blog/' . $account->uid . '/feed'; $form['feedburner'] = array( '#type' => 'fieldset', '#title' => t('Your Blog\'s FeedBurner Settings'), '#weight' => 1, '#collapsible' => TRUE, '#description' => t('Requests for your blog\'s feed (@url) will be redirected to the FeedBurner feed below. Leave this blank to disable redirection.', array('@url' => url($user_blog_url, array('absolute' => TRUE)))), ); $form['feedburner']['feedburner_user_blog'] = array( '#type' => 'textfield', '#maxlength' => 100, '#size' => 30, '#default_value' => db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", $user_blog_url)), '#field_prefix' => _feedburner_construct_url(), '#description' => t('This field is case-sensitive and alphanumeric.'), ); return $form; } elseif ($op == 'validate' && isset($edit['feedburner_user_blog'])) { // TODO: Matches slashes?? if (preg_match('/[^\w-]/', $edit['feedburner_user_blog'])) { form_set_error('feedburner_user_blog', 'Invalid FeedBurner feed name'); } } elseif ($op == 'update' && isset($edit['feedburner_user_blog'])) { module_load_include('inc', 'feedburner', 'feedburner.admin'); $user_blog_url = 'blog/' . $account->uid . '/feed'; _feedburner_save_feed($user_blog_url, $edit['feedburner_user_blog']); $edit['feedburner_user_blog'] = NULL; } elseif ($op == 'delete') { module_load_include('inc', 'feedburner', 'feedburner.admin'); $user_blog_url = 'blog/' . $account->uid . '/feed'; _feedburner_save_feed($user_blog_url); } } /** * Implementation of hook_block(). */ function feedburner_block($op = 'list', $delta = 0, $edit = array()) { if ($op == 'list') { $blocks[0]['info'] = t('FeedBurner FeedFlare'); $blocks[0]['cache'] = BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE; $blocks[1]['info'] = t('FeedBurner E-mail Subscribe'); $blocks[1]['cache'] = BLOCK_CACHE_PER_PAGE; $blocks[2]['info'] = t('FeedBurner FeedCount'); $blocks[2]['cache'] = BLOCK_CACHE_GLOBAL; $blocks[3]['info'] = t('FeedBurner Feeds'); $blocks[3]['cache'] = BLOCK_CACHE_GLOBAL; return $blocks; } elseif ($op == 'configure' && $delta == 1) { module_load_include('inc', 'feedburner', 'feedburner.admin'); $feeds = array(0 => 'None (disabled)'); $result = db_query('SELECT DISTINCT feedburner FROM {feedburner} ORDER BY feedburner'); while ($feed = db_result($result)) { $details = _feedburner_get_feed_features($feed); if ($details->id) { $feeds[$details->id] = $feed; } } $form['feedburner_block_email_id'] = array( '#type' => 'select', '#title' => t('FeedBurner feed'), '#default_value' => variable_get('feedburner_block_email_id', 0), '#options' => $feeds, '#description' => t('Only feeds with the email subscription feature verified can be selected.'), ); return $form; } elseif ($op == 'configure' & $delta == 2) { $feeds = array(0 => 'None (disabled)'); $result = db_query('SELECT DISTINCT feedburner FROM {feedburner} ORDER BY feedburner'); while ($feed = db_result($result)) { $feeds[$feed] = $feed; } $form['feedburner_block_feedcount_feed'] = array( '#type' => 'select', '#title' => t('FeedBurner feed'), '#default_value' => variable_get('feedburner_block_feedcount_feed', 0), '#options' => $feeds, ); return $form; } elseif ($op == 'save' && $delta == 1) { variable_set('feedburner_block_email_id', (int) $edit['feedburner_block_email_id']); } elseif ($op == 'save' && $delta == 2) { variable_set('feedburner_block_feedcount_feed', $edit['feedburner_block_feedcount_feed']); } elseif ($op == 'view') { $block = array(); switch ($delta) { case 0: if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == NULL) { $node = node_load(arg(1)); if ($feedflare = _feedburner_get_feedflare($node->nid, $node->type)) { $block['subject'] = t('FeedFlare'); $block['content'] = $feedflare; } } return $block; case 1: $id = variable_get('feedburner_block_email_id', 0); if ($id) { // TODO: Convert to Form API? or better containing divs? $block['subject'] = t('Get E-mail Updates'); $block['content'] .= ''; } return $block; case 2: $feed = variable_get('feedburner_block_feedcount_feed', 0); if (!empty($feed)) { $block['content'] = ''; } return $block; case 3: module_load_include('inc', 'feedburner', 'feedburner.admin'); $block['subject'] = variable_get('site_name', 'Drupal') . t(' Feeds'); $feeds = db_query("SELECT path, feedburner FROM {feedburner}"); //$block['content'] .= '' . t('This module was developed by Dave Reid with assistance from FeedBurner.
Please consider reviewing this module on drupalmodules.com or donating to the developer\'s replacement laptop fund.', array('@link-dave' => 'http://davereid.net/', '@link-feedburner' => 'http://www.feedburner.com/', '@link-review' => 'http://drupalmodules.com/module/feedburner', '@link-donate' => 'http://davereid.net/content/laptop-fund')) . '