| 121 |
/** |
/** |
| 122 |
* Implementation of hook_url_alter_outbound() from the url_alter module. |
* Implementation of hook_url_alter_outbound() from the url_alter module. |
| 123 |
*/ |
*/ |
| 124 |
/*function feedburner_url_alter_outbound(&$path, &$options, $original_path) { |
function feedburner_url_alter_outbound(&$path, &$options, $original_path) { |
| 125 |
if (!preg_match('/^admin\/?|^node\/\d+\/?$/i', $path)) { |
static $feeds; |
| 126 |
if ($result = db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", array(':path' => $path)))) { |
|
| 127 |
$path = _feedburner_contstruct_url($result); |
if ($original_path == 'feedburner/url-rewrite-test') { |
| 128 |
$options['external'] = TRUE; |
// Create a define that can be checked in admin/build/feedburner/settings. |
| 129 |
} |
define('FEEDBURNER_CUSTOM_URL_REWRITE_OUTBOUND', TRUE); |
| 130 |
|
return; |
| 131 |
} |
} |
|
}*/ |
|
| 132 |
|
|
| 133 |
/** |
if (feedburner_var('replace_html') && variable_get('clean_url', 0) && !preg_match('/^admin\/?|^node\/\d+\/?$/i', $original_path)) { |
| 134 |
* Implementation of hook_init(). |
// Perform URL replacement. |
| 135 |
*/ |
|
| 136 |
/*function feedburner_init() { |
if (!isset($feeds)) { |
| 137 |
if (feedburner_var('replace_html')) { |
// Store a static list of all current FeedBurner feeds. |
| 138 |
// Start another output buffer so we can catch it in feedburner_exit(). |
$query = db_query("SELECT path, feedburner FROM {feedburner}"); |
| 139 |
ob_start(); |
while ($feed = db_fetch_object($query)) { |
| 140 |
|
$feeds[$feed->path] = $feed->feedburner; |
| 141 |
|
} |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
// If $path is aliased, get the normal path. |
| 145 |
|
if (!empty($options['alias'])) { |
| 146 |
|
$original_path = drupal_get_normal_path($original_path); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
if (!empty($feeds[$original_path])) { |
| 150 |
|
$path = $feeds[$original_path]; |
| 151 |
|
$options['absolute'] = TRUE; |
| 152 |
|
$options['base_url'] = 'http://'. feedburner_var('domain'); |
| 153 |
|
//$path = _feedburner_construct_url($feeds[$original_path]); |
| 154 |
|
//$options['external'] = TRUE; |
| 155 |
|
} |
| 156 |
} |
} |
| 157 |
}*/ |
} |
| 158 |
|
|
| 159 |
/** |
/** |
| 160 |
* Implementation of hook_exit(). |
* Implementation of custom_url_rewrite_outbound(). |
| 161 |
|
* |
| 162 |
|
* This function will only work if custom_url_rewrite_outbound is not already |
| 163 |
|
* defined, or the url_alter module is not enabled (might work for a majority |
| 164 |
|
* of sites). |
| 165 |
*/ |
*/ |
| 166 |
/*function feedburner_exit() { |
if (!function_exists('custom_url_rewrite_outbound')) { |
| 167 |
// Replace any links to original feed URLs with their FeedBurner equivalents. |
function custom_url_rewrite_outbound(&$path, &$options, $original_path) { |
| 168 |
if (feedburner_var('replace_html') && ob_get_level()) { |
feedburner_url_alter_outbound($path, $options, $original_path); |
|
// Get the current output and clean the output buffer. |
|
|
$data = ob_get_contents(); |
|
|
ob_end_clean(); |
|
|
|
|
|
// Replace feed URLs with FeedBurner feed URLs. |
|
|
$changed = _feedburner_replace_feed_html($data); |
|
|
|
|
|
// If the page has been changed and caching is enabled, start a new output |
|
|
// buffer and save the new version to the cache. If nothing has changed, |
|
|
// simply output the page content. |
|
|
if ($changed && variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED && page_get_cache(TRUE)) { |
|
|
ob_start(); |
|
|
echo $data; |
|
|
page_set_cache(); |
|
|
} |
|
|
else { |
|
|
echo $data; |
|
|
} |
|
| 169 |
} |
} |
| 170 |
}*/ |
} |
| 171 |
|
|
| 172 |
/** |
/** |
| 173 |
* Implementation of hook_nodeapi(). |
* Implementation of hook_nodeapi(). |