function xmlsitemap_enable in XML sitemap 5
Same name and namespace in other branches
- 5.2 xmlsitemap/xmlsitemap.install \xmlsitemap_enable()
- 6.2 xmlsitemap.install \xmlsitemap_enable()
- 6 xmlsitemap.install \xmlsitemap_enable()
- 7.2 xmlsitemap.install \xmlsitemap_enable()
Implementation of hook_enable().
File
- ./
xmlsitemap.install, line 36
Code
function xmlsitemap_enable() {
global $base_path;
$xsl = file_get_contents(drupal_get_path('module', 'xmlsitemap') . '/gss/gss.xsl');
$css_start = strpos($xsl, '<link href="') + strlen('<link href="');
$css_length = strpos($xsl, '" type="text/css" rel="stylesheet"/>') - $css_start;
$xsl = substr_replace($xsl, $base_path . drupal_get_path('module', 'xmlsitemap') . '/gss/gss.css', $css_start, $css_length);
$js_start = strpos($xsl, '<script src="') + strlen('<script src="');
$js_length = strpos($xsl, '"></script>') - $js_start;
$xsl = substr_replace($xsl, $base_path . drupal_get_path('module', 'xmlsitemap') . '/gss/gss.js', $js_start, $js_length);
if (file_check_directory($path = file_directory_path() . '/xmlsitemap', FILE_CREATE_DIRECTORY)) {
file_save_data($xsl, "{$path}/gss.xsl", FILE_EXISTS_REPLACE);
}
_xmlsitemap_gsitemap_replace();
}