'. t("This module was developed by Dave Reid with assistance from FeedBurner.
If you like this module please consider donating to the developer's replacement laptop fund.", array('@link1' => 'http://davereid.net/', '@link2' => 'http://www.feedburner.com/', '@link3' => 'http://davereid.net/laptop-fund')) .'
'. 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(). * Defines a few access roles utilized in this module. */ function feedburner_perm() { return array('administer FeedBurner', 'view FeedFlare', 'edit own blog FeedBurner redirection'); } function feedburner_menu($may_cache) { $items = array(); $feedburner_admin = user_access('administer FeedBurner'); if ($may_cache) { $items[] = array( 'path' => 'admin/settings/feedburner', 'title' => t('FeedBurner'), 'description' => t('Administer FeedBurner integration.'), 'callback' => 'drupal_get_form', 'callback arguments' => array('feedburner_admin_settings'), 'access' => $feedburner_admin, ); $items[] = array( 'path' => 'admin/build/feedburner', 'title' => t('FeedBurner'), 'description' => t('Change site feed redirections to FeedBurner.'), 'callback' => 'feedburner_admin_build', 'access' => $feedburner_admin, ); $items[] = array( 'path' => 'admin/build/feedburner/list', 'title' => t('List'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); $items[] = array( 'path' => 'admin/build/feedburner/add', 'title' => t('Add'), 'callback' => 'drupal_get_form', 'callback arguments' => array('feedburner_admin_build_edit'), 'access' => $feedburner_admin, 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => 'admin/build/feedburner/edit', 'title' => t('Edit'), 'callback' => 'drupal_get_form', 'callback arguments' => array('feedburner_admin_build_edit'), 'access' => $feedburner_admin, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'admin/build/feedburner/remove', 'title' => t('Remove'), //'callback' => 'drupal_get_form', //'callback arguments' => array('feedburner_admin_build_remove'), 'callback' => 'feedburner_admin_build_remove', 'access' => $feedburner_admin, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'feedburner/verify', 'callback' => 'feedburner_verify', 'access' => $feedburner_admin, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'feedburner/autocomplete', 'title' => t('Feeds autocomplete'), 'callback' => 'feedburner_autocomplete', 'access' => $feedburner_admin, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'feedburner/test', 'callback' => 'feedburner_test', 'access' => true, ); } return $items; } /** * Implementation of hook_init(). */ function feedburner_init() { $useragent = $_SERVER['HTTP_USER_AGENT']; $useragents = '/'. variable_get('feedburner_useragents', FEEDBURNER_DEFAULT_USERAGENTS) .'/i'; if (!preg_match($useragents, $useragent)) { drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH); //preg_match('/admin\/build\/feedburner/', referer_uri()) $feed = _feedburner_load($_GET['q']); if (isset($feed['fb_uri']) && !isset($_GET['feedburner']) /*&& $_GET['FEEDBURNER'] != 'NOREDIRECT'*/) { $url = _feedburner_url($feed['fb_uri']); $status = intval(variable_get('feedburner_redirect_status', FEEDBURNER_DEFAULT_REDIRECT_STATUS)); drupal_goto($url, null, null, $status); } } /*else { global $_FEEDBURNER_NO_CACHE; $_FEEDBURNER_NO_CACHE = true; return; }*/ } /** * Implementation of hook_exit(). */ /*function feedburner_exit() { global $_FEEDBURNER_NO_CACHE; if ($_FEEDBURNER_NO_CACHE == true) { // Remove page from cache } }*/ /** * Implementation of hook_user(). */ function feedburner_user($op, &$edit, &$account, $category = null) { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.user.inc'); return _feedburner_user($op, $edit, $account, $category); } /** * Implementation of hook_block(). */ /*function feedburner_block($op = 'list', $delta = 0, $edit = array()) { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.block.inc'); return _feedburner_block($op, $delta, $edit); }*/ /** * Defines the FeedBurner admin settings form */ function feedburner_admin_settings() { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); return _feedburner_settings_form(); } function feedburner_admin_build() { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); return _feedburner_build_overview(); } function feedburner_admin_build_edit() { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); $path = _feedburner_path_keys(); /*if ($path != drupal_get_normal_path($path)) { //drupal_goto('admin/build/feedburner/edit/'. drupal_get_normal_path($path)); }*/ $result = _feedburner_load($path, 'local_uri, fb_uri'); if (empty($result)) { drupal_set_title('Add FeedBurner Redirect'); $output = _feedburner_build_edit_form(array('local_uri' => $path)); } else { drupal_set_title('Edit FeedBurner Redirect'); $output = _feedburner_build_edit_form($result); } return $output; } function feedburner_admin_build_remove() { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); return _feedburner_build_remove(); } function feedburner_autocomplete() { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); return _feedburner_autocomplete(); } function feedburner_verify($fb_uri) { require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); _feedburner_verify_feed($fb_uri, (isset($_GET['local_uri']) ? $_GET['local_uri'] : db_result(db_query("SELECT local_uri FROM {feedburner_feeds} WHERE fb_uri = '%s'", $fb_uri)))); /*if (_feedburner_verify_feed($fb_uri) == true) { //drupal_set_message(t('The FeedBurner feed %path was successfully verified.', array('%path' => $fb_uri))); } else { //$local_uri = $_GET['local_uri']; //$local_uri = db_result(db_query("SELECT local_uri FROM {feedburner_feeds} WHERE fb_uri = '%s'", $fb_uri)); //drupal_set_message(t('The FeedBurner feed %path could not be verified. Please check that you have set up the feed in your FeedBurner account or you can burn the feed at Feedburner.', array('%path' => $fb_uri, '@fb-account' => 'http://www.feedburner.com/fb/a/myfeeds', '@fb-create' => 'https://www.feedburner.com/fb/a/addfeed?sourceUrl='. url($local_uri, null, null, true) .'&mappedUri='. $fb_uri))); }*/ drupal_goto('admin/build/feedburner'); } function _feedburner_url($fb_uri = '') { return 'http://'. variable_get('feedburner_domain', FEEDBURNER_DEFAULT_DOMAIN) .'/'. $fb_uri; } /** * Helper function to load details about a FeedBurner feed from the database. * @param local_uri The local system uri * @param parts The fields to load from the database, defaulted to 'fb_uri' * @return false if not found, otherwise array of details about feed */ function _feedburner_load($local_uri, $parts = 'fb_uri') { if (empty($local_uri)) { return false; } $result = db_fetch_array(db_query("SELECT %s FROM {feedburner_feeds} WHERE local_uri = LOWER('%s')", $parts, $local_uri)); return (empty($result) ? false : $result); } // Test function function feedburner_test() { echo ''; require_once('./'. drupal_get_path('module', 'feedburner') .'/feedburner.admin.inc'); $data = drupal_http_request(url('rss.xml', null, null, true)); //unset($data->data); var_export($data->headers['Content-Type']); var_export((bool) preg_match('/rss|rdf|atom|xml/i', $data->headers['Content-Type'])); //$data->data = wordwrap(htmlspecialchars($data->data), 200, "\n"); //var_export($data); echo ''; die(); }