You are here

function parser_simplepie_install in FeedAPI 5

Same name and namespace in other branches
  1. 6 parser_simplepie/parser_simplepie.install \parser_simplepie_install()

Implementation of hook_install().

File

parser_simplepie/parser_simplepie.install, line 6

Code

function parser_simplepie_install() {
  $path = drupal_get_path('module', 'parser_simplepie') . '/simplepie.inc';
  if (!file_exists($path)) {
    drupal_set_message('<b>' . t("To use SimplePie parser, obtain the !simplepie package and copy simplepie.inc to the parser_simplepie directory.", array(
      '!simplepie' => l('SimplePie', 'http://simplepie.org/downloads', array(), NULL, NULL, TRUE),
    )) . '</b>');
  }

  // Set the parser of defaultly shipped processors if it's not done previously
  $default_processors = array(
    'feed',
    'feedapi_aggregator',
  );
  $set_simplepie = array(
    "parsers" => array(
      "parser_simplepie" => array(
        "enabled" => TRUE,
        "weight" => 0,
      ),
    ),
  );
  foreach ($default_processors as $processor) {
    $settings = variable_get('feedapi_settings_' . $processor, FALSE);
    if (!isset($settings['parsers'])) {
      $settings = is_array($settings) ? array_merge($settings, $set_simplepie) : $set_simplepie;
      variable_set('feedapi_settings_' . $processor, $settings);
    }
  }
}