View source
<?php
function bear_install() {
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => -10,
'filters' => array(
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
'filter_html' => array(
'weight' => 1,
'status' => 1,
'settings' => array(
'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br> <table> <tr> <td> <thead> <tbody> <th> <u> <s> <h2> <h3> <h4> <h5>',
'filter_html_help' => 1,
'filter_html_nofollow' => 0,
),
),
'assets_filter' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
'kill_nbsp' => array(
'status' => 1,
'weight' => 1,
'settings' => array(),
),
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
$full_html_format = array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => -9,
'filters' => array(
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
'filter_autop' => array(
'weight' => 1,
'status' => 1,
),
'assets_filter' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
'kill_nbsp' => array(
'status' => 1,
'weight' => 1,
'settings' => array(),
),
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$full_html_format = (object) $full_html_format;
filter_format_save($full_html_format);
$plain_text_format = array(
'format' => 'plain_text',
'name' => 'Plain text',
'weight' => -8,
'filters' => array(
'filter_html_escape' => array(
'weight' => 0,
'status' => 1,
'settings' => array(),
),
'filter_url' => array(
'weight' => 1,
'status' => 1,
'settings' => array(
'filter_url_length' => 72,
),
),
'filter_autop' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
),
);
$plain_text_format = (object) $plain_text_format;
filter_format_save($plain_text_format);
$default_theme = variable_get('theme_default', 'bartik');
$admin_theme = 'seven';
$blocks = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
$query = db_insert('block')
->fields(array(
'module',
'delta',
'theme',
'status',
'weight',
'region',
'pages',
'cache',
));
foreach ($blocks as $block) {
$query
->values($block);
}
$query
->execute();
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
variable_set('node_options_page', array(
'status',
'revision',
));
variable_set('node_preview_page', 0);
variable_set('node_submitted_page', FALSE);
variable_set('pathauto_node_pattern', "[node:menu-link:parents:join-path]/[node:title]");
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
$filtered_html_permission = filter_permission_name($filtered_html_format);
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access content',
$filtered_html_permission,
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access content',
$filtered_html_permission,
));
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 3;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
variable_set('user_admin_role', $admin_role->rid);
$editor_role = new stdClass();
$editor_role->name = 'editor';
$editor_role->weight = 2;
user_role_save($editor_role);
$perms = array(
'access administration menu',
'access administration pages',
'access assets overview',
'access coffee',
'access content',
'access content overview',
'access user profiles',
'administer assets',
'administer asset types',
'administer menu',
'administer nodes',
'administer url aliases',
'administer users',
'bypass node access',
'change own username',
'create url aliases',
'create asset with type document',
'create asset with type image',
'create asset with type embed',
'delete asset with type document',
'delete asset with type image',
'delete asset with type embed',
'delete revisions',
'edit asset with type document',
'edit asset with type image',
'edit asset with type embed',
'revert revisions',
'use text format filtered_html',
'use text format full_html',
'view own unpublished content',
'view revisions',
'view style guides',
'view the administration theme',
);
user_role_grant_permissions($editor_role->rid, $perms);
theme_enable(array(
'seven',
'bear_coat',
));
variable_set('theme_default', 'bear_coat');
variable_set('admin_theme', 'seven');
variable_set('node_admin_theme', '1');
}