You are here

function parser_simplepie_install in FeedAPI 6

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

Implementation of hook_install().

File

parser_simplepie/parser_simplepie.install, line 49
Install file for Parser SimplePie module.

Code

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

  // Set the parser of defaultly shipped processors if it's not done previously
  $default_processors = array(
    'feed',
  );
  $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);
    }
  }
}