| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
function feedburner_build_overview($category) { |
function feedburner_build_overview($category) { |
| 10 |
$keys = _feedburner_get_path(6); |
$keys = _feedburner_get_path_segment(6); |
| 11 |
$output = drupal_get_form('feedburner_build_filter_form', $category, $keys); |
$output = drupal_get_form('feedburner_build_filter_form', $category, $keys); |
| 12 |
|
|
| 13 |
$header = array( |
$header = array( |
| 23 |
$rows = array(); |
$rows = array(); |
| 24 |
foreach ($feeds as $feed) { |
foreach ($feeds as $feed) { |
| 25 |
$row = array(); |
$row = array(); |
| 26 |
//$row[] = l($feed['path'] . (isset($feed['alias']) ? ' ('. $feed['alias'] .')' : ''), $feed['path']); |
$row[] = l($feed['alias'], $feed['path'], array('attributes' => array('alt' => $feed['description'], 'title' => $feed['description']))); |
|
$row[] = l(($feed['alias'] != $feed['path'] ? $feed['alias'] .' ('. $feed['path'] .')' : $feed['path']), $feed['path']); |
|
| 27 |
if (isset($feed['feedburner'])) { |
if (isset($feed['feedburner'])) { |
| 28 |
$row[] = l($feed['feedburner'], _feedburner_construct_url($feed['feedburner'])); |
$row[] = l($feed['feedburner'], _feedburner_construct_url($feed['feedburner'])); |
| 29 |
$row[] = l(t('Edit'), 'admin/build/feedburner/burn/'. $feed['path']); |
$row[] = l(t('Edit'), 'admin/build/feedburner/burn/'. $feed['path']); |
| 117 |
|
|
| 118 |
|
|
| 119 |
function feedburner_burn_form() { |
function feedburner_burn_form() { |
| 120 |
$path = _feedburner_get_path(5); |
$path = _feedburner_get_path_segment(5); |
| 121 |
$feedburner = db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", $path)); |
$feedburner = db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", $path)); |
| 122 |
|
|
| 123 |
$form['path'] = array( |
$form['path'] = array( |
| 169 |
} |
} |
| 170 |
|
|
| 171 |
function feedburner_burn_form_submit($form, &$form_state) { |
function feedburner_burn_form_submit($form, &$form_state) { |
| 172 |
feedburner_save_feed($form_state['values']['path'], $form_state['values']['feedburner']); |
feedburner_save($form_state['values']); |
| 173 |
drupal_set_message(t('The feed redirection for %path has been saved.', array('%path' => $form_state['values']['path']))); |
drupal_set_message(t('The feed redirection for %path has been saved.', array('%path' => $form_state['values']['path']))); |
| 174 |
} |
} |
| 175 |
|
|
| 176 |
|
|
| 177 |
function feedburner_unburn_form() { |
function feedburner_unburn_form() { |
| 178 |
$path = _feedburner_get_path(5); |
$path = _feedburner_get_path_segment(5); |
| 179 |
$feed = db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", $path)); |
$feed = db_result(db_query("SELECT feedburner FROM {feedburner} WHERE path = '%s'", $path)); |
| 180 |
|
|
| 181 |
if (empty($path) || empty($feed)) { |
if (empty($path) || empty($feed)) { |
| 210 |
//if (isset($form_state['values']['unburn'])) { |
//if (isset($form_state['values']['unburn'])) { |
| 211 |
// // TODO: Implement Management API DeleteFeed |
// // TODO: Implement Management API DeleteFeed |
| 212 |
//} |
//} |
| 213 |
feedburner_save_feed($form_state['values']['path']); |
feedburner_delete(array('path' => $form_state['values']['path'])); |
| 214 |
drupal_set_message(t('Redirection for %url has been removed.', array('%url' => $form_state['values']['path']))); |
drupal_set_message(t('Redirection for %url has been removed.', array('%url' => $form_state['values']['path']))); |
| 215 |
$form_state['redirect'] = 'admin/build/feedburner'; |
$form_state['redirect'] = 'admin/build/feedburner'; |
| 216 |
return; |
return; |
| 336 |
return system_settings_form($form); |
return system_settings_form($form); |
| 337 |
} |
} |
| 338 |
|
|
|
|
|
| 339 |
function feedburner_settings_form_validate($form, &$form_state) { |
function feedburner_settings_form_validate($form, &$form_state) { |
| 340 |
$values =& $form_state['values']; |
$values =& $form_state['values']; |
| 341 |
|
|
| 364 |
|
|
| 365 |
// feedburner_domain |
// feedburner_domain |
| 366 |
$feedburner_domain = $values['feedburner_domain']; |
$feedburner_domain = $values['feedburner_domain']; |
| 367 |
if (!variable_get('drupal_http_request_fails', FALSE) && $feedburner_domain != feedburner_var('domain') && $feedburner_domain != 'feedproxy.google.com') { |
if ($feedburner_domain != feedburner_var('domain')) { |
| 368 |
$request = drupal_http_request('http://'. $feedburner_domain .'/'); |
$request = drupal_http_request('http://'. $feedburner_domain .'/'); |
|
unset($request->data); |
|
| 369 |
if (!isset($request->headers['X-FB-Host']) || !isset($request->code) || $request->code != 400 || !isset($request->error) || $request->error != 'You must provide a feed uri') { |
if (!isset($request->headers['X-FB-Host']) || !isset($request->code) || $request->code != 400 || !isset($request->error) || $request->error != 'You must provide a feed uri') { |
| 370 |
// TODO: Insert help link for CNAME MyBrand editing (http://feedburner.google.com/fb/a/publishers/mybrand) |
// TODO: Insert help link for CNAME MyBrand editing (http://feedburner.google.com/fb/a/publishers/mybrand) |
| 371 |
drupal_set_message(t('The MyBrand domain <a href="http://@domain/">@domain</a> failed verification. Make sure you have edited the domain\'s CNAME settings before enabling this option.', array('@domain' => $feedburner_domain)), 'error'); |
drupal_set_message(t('The MyBrand domain <a href="http://@domain/">@domain</a> failed verification. Make sure you have edited the domain\'s CNAME settings before enabling this option.', array('@domain' => $feedburner_domain)), 'error'); |
| 374 |
} |
} |
| 375 |
|
|
| 376 |
/** |
/** |
| 377 |
* Returns a list of site feeds. |
* Get a list of site feeds. |
|
* |
|
|
* @param $category |
|
|
* Category of feeds |
|
|
* @return |
|
|
* Array of site feeds. |
|
| 378 |
*/ |
*/ |
| 379 |
function _feedburner_get_feed_list($category = 'site', $options = array()) { |
function _feedburner_get_site_feeds(&$feeds) { |
| 380 |
$options += array('feedburner' => FALSE); |
$feeds[] = array('path' => 'rss.xml', 'description' => variable_get('site_name', 'Drupal') .' frontpage feed'); |
| 381 |
$feeds = array(); |
$feeds[] = array('path' => 'aggregator/feed', 'description' => 'Aggregator feed', 'module' => 'aggregator'); |
| 382 |
|
$feeds[] = array('path' => 'blog/feed', 'description' => variable_get('site_name', 'Drupal') .' blogs'); |
| 383 |
// Site feeds (and various module feeds) |
$feeds[] = array('path' => 'crss', 'description' => variable_get('site_name', 'Drupal') .' comments', 'module' => 'commentrss'); |
| 384 |
if ($category == 'site' || $category == 'all') { |
$feeds[] = array('path' => 'atom/feed', 'description' => variable_get('site_name', 'Drupal') .' ATOM', 'module' => 'atom'); |
| 385 |
$feeds[] = array('path' => 'rss.xml', 'description' => variable_get('site_name', 'Drupal') .' frontpage feed'); |
} |
|
$feeds[] = array('path' => 'aggregator/feed', 'description' => 'Aggregator feed', 'module' => 'aggregator'); |
|
|
$feeds[] = array('path' => 'blog/feed', 'description' => variable_get('site_name', 'Drupal') .' blogs'); |
|
|
$feeds[] = array('path' => 'crss', 'description' => variable_get('site_name', 'Drupal') .' comments', 'module' => 'commentrss'); |
|
|
$feeds[] = array('path' => 'atom/feed', 'description' => variable_get('site_name', 'Drupal') .' ATOM', 'module' => 'atom'); |
|
|
} |
|
| 386 |
|
|
| 387 |
// Views integration |
/** |
| 388 |
if (($category == 'site' || $category == 'all') && module_exists('views')) { |
* Get a list of views feeds. |
| 389 |
$views = views_get_all_views(); |
*/ |
| 390 |
foreach ($views as $view) { |
function _feedburner_get_views_feeds(&$feeds, $key = NULL) { |
| 391 |
if (isset($view->disabled) && $view->disabled) { |
$views = views_get_all_views(); |
| 392 |
continue; |
foreach ($views as $view_key => $view) { |
| 393 |
} |
if ((isset($key) && !strpos($view_key, $key) === FALSE) || !empty($view->disabled)) { |
| 394 |
foreach ($view->display as $display) { |
continue; |
| 395 |
if ($display->display_plugin == 'feed') { |
} |
| 396 |
$view->set_display($display->id); |
foreach ($view->display as $display) { |
| 397 |
$feeds[] = array('path' => $view->display_handler->get_option('path'), 'description' => $view->display_handler->get_option('title')); |
if ($display->display_plugin == 'feed') { |
| 398 |
break; |
$view->set_display($display->id); |
| 399 |
|
if ($view->display_handler->get_option('path') != 'not_used') { |
| 400 |
|
$feeds[] = array( |
| 401 |
|
'path' => $view->display_handler->get_option('path'), |
| 402 |
|
'description' => $view->display_handler->get_option('title'), |
| 403 |
|
); |
| 404 |
} |
} |
| 405 |
|
break; |
| 406 |
} |
} |
| 407 |
} |
} |
| 408 |
} |
} |
| 409 |
|
} |
| 410 |
|
|
| 411 |
// Blog module feeds |
/** |
| 412 |
if (($category == 'all' || $category == 'blogs' ) && module_exists('blog')) { |
* Get a list of blog feeds. |
| 413 |
$feeds[] = array('path' => 'blog/feed', 'description' => variable_get('site_name', 'Drupal') .' blogs'); |
*/ |
| 414 |
|
function _feedburner_get_blog_feeds(&$feeds) { |
| 415 |
// Get all user blog feeds for users with the blogging permission granted |
$feeds[] = array( |
| 416 |
$sql = "SELECT u.uid, u.name FROM {users} u LEFT JOIN {users_roles} ur ON ur.uid = u.uid WHERE u.uid = 1"; |
'path' => 'blog/feed', |
| 417 |
$args = array(); |
'description' => variable_get('site_name', 'Drupal') .' blogs', |
| 418 |
|
); |
| 419 |
$blog_roles = user_roles(TRUE, 'create blog entries'); |
|
| 420 |
// if (isset($blog_roles[DRUPAL_ANONYMOUS_RID])) {} |
// Get all user blog feeds for users with the blogging permission granted |
| 421 |
if (isset($blog_roles[DRUPAL_AUTHENTICATED_RID])) { |
$sql = "SELECT u.uid, u.name FROM {users} u LEFT JOIN {users_roles} ur USING (uid) WHERE u.uid = 1"; |
| 422 |
$sql .= ' OR u.uid > 1'; |
$args = array(); |
| 423 |
} |
|
| 424 |
elseif (count($blog_roles)) { |
$blog_roles = user_roles(TRUE, 'create blog entries'); |
| 425 |
$sql .= ' OR ur.rid IN ('. db_placeholders($blog_roles) .')'; |
// if (isset($blog_roles[DRUPAL_ANONYMOUS_RID])) {} |
| 426 |
$args = array_keys($blog_roles); |
if (isset($blog_roles[DRUPAL_AUTHENTICATED_RID])) { |
| 427 |
} |
$sql .= ' OR u.uid > 1'; |
| 428 |
|
} |
| 429 |
|
elseif (count($blog_roles)) { |
| 430 |
|
$sql .= ' OR ur.rid IN ('. db_placeholders($blog_roles) .')'; |
| 431 |
|
$args = array_keys($blog_roles); |
| 432 |
|
} |
| 433 |
|
|
| 434 |
|
$query = db_query($sql, $args); |
| 435 |
|
while ($account = db_fetch_object($query)) { |
| 436 |
|
$feeds[] = array( |
| 437 |
|
'path' => 'blog/'. $account->uid .'/feed', |
| 438 |
|
'description' => t("@username's blog", array('@username' => $account->name)), |
| 439 |
|
); |
| 440 |
|
} |
| 441 |
|
} |
| 442 |
|
|
| 443 |
$query = db_query($sql, $args); |
/** |
| 444 |
while ($blogging_user = db_fetch_object($query)) { |
* Get a list of taxonomy feeds. |
| 445 |
$feeds[] = array('path' => 'blog/'. $blogging_user->uid .'/feed', 'description' => $blogging_user->name ."'s Blog"); |
*/ |
| 446 |
} |
function _feedburner_get_taxonomy_feeds(&$feed) { |
| 447 |
unset($query); |
$query = db_query('SELECT tid, name FROM {term_data}'); |
| 448 |
|
while ($term = db_fetch_object($query)) { |
| 449 |
|
$feeds[] = array( |
| 450 |
|
'path' => 'taxonomy/term/'. $term->tid .'/0/feed', |
| 451 |
|
'description' => $term->name, |
| 452 |
|
); |
| 453 |
} |
} |
| 454 |
|
} |
| 455 |
|
|
| 456 |
// Taxonomy feeds |
/** |
| 457 |
if (($category == 'all' || $category == 'taxonomy') && module_exists('taxonomy')) { |
* Get a list of organic gropus feeds. |
| 458 |
$query = db_query('SELECT tid, name FROM {term_data}'); |
*/ |
| 459 |
while ($term = db_fetch_object($query)) { |
function _feedburner_get_og_feeds(&$feeds) { |
| 460 |
$feeds[] = array('path' => 'taxonomy/term/'. $term->tid .'/0/feed', 'description' => $term->name); |
/*$feeds[] = array( |
| 461 |
} |
'path' => 'og/all/feed', |
| 462 |
unset($query); |
'description' => t('Groups'), |
| 463 |
|
); |
| 464 |
|
$feeds[] = array( |
| 465 |
|
'path' => 'group/tracker/feed', |
| 466 |
|
'description' => t('Recent posts across whole site'), |
| 467 |
|
);*/ |
| 468 |
|
//$feeds[] = array( |
| 469 |
|
// 'path' => 'group/myunread/feed', |
| 470 |
|
// 'description' => t('Unread posts in my group'), |
| 471 |
|
//); |
| 472 |
|
//$feeds[] = array( |
| 473 |
|
// 'path' => 'group/mytracker/feed', |
| 474 |
|
// 'description' => t('Recent posts in my groups'), |
| 475 |
|
//); |
| 476 |
|
_feedburner_get_views_feeds($feeds, 'og_'); |
| 477 |
|
$query = db_query("SELECT n.nid, n.title FROM {og} og LEFT JOIN {node} n USING (nid)"); |
| 478 |
|
while ($group = db_fetch_object($query)) { |
| 479 |
|
$feeds[] = array( |
| 480 |
|
'path' => 'node/'. $group->nid .'/feed', |
| 481 |
|
'description' => $group->title, |
| 482 |
|
); |
| 483 |
} |
} |
| 484 |
|
} |
| 485 |
|
|
| 486 |
|
/** |
| 487 |
|
* Returns a list of site feeds. |
| 488 |
|
* |
| 489 |
|
* @param $category |
| 490 |
|
* Category of feeds |
| 491 |
|
* @return |
| 492 |
|
* Array of site feeds. |
| 493 |
|
*/ |
| 494 |
|
function _feedburner_get_feed_list($category = 'site', $options = array()) { |
| 495 |
|
$options += array('feedburner' => FALSE); |
| 496 |
|
$feeds = array(); |
| 497 |
|
|
| 498 |
// Organic groups |
$categories = _feedburner_get_feed_categories(); |
| 499 |
if (($category == 'all' || $category == 'organic groups') && module_exists('og')) { |
foreach ($categories as $category_key => $category_options) { |
| 500 |
$query = db_query("SELECT nid, title FROM {og}"); |
$function = '_feedburner_get_'. $category_key .'_feeds'; |
| 501 |
while ($group = db_fetch_object($query)) { |
if (($category == $category_key || $category == 'all') && $category_options['access'] && function_exists($function)) { |
| 502 |
$feeds[] = array('path' => 'node/'. $group->nid .'/feed', 'description' => $group->title); |
$function($feeds); |
| 503 |
} |
} |
| 504 |
} |
} |
| 505 |
|
|
| 521 |
} |
} |
| 522 |
} |
} |
| 523 |
} |
} |
|
unset($query); |
|
| 524 |
} |
} |
| 525 |
|
|
| 526 |
//if ($category == 'feedburner' || $options['feedburner']) { |
//if ($category == 'feedburner' || $options['feedburner']) { |
| 647 |
|
|
| 648 |
// If a limit is specified, trim the list. We do this after sorting so that |
// If a limit is specified, trim the list. We do this after sorting so that |
| 649 |
// best results will always be at the top. |
// best results will always be at the top. |
| 650 |
if ($options['limit'] && is_int($options['limit'])) { |
if ($options['limit']) { |
| 651 |
$keepers = array_slice($keepers, 0, $options['limit']); |
$keepers = array_slice($keepers, 0, $options['limit']); |
| 652 |
} |
} |
| 653 |
|
|
| 654 |
$feeds = array(); |
$feeds = array(); |
| 655 |
foreach ($keepers as &$feed) { |
foreach ($keepers as &$feed) { |
| 656 |
// TODO: Drupal 7 / PHP 5, replace with array_combine()? |
//@todo Replace with array_combine in Drupal 7. |
| 657 |
$key = $options['key'] ? $feed['key'] : count($feeds); |
$key = $options['key'] ? $feed['key'] : count($feeds); |
| 658 |
unset($feed['key']); |
unset($feed['key']); |
| 659 |
if ($options['fields']) { |
if ($options['fields']) { |
| 839 |
*/ |
*/ |
| 840 |
function feedburner_admin_build_autocomplete($category) { |
function feedburner_admin_build_autocomplete($category) { |
| 841 |
module_load_include('inc', 'feedburner', 'feedburner.admin'); |
module_load_include('inc', 'feedburner', 'feedburner.admin'); |
| 842 |
$key = _feedburner_get_path(6); |
$key = _feedburner_get_path_segment(6); |
| 843 |
$options = array('match' => $key, 'limit' => 10, 'feedburner' => TRUE); |
$options = array('match' => $key, 'limit' => 10, 'feedburner' => TRUE); |
| 844 |
|
|
| 845 |
if ($category == 'feedburner') { |
if ($category == 'feedburner') { |