'), -1, PREG_SPLIT_NO_EMPTY));
+ return filter_xss($value, preg_split('/\s+|<|>/', variable_get(V_AGGREGATOR_ALLOWED_HTML_TAGS, '
-
-
-
'), -1, PREG_SPLIT_NO_EMPTY));
}
/**
Index: modules/aggregator/aggregator.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.pages.inc,v
retrieving revision 1.14
diff -u -F^f -r1.14 aggregator.pages.inc
--- modules/aggregator/aggregator.pages.inc 15 May 2008 21:27:32 -0000 1.14
+++ modules/aggregator/aggregator.pages.inc 20 May 2008 20:39:56 -0000
@@ -6,6 +6,15 @@
* User page callbacks for the aggregator module.
*/
+/** @variable V_DATE_FORMAT_MEDIUM: TODO: add documentation **/
+define('V_DATE_FORMAT_MEDIUM', 'date_format_medium');
+
+/** @variable V_FEED_DEFAULT_ITEMS: TODO: add documentation **/
+define('V_FEED_DEFAULT_ITEMS', 'feed_default_items');
+
+/** @variable V_FEED_ITEM_LENGTH: TODO: add documentation **/
+define('V_FEED_ITEM_LENGTH', 'feed_item_length');
+
/**
* Menu callback; displays the most recent items gathered from any feed.
*
@@ -13,7 +22,7 @@
* The items HTML.
*/
function aggregator_page_last() {
- drupal_add_feed(url('aggregator/rss'), variable_get('site_name', 'Drupal') . ' ' . t('aggregator'));
+ drupal_add_feed(url('aggregator/rss'), variable_get(V_SITE_NAME, 'Drupal') . ' ' . t('aggregator'));
$items = aggregator_feed_items_load('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC');
@@ -65,7 +74,7 @@ function aggregator_page_category($arg1,
// $form_state and $arg2 is $category. Otherwise, $arg1 is $category.
$category = is_array($arg2) ? $arg2 : $arg1;
- drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get('site_name', 'Drupal') . ' ' . t('aggregator - @title', array('@title' => $category['title'])));
+ drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get(V_SITE_NAME, 'Drupal') . ' ' . t('aggregator - @title', array('@title' => $category['title'])));
// It is safe to include the cid in the query because it's loaded from the
// database by aggregator_category_load.
@@ -171,7 +180,7 @@ function aggregator_categorize_items($it
}
$done = TRUE;
$form['categories'][$item->iid] = array(
- '#type' => variable_get('aggregator_category_selector', 'checkboxes'),
+ '#type' => variable_get(V_AGGREGATOR_CATEGORY_SELECTOR, 'checkboxes'),
'#default_value' => $selected,
'#options' => $categories,
'#size' => 10,
@@ -269,7 +278,7 @@ function template_preprocess_aggregator_
$variables['source_date'] = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp)));
}
else {
- $variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i'));
+ $variables['source_date'] = format_date($item->timestamp, 'custom', variable_get(V_DATE_FORMAT_MEDIUM, 'D, m/d/Y - H:i'));
}
$variables['categories'] = array();
@@ -288,8 +297,8 @@ function aggregator_page_sources() {
while ($feed = db_fetch_object($result)) {
// Most recent items:
$summary_items = array();
- if (variable_get('aggregator_summary_items', 3)) {
- $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3));
+ if (variable_get(V_AGGREGATOR_SUMMARY_ITEMS, 3)) {
+ $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get(V_AGGREGATOR_SUMMARY_ITEMS, 3));
while ($item = db_fetch_object($items)) {
$summary_items[] = theme('aggregator_summary_item', $item);
}
@@ -310,9 +319,9 @@ function aggregator_page_categories() {
$output = '';
while ($category = db_fetch_object($result)) {
- if (variable_get('aggregator_summary_items', 3)) {
+ if (variable_get(V_AGGREGATOR_SUMMARY_ITEMS, 3)) {
$summary_items = array();
- $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3));
+ $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get(V_AGGREGATOR_SUMMARY_ITEMS, 3));
while ($item = db_fetch_object($items)) {
$summary_items[] = theme('aggregator_summary_item', $item);
}
@@ -333,13 +342,13 @@ function aggregator_page_rss() {
if (arg(2)) {
$category = db_fetch_object(db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = %d', arg(2)));
$sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, i.iid DESC';
- $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10));
+ $result = db_query_range($sql, $category->cid, 0, variable_get(V_FEED_DEFAULT_ITEMS, 10));
}
// Or, get the default aggregator items.
else {
$category = NULL;
$sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC';
- $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
+ $result = db_query_range($sql, 0, variable_get(V_FEED_DEFAULT_ITEMS, 10));
}
$feeds = array();
@@ -363,7 +372,7 @@ function theme_aggregator_page_rss($feed
drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
$items = '';
- $feed_length = variable_get('feed_item_length', 'teaser');
+ $feed_length = variable_get(V_FEED_ITEM_LENGTH, 'teaser');
foreach ($feeds as $feed) {
switch ($feed_length) {
case 'teaser':
@@ -380,7 +389,7 @@ function theme_aggregator_page_rss($feed
$items .= format_rss_item($feed->ftitle . ': ' . $feed->title, $feed->link, $feed->description, array('pubDate' => date('r', $feed->timestamp)));
}
- $site_name = variable_get('site_name', 'Drupal');
+ $site_name = variable_get(V_SITE_NAME, 'Drupal');
$url = url((isset($category) ? 'aggregator/categories/' . $category->cid : 'aggregator'), array('absolute' => TRUE));
$description = isset($category) ? t('@site_name - aggregated feeds in category @title', array('@site_name' => $site_name, '@title' => $category->title)) : t('@site_name - aggregated feeds', array('@site_name' => $site_name));
@@ -429,7 +438,7 @@ function theme_aggregator_page_opml($fee
$output = "\n";
$output .= "\n";
$output .= "\n";
- $output .= '' . check_plain(variable_get('site_name', 'Drupal')) . "\n";
+ $output .= '' . check_plain(variable_get(V_SITE_NAME, 'Drupal')) . "\n";
$output .= '' . gmdate('r') . "\n";
$output .= "\n";
$output .= "\n";
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.17
diff -u -F^f -r1.17 block.admin.inc
--- modules/block/block.admin.inc 15 May 2008 21:30:02 -0000 1.17
+++ modules/block/block.admin.inc 20 May 2008 20:39:56 -0000
@@ -13,7 +13,7 @@ function block_admin_display($theme = NU
global $custom_theme;
// If non-default theme configuration has been selected, set the custom theme.
- $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
+ $custom_theme = isset($theme) ? $theme : variable_get(V_THEME_DEFAULT, 'garland');
// Fetch and sort blocks.
$blocks = _block_rehash();
@@ -31,7 +31,7 @@ function block_admin_display_form(&$form
drupal_add_css(drupal_get_path('module', 'block') . '/block.css', 'module', 'all', FALSE);
// If non-default theme configuration has been selected, set the custom theme.
- $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
+ $custom_theme = isset($theme) ? $theme : variable_get(V_THEME_DEFAULT, 'garland');
init_theme();
$block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>');
Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.306
diff -u -F^f -r1.306 block.module
--- modules/block/block.module 15 May 2008 21:30:02 -0000 1.306
+++ modules/block/block.module 20 May 2008 20:39:56 -0000
@@ -6,6 +6,9 @@
* Controls the boxes that are displayed around the main content.
*/
+/** @variable V_BLOCK_CACHE: TODO: add documentation **/
+define('V_BLOCK_CACHE', 'block_cache');
+
// Denotes that a block is not enabled in any region and should not be shown.
define('BLOCK_REGION_NONE', -1);
@@ -150,7 +153,7 @@ function block_menu() {
'access arguments' => array('administer blocks'),
'type' => MENU_LOCAL_TASK,
);
- $default = variable_get('theme_default', 'garland');
+ $default = variable_get(V_THEME_DEFAULT, 'garland');
foreach (list_themes() as $key => $theme) {
$items['admin/build/block/list/' . $key] = array(
'title' => check_plain($theme->info['name']),
@@ -168,7 +171,7 @@ function block_menu() {
* Menu item access callback - only admin or enabled themes can be accessed.
*/
function _block_themes_access($theme) {
- return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme', '0'));
+ return user_access('administer blocks') && ($theme->status || $theme->name == variable_get(V_ADMIN_THEME, '0'));
}
/**
@@ -531,7 +534,7 @@ function _block_get_cache_id($block) {
// it brings too many chances of having unwanted output get in the cache
// and later be served to other users. We therefore exclude user 1 from
// block caching.
- if (variable_get('block_cache', 0) && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) {
+ if (variable_get(V_BLOCK_CACHE, 0) && $block->cache != BLOCK_NO_CACHE && $user->uid != 1) {
$cid_parts = array();
// Start with common sub-patterns: block identification, theme, language.
Index: modules/blog/blog.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.pages.inc,v
retrieving revision 1.9
diff -u -F^f -r1.9 blog.pages.inc
--- modules/blog/blog.pages.inc 13 May 2008 18:15:07 -0000 1.9
+++ modules/blog/blog.pages.inc 20 May 2008 20:39:56 -0000
@@ -6,6 +6,9 @@
* Page callback file for the blog module.
*/
+/** @variable V_DEFAULT_NODES_MAIN: TODO: add documentation **/
+define('V_DEFAULT_NODES_MAIN', 'default_nodes_main');
+
/**
* Menu callback; displays a Drupal page containing recent blog entries of a given user.
*/
@@ -25,7 +28,7 @@ function blog_page_user($account) {
$output = theme('item_list', $items);
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
+ $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get(V_DEFAULT_NODES_MAIN, 10), 0, NULL, $account->uid);
$has_posts = FALSE;
while ($node = db_fetch_object($result)) {
@@ -34,7 +37,7 @@ function blog_page_user($account) {
}
if ($has_posts) {
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $output .= theme('pager', NULL, variable_get(V_DEFAULT_NODES_MAIN, 10));
}
else {
if ($account->uid == $user->uid) {
@@ -64,7 +67,7 @@ function blog_page_last() {
$output = theme('item_list', $items);
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
+ $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get(V_DEFAULT_NODES_MAIN, 10));
$has_posts = FALSE;
while ($node = db_fetch_object($result)) {
@@ -73,7 +76,7 @@ function blog_page_last() {
}
if ($has_posts) {
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $output .= theme('pager', NULL, variable_get(V_DEFAULT_NODES_MAIN, 10));
}
else {
drupal_set_message(t('No blog entries have been created.'));
@@ -87,7 +90,7 @@ function blog_page_last() {
* Menu callback; displays an RSS feed containing recent blog entries of a given user.
*/
function blog_feed_user($account) {
- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get('feed_default_items', 10));
+ $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $account->uid, 0, variable_get(V_FEED_DEFAULT_ITEMS, 10));
$channel['title'] = $account->name . "'s blog";
$channel['link'] = url('blog/' . $account->uid, array('absolute' => TRUE));
@@ -102,8 +105,8 @@ function blog_feed_user($account) {
* Menu callback; displays an RSS feed containing recent blog entries of all users.
*/
function blog_feed_last() {
- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
- $channel['title'] = variable_get('site_name', 'Drupal') . ' blogs';
+ $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get(V_FEED_DEFAULT_ITEMS, 10));
+ $channel['title'] = variable_get(V_SITE_NAME, 'Drupal') . ' blogs';
$channel['link'] = url('blog', array('absolute' => TRUE));
$items = array();
Index: modules/blogapi/blogapi.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v
retrieving revision 1.119
diff -u -F^f -r1.119 blogapi.module
--- modules/blogapi/blogapi.module 13 May 2008 18:13:43 -0000 1.119
+++ modules/blogapi/blogapi.module 20 May 2008 20:39:56 -0000
@@ -6,6 +6,9 @@
* Enable users to post using applications that support XML-RPC blog APIs.
*/
+/** @variable V_BLOGAPI_NODE_TYPES: TODO: add documentation **/
+define('V_BLOGAPI_NODE_TYPES', 'blogapi_node_types');
+
/**
* Implementation of hook_help().
*/
@@ -193,11 +196,11 @@ function blogapi_blogger_new_post($appke
$edit = array();
$edit['type'] = $blogid;
// Get the node type defaults.
- $node_type_default = variable_get('node_options_' . $edit['type'], array('status', 'promote'));
+ $node_type_default = variable_get(V_NODE_OPTIONS_ . $edit['type'], array('status', 'promote'));
$edit['uid'] = $user->uid;
$edit['name'] = $user->name;
$edit['promote'] = in_array('promote', $node_type_default);
- $edit['comment'] = variable_get('comment_' . $edit['type'], 2);
+ $edit['comment'] = variable_get(V_COMMENT_ . $edit['type'], 2);
$edit['revision'] = in_array('revision', $node_type_default);
$edit['format'] = FILTER_FORMAT_DEFAULT;
$edit['status'] = $publish;
@@ -573,7 +576,7 @@ function blogapi_admin_settings() {
'#type' => 'checkboxes',
'#title' => t('Enable for external blogging clients'),
'#required' => TRUE,
- '#default_value' => variable_get('blogapi_node_types', $defaults),
+ '#default_value' => variable_get(V_BLOGAPI_NODE_TYPES, $defaults),
'#options' => $node_types,
'#description' => t('Select the content types available to external blogging clients via Blog API. If supported, each enabled content type will be displayed as a separate "blog" by the external client.')
);
@@ -730,7 +733,7 @@ function _blogapi_validate_blogid($blogi
}
function _blogapi_get_node_types() {
- $available_types = array_keys(array_filter(variable_get('blogapi_node_types', array('blog' => 1))));
+ $available_types = array_keys(array_filter(variable_get(V_BLOGAPI_NODE_TYPES, array('blog' => 1))));
$types = array();
foreach (node_get_types() as $type => $name) {
if (node_access('create', $type) && in_array($type, $available_types)) {
Index: modules/book/book.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v
retrieving revision 1.10
diff -u -F^f -r1.10 book.admin.inc
--- modules/book/book.admin.inc 15 May 2008 21:19:24 -0000 1.10
+++ modules/book/book.admin.inc 20 May 2008 20:39:56 -0000
@@ -31,7 +31,7 @@ function book_admin_settings() {
$form['book_allowed_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed book outline types'),
- '#default_value' => variable_get('book_allowed_types', array('book')),
+ '#default_value' => variable_get(V_BOOK_ALLOWED_TYPES, array('book')),
'#options' => $types,
'#description' => t('Select content types which users with the %add-perm permission will be allowed to add to the book hierarchy. Users with the %outline-perm permission can add all content types.', array('%add-perm' => t('add content to books'), '%outline-perm' => t('administer book outlines'))),
'#required' => TRUE,
@@ -39,7 +39,7 @@ function book_admin_settings() {
$form['book_child_type'] = array(
'#type' => 'radios',
'#title' => t('Default child page type'),
- '#default_value' => variable_get('book_child_type', 'book'),
+ '#default_value' => variable_get(V_BOOK_CHILD_TYPE, 'book'),
'#options' => $types,
'#description' => t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', array('%add-child' => t('Add child page'))),
'#required' => TRUE,
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.22
diff -u -F^f -r1.22 book.install
--- modules/book/book.install 15 May 2008 21:19:24 -0000 1.22
+++ modules/book/book.install 20 May 2008 20:39:56 -0000
@@ -37,10 +37,10 @@ function _book_install_type_create() {
$book_node_type = (object)_node_type_set_defaults($book_node_type);
node_type_save($book_node_type);
// Default to not promoted.
- variable_set('node_options_book', array('status'));
+ variable_set(V_NODE_OPTIONS_BOOK, array('status'));
// Use this default type for adding content to books.
- variable_set('book_allowed_types', array('book'));
- variable_set('book_child_type', 'book');
+ variable_set(V_BOOK_ALLOWED_TYPES, array('book'));
+ variable_set(V_BOOK_CHILD_TYPE, 'book');
}
/**
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.464
diff -u -F^f -r1.464 book.module
--- modules/book/book.module 15 May 2008 21:19:24 -0000 1.464
+++ modules/book/book.module 20 May 2008 20:39:56 -0000
@@ -6,6 +6,15 @@
* Allows users to structure the pages of a site in a hierarchy or outline.
*/
+/** @variable V_BOOK_ALLOWED_TYPES: TODO: add documentation **/
+define('V_BOOK_ALLOWED_TYPES', 'book_allowed_types');
+
+/** @variable V_BOOK_BLOCK_MODE: TODO: add documentation **/
+define('V_BOOK_BLOCK_MODE', 'book_block_mode');
+
+/** @variable V_BOOK_CHILD_TYPE: TODO: add documentation **/
+define('V_BOOK_CHILD_TYPE', 'book_child_type');
+
/**
* Implementation of hook_theme().
*/
@@ -56,7 +65,7 @@ function book_link($type, $node = NULL,
if ($type == 'node' && isset($node->book)) {
if (!$teaser) {
- $child_type = variable_get('book_child_type', 'book');
+ $child_type = variable_get(V_BOOK_CHILD_TYPE, 'book');
if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) {
$links['book_add_child'] = array(
'title' => t('Add child page'),
@@ -188,7 +197,7 @@ function book_block($op = 'list', $delta
$current_bid = empty($node->book['bid']) ? 0 : $node->book['bid'];
}
- if (variable_get('book_block_mode', 'all pages') == 'all pages') {
+ if (variable_get(V_BOOK_BLOCK_MODE, 'all pages') == 'all pages') {
$block['subject'] = t('Book navigation');
$book_menus = array();
$pseudo_tree = array(0 => array('below' => FALSE));
@@ -232,14 +241,14 @@ function book_block($op = 'list', $delta
'#type' => 'radios',
'#title' => t('Book navigation block display'),
'#options' => $options,
- '#default_value' => variable_get('book_block_mode', 'all pages'),
+ '#default_value' => variable_get(V_BOOK_BLOCK_MODE, 'all pages'),
'#description' => t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."),
);
return $form;
case 'save':
- variable_set('book_block_mode', $edit['book_block_mode']);
+ variable_set(V_BOOK_BLOCK_MODE, $edit['book_block_mode']);
break;
}
}
@@ -332,7 +341,7 @@ function book_form_alter(&$form, $form_s
* form element.
*/
function _book_parent_select($book_link) {
- if (variable_get('menu_override_parent_selector', FALSE)) {
+ if (variable_get(V_MENU_OVERRIDE_PARENT_SELECTOR, FALSE)) {
return array();
}
// Offer a message or a drop-down to choose a different parent page.
@@ -676,7 +685,7 @@ function book_build_active_trail($book_l
function book_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'load':
- if (in_array($node->type, variable_get('book_allowed_types', array('book')))) {
+ if (in_array($node->type, variable_get(V_BOOK_ALLOWED_TYPES, array('book')))) {
// Note - we cannot use book_link_load() because it will call node_load().
$info['book'] = db_fetch_array(db_query('SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid = %d', $node->nid));
@@ -1001,7 +1010,7 @@ function template_preprocess_book_node_e
* Determine if a given node type is in the list of types allowed for books.
*/
function book_type_is_allowed($type) {
- return in_array($type, variable_get('book_allowed_types', array('book')));
+ return in_array($type, variable_get(V_BOOK_ALLOWED_TYPES, array('book')));
}
/**
@@ -1015,18 +1024,18 @@ function book_node_type($op, $type) {
case 'update':
if (!empty($type->old_type) && $type->old_type != $type->type) {
// Update the list of node types that are allowed to be added to books.
- $allowed_types = variable_get('book_allowed_types', array('book'));
+ $allowed_types = variable_get(V_BOOK_ALLOWED_TYPES, array('book'));
$key = array_search($type->old_type, $allowed_types);
if ($key !== FALSE) {
$allowed_types[$type->type] = $allowed_types[$key] ? $type->type : 0;
unset($allowed_types[$key]);
- variable_set('book_allowed_types', $allowed_types);
+ variable_set(V_BOOK_ALLOWED_TYPES, $allowed_types);
}
// Update the setting for the "Add child page" link.
- if (variable_get('book_child_type', 'book') == $type->old_type) {
- variable_set('book_child_type', $type->type);
+ if (variable_get(V_BOOK_CHILD_TYPE, 'book') == $type->old_type) {
+ variable_set(V_BOOK_CHILD_TYPE, $type->type);
}
}
break;
Index: modules/color/color.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.module,v
retrieving revision 1.40
diff -u -F^f -r1.40 color.module
--- modules/color/color.module 14 Apr 2008 17:48:36 -0000 1.40
+++ modules/color/color.module 20 May 2008 20:39:56 -0000
@@ -1,6 +1,9 @@
download method
is set to public.', array('@url' => url('admin/settings/file-system'))), 'warning');
@@ -54,7 +57,7 @@ function color_form_alter(&$form, $form_
if ($form_id == 'system_theme_select_form' || $form_id == 'system_themes') {
$themes = list_themes();
foreach (element_children($form) as $theme) {
- if ($screenshot = variable_get('color_' . $theme . '_screenshot', NULL)) {
+ if ($screenshot = variable_get(V_COLOR_ . $theme . '_screenshot', NULL)) {
if (isset($form[$theme]['screenshot'])) {
$form[$theme]['screenshot']['#value'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
}
@@ -70,7 +73,7 @@ function _color_page_alter(&$vars) {
global $language, $theme_key;
// Override stylesheets.
- $color_paths = variable_get('color_' . $theme_key . '_stylesheets', array());
+ $color_paths = variable_get(V_COLOR_ . $theme_key . '_stylesheets', array());
if (!empty($color_paths)) {
// Loop over theme CSS files and try to rebuild CSS array with rewritten
// stylesheets. Keep the orginal order intact for CSS cascading.
@@ -110,7 +113,7 @@ function _color_page_alter(&$vars) {
}
// Override logo.
- $logo = variable_get('color_' . $theme_key . '_logo', NULL);
+ $logo = variable_get(V_COLOR_ . $theme_key . '_logo', NULL);
if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) {
$vars['logo'] = base_path() . $logo;
}
@@ -141,7 +144,7 @@ function color_get_palette($theme, $defa
}
// Load variable
- return $default ? $palette : variable_get('color_' . $theme . '_palette', $palette);
+ return $default ? $palette : variable_get(V_COLOR_ . $theme . '_palette', $palette);
}
/**
@@ -163,7 +166,7 @@ function color_scheme_form(&$form_state,
)), 'setting');
// See if we're using a predefined scheme
- $current = implode(',', variable_get('color_' . $theme . '_palette', array()));
+ $current = implode(',', variable_get(V_COLOR_ . $theme . '_palette', array()));
// Note: we use the original theme when the default scheme is chosen.
$current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : '');
@@ -274,7 +277,7 @@ function color_scheme_form_submit($form,
}
// Delete old files
- foreach (variable_get('color_' . $theme . '_files', array()) as $file) {
+ foreach (variable_get(V_COLOR_ . $theme . '_files', array()) as $file) {
@unlink($file);
}
if (isset($file) && $file = dirname($file)) {
@@ -305,8 +308,8 @@ function color_scheme_form_submit($form,
$paths['files'] = $paths['map'] = array();
// Save palette and logo location.
- variable_set('color_' . $theme . '_palette', $palette);
- variable_set('color_' . $theme . '_logo', $paths['target'] . 'logo.png');
+ variable_set(V_COLOR_ . $theme . '_palette', $palette);
+ variable_set(V_COLOR_ . $theme . '_logo', $paths['target'] . 'logo.png');
// Copy over neutral images.
foreach ($info['copy'] as $file) {
@@ -359,8 +362,8 @@ function color_scheme_form_submit($form,
}
// Maintain list of files.
- variable_set('color_' . $theme . '_stylesheets', $css);
- variable_set('color_' . $theme . '_files', $paths['files']);
+ variable_set(V_COLOR_ . $theme . '_stylesheets', $css);
+ variable_set(V_COLOR_ . $theme . '_files', $paths['files']);
}
/**
@@ -491,7 +494,7 @@ function _color_render_images($theme, &$
if ($file == 'screenshot.png') {
$slice = imagecreatetruecolor(150, 90);
imagecopyresampled($slice, $target, 0, 0, $x, $y, 150, 90, $width, $height);
- variable_set('color_' . $theme . '_screenshot', $image);
+ variable_set(V_COLOR_ . $theme . '_screenshot', $image);
}
else {
$slice = imagecreatetruecolor($width, $height);
Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.22
diff -u -F^f -r1.22 comment.install
--- modules/comment/comment.install 14 May 2008 13:12:40 -0000 1.22
+++ modules/comment/comment.install 20 May 2008 20:39:56 -0000
@@ -17,8 +17,8 @@ function comment_update_1() {
db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', time(), time());
// Unstuck node indexing timestamp if needed.
- if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
- variable_set('node_cron_last', min(time(), $last));
+ if (($last = variable_get(V_NODE_CRON_LAST, FALSE)) !== FALSE) {
+ variable_set(V_NODE_CRON_LAST, min(time(), $last));
}
return array();
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.633
diff -u -F^f -r1.633 comment.module
--- modules/comment/comment.module 14 May 2008 13:12:40 -0000 1.633
+++ modules/comment/comment.module 20 May 2008 20:39:57 -0000
@@ -10,6 +10,39 @@
* a forum topic, weblog post, story, collaborative book page, etc.
*/
+/** @variable V_ANONYMOUS: TODO: add documentation **/
+define('V_ANONYMOUS', 'anonymous');
+
+/** @variable V_COMMENT_: TODO: add documentation **/
+define('V_COMMENT_', 'comment_');
+
+/** @variable V_COMMENT_ANONYMOUS_: TODO: add documentation **/
+define('V_COMMENT_ANONYMOUS_', 'comment_anonymous_');
+
+/** @variable V_COMMENT_BLOCK_COUNT: TODO: add documentation **/
+define('V_COMMENT_BLOCK_COUNT', 'comment_block_count');
+
+/** @variable V_COMMENT_DEFAULT_MODE_: TODO: add documentation **/
+define('V_COMMENT_DEFAULT_MODE_', 'comment_default_mode_');
+
+/** @variable V_COMMENT_DEFAULT_ORDER_: TODO: add documentation **/
+define('V_COMMENT_DEFAULT_ORDER_', 'comment_default_order_');
+
+/** @variable V_COMMENT_DEFAULT_PER_PAGE_: TODO: add documentation **/
+define('V_COMMENT_DEFAULT_PER_PAGE_', 'comment_default_per_page_');
+
+/** @variable V_COMMENT_FORM_LOCATION_: TODO: add documentation **/
+define('V_COMMENT_FORM_LOCATION_', 'comment_form_location_');
+
+/** @variable V_COMMENT_PAGE: TODO: add documentation **/
+define('V_COMMENT_PAGE', 'comment_page');
+
+/** @variable V_COMMENT_PREVIEW_: TODO: add documentation **/
+define('V_COMMENT_PREVIEW_', 'comment_preview_');
+
+/** @variable V_COMMENT_SUBJECT_FIELD_: TODO: add documentation **/
+define('V_COMMENT_SUBJECT_FIELD_', 'comment_subject_field_');
+
/**
* Comment is published.
*/
@@ -268,7 +301,7 @@ function comment_block($op = 'list', $de
$form['comment_block_count'] = array(
'#type' => 'select',
'#title' => t('Number of recent comments'),
- '#default_value' => variable_get('comment_block_count', 10),
+ '#default_value' => variable_get(V_COMMENT_BLOCK_COUNT, 10),
'#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)),
'#description' => t('Number of comments displayed in the Recent comments block.'),
);
@@ -276,7 +309,7 @@ function comment_block($op = 'list', $de
return $form;
case 'save':
- variable_set('comment_block_count', (int)$edit['comment_block_count']);
+ variable_set(V_COMMENT_BLOCK_COUNT, (int)$edit['comment_block_count']);
break;
case 'view':
@@ -391,7 +424,7 @@ function comment_new_page_count($num_com
*/
function theme_comment_block() {
$items = array();
- $number = variable_get('comment_block_count', 10);
+ $number = variable_get(V_COMMENT_BLOCK_COUNT, 10);
foreach (comment_get_recent($number) as $comment) {
$items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '
' . t('@time ago', array('@time' => format_interval(time() - $comment->timestamp)));
}
@@ -453,7 +486,7 @@ function comment_link($type, $node = NUL
// if this node is not read-only, and if the comment form isn't already shown.
if ($node->comment == COMMENT_NODE_READ_WRITE) {
if (user_access('post comments')) {
- if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ if (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$links['comment_add'] = array(
'title' => t('Add new comment'),
'href' => "comment/reply/$node->nid",
@@ -494,35 +527,35 @@ function comment_form_alter(&$form, $for
$form['comment']['comment'] = array(
'#type' => 'radios',
'#title' => t('Default comment setting'),
- '#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_READ_WRITE),
+ '#default_value' => variable_get(V_COMMENT_ . $form['#node_type']->type, COMMENT_NODE_READ_WRITE),
'#options' => array(t('Disabled'), t('Read only'), t('Read/Write')),
'#description' => t('Users with the administer comments permission will be able to override this setting.'),
);
$form['comment']['comment_default_mode'] = array(
'#type' => 'radios',
'#title' => t('Default display mode'),
- '#default_value' => variable_get('comment_default_mode_' . $form['#node_type']->type, COMMENT_MODE_THREADED_EXPANDED),
+ '#default_value' => variable_get(V_COMMENT_DEFAULT_MODE_ . $form['#node_type']->type, COMMENT_MODE_THREADED_EXPANDED),
'#options' => _comment_get_modes(),
'#description' => t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.'),
);
$form['comment']['comment_default_order'] = array(
'#type' => 'radios',
'#title' => t('Default display order'),
- '#default_value' => variable_get('comment_default_order_' . $form['#node_type']->type, COMMENT_ORDER_NEWEST_FIRST),
+ '#default_value' => variable_get(V_COMMENT_DEFAULT_ORDER_ . $form['#node_type']->type, COMMENT_ORDER_NEWEST_FIRST),
'#options' => _comment_get_orders(),
'#description' => t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.'),
);
$form['comment']['comment_default_per_page'] = array(
'#type' => 'select',
'#title' => t('Default comments per page'),
- '#default_value' => variable_get('comment_default_per_page_' . $form['#node_type']->type, 50),
+ '#default_value' => variable_get(V_COMMENT_DEFAULT_PER_PAGE_ . $form['#node_type']->type, 50),
'#options' => _comment_per_page(),
'#description' => t('Default number of comments for each page: more comments are distributed in several pages.'),
);
$form['comment']['comment_anonymous'] = array(
'#type' => 'radios',
'#title' => t('Anonymous commenting'),
- '#default_value' => variable_get('comment_anonymous_' . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+ '#default_value' => variable_get(V_COMMENT_ANONYMOUS_ . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT),
'#options' => array(
COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'),
COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'),
@@ -537,21 +570,21 @@ function comment_form_alter(&$form, $for
$form['comment']['comment_subject_field'] = array(
'#type' => 'radios',
'#title' => t('Comment subject field'),
- '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1),
+ '#default_value' => variable_get(V_COMMENT_SUBJECT_FIELD_ . $form['#node_type']->type, 1),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Can users provide a unique subject for their comments?'),
);
$form['comment']['comment_preview'] = array(
'#type' => 'radios',
'#title' => t('Preview comment'),
- '#default_value' => variable_get('comment_preview_' . $form['#node_type']->type, COMMENT_PREVIEW_REQUIRED),
+ '#default_value' => variable_get(V_COMMENT_PREVIEW_ . $form['#node_type']->type, COMMENT_PREVIEW_REQUIRED),
'#options' => array(t('Optional'), t('Required')),
'#description' => t("Forces a user to look at their comment by clicking on a 'Preview' button before they can actually add the comment"),
);
$form['comment']['comment_form_location'] = array(
'#type' => 'radios',
'#title' => t('Location of comment submission form'),
- '#default_value' => variable_get('comment_form_location_' . $form['#node_type']->type, COMMENT_FORM_SEPARATE_PAGE),
+ '#default_value' => variable_get(V_COMMENT_FORM_LOCATION_ . $form['#node_type']->type, COMMENT_FORM_SEPARATE_PAGE),
'#options' => array(t('Display on separate page'), t('Display below post or comments')),
);
}
@@ -1009,7 +1042,7 @@ function comment_render($node, $cid = 0)
// If enabled, show new comment form if it's not already being displayed.
$reply = arg(0) == 'comment' && arg(1) == 'reply';
- if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) {
+ if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) {
$output .= comment_form_box(array('nid' => $nid), t('Post new comment'));
}
$output = theme('comment_wrapper', $output, $node);
@@ -1160,14 +1193,14 @@ function comment_validate($edit) {
// Check validity of name, mail and homepage (if given).
if (!$user->uid || isset($edit['is_anonymous'])) {
$node = node_load($edit['nid']);
- if (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+ if (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) > COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
if ($edit['name']) {
$taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name']));
if ($taken != 0) {
form_set_error('name', t('The name you used belongs to a registered user.'));
}
}
- elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
+ elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
form_set_error('name', t('You have to leave your name.'));
}
@@ -1176,7 +1209,7 @@ function comment_validate($edit) {
form_set_error('mail', t('The e-mail address you specified is not valid.'));
}
}
- elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
+ elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
form_set_error('mail', t('You have to leave an e-mail address.'));
}
@@ -1205,7 +1238,7 @@ function comment_form(&$form_state, $edi
$op = isset($_POST['op']) ? $_POST['op'] : '';
$node = node_load($edit['nid']);
- if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+ if (!$user->uid && variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
drupal_add_js(drupal_get_path('module', 'comment') . '/comment.js');
}
$edit += array('name' => '', 'mail' => '', 'homepage' => '');
@@ -1316,13 +1349,13 @@ function comment_form(&$form_state, $edi
);
}
}
- elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) {
+ elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAY_CONTACT) {
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Your name'),
'#maxlength' => 60,
'#size' => 30,
- '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')),
+ '#default_value' => $edit['name'] ? $edit['name'] : variable_get(V_ANONYMOUS, t('Anonymous')),
);
$form['mail'] = array(
'#type' => 'textfield',
@@ -1339,13 +1372,13 @@ function comment_form(&$form_state, $edi
'#default_value' => $edit['homepage'],
);
}
- elseif (variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
+ elseif (variable_get(V_COMMENT_ANONYMOUS_ . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MUST_CONTACT) {
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Your name'),
'#maxlength' => 60,
'#size' => 30,
- '#default_value' => $edit['name'] ? $edit['name'] : variable_get('anonymous', t('Anonymous')),
+ '#default_value' => $edit['name'] ? $edit['name'] : variable_get(V_ANONYMOUS, t('Anonymous')),
'#required' => TRUE,
);
$form['mail'] = array(
@@ -1365,7 +1398,7 @@ function comment_form(&$form_state, $edi
);
}
- if (variable_get('comment_subject_field_' . $node->type, 1) == 1) {
+ if (variable_get(V_COMMENT_SUBJECT_FIELD_ . $node->type, 1) == 1) {
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
@@ -1413,7 +1446,7 @@ function comment_form(&$form_state, $edi
// Only show save button if preview is optional or if we are in preview mode.
// We show the save button in preview mode even if there are form errors so that
// optional form elements (e.g., captcha) can be updated in preview mode.
- if (!form_get_errors() && ((variable_get('comment_preview_' . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
+ if (!form_get_errors() && ((variable_get(V_COMMENT_PREVIEW_ . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
@@ -1484,7 +1517,7 @@ function comment_form_add_preview($form,
$comment->name = check_plain($account->name);
}
elseif (empty($comment->name)) {
- $comment->name = variable_get('anonymous', t('Anonymous'));
+ $comment->name = variable_get(V_ANONYMOUS, t('Anonymous'));
}
$comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time();
@@ -1741,14 +1774,14 @@ function theme_comment_post_forbidden($n
if ($authenticated_post_comments) {
// We cannot use drupal_get_destination() because these links
// sometimes appear on /node and taxonomy listing pages.
- if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+ if (variable_get(V_COMMENT_FORM_LOCATION_ . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$destination = 'destination=' . drupal_urlencode("comment/reply/$node->nid#comment-form");
}
else {
$destination = 'destination=' . drupal_urlencode("node/$node->nid#comment-form");
}
- if (variable_get('user_register', 1)) {
+ if (variable_get(V_USER_REGISTER, 1)) {
// Users can register themselves.
return t('Login or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination))));
}
@@ -1835,15 +1868,15 @@ function _comment_per_page() {
function _comment_get_display_setting($setting, $node) {
switch ($setting) {
case 'mode':
- $value = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED_EXPANDED);
+ $value = variable_get(V_COMMENT_DEFAULT_MODE_ . $node->type, COMMENT_MODE_THREADED_EXPANDED);
break;
case 'sort':
- $value = variable_get('comment_default_order_' . $node->type, COMMENT_ORDER_NEWEST_FIRST);
+ $value = variable_get(V_COMMENT_DEFAULT_ORDER_ . $node->type, COMMENT_ORDER_NEWEST_FIRST);
break;
case 'comments_per_page':
- $value = variable_get('comment_default_per_page_' . $node->type, 50);
+ $value = variable_get(V_COMMENT_DEFAULT_PER_PAGE_ . $node->type, 50);
}
return $value;
@@ -2051,7 +2084,7 @@ function comment_ranking() {
'join' => 'LEFT JOIN {node_comment_statistics} node_comment_statistics ON node_comment_statistics.nid = i.sid',
// Inverse law that maps the highest reply count on the site to 1 and 0 to 0.
'score' => '2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * %f)',
- 'arguments' => array(variable_get('node_cron_comments_scale', 0)),
+ 'arguments' => array(variable_get(V_NODE_CRON_COMMENTS_SCALE, 0)),
),
);
}
Index: modules/contact/contact.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v
retrieving revision 1.4
diff -u -F^f -r1.4 contact.admin.inc
--- modules/contact/contact.admin.inc 14 Apr 2008 17:48:36 -0000 1.4
+++ modules/contact/contact.admin.inc 20 May 2008 20:39:57 -0000
@@ -154,19 +154,19 @@ function contact_admin_delete_submit($fo
function contact_admin_settings() {
$form['contact_form_information'] = array('#type' => 'textarea',
'#title' => t('Additional information'),
- '#default_value' => variable_get('contact_form_information', t('You can leave a message using the contact form below.')),
+ '#default_value' => variable_get(V_CONTACT_FORM_INFORMATION, t('You can leave a message using the contact form below.')),
'#description' => t('Information to show on the contact page. Can be anything from submission guidelines to your postal address or telephone number.', array('@form' => url('contact'))),
);
$form['contact_hourly_threshold'] = array('#type' => 'select',
'#title' => t('Hourly threshold'),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50)),
- '#default_value' => variable_get('contact_hourly_threshold', 3),
+ '#default_value' => variable_get(V_CONTACT_HOURLY_THRESHOLD, 3),
'#description' => t('The maximum number of contact form submissions a user can perform per hour.'),
);
$form['contact_default_status'] = array(
'#type' => 'checkbox',
'#title' => t('Enable personal contact form by default'),
- '#default_value' => variable_get('contact_default_status', 1),
+ '#default_value' => variable_get(V_CONTACT_DEFAULT_STATUS, 1),
'#description' => t('Default status of the personal contact form for new users.'),
);
return system_settings_form($form);
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.107
diff -u -F^f -r1.107 contact.module
--- modules/contact/contact.module 6 May 2008 12:18:47 -0000 1.107
+++ modules/contact/contact.module 20 May 2008 20:39:57 -0000
@@ -6,6 +6,15 @@
* Enables the use of personal and site-wide contact forms.
*/
+/** @variable V_CONTACT_DEFAULT_STATUS: TODO: add documentation **/
+define('V_CONTACT_DEFAULT_STATUS', 'contact_default_status');
+
+/** @variable V_CONTACT_FORM_INFORMATION: TODO: add documentation **/
+define('V_CONTACT_FORM_INFORMATION', 'contact_form_information');
+
+/** @variable V_CONTACT_HOURLY_THRESHOLD: TODO: add documentation **/
+define('V_CONTACT_HOURLY_THRESHOLD', 'contact_hourly_threshold');
+
/**
* Implementation of hook_help().
*/
@@ -152,7 +161,7 @@ function contact_user($type, &$edit, &$u
return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
}
elseif ($type == 'insert') {
- $edit['contact'] = variable_get('contact_default_status', 1);
+ $edit['contact'] = variable_get(V_CONTACT_DEFAULT_STATUS, 1);
}
}
@@ -178,9 +187,9 @@ function contact_mail($key, &$message, $
case 'user_copy':
$user = $params['user'];
$account = $params['account'];
- $message['subject'] .= '[' . variable_get('site_name', 'Drupal') . '] ' . $params['subject'];
+ $message['subject'] .= '[' . variable_get(V_SITE_NAME, 'Drupal') . '] ' . $params['subject'];
$message['body'][] = "$account->name,";
- $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get('site_name', 'Drupal')), $language->language);
+ $message['body'][] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE, 'language' => $language)), '!form-url' => url($_GET['q'], array('absolute' => TRUE, 'language' => $language)), '!site' => variable_get(V_SITE_NAME, 'Drupal')), $language->language);
$message['body'][] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE, 'language' => $language))), $language->language);
$message['body'][] = t('Message:', NULL, $language->language);
$message['body'][] = $params['message'];
Index: modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.10
diff -u -F^f -r1.10 contact.pages.inc
--- modules/contact/contact.pages.inc 19 Apr 2008 14:44:34 -0000 1.10
+++ modules/contact/contact.pages.inc 20 May 2008 20:39:57 -0000
@@ -13,8 +13,8 @@
function contact_site_page() {
global $user;
- if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) {
- $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
+ if (!flood_is_allowed('contact', variable_get(V_CONTACT_HOURLY_THRESHOLD, 3)) && !user_access('administer site-wide contact form')) {
+ $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get(V_CONTACT_HOURLY_THRESHOLD, 3)));
}
else {
$output = drupal_get_form('contact_mail_page');
@@ -38,7 +38,7 @@ function contact_mail_page() {
if (count($categories) > 0) {
$form['#token'] = $user->uid ? $user->name . $user->mail : '';
- $form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.'))));
+ $form['contact_information'] = array('#value' => filter_xss_admin(variable_get(V_CONTACT_FORM_INFORMATION, t('You can leave a message using the contact form below.'))));
$form['name'] = array('#type' => 'textfield',
'#title' => t('Your name'),
'#maxlength' => 255,
@@ -160,8 +160,8 @@ function contact_user_page($account) {
if (!valid_email_address($user->mail)) {
$output = t('You need to provide a valid e-mail address to contact other users. Please update your user information and try again.', array('@url' => url("user/$user->uid/edit", array('query' => 'destination=' . drupal_get_destination()))));
}
- else if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) {
- $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3)));
+ else if (!flood_is_allowed('contact', variable_get(V_CONTACT_HOURLY_THRESHOLD, 3)) && !user_access('administer site-wide contact form')) {
+ $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get(V_CONTACT_HOURLY_THRESHOLD, 3)));
}
else {
drupal_set_title(check_plain($account->name));
Index: modules/dblog/dblog.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v
retrieving revision 1.7
diff -u -F^f -r1.7 dblog.admin.inc
--- modules/dblog/dblog.admin.inc 14 Apr 2008 17:48:36 -0000 1.7
+++ modules/dblog/dblog.admin.inc 20 May 2008 20:39:57 -0000
@@ -16,7 +16,7 @@ function dblog_admin_settings() {
$form['dblog_row_limit'] = array(
'#type' => 'select',
'#title' => t('Discard log entries above the following row limit'),
- '#default_value' => variable_get('dblog_row_limit', 1000),
+ '#default_value' => variable_get(V_DBLOG_ROW_LIMIT, 1000),
'#options' => drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
'#description' => t('The maximum number of rows to keep in the database log. Older entries will be automatically discarded. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status')))
);
Index: modules/dblog/dblog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v
retrieving revision 1.25
diff -u -F^f -r1.25 dblog.module
--- modules/dblog/dblog.module 6 May 2008 12:18:47 -0000 1.25
+++ modules/dblog/dblog.module 20 May 2008 20:39:57 -0000
@@ -12,6 +12,9 @@
* @see watchdog()
*/
+/** @variable V_DBLOG_ROW_LIMIT: TODO: add documentation **/
+define('V_DBLOG_ROW_LIMIT', 'dblog_row_limit');
+
/**
* Implementation of hook_help().
*/
@@ -97,7 +100,7 @@ function dblog_init() {
function dblog_cron() {
// Cleanup the watchdog table
$max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
- db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit', 1000));
+ db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get(V_DBLOG_ROW_LIMIT, 1000));
}
/**
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.11
diff -u -F^f -r1.11 filter.admin.inc
--- modules/filter/filter.admin.inc 14 Apr 2008 17:48:37 -0000 1.11
+++ modules/filter/filter.admin.inc 20 May 2008 20:39:57 -0000
@@ -28,7 +28,7 @@ function filter_admin_overview() {
$roles[] = $name;
}
}
- $default = ($id == variable_get('filter_default_format', 1));
+ $default = ($id == variable_get(V_FILTER_DEFAULT_FORMAT, 1));
$options[$id] = '';
$form[$id]['name'] = array('#value' => $format->name);
$form[$id]['roles'] = array('#value' => $default ? t('All roles may use default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')));
@@ -36,7 +36,7 @@ function filter_admin_overview() {
$form[$id]['delete'] = array('#value' => $default ? '' : l(t('delete'), 'admin/settings/filters/delete/' . $id));
$form[$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
}
- $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
+ $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get(V_FILTER_DEFAULT_FORMAT, 1));
$form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
return $form;
}
@@ -45,7 +45,7 @@ function filter_admin_overview_submit($f
// Process form submission to set the default format.
if (is_numeric($form_state['values']['default'])) {
drupal_set_message(t('Default format updated.'));
- variable_set('filter_default_format', $form_state['values']['default']);
+ variable_set(V_FILTER_DEFAULT_FORMAT, $form_state['values']['default']);
}
foreach ($form_state['values'] as $id => $data) {
if (is_array($data) && isset($data['weight'])) {
@@ -108,7 +108,7 @@ function filter_admin_format_page($forma
* @see filter_admin_format_form_submit()
*/
function filter_admin_format_form(&$form_state, $format) {
- $default = ($format->format == variable_get('filter_default_format', 1));
+ $default = ($format->format == variable_get(V_FILTER_DEFAULT_FORMAT, 1));
if ($default) {
$help = t('All roles for the default format must be enabled and cannot be changed.');
$form['default_format'] = array('#type' => 'hidden', '#value' => 1);
@@ -261,7 +261,7 @@ function filter_admin_delete() {
$format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
if ($format) {
- if ($format->format != variable_get('filter_default_format', 1)) {
+ if ($format->format != variable_get(V_FILTER_DEFAULT_FORMAT, 1)) {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
$form['name'] = array('#type' => 'hidden', '#value' => $format->name);
@@ -284,7 +284,7 @@ function filter_admin_delete_submit($for
db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_state['values']['format']);
db_query("DELETE FROM {filters} WHERE format = %d", $form_state['values']['format']);
- $default = variable_get('filter_default_format', 1);
+ $default = variable_get(V_FILTER_DEFAULT_FORMAT, 1);
// Replace existing instances of the deleted format with the default format.
db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.9
diff -u -F^f -r1.9 filter.install
--- modules/filter/filter.install 14 Apr 2008 17:48:37 -0000 1.9
+++ modules/filter/filter.install 20 May 2008 20:39:57 -0000
@@ -115,7 +115,7 @@ function filter_update_7001() {
$result = db_query("SELECT format FROM {filter_formats}");
while ($format = db_fetch_object($result)) {
// Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
- if (variable_get('filter_html_' . $format->format, 1) == 2) {
+ if (variable_get(V_FILTER_HTML_ . $format->format, 1) == 2) {
$ret[] = update_sql("INSERT INTO {filters} (format, module, delta, weight) VALUES (" . $format->format . ", 'filter', 4, 0)");
}
variable_del('filter_html_' . $format->format);
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.213
diff -u -F^f -r1.213 filter.module
--- modules/filter/filter.module 6 May 2008 12:18:47 -0000 1.213
+++ modules/filter/filter.module 20 May 2008 20:39:57 -0000
@@ -6,6 +6,18 @@
* Framework for handling filtering of content.
*/
+/** @variable V_FILTER_ALLOWED_PROTOCOLS: TODO: add documentation **/
+define('V_FILTER_ALLOWED_PROTOCOLS', 'filter_allowed_protocols');
+
+/** @variable V_FILTER_DEFAULT_FORMAT: TODO: add documentation **/
+define('V_FILTER_DEFAULT_FORMAT', 'filter_default_format');
+
+/** @variable V_FILTER_HTML_: TODO: add documentation **/
+define('V_FILTER_HTML_', 'filter_html_');
+
+/** @variable V_FILTER_URL_LENGTH_: TODO: add documentation **/
+define('V_FILTER_URL_LENGTH_', 'filter_url_length_');
+
/**
* Special format ID which means "use the default format".
*
@@ -179,7 +191,7 @@ function filter_filter_tips($delta, $for
$output .= '' . t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '
';
$output .= '' . t('For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '
';
$tips = array(
- 'a' => array( t('Anchors are used to make links to other pages.'), '' . variable_get('site_name', 'Drupal') . ''),
+ 'a' => array( t('Anchors are used to make links to other pages.'), '' . variable_get(V_SITE_NAME, 'Drupal') . ''),
'br' => array( t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with
line break')),
'p' => array( t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '' . t('Paragraph one.') . '
' . t('Paragraph two.') . '
'),
'strong' => array( t('Strong'), '' . t('Strong') . ''),
@@ -303,7 +315,7 @@ function filter_formats($index = NULL) {
$args[] = $rid;
}
$query .= ' WHERE ' . implode(' OR ', $where) . ' OR format = %d';
- $args[] = variable_get('filter_default_format', 1);
+ $args[] = variable_get(V_FILTER_DEFAULT_FORMAT, 1);
}
$result = db_query($query . ' ORDER by weight', $args);
@@ -348,7 +360,7 @@ function _filter_list_cmp($a, $b) {
* Resolve a format id, including the default format.
*/
function filter_resolve_format($format) {
- return $format == FILTER_FORMAT_DEFAULT ? variable_get('filter_default_format', 1) : $format;
+ return $format == FILTER_FORMAT_DEFAULT ? variable_get(V_FILTER_DEFAULT_FORMAT, 1) : $format;
}
/**
* Check if text in a certain input format is allowed to be cached.
@@ -505,7 +517,7 @@ function filter_form($value = FILTER_FOR
// Only one format available: use a hidden form item and only show tips.
$format = array_shift($formats);
$form[$format->format] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);
- $tips = _filter_tips(variable_get('filter_default_format', 1), FALSE);
+ $tips = _filter_tips(variable_get(V_FILTER_DEFAULT_FORMAT, 1), FALSE);
$form['format']['guidelines'] = array(
'#title' => t('Formatting guidelines'),
'#value' => theme('filter_tips', $tips, FALSE, $extra),
@@ -530,7 +542,7 @@ function filter_form_validate($form) {
*/
function filter_access($format) {
$format = filter_resolve_format($format);
- if (user_access('administer filters') || ($format == variable_get('filter_default_format', 1))) {
+ if (user_access('administer filters') || ($format == variable_get(V_FILTER_DEFAULT_FORMAT, 1))) {
return TRUE;
}
else {
@@ -706,7 +718,7 @@ function _filter_url_settings($format) {
$form['filter_urlfilter']['filter_url_length_' . $format] = array(
'#type' => 'textfield',
'#title' => t('Maximum link text length'),
- '#default_value' => variable_get('filter_url_length_' . $format, 72),
+ '#default_value' => variable_get(V_FILTER_URL_LENGTH_ . $format, 72),
'#maxlength' => 4,
'#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'),
);
@@ -719,7 +731,7 @@ function _filter_url_settings($format) {
*/
function _filter_url($text, $format) {
// Pass length to regexp callback
- _filter_url_trim(NULL, variable_get('filter_url_length_' . $format, 72));
+ _filter_url_trim(NULL, variable_get(V_FILTER_URL_LENGTH_ . $format, 72));
$text = ' ' . $text . ' ';
@@ -1158,7 +1170,7 @@ function _filter_xss_attributes($attr) {
function filter_xss_bad_protocol($string, $decode = TRUE) {
static $allowed_protocols;
if (!isset($allowed_protocols)) {
- $allowed_protocols = array_flip(variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')));
+ $allowed_protocols = array_flip(variable_get(V_FILTER_ALLOWED_PROTOCOLS, array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')));
}
// Get the plain text representation of the attribute value (i.e. its meaning).
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.10
diff -u -F^f -r1.10 forum.admin.inc
--- modules/forum/forum.admin.inc 14 Apr 2008 17:48:37 -0000 1.10
+++ modules/forum/forum.admin.inc 20 May 2008 20:39:57 -0000
@@ -54,7 +54,7 @@ function forum_form_forum(&$form_state,
'#description' => t('Forums are displayed in ascending order by weight (forums with equal weights are displayed alphabetically).'),
);
- $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary', ''));
+ $form['vid'] = array('#type' => 'hidden', '#value' => variable_get(V_FORUM_NAV_VOCABULARY, ''));
$form['submit' ] = array('#type' => 'submit', '#value' => t('Save'));
if ($edit['tid']) {
$form['delete'] = array('#type' => 'submit', '#value' => t('Delete'));
@@ -83,9 +83,9 @@ function forum_form_submit($form, &$form
switch ($status) {
case SAVED_NEW:
if ($container) {
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get(V_FORUM_CONTAINERS, array());
$containers[] = $form_state['values']['tid'];
- variable_set('forum_containers', $containers);
+ variable_set(V_FORUM_CONTAINERS, $containers);
}
drupal_set_message(t('Created new @type %term.', array('%term' => $form_state['values']['name'], '@type' => $type)));
break;
@@ -138,7 +138,7 @@ function forum_form_container(&$form_sta
$form['vid'] = array(
'#type' => 'hidden',
- '#value' => variable_get('forum_nav_vocabulary', ''),
+ '#value' => variable_get(V_FORUM_NAV_VOCABULARY, ''),
);
$form['submit'] = array(
'#type' => 'submit',
@@ -190,21 +190,21 @@ function forum_admin_settings() {
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500));
$form['forum_hot_topic'] = array('#type' => 'select',
'#title' => t('Hot topic threshold'),
- '#default_value' => variable_get('forum_hot_topic', 15),
+ '#default_value' => variable_get(V_FORUM_HOT_TOPIC, 15),
'#options' => $number,
'#description' => t('The number of posts a topic must have to be considered "hot".'),
);
$number = drupal_map_assoc(array(10, 25, 50, 75, 100));
$form['forum_per_page'] = array('#type' => 'select',
'#title' => t('Topics per page'),
- '#default_value' => variable_get('forum_per_page', 25),
+ '#default_value' => variable_get(V_FORUM_PER_PAGE, 25),
'#options' => $number,
'#description' => t('Default number of forum topics displayed per page.'),
);
$forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4 => t('Posts - least active first'));
$form['forum_order'] = array('#type' => 'radios',
'#title' => t('Default order'),
- '#default_value' => variable_get('forum_order', '1'),
+ '#default_value' => variable_get(V_FORUM_ORDER, '1'),
'#options' => $forder,
'#description' => t('Default display order for topics.'),
);
@@ -217,7 +217,7 @@ function forum_admin_settings() {
function forum_overview(&$form_state) {
module_load_include('inc', 'taxonomy', 'taxonomy.admin');
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$vocabulary = taxonomy_vocabulary_load($vid);
$form = taxonomy_overview_terms($form_state, $vocabulary);
drupal_set_title('Forums');
@@ -226,7 +226,7 @@ function forum_overview(&$form_state) {
if (isset($form[$key]['#term'])) {
$term = $form[$key]['#term'];
$form[$key]['view']['#value'] = l($term['name'], 'forum/' . $term['tid']);
- if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
+ if (in_array($form[$key]['#term']['tid'], variable_get(V_FORUM_CONTAINERS, array()))) {
$form[$key]['edit']['#value'] = l(t('edit container'), 'admin/content/forum/edit/container/' . $term['tid']);
}
else {
@@ -264,7 +264,7 @@ function _forum_parent_select($tid, $tit
$parent = 0;
}
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$children = taxonomy_get_tree($vid, $tid);
// A term can't be the child of itself, nor of its children.
Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.18
diff -u -F^f -r1.18 forum.install
--- modules/forum/forum.install 10 Apr 2008 10:28:22 -0000 1.18
+++ modules/forum/forum.install 20 May 2008 20:39:57 -0000
@@ -12,7 +12,7 @@ function forum_install() {
}
function forum_enable() {
- if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0))) {
+ if ($vocabulary = taxonomy_vocabulary_load(variable_get(V_FORUM_NAV_VOCABULARY, 0))) {
// Existing install. Add back forum node type, if the forums
// vocabulary still exists. Keep all other node types intact there.
$vocabulary = (array) $vocabulary;
@@ -35,7 +35,7 @@ function forum_enable() {
);
taxonomy_save_vocabulary($vocabulary);
- variable_set('forum_nav_vocabulary', $vocabulary['vid']);
+ variable_set(V_FORUM_NAV_VOCABULARY, $vocabulary['vid']);
}
}
@@ -47,7 +47,7 @@ function forum_uninstall() {
drupal_load('module', 'taxonomy');
// Delete the vocabulary.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
taxonomy_del_vocabulary($vid);
db_query("DELETE FROM {node} WHERE type = 'forum'");
@@ -109,7 +109,7 @@ function forum_schema() {
function forum_update_6000() {
$ret = array();
- $vid = variable_get('forum_nav_vocabulary', 0);
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, 0);
$vocabularies = taxonomy_get_vocabularies();
if (!isset($vocabularies[$vid])) {
$vocabulary = array(
@@ -124,7 +124,7 @@ function forum_update_6000() {
);
taxonomy_save_vocabulary($vocabulary);
- variable_set('forum_nav_vocabulary', $vocabulary['vid']);
+ variable_set(V_FORUM_NAV_VOCABULARY, $vocabulary['vid']);
}
return $ret;
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.456
diff -u -F^f -r1.456 forum.module
--- modules/forum/forum.module 6 May 2008 12:18:47 -0000 1.456
+++ modules/forum/forum.module 20 May 2008 20:39:57 -0000
@@ -6,6 +6,36 @@
* Enable threaded discussions about general topics.
*/
+/** @variable V_FORUM_BLOCK_NUM_: TODO: add documentation **/
+define('V_FORUM_BLOCK_NUM_', 'forum_block_num_');
+
+/** @variable V_FORUM_BLOCK_NUM_0: TODO: add documentation **/
+define('V_FORUM_BLOCK_NUM_0', 'forum_block_num_0');
+
+/** @variable V_FORUM_BLOCK_NUM_1: TODO: add documentation **/
+define('V_FORUM_BLOCK_NUM_1', 'forum_block_num_1');
+
+/** @variable V_FORUM_BLOCK_NUM_ACTIVE: TODO: add documentation **/
+define('V_FORUM_BLOCK_NUM_ACTIVE', 'forum_block_num_active');
+
+/** @variable V_FORUM_BLOCK_NUM_NEW: TODO: add documentation **/
+define('V_FORUM_BLOCK_NUM_NEW', 'forum_block_num_new');
+
+/** @variable V_FORUM_CONTAINERS: TODO: add documentation **/
+define('V_FORUM_CONTAINERS', 'forum_containers');
+
+/** @variable V_FORUM_HOT_TOPIC: TODO: add documentation **/
+define('V_FORUM_HOT_TOPIC', 'forum_hot_topic');
+
+/** @variable V_FORUM_NAV_VOCABULARY: TODO: add documentation **/
+define('V_FORUM_NAV_VOCABULARY', 'forum_nav_vocabulary');
+
+/** @variable V_FORUM_ORDER: TODO: add documentation **/
+define('V_FORUM_ORDER', 'forum_order');
+
+/** @variable V_FORUM_PER_PAGE: TODO: add documentation **/
+define('V_FORUM_PER_PAGE', 'forum_per_page');
+
/**
* Implementation of hook_help().
*/
@@ -28,7 +58,7 @@ function forum_help($path, $arg) {
case 'admin/content/forum/add/forum':
return '' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '
';
case 'admin/content/forum/settings':
- return '' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', '')))) . '
';
+ return '' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get(V_FORUM_NAV_VOCABULARY, '')))) . '
';
}
}
@@ -74,7 +104,7 @@ function forum_theme() {
* An associative array containing the term data or FALSE if the term cannot be loaded, or is not part of the forum vocabulary.
*/
function forum_term_load($tid) {
- $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', ''));
+ $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get(V_FORUM_NAV_VOCABULARY, ''));
return db_fetch_array($result);
}
@@ -163,7 +193,7 @@ function forum_nodeapi(&$node, $op, $tea
// types assigned to the forum vocabulary. If forum_nav_vocabulary
// is undefined or the vocabulary does not exist, it clearly cannot
// be assigned to $node->type, so return to avoid E_ALL warnings.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$vocabulary = taxonomy_vocabulary_load($vid);
if (empty($vocabulary)) {
return;
@@ -220,7 +250,7 @@ function forum_nodeapi(&$node, $op, $tea
if ($node->taxonomy) {
// Extract the node's proper topic ID.
$vocabulary = $vid;
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get(V_FORUM_CONTAINERS, array());
foreach ($node->taxonomy as $term) {
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
if (in_array($term, $containers)) {
@@ -328,7 +358,7 @@ function forum_perm() {
* Implementation of hook_taxonomy().
*/
function forum_taxonomy($op, $type, $term = NULL) {
- if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) {
+ if ($op == 'delete' && $term['vid'] == variable_get(V_FORUM_NAV_VOCABULARY, '')) {
switch ($type) {
case 'term':
$results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']);
@@ -338,12 +368,12 @@ function forum_taxonomy($op, $type, $ter
}
// For containers, remove the tid from the forum_containers variable.
- $containers = variable_get('forum_containers', array());
+ $containers = variable_get(V_FORUM_CONTAINERS, array());
$key = array_search($term['tid'], $containers);
if ($key !== FALSE) {
unset($containers[$key]);
}
- variable_set('forum_containers', $containers);
+ variable_set(V_FORUM_CONTAINERS, $containers);
break;
case 'vocabulary':
variable_del('forum_nav_vocabulary');
@@ -355,7 +385,7 @@ function forum_taxonomy($op, $type, $ter
* Implementation of hook_form_alter().
*/
function forum_form_alter(&$form, $form_state, $form_id) {
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
if (isset($form['vid']) && $form['vid']['#value'] == $vid) {
// Hide critical options from forum vocabulary.
if ($form_id == 'taxonomy_form_vocabulary') {
@@ -378,7 +408,7 @@ function forum_form_alter(&$form, $form_
}
if ($form_id == 'forum_node_form') {
// Make the vocabulary required for 'real' forum-nodes.
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$form['taxonomy'][$vid]['#required'] = TRUE;
$form['taxonomy'][$vid]['#options'][''] = t('- Please choose -');
}
@@ -407,11 +437,11 @@ function forum_block($op = 'list', $delt
return $blocks;
case 'configure':
- $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_' . $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
+ $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get(V_FORUM_BLOCK_NUM_ . $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
return $form;
case 'save':
- variable_set('forum_block_num_' . $delta, $edit['forum_block_num_' . $delta]);
+ variable_set(V_FORUM_BLOCK_NUM_ . $delta, $edit['forum_block_num_' . $delta]);
break;
case 'view':
@@ -420,14 +450,14 @@ function forum_block($op = 'list', $delt
case 'active':
$title = t('Active forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY l.last_comment_timestamp DESC");
- $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_active', '5'));
+ $result = db_query_range($sql, variable_get(V_FORUM_NAV_VOCABULARY, ''), 0, variable_get(V_FORUM_BLOCK_NUM_ACTIVE, '5'));
$content = node_title_list($result);
break;
case 'new':
$title = t('New forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC");
- $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_new', '5'));
+ $result = db_query_range($sql, variable_get(V_FORUM_NAV_VOCABULARY, ''), 0, variable_get(V_FORUM_BLOCK_NUM_NEW, '5'));
$content = node_title_list($result);
break;
}
@@ -449,7 +479,7 @@ function forum_form(&$node, $form_state)
$form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5);
if (!empty($node->nid)) {
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$forum_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
// if editing, give option to leave shadows
$shadow = (count($forum_terms) > 1);
@@ -470,7 +500,7 @@ function forum_link_alter(&$links, $node
// Link back to the forum and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to forums.
$tid = str_replace('taxonomy/term/', '', $link['href']);
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$term = taxonomy_get_term($tid);
if ($term->vid == $vid) {
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
@@ -495,7 +525,7 @@ function forum_link_alter(&$links, $node
function forum_get_forums($tid = 0) {
$forums = array();
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$_forums = taxonomy_get_tree($vid, $tid);
if (count($_forums)) {
@@ -511,7 +541,7 @@ function forum_get_forums($tid = 0) {
}
foreach ($_forums as $forum) {
- if (in_array($forum->tid, variable_get('forum_containers', array()))) {
+ if (in_array($forum->tid, variable_get(V_FORUM_CONTAINERS, array()))) {
$forum->container = 1;
}
@@ -643,7 +673,7 @@ function _forum_new($tid) {
function template_preprocess_forums(&$variables) {
global $user;
- $vid = variable_get('forum_nav_vocabulary', '');
+ $vid = variable_get(V_FORUM_NAV_VOCABULARY, '');
$vocabulary = taxonomy_vocabulary_load($vid);
$title = !empty($vocabulary->name) ? $vocabulary->name : '';
@@ -699,7 +729,7 @@ function template_preprocess_forums(&$va
$variables['forums'] = '';
}
- if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) {
+ if ($variables['tid'] && !in_array($variables['tid'], variable_get(V_FORUM_CONTAINERS, array()))) {
$variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']);
drupal_add_feed(url('taxonomy/term/' . $variables['tid'] . '/0/feed'), 'RSS - ' . $title);
}
@@ -854,7 +884,7 @@ function template_preprocess_forum_topic
* @see theme_forum_icon()
*/
function template_preprocess_forum_icon(&$variables) {
- $variables['hot_threshold'] = variable_get('forum_hot_topic', 15);
+ $variables['hot_threshold'] = variable_get(V_FORUM_HOT_TOPIC, 15);
if ($variables['num_posts'] > $variables['hot_threshold']) {
$variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot';
}
@@ -883,7 +913,7 @@ function template_preprocess_forum_topic
$output = '';
// get previous and next topic
- $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1));
+ $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get(V_FORUM_ORDER, 1));
$result = db_query(db_rewrite_sql($sql), isset($variables['node']->tid) ? $variables['node']->tid : 0);
$stop = $variables['prev'] = $variables['next'] = 0;
Index: modules/forum/forum.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.pages.inc,v
retrieving revision 1.2
diff -u -F^f -r1.2 forum.pages.inc
--- modules/forum/forum.pages.inc 26 Jul 2007 06:48:03 -0000 1.2
+++ modules/forum/forum.pages.inc 20 May 2008 20:39:57 -0000
@@ -11,12 +11,12 @@
*/
function forum_page($tid = 0) {
$topics = '';
- $forum_per_page = variable_get('forum_per_page', 25);
- $sortby = variable_get('forum_order', 1);
+ $forum_per_page = variable_get(V_FORUM_PER_PAGE, 25);
+ $sortby = variable_get(V_FORUM_ORDER, 1);
$forums = forum_get_forums($tid);
$parents = taxonomy_get_parents_all($tid);
- if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
+ if ($tid && !in_array($tid, variable_get(V_FORUM_CONTAINERS, array()))) {
$topics = forum_get_topics($tid, $sortby, $forum_per_page);
}
Index: modules/locale/locale.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v
retrieving revision 1.30
diff -u -F^f -r1.30 locale.install
--- modules/locale/locale.install 14 Apr 2008 17:48:37 -0000 1.30
+++ modules/locale/locale.install 20 May 2008 20:39:57 -0000
@@ -104,11 +104,11 @@ function locale_update_6000() {
// Save the language count in the variable table
$count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
- variable_set('language_count', $count);
+ variable_set(V_LANGUAGE_COUNT, $count);
// Save the default language in the variable table
$default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1'));
- variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0));
+ variable_set(V_LANGUAGE_DEFAULT, (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0));
$ret[] = update_sql("DROP TABLE {locales_meta}");
return $ret;
@@ -172,11 +172,11 @@ function locale_update_6004() {
function locale_update_6005() {
foreach (node_get_types() as $type => $content_type) {
// Default to NULL, so we can skip dealing with non-existent settings.
- $setting = variable_get('language_' . $type, NULL);
+ $setting = variable_get(V_LANGUAGE_ . $type, NULL);
if ($type == 'default' && is_numeric($setting)) {
// language_default was overwritten with the content type setting,
// so reset the default language and save the content type setting.
- variable_set('language_content_type_default', $setting);
+ variable_set(V_LANGUAGE_CONTENT_TYPE_DEFAULT, $setting);
variable_del('language_default');
drupal_set_message('The default language setting has been reset to its default value. Check the ' . l('language configuration page', 'admin/settings/language') . ' to configure it correctly.');
}
@@ -185,19 +185,19 @@ function locale_update_6005() {
// the negotiation setting or the content type setting.
// The language_negotiation setting is not reset, but
// the user is alerted that this setting possibly was overwritten
- variable_set('language_content_type_negotiation', $setting);
+ variable_set(V_LANGUAGE_CONTENT_TYPE_NEGOTIATION, $setting);
drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the ' . l('language configuration page', 'admin/settings/language/configure') . ' and the ' . l('' . $content_type->name . " content type's multilingual support settings", 'admin/build/types/negotiation', array('html' => TRUE)) . ' to configure them correctly.');
}
elseif (!is_null($setting)) {
// Change the language setting variable for any other content type.
// Do not worry about language_count, it will be updated below.
- variable_set('language_content_type_' . $type, $setting);
+ variable_set(V_LANGUAGE_CONTENT_TYPE_ . $type, $setting);
variable_del('language_' . $type);
}
}
// Update language count variable that might be overwritten.
$count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
- variable_set('language_count', $count);
+ variable_set(V_LANGUAGE_COUNT, $count);
return array();
}
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.217
diff -u -F^f -r1.217 locale.module
--- modules/locale/locale.module 23 Apr 2008 20:01:52 -0000 1.217
+++ modules/locale/locale.module 20 May 2008 20:39:57 -0000
@@ -12,6 +12,18 @@
* Gettext portable object files are supported.
*/
+/** @variable V_JAVASCRIPT_PARSED: TODO: add documentation **/
+define('V_JAVASCRIPT_PARSED', 'javascript_parsed');
+
+/** @variable V_LOCALE_CACHE_STRINGS: TODO: add documentation **/
+define('V_LOCALE_CACHE_STRINGS', 'locale_cache_strings');
+
+/** @variable V_LOCALE_CUSTOM_STRINGS_: TODO: add documentation **/
+define('V_LOCALE_CUSTOM_STRINGS_', 'locale_custom_strings_');
+
+/** @variable V_LOCALE_JS_DIRECTORY: TODO: add documentation **/
+define('V_LOCALE_JS_DIRECTORY', 'locale_js_directory');
+
/**
* Language written left to right. Possible value of $language->direction.
*/
@@ -219,7 +231,7 @@ function locale_user($type, $edit, &$use
// If we have more then one language and either creating a user on the
// admin interface or edit the user, show the language selector.
- if (variable_get('language_count', 1) > 1 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) {
+ if (variable_get(V_LANGUAGE_COUNT, 1) > 1 && ($type == 'register' && user_access('administer users') || $type == 'form' && $category == 'account' )) {
$languages = language_list('enabled');
$languages = $languages[1];
@@ -238,7 +250,7 @@ function locale_user($type, $edit, &$use
);
// Get language negotiation settings.
- $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE);
+ $mode = variable_get(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE);
$form['locale']['language'] = array(
'#type' => (count($names) <= 5 ? 'radios' : 'select'),
'#title' => t('Language'),
@@ -274,7 +286,7 @@ function locale_form_alter(&$form, $form
$form['workflow']['language_content_type'] = array(
'#type' => 'radios',
'#title' => t('Multilingual support'),
- '#default_value' => variable_get('language_content_type_' . $form['#node_type']->type, 0),
+ '#default_value' => variable_get(V_LANGUAGE_CONTENT_TYPE_ . $form['#node_type']->type, 0),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/settings/language'))),
);
@@ -284,7 +296,7 @@ function locale_form_alter(&$form, $form
// Language field for nodes
default:
if (isset($form['#id']) && $form['#id'] == 'node-form') {
- if (isset($form['#node']->type) && variable_get('language_content_type_' . $form['#node']->type, 0)) {
+ if (isset($form['#node']->type) && variable_get(V_LANGUAGE_CONTENT_TYPE_ . $form['#node']->type, 0)) {
$form['language'] = array(
'#type' => 'select',
'#title' => t('Language'),
@@ -355,7 +367,7 @@ function locale($string = NULL, $langcod
// the exact list of strings used on a page. From a performance
// perspective that is a really bad idea, so we have no user
// interface for this. Be careful when turning this option off!
- if (variable_get('locale_cache_strings', 1) == 1) {
+ if (variable_get(V_LOCALE_CACHE_STRINGS, 1) == 1) {
if ($cache = cache_get('locale:' . $langcode, 'cache')) {
$locale_t[$langcode] = $cache->data;
}
@@ -501,8 +513,8 @@ function locale_system_update($component
function locale_update_js_files() {
global $language;
- $dir = file_create_path(variable_get('locale_js_directory', 'languages'));
- $parsed = variable_get('javascript_parsed', array());
+ $dir = file_create_path(variable_get(V_LOCALE_JS_DIRECTORY, 'languages'));
+ $parsed = variable_get(V_JAVASCRIPT_PARSED, array());
// The first three parameters are NULL in order to get an array with all
// scopes. This is necessary to prevent recreation of JS translation files
@@ -544,12 +556,12 @@ function locale_update_js_files() {
unset($parsed['refresh:' . $language->language]);
}
// Store any changes after refresh was attempted.
- variable_set('javascript_parsed', $parsed);
+ variable_set(V_JAVASCRIPT_PARSED, $parsed);
}
// If no refresh was attempted, but we have new source files, we need
// to store them too. This occurs if current page is in English.
else if ($new_files) {
- variable_set('javascript_parsed', $parsed);
+ variable_set(V_JAVASCRIPT_PARSED, $parsed);
}
// Add the translation JavaScript file to the page.
@@ -575,7 +587,7 @@ function locale_block($op = 'list', $del
// Only show if we have at least two languages and language dependent
// web addresses, so we can actually link to other language versions.
- elseif ($op == 'view' && variable_get('language_count', 1) > 1 && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) {
+ elseif ($op == 'view' && variable_get(V_LANGUAGE_COUNT, 1) > 1 && variable_get(V_LANGUAGE_NEGOTIATION, LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) {
$languages = language_list('enabled');
$links = array();
foreach ($languages[1] as $language) {
Index: modules/menu/menu.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v
retrieving revision 1.30
diff -u -F^f -r1.30 menu.admin.inc
--- modules/menu/menu.admin.inc 14 Apr 2008 17:48:37 -0000 1.30
+++ modules/menu/menu.admin.inc 20 May 2008 20:39:58 -0000
@@ -607,12 +607,12 @@ function menu_configure() {
$form['menu_default_node_menu'] = array(
'#type' => 'select',
'#title' => t('Default menu for content'),
- '#default_value' => variable_get('menu_default_node_menu', 'primary-links'),
+ '#default_value' => variable_get(V_MENU_DEFAULT_NODE_MENU, 'primary-links'),
'#options' => $menu_options,
'#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'),
);
- $primary = variable_get('menu_primary_links_source', 'primary-links');
+ $primary = variable_get(V_MENU_PRIMARY_LINKS_SOURCE, 'primary-links');
$primary_options = array_merge($menu_options, array('' => t('No primary links')));
$form['menu_primary_links_source'] = array(
'#type' => 'select',
@@ -627,7 +627,7 @@ function menu_configure() {
$form["menu_secondary_links_source"] = array(
'#type' => 'select',
'#title' => t('Source for the secondary links'),
- '#default_value' => variable_get('menu_secondary_links_source', 'secondary-links'),
+ '#default_value' => variable_get(V_MENU_SECONDARY_LINKS_SOURCE, 'secondary-links'),
'#options' => $secondary_options,
'#tree' => FALSE,
'#description' => t('Select what should be displayed as the secondary links. You can choose the same menu for secondary links as for primary links (currently %primary). If you do this, the children of the active primary menu link will be displayed as secondary links.', array('%primary' => $primary_options[$primary])),
Index: modules/menu/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v
retrieving revision 1.164
diff -u -F^f -r1.164 menu.module
--- modules/menu/menu.module 10 May 2008 06:52:32 -0000 1.164
+++ modules/menu/menu.module 20 May 2008 20:39:58 -0000
@@ -197,7 +197,7 @@ function menu_parent_options($menus, $it
// allow contrib modules to provide more scalable pattern choosers.
// hook_form_alter is too late in itself because all the possible parents are
// retrieved here, unless menu_override_parent_selector is set to TRUE.
- if (variable_get('menu_override_parent_selector', FALSE)) {
+ if (variable_get(V_MENU_OVERRIDE_PARENT_SELECTOR, FALSE)) {
return array();
}
// If the item has children, there is an added limit to the depth of valid parents.
@@ -310,7 +310,7 @@ function menu_nodeapi(&$node, $op) {
case 'prepare':
if (empty($node->menu)) {
// Prepare the node for the edit form so that $node->menu always exists.
- $menu_name = variable_get('menu_default_node_menu', 'primary-links');
+ $menu_name = variable_get(V_MENU_DEFAULT_NODE_MENU, 'primary-links');
$item = array();
if (isset($node->nid)) {
// Give priority to the default menu
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.53
diff -u -F^f -r1.53 content_types.inc
--- modules/node/content_types.inc 13 May 2008 17:37:58 -0000 1.53
+++ modules/node/content_types.inc 20 May 2008 20:39:58 -0000
@@ -152,7 +152,7 @@ function node_type_form(&$form_state, $t
);
$form['workflow']['node_options'] = array('#type' => 'checkboxes',
'#title' => t('Default options'),
- '#default_value' => variable_get('node_options_' . $type->type, array('status', 'promote')),
+ '#default_value' => variable_get(V_NODE_OPTIONS_ . $type->type, array('status', 'promote')),
'#options' => array(
'status' => t('Published'),
'promote' => t('Promoted to front page'),
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.22
diff -u -F^f -r1.22 node.admin.inc
--- modules/node/node.admin.inc 14 Apr 2008 17:48:38 -0000 1.22
+++ modules/node/node.admin.inc 20 May 2008 20:39:58 -0000
@@ -29,12 +29,12 @@ function node_configure() {
}
$form['default_nodes_main'] = array(
- '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get('default_nodes_main', 10),
+ '#type' => 'select', '#title' => t('Number of posts on main page'), '#default_value' => variable_get(V_DEFAULT_NODES_MAIN, 10),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('The default maximum number of posts to display per page on overview pages such as the main page.')
);
$form['teaser_length'] = array(
- '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get('teaser_length', 600),
+ '#type' => 'select', '#title' => t('Length of trimmed posts'), '#default_value' => variable_get(V_TEASER_LENGTH, 600),
'#options' => array(
0 => t('Unlimited'),
200 => t('200 characters'),
@@ -54,7 +54,7 @@ function node_configure() {
$form['node_preview'] = array(
'#type' => 'radios',
'#title' => t('Preview post'),
- '#default_value' => variable_get('node_preview', 0),
+ '#default_value' => variable_get(V_NODE_PREVIEW, 0),
'#options' => array(t('Optional'), t('Required')),
'#description' => t('Must users preview posts before submitting?'),
);
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.966
diff -u -F^f -r1.966 node.module
--- modules/node/node.module 15 May 2008 21:40:31 -0000 1.966
+++ modules/node/node.module 20 May 2008 20:39:58 -0000
@@ -7,6 +7,39 @@
* programmatically submit nodes using the usual form API pattern.
*/
+/** @variable V_NODE_ACCESS_NEEDS_REBUILD: TODO: add documentation **/
+define('V_NODE_ACCESS_NEEDS_REBUILD', 'node_access_needs_rebuild');
+
+/** @variable V_NODE_ADMIN_THEME: TODO: add documentation **/
+define('V_NODE_ADMIN_THEME', 'node_admin_theme');
+
+/** @variable V_NODE_CRON_COMMENTS_SCALE: TODO: add documentation **/
+define('V_NODE_CRON_COMMENTS_SCALE', 'node_cron_comments_scale');
+
+/** @variable V_NODE_CRON_LAST: TODO: add documentation **/
+define('V_NODE_CRON_LAST', 'node_cron_last');
+
+/** @variable V_NODE_CRON_VIEWS_SCALE: TODO: add documentation **/
+define('V_NODE_CRON_VIEWS_SCALE', 'node_cron_views_scale');
+
+/** @variable V_NODE_OPTIONS_: TODO: add documentation **/
+define('V_NODE_OPTIONS_', 'node_options_');
+
+/** @variable V_NODE_OPTIONS_BOOK: TODO: add documentation **/
+define('V_NODE_OPTIONS_BOOK', 'node_options_book');
+
+/** @variable V_NODE_OPTIONS_PAGE: TODO: add documentation **/
+define('V_NODE_OPTIONS_PAGE', 'node_options_page');
+
+/** @variable V_NODE_PREVIEW: TODO: add documentation **/
+define('V_NODE_PREVIEW', 'node_preview');
+
+/** @variable V_NODE_RANK_: TODO: add documentation **/
+define('V_NODE_RANK_', 'node_rank_');
+
+/** @variable V_TEASER_LENGTH: TODO: add documentation **/
+define('V_TEASER_LENGTH', 'teaser_length');
+
define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60);
define('NODE_BUILD_NORMAL', 0);
@@ -301,7 +334,7 @@ function node_teaser_include_verify(&$fo
function node_teaser($body, $format = NULL, $size = NULL) {
if (!isset($size)) {
- $size = variable_get('teaser_length', 600);
+ $size = variable_get(V_TEASER_LENGTH, 600);
}
// Find where the delimiter is in the body
@@ -1150,7 +1183,7 @@ function _node_rankings() {
);
if ($ranking = module_invoke_all('ranking')) {
foreach ($ranking as $rank => $values) {
- if ($node_rank = variable_get('node_rank_'. $rank, 0)) {
+ if ($node_rank = variable_get(V_NODE_RANK_. $rank, 0)) {
// If the table defined in the ranking isn't already joined, then add it.
if (isset($values['join']) && !isset($rankings['join'][$values['join']])) {
$rankings['join'][$values['join']] = $values['join'];
@@ -1210,7 +1243,7 @@ function node_search($op = 'search', $ke
'#title' => $values['title'],
'#type' => 'select',
'#options' => $options,
- '#default_value' => variable_get('node_rank_'. $var, 0),
+ '#default_value' => variable_get(V_NODE_RANK_. $var, 0),
);
}
return $form;
@@ -1329,7 +1362,7 @@ function node_ranking() {
);
// Add relevance based on creation or changed date.
- if ($node_cron_last = variable_get('node_cron_last', 0)) {
+ if ($node_cron_last = variable_get(V_NODE_CRON_LAST, 0)) {
$ranking['recent'] = array(
'title' => t('Recently posted'),
// Exponential decay with half-life of 6 months, starting at last indexed node
@@ -1674,13 +1707,13 @@ function node_feed($nids = FALSE, $chann
if ($nids === FALSE) {
$nids = array();
- $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
+ $result = db_query_range(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get(V_FEED_DEFAULT_ITEMS, 10));
while ($row = db_fetch_object($result)) {
$nids[] = $row->nid;
}
}
- $item_length = variable_get('feed_item_length', 'teaser');
+ $item_length = variable_get(V_FEED_ITEM_LENGTH, 'teaser');
$namespaces = array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/');
$items = '';
@@ -1735,9 +1768,9 @@ function node_feed($nids = FALSE, $chann
$channel_defaults = array(
'version' => '2.0',
- 'title' => variable_get('site_name', 'Drupal'),
+ 'title' => variable_get(V_SITE_NAME, 'Drupal'),
'link' => $base_url,
- 'description' => variable_get('site_mission', ''),
+ 'description' => variable_get(V_SITE_MISSION, ''),
'language' => $language->language
);
$channel = array_merge($channel_defaults, $channel);
@@ -1755,7 +1788,7 @@ function node_feed($nids = FALSE, $chann
* Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
- $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
+ $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get(V_DEFAULT_NODES_MAIN, 10));
$output = '';
$num_rows = FALSE;
@@ -1766,8 +1799,8 @@ function node_page_default() {
if ($num_rows) {
$feed_url = url('rss.xml', array('absolute' => TRUE));
- drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') . ' ' . t('RSS'));
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ drupal_add_feed($feed_url, variable_get(V_SITE_NAME, 'Drupal') . ' ' . t('RSS'));
+ $output .= theme('pager', NULL, variable_get(V_DEFAULT_NODES_MAIN, 10));
}
else {
$default_message = '' . t('Welcome to your new Drupal website!') . '
';
@@ -1799,11 +1832,11 @@ function node_page_view($node, $cid = NU
* Implementation of hook_update_index().
*/
function node_update_index() {
- $limit = (int)variable_get('search_cron_limit', 100);
+ $limit = (int)variable_get(V_SEARCH_CRON_LIMIT, 100);
// Store the maximum possible comments per thread (used for ranking by reply count)
- variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
- variable_set('node_cron_views_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}'))));
+ variable_set(V_NODE_CRON_COMMENTS_SCALE, 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
+ variable_set(V_NODE_CRON_VIEWS_SCALE, 1.0 / max(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}'))));
$result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
@@ -1822,7 +1855,7 @@ function _node_index_node($node) {
$node = node_load($node->nid);
// save the changed time of the most recent indexed node, for the search results half-life calculation
- variable_set('node_cron_last', $node->changed);
+ variable_set(V_NODE_CRON_LAST, $node->changed);
// Build the node body.
$node->build_mode = NODE_BUILD_SEARCH_INDEX;
@@ -2298,10 +2331,10 @@ function node_access_write_grants($node,
*/
function node_access_needs_rebuild($rebuild = NULL) {
if (!isset($rebuild)) {
- return variable_get('node_access_needs_rebuild', FALSE);
+ return variable_get(V_NODE_ACCESS_NEEDS_REBUILD, FALSE);
}
elseif ($rebuild) {
- variable_set('node_access_needs_rebuild', TRUE);
+ variable_set(V_NODE_ACCESS_NEEDS_REBUILD, TRUE);
}
else {
variable_del('node_access_needs_rebuild');
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.30
diff -u -F^f -r1.30 node.pages.inc
--- modules/node/node.pages.inc 14 Apr 2008 17:48:38 -0000 1.30
+++ modules/node/node.pages.inc 20 May 2008 20:39:58 -0000
@@ -67,7 +67,7 @@ function node_form_validate($form, &$for
function node_object_prepare(&$node) {
// Set up default values, if required.
- $node_options = variable_get('node_options_' . $node->type, array('status', 'promote'));
+ $node_options = variable_get(V_NODE_OPTIONS_ . $node->type, array('status', 'promote'));
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array('status', 'promote', 'sticky') as $key) {
@@ -180,7 +180,7 @@ function node_form(&$form_state, $node)
'#autocomplete_path' => 'user/autocomplete',
'#default_value' => $node->name ? $node->name : '',
'#weight' => -1,
- '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
+ '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get(V_ANONYMOUS, t('Anonymous')))),
);
$form['author']['date'] = array(
'#type' => 'textfield',
Index: modules/openid/openid.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v
retrieving revision 1.25
diff -u -F^f -r1.25 openid.module
--- modules/openid/openid.module 6 May 2008 12:18:48 -0000 1.25
+++ modules/openid/openid.module 20 May 2008 20:39:58 -0000
@@ -63,7 +63,7 @@ function openid_help($path, $arg) {
function openid_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'insert' && isset($_SESSION['openid']['values'])) {
// The user has registered after trying to login via OpenID.
- if (variable_get('user_email_verification', TRUE)) {
+ if (variable_get(V_USER_EMAIL_VERIFICATION, TRUE)) {
drupal_set_message(t('Once you have verified your email address, you may log in via OpenID.'));
}
unset($_SESSION['openid']);
@@ -118,7 +118,7 @@ function openid_form_alter(&$form, $form
$form['mail']['#default_value'] = $_SESSION['openid']['values']['mail'];
// If user_email_verification is off, hide the password field and just fill
// with random password to avoid confusion.
- if (!variable_get('user_email_verification', TRUE)) {
+ if (!variable_get(V_USER_EMAIL_VERIFICATION, TRUE)) {
$form['pass']['#type'] = 'hidden';
$form['pass']['#value'] = user_password();
}
@@ -387,20 +387,20 @@ function openid_authentication($response
$account = user_external_load($identity);
if (isset($account->uid)) {
- if (!variable_get('user_email_verification', TRUE) || $account->login) {
+ if (!variable_get(V_USER_EMAIL_VERIFICATION, TRUE) || $account->login) {
user_external_login($account, $_SESSION['openid']['user_login_values']);
}
else {
drupal_set_message(t('You must validate your email address for this account before logging in via OpenID'));
}
}
- elseif (variable_get('user_register', 1)) {
+ elseif (variable_get(V_USER_REGISTER, 1)) {
// Register new user
$form_state['redirect'] = NULL;
$form_state['values']['name'] = (empty($response['openid.sreg.nickname'])) ? $identity : $response['openid.sreg.nickname'];
$form_state['values']['mail'] = (empty($response['openid.sreg.email'])) ? '' : $response['openid.sreg.email'];
$form_state['values']['pass'] = user_password();
- $form_state['values']['status'] = variable_get('user_register', 1) == 1;
+ $form_state['values']['status'] = variable_get(V_USER_REGISTER, 1) == 1;
$form_state['values']['response'] = $response;
$form = drupal_retrieve_form('user_register', $form_state);
drupal_prepare_form('user_register', $form, $form_state);
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.8
diff -u -F^f -r1.8 path.admin.inc
--- modules/path/path.admin.inc 14 Apr 2008 17:48:38 -0000 1.8
+++ modules/path/path.admin.inc 20 May 2008 20:39:58 -0000
@@ -95,7 +95,7 @@ function path_admin_form(&$form_state, $
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get(V_CLEAN_URL, 0) ? '' : '?q='),
'#required' => TRUE,
);
$form['dst'] = array(
@@ -105,7 +105,7 @@ function path_admin_form(&$form_state, $
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get(V_CLEAN_URL, 0) ? '' : '?q='),
'#required' => TRUE,
);
// This will be a hidden value unless locale module is enabled
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.241
diff -u -F^f -r1.241 profile.module
--- modules/profile/profile.module 6 May 2008 12:18:49 -0000 1.241
+++ modules/profile/profile.module 20 May 2008 20:39:59 -0000
@@ -6,6 +6,9 @@
* Support for configurable user profiles.
*/
+/** @variable V_PROFILE_BLOCK_AUTHOR_FIELDS: TODO: add documentation **/
+define('V_PROFILE_BLOCK_AUTHOR_FIELDS', 'profile_block_author_fields');
+
/**
* Private field, content only available to privileged users.
*/
@@ -146,14 +149,14 @@ function profile_block($op = 'list', $de
$form['profile_block_author_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Profile fields to display'),
- '#default_value' => variable_get('profile_block_author_fields', array()),
+ '#default_value' => variable_get(V_PROFILE_BLOCK_AUTHOR_FIELDS, array()),
'#options' => $fields,
'#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the profile field configuration are available.', array('@profile-admin' => url('admin/user/profile'))),
);
return $form;
}
else if ($op == 'save') {
- variable_set('profile_block_author_fields', $edit['profile_block_author_fields']);
+ variable_set(V_PROFILE_BLOCK_AUTHOR_FIELDS, $edit['profile_block_author_fields']);
}
else if ($op == 'view') {
if (user_access('access user profiles')) {
@@ -162,7 +165,7 @@ function profile_block($op = 'list', $de
$node = node_load(arg(1));
$account = user_load(array('uid' => $node->uid));
- if ($use_fields = variable_get('profile_block_author_fields', array())) {
+ if ($use_fields = variable_get(V_PROFILE_BLOCK_AUTHOR_FIELDS, array())) {
// Compile a list of fields to show.
$fields = array();
$result = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
@@ -261,7 +264,7 @@ function profile_view_field($user, $fiel
case 'url':
return '' . check_plain($value) . '';
case 'date':
- $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
+ $format = substr(variable_get(V_DATE_FORMAT_SHORT, 'm/d/Y - H:i'), 0, 5);
// Note: Avoid PHP's date() because it does not handle dates before
// 1970 on Windows. This would make the date field useless for e.g.
// birthdays.
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.5
diff -u -F^f -r1.5 search.admin.inc
--- modules/search/search.admin.inc 14 Apr 2008 17:48:41 -0000 1.5
+++ modules/search/search.admin.inc 20 May 2008 20:39:59 -0000
@@ -6,6 +6,9 @@
* Admin page callbacks for the search module.
*/
+/** @variable V_OVERLAP_CJK: TODO: add documentation **/
+define('V_OVERLAP_CJK', 'overlap_cjk');
+
/**
* Menu callback: confirm wiping of the index.
*/
@@ -55,12 +58,12 @@ function search_admin_settings() {
// Indexing throttle:
$form['indexing_throttle'] = array('#type' => 'fieldset', '#title' => t('Indexing throttle'));
- $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Number of items to index per cron run'), '#default_value' => variable_get('search_cron_limit', 100), '#options' => $items, '#description' => t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))));
+ $form['indexing_throttle']['search_cron_limit'] = array('#type' => 'select', '#title' => t('Number of items to index per cron run'), '#default_value' => variable_get(V_SEARCH_CRON_LIMIT, 100), '#options' => $items, '#description' => t('The maximum number of items indexed in each pass of a cron maintenance task. If necessary, reduce the number of items to prevent timeouts and memory errors while indexing.', array('@cron' => url('admin/reports/status'))));
// Indexing settings:
$form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
$form['indexing_settings']['info'] = array('#value' => t('Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.
The default settings should be appropriate for the majority of sites.
'));
- $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
- $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', TRUE), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
+ $form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get(V_MINIMUM_WORD_SIZE, 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
+ $form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get(V_OVERLAP_CJK, TRUE), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
$form['#validate'] = array('search_admin_settings_validate');
@@ -77,8 +80,8 @@ function search_admin_settings_validate(
drupal_goto('admin/settings/search/wipe');
}
// If these settings change, the index needs to be rebuilt.
- if ((variable_get('minimum_word_size', 3) != $form_state['values']['minimum_word_size']) ||
- (variable_get('overlap_cjk', TRUE) != $form_state['values']['overlap_cjk'])) {
+ if ((variable_get(V_MINIMUM_WORD_SIZE, 3) != $form_state['values']['minimum_word_size']) ||
+ (variable_get(V_OVERLAP_CJK, TRUE) != $form_state['values']['overlap_cjk'])) {
drupal_set_message(t('The index will be rebuilt.'));
search_wipe();
}
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.257
diff -u -F^f -r1.257 search.module
--- modules/search/search.module 14 May 2008 15:07:25 -0000 1.257
+++ modules/search/search.module 20 May 2008 20:39:59 -0000
@@ -6,6 +6,15 @@
* Enables site-wide keyword searching.
*/
+/** @variable V_MINIMUM_WORD_SIZE: TODO: add documentation **/
+define('V_MINIMUM_WORD_SIZE', 'minimum_word_size');
+
+/** @variable V_SEARCH_CRON_LIMIT: TODO: add documentation **/
+define('V_SEARCH_CRON_LIMIT', 'search_cron_limit');
+
+/** @variable V_SEARCH_TAG_WEIGHTS: TODO: add documentation **/
+define('V_SEARCH_TAG_WEIGHTS', 'search_tag_weights');
+
/**
* Matches Unicode character classes to exclude from the search index.
*
@@ -312,7 +321,7 @@ function search_simplify($text) {
search_invoke_preprocess($text);
// Simple CJK handling
- if (variable_get('overlap_cjk', TRUE)) {
+ if (variable_get(V_OVERLAP_CJK, TRUE)) {
$text = preg_replace_callback('/[' . PREG_CLASS_CJK . ']+/u', 'search_expand_cjk', $text);
}
@@ -340,7 +349,7 @@ function search_simplify($text) {
* sequences of characters ('minimum_word_size' long).
*/
function search_expand_cjk($matches) {
- $min = variable_get('minimum_word_size', 3);
+ $min = variable_get(V_MINIMUM_WORD_SIZE, 3);
$str = $matches[0];
$l = drupal_strlen($str);
// Passthrough short words
@@ -417,7 +426,7 @@ function search_invoke_preprocess(&$text
* @ingroup search
*/
function search_index($sid, $type, $text) {
- $minimum_word_size = variable_get('minimum_word_size', 3);
+ $minimum_word_size = variable_get(V_MINIMUM_WORD_SIZE, 3);
// Link matching
global $base_url;
@@ -426,7 +435,7 @@ function search_index($sid, $type, $text
// Multipliers for scores of words inside certain HTML tags. The weights are stored
// in a variable so that modules can overwrite the default weights.
// Note: 'a' must be included for link ranking to work.
- $tags = variable_get('search_tag_weights', array(
+ $tags = variable_get(V_SEARCH_TAG_WEIGHTS, array(
'h1' => 25,
'h2' => 18,
'h3' => 15,
@@ -844,7 +853,7 @@ function _search_parse_query(&$word, &$s
$split = explode(' ', $word);
foreach ($split as $s) {
$num = is_numeric($s);
- if ($num || drupal_strlen($s) >= variable_get('minimum_word_size', 3)) {
+ if ($num || drupal_strlen($s) >= variable_get(V_MINIMUM_WORD_SIZE, 3)) {
$s = $num ? ((int)ltrim($s, '-0')) : $s;
if (!isset($scores[$s])) {
$scores[$s] = $s;
@@ -916,7 +925,7 @@ function do_search($keywords, $type, $jo
$query = search_parse_query($keywords);
if ($query[2] == '') {
- form_set_error('keys', t('You must include at least one positive keyword with @count characters or more.', array('@count' => variable_get('minimum_word_size', 3))));
+ form_set_error('keys', t('You must include at least one positive keyword with @count characters or more.', array('@count' => variable_get(V_MINIMUM_WORD_SIZE, 3))));
}
if ($query[6]) {
if ($query[6] == 'or') {
Index: modules/simpletest/drupal_test_suite.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_test_suite.php,v
retrieving revision 1.3
diff -u -F^f -r1.3 drupal_test_suite.php
--- modules/simpletest/drupal_test_suite.php 6 May 2008 11:21:10 -0000 1.3
+++ modules/simpletest/drupal_test_suite.php 20 May 2008 20:39:59 -0000
@@ -143,7 +143,7 @@
function cleanupBeforeRun() {
cache_clear_all();
// Disable devel output, check simpletest settings page.
- if (!variable_get('simpletest_devel', FALSE)) {
+ if (!variable_get(V_SIMPLETEST_DEVEL, FALSE)) {
$GLOBALS['devel_shutdown'] = FALSE;
}
}
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.6
diff -u -F^f -r1.6 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php 16 May 2008 02:09:22 -0000 1.6
+++ modules/simpletest/drupal_web_test_case.php 20 May 2008 20:39:59 -0000
@@ -1,6 +1,9 @@
db_prefix_original = $db_prefix;
- $clean_url_original = variable_get('clean_url', 0);
+ $clean_url_original = variable_get(V_CLEAN_URL, 0);
$db_prefix = 'simpletest' . mt_rand(1000, 1000000);
include_once './includes/install.inc';
drupal_install_system();
@@ -369,13 +372,13 @@
menu_rebuild();
actions_synchronize();
_drupal_flush_css_js();
- variable_set('install_profile', 'default');
- variable_set('install_task', 'profile-finished');
- variable_set('clean_url', $clean_url_original);
+ variable_set(V_INSTALL_PROFILE, 'default');
+ variable_set(V_INSTALL_TASK, 'profile-finished');
+ variable_set(V_CLEAN_URL, $clean_url_original);
// Use temporary files directory with the same prefix as database.
$this->original_file_directory = file_directory_path();
- variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix);
+ variable_set(V_FILE_DIRECTORY_PATH, file_directory_path() . '/' . $db_prefix);
file_check_directory(file_directory_path(), TRUE); // Create the files directory.
parent::setUp();
}
@@ -389,7 +392,7 @@
if (preg_match('/simpletest\d+/', $db_prefix)) {
// Delete temporary files directory and reset files directory path.
simpletest_clean_temporary_directory(file_directory_path());
- variable_set('file_directory_path', $this->original_file_directory);
+ variable_set(V_FILE_DIRECTORY_PATH, $this->original_file_directory);
$schema = drupal_get_schema(NULL, TRUE);
$ret = array();
@@ -436,8 +439,8 @@
if (preg_match('/simpletest\d+/', $db_prefix)) {
$curl_options[CURLOPT_USERAGENT] = $db_prefix;
}
- if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get('simpletest_httpauth_username', ''))) {
- if ($pass = variable_get('simpletest_httpauth_pass', '')) {
+ if (!isset($curl_options[CURLOPT_USERPWD]) && ($auth = variable_get(V_SIMPLETEST_HTTPAUTH_USERNAME, ''))) {
+ if ($pass = variable_get(V_SIMPLETEST_HTTPAUTH_PASS, '')) {
$auth .= ':' . $pass;
}
$curl_options[CURLOPT_USERPWD] = $auth;
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.3
diff -u -F^f -r1.3 simpletest.module
--- modules/simpletest/simpletest.module 10 May 2008 07:46:22 -0000 1.3
+++ modules/simpletest/simpletest.module 20 May 2008 20:39:59 -0000
@@ -1,6 +1,18 @@
'checkbox',
'#title' => t('Use http authentication'),
- '#default_value' => variable_get('simpletest_httpauth', FALSE),
+ '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH, FALSE),
);
$form['http_auth']['simpletest_httpauth_username'] = array(
'#type' => 'textfield',
'#title' => t('Username'),
- '#default_value' => variable_get('simpletest_httpauth_username', ''),
+ '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH_USERNAME, ''),
);
$form['http_auth']['simpletest_httpauth_pass'] = array(
'#title' => t('Password'),
'#type' => 'password',
- '#default_value' => variable_get('simpletest_httpauth_pass', ''),
+ '#default_value' => variable_get(V_SIMPLETEST_HTTPAUTH_PASS, ''),
);
$form['devel'] = array(
'#type' => 'fieldset',
@@ -469,7 +481,7 @@ function simpletest_settings() {
$form['devel']['simpletest_devel'] = array(
'#type' => 'checkbox',
'#title' => t('Use devel query log on test result pages'),
- '#default_value' => variable_get('simpletest_devel', FALSE),
+ '#default_value' => variable_get(V_SIMPLETEST_DEVEL, FALSE),
);
return system_settings_form($form);
Index: modules/statistics/statistics.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v
retrieving revision 1.8
diff -u -F^f -r1.8 statistics.admin.inc
--- modules/statistics/statistics.admin.inc 7 May 2008 19:17:50 -0000 1.8
+++ modules/statistics/statistics.admin.inc 20 May 2008 20:40:00 -0000
@@ -64,7 +64,7 @@ function statistics_top_pages() {
$rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
}
- drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200)))));
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
@@ -97,7 +97,7 @@ function statistics_top_visitors() {
$rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4));
}
- drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200)))));
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 30, 0);
return $output;
@@ -109,7 +109,7 @@ function statistics_top_visitors() {
function statistics_top_referrers() {
$query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%%%s%%' AND url <> '' GROUP BY url";
$query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%%%s%%'";
- drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
+ drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200)))));
$header = array(
array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'),
@@ -189,14 +189,14 @@ function statistics_access_logging_setti
$form['access']['statistics_enable_access_log'] = array(
'#type' => 'radios',
'#title' => t('Enable access log'),
- '#default_value' => variable_get('statistics_enable_access_log', 0),
+ '#default_value' => variable_get(V_STATISTICS_ENABLE_ACCESS_LOG, 0),
'#options' => $options,
'#description' => t('Log each page access. Required for referrer statistics.'));
$period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$form['access']['statistics_flush_accesslog_timer'] = array(
'#type' => 'select',
'#title' => t('Discard access logs older than'),
- '#default_value' => variable_get('statistics_flush_accesslog_timer', 259200),
+ '#default_value' => variable_get(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200),
'#options' => $period,
'#description' => t('Older access log entries (including referrer statistics) will be automatically discarded. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status'))));
@@ -207,7 +207,7 @@ function statistics_access_logging_setti
$form['content']['statistics_count_content_views'] = array(
'#type' => 'radios',
'#title' => t('Count content views'),
- '#default_value' => variable_get('statistics_count_content_views', 0),
+ '#default_value' => variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0),
'#options' => $options,
'#description' => t('Increment a counter each time content is viewed.'));
Index: modules/statistics/statistics.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v
retrieving revision 1.278
diff -u -F^f -r1.278 statistics.module
--- modules/statistics/statistics.module 14 May 2008 11:10:54 -0000 1.278
+++ modules/statistics/statistics.module 20 May 2008 20:40:00 -0000
@@ -6,6 +6,27 @@
* Logs access statistics for your site.
*/
+/** @variable V_STATISTICS_BLOCK_TOP_ALL_NUM: TODO: add documentation **/
+define('V_STATISTICS_BLOCK_TOP_ALL_NUM', 'statistics_block_top_all_num');
+
+/** @variable V_STATISTICS_BLOCK_TOP_DAY_NUM: TODO: add documentation **/
+define('V_STATISTICS_BLOCK_TOP_DAY_NUM', 'statistics_block_top_day_num');
+
+/** @variable V_STATISTICS_BLOCK_TOP_LAST_NUM: TODO: add documentation **/
+define('V_STATISTICS_BLOCK_TOP_LAST_NUM', 'statistics_block_top_last_num');
+
+/** @variable V_STATISTICS_COUNT_CONTENT_VIEWS: TODO: add documentation **/
+define('V_STATISTICS_COUNT_CONTENT_VIEWS', 'statistics_count_content_views');
+
+/** @variable V_STATISTICS_DAY_TIMESTAMP: TODO: add documentation **/
+define('V_STATISTICS_DAY_TIMESTAMP', 'statistics_day_timestamp');
+
+/** @variable V_STATISTICS_ENABLE_ACCESS_LOG: TODO: add documentation **/
+define('V_STATISTICS_ENABLE_ACCESS_LOG', 'statistics_enable_access_log');
+
+/** @variable V_STATISTICS_FLUSH_ACCESSLOG_TIMER: TODO: add documentation **/
+define('V_STATISTICS_FLUSH_ACCESSLOG_TIMER', 'statistics_flush_accesslog_timer');
+
/**
* Implementation of hook_help().
*/
@@ -47,7 +68,7 @@ function statistics_exit() {
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) {
// We are counting content views.
if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
// A node has been viewed, so update the node's counters.
@@ -59,7 +80,7 @@ function statistics_exit() {
}
}
}
- if (variable_get('statistics_enable_access_log', 0)) {
+ if (variable_get(V_STATISTICS_ENABLE_ACCESS_LOG, 0)) {
// Log this page access.
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", strip_tags(drupal_get_title()), $_GET['q'], referer_uri(), ip_address(), $user->uid, session_id(), timer_read('page'), time());
}
@@ -172,16 +193,16 @@ function statistics_user($op, &$edit, &$
* Implementation of hook_cron().
*/
function statistics_cron() {
- $statistics_timestamp = variable_get('statistics_day_timestamp', '');
+ $statistics_timestamp = variable_get(V_STATISTICS_DAY_TIMESTAMP, '');
if ((time() - $statistics_timestamp) >= 86400) {
// Reset day counts.
db_query('UPDATE {node_counter} SET daycount = 0');
- variable_set('statistics_day_timestamp', time());
+ variable_set(V_STATISTICS_DAY_TIMESTAMP, time());
}
// Clean up expired access logs.
- db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
+ db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get(V_STATISTICS_FLUSH_ACCESSLOG_TIMER, 259200));
}
/**
@@ -237,7 +258,7 @@ function statistics_get($nid) {
function statistics_block($op = 'list', $delta = '', $edit = array()) {
switch ($op) {
case 'list':
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) {
$blocks['popular']['info'] = t('Popular content');
// Too dynamic to cache.
$blocks['popular']['cache'] = BLOCK_NO_CACHE;
@@ -248,32 +269,32 @@ function statistics_block($op = 'list',
case 'configure':
// Popular content block settings
$numbers = array('0' => t('Disabled')) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
- $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get('statistics_block_top_day_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
- $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get('statistics_block_top_all_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
- $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get('statistics_block_top_last_num', 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
+ $form['statistics_block_top_day_num'] = array('#type' => 'select', '#title' => t("Number of day's top views to display"), '#default_value' => variable_get(V_STATISTICS_BLOCK_TOP_DAY_NUM, 0), '#options' => $numbers, '#description' => t('How many content items to display in "day" list.'));
+ $form['statistics_block_top_all_num'] = array('#type' => 'select', '#title' => t('Number of all time views to display'), '#default_value' => variable_get(V_STATISTICS_BLOCK_TOP_ALL_NUM, 0), '#options' => $numbers, '#description' => t('How many content items to display in "all time" list.'));
+ $form['statistics_block_top_last_num'] = array('#type' => 'select', '#title' => t('Number of most recent views to display'), '#default_value' => variable_get(V_STATISTICS_BLOCK_TOP_LAST_NUM, 0), '#options' => $numbers, '#description' => t('How many content items to display in "recently viewed" list.'));
return $form;
case 'save':
- variable_set('statistics_block_top_day_num', $edit['statistics_block_top_day_num']);
- variable_set('statistics_block_top_all_num', $edit['statistics_block_top_all_num']);
- variable_set('statistics_block_top_last_num', $edit['statistics_block_top_last_num']);
+ variable_set(V_STATISTICS_BLOCK_TOP_DAY_NUM, $edit['statistics_block_top_day_num']);
+ variable_set(V_STATISTICS_BLOCK_TOP_ALL_NUM, $edit['statistics_block_top_all_num']);
+ variable_set(V_STATISTICS_BLOCK_TOP_LAST_NUM, $edit['statistics_block_top_last_num']);
break;
case 'view':
if (user_access('access content')) {
$content = array();
- $daytop = variable_get('statistics_block_top_day_num', 0);
+ $daytop = variable_get(V_STATISTICS_BLOCK_TOP_DAY_NUM, 0);
if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && ($node_title_list = node_title_list($result, t("Today's:")))) {
$content[] = $node_title_list;
}
- $alltimetop = variable_get('statistics_block_top_all_num', 0);
+ $alltimetop = variable_get(V_STATISTICS_BLOCK_TOP_ALL_NUM, 0);
if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
$content[] = $node_title_list;
}
- $lasttop = variable_get('statistics_block_top_last_num', 0);
+ $lasttop = variable_get(V_STATISTICS_BLOCK_TOP_LAST_NUM, 0);
if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && ($node_title_list = node_title_list($result, t('Last viewed:')))) {
$content[] = $node_title_list;
}
@@ -319,14 +340,14 @@ function statistics_nodeapi(&$node, $op,
* Implementation of hook_ranking().
*/
function statistics_ranking() {
- if (variable_get('statistics_count_content_views', 0)) {
+ if (variable_get(V_STATISTICS_COUNT_CONTENT_VIEWS, 0)) {
return array(
'views' => array(
'title' => t('Number of views'),
'join' => 'LEFT JOIN {node_counter} node_counter ON node_counter.nid = i.sid',
// Inverse law that maps the highest view count on the site to 1 and 0 to 0.
'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * %f)',
- 'arguments' => array(variable_get('node_cron_views_scale', 0)),
+ 'arguments' => array(variable_get(V_NODE_CRON_VIEWS_SCALE, 0)),
),
);
}
Index: modules/syslog/syslog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v
retrieving revision 1.16
diff -u -F^f -r1.16 syslog.module
--- modules/syslog/syslog.module 23 Apr 2008 20:01:53 -0000 1.16
+++ modules/syslog/syslog.module 20 May 2008 20:40:00 -0000
@@ -6,6 +6,9 @@
* Redirects logging messages to syslog.
*/
+/** @variable V_SYSLOG_FACILITY: TODO: add documentation **/
+define('V_SYSLOG_FACILITY', 'syslog_facility');
+
if (defined('LOG_LOCAL0')) {
define('DEFAULT_SYSLOG_FACILITY', LOG_LOCAL0);
}
@@ -41,7 +44,7 @@ function syslog_admin_settings() {
$form['syslog_facility'] = array(
'#type' => 'select',
'#title' => t('Send events to this syslog facility'),
- '#default_value' => variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY),
+ '#default_value' => variable_get(V_SYSLOG_FACILITY, DEFAULT_SYSLOG_FACILITY),
'#options' => syslog_facility_list(),
'#description' => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER. Depending on the system configuration, syslog and other logging tools use this code to identify or filter Drupal messages from within the entire system log. For more information on syslog, see Syslog help.', array(
'@syslog_help' => url('admin/help/syslog'),
@@ -75,7 +78,7 @@ function syslog_watchdog($entry) {
if (!$log_init) {
$log_init = TRUE;
- openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY));
+ openlog('drupal', LOG_NDELAY, variable_get(V_SYSLOG_FACILITY, DEFAULT_SYSLOG_FACILITY));
}
syslog($entry['severity'], theme('syslog_format', $entry));
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.76
diff -u -F^f -r1.76 system.admin.inc
--- modules/system/system.admin.inc 10 May 2008 07:32:02 -0000 1.76
+++ modules/system/system.admin.inc 20 May 2008 20:40:00 -0000
@@ -6,6 +6,24 @@
* Admin page callbacks for the system module.
*/
+/** @variable V_CLEAN_URL: TODO: add documentation **/
+define('V_CLEAN_URL', 'clean_url');
+
+/** @variable V_DATE_FIRST_DAY: TODO: add documentation **/
+define('V_DATE_FIRST_DAY', 'date_first_day');
+
+/** @variable V_DATE_FORMAT_LONG_CUSTOM: TODO: add documentation **/
+define('V_DATE_FORMAT_LONG_CUSTOM', 'date_format_long_custom');
+
+/** @variable V_DATE_FORMAT_MEDIUM_CUSTOM: TODO: add documentation **/
+define('V_DATE_FORMAT_MEDIUM_CUSTOM', 'date_format_medium_custom');
+
+/** @variable V_DATE_FORMAT_SHORT_CUSTOM: TODO: add documentation **/
+define('V_DATE_FORMAT_SHORT_CUSTOM', 'date_format_short_custom');
+
+/** @variable V_IMAGE_TOOLKIT: TODO: add documentation **/
+define('V_IMAGE_TOOLKIT', 'image_toolkit');
+
/**
* Menu callback; Provide the administration overview page.
*/
@@ -153,14 +171,14 @@ function system_admin_theme_settings() {
'#options' => $options,
'#title' => t('Administration theme'),
'#description' => t('Choose which theme the administration pages should display in. If you choose "System default" the administration pages will use the same theme as the rest of the site.'),
- '#default_value' => variable_get('admin_theme', '0'),
+ '#default_value' => variable_get(V_ADMIN_THEME, '0'),
);
$form['node_admin_theme'] = array(
'#type' => 'checkbox',
'#title' => t('Use administration theme for content editing'),
'#description' => t('Use the administration theme when editing existing posts or creating new ones.'),
- '#default_value' => variable_get('node_admin_theme', '0'),
+ '#default_value' => variable_get(V_NODE_ADMIN_THEME, '0'),
);
$form['#submit'][] = 'system_admin_theme_submit';
@@ -203,7 +221,7 @@ function system_themes_form() {
);
$options[$theme->name] = '';
- if (!empty($theme->status) || $theme->name == variable_get('admin_theme', '0')) {
+ if (!empty($theme->status) || $theme->name == variable_get(V_ADMIN_THEME, '0')) {
$form[$theme->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/' . $theme->name) );
}
else {
@@ -234,7 +252,7 @@ function system_themes_form() {
$form['theme_default'] = array(
'#type' => 'radios',
'#options' => $options,
- '#default_value' => variable_get('theme_default', 'garland'),
+ '#default_value' => variable_get(V_THEME_DEFAULT, 'garland'),
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
@@ -272,14 +290,14 @@ function system_themes_form_submit($form
}
}
}
- if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_state['values']['theme_default']) {
+ if (($admin_theme = variable_get(V_ADMIN_THEME, '0')) != '0' && $admin_theme != $form_state['values']['theme_default']) {
drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array(
'!admin_theme_page' => url('admin/settings/admin'),
'%admin_theme' => $admin_theme,
'%selected_theme' => $form_state['values']['theme_default'],
)));
}
- variable_set('theme_default', $form_state['values']['theme_default']);
+ variable_set(V_THEME_DEFAULT, $form_state['values']['theme_default']);
}
else {
// Revert to defaults: only Garland is enabled.
@@ -376,7 +394,7 @@ function system_theme_settings(&$form_st
// Some features are not always available
$disabled = array();
- if (!variable_get('user_pictures', 0)) {
+ if (!variable_get(V_USER_PICTURES, 0)) {
$disabled['toggle_node_user_picture'] = TRUE;
$disabled['toggle_comment_user_picture'] = TRUE;
}
@@ -1191,49 +1209,49 @@ function system_site_information_setting
$form['site_name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
- '#default_value' => variable_get('site_name', 'Drupal'),
+ '#default_value' => variable_get(V_SITE_NAME, 'Drupal'),
'#description' => t('The name of this website.'),
'#required' => TRUE
);
$form['site_mail'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
- '#default_value' => variable_get('site_mail', ini_get('sendmail_from')),
+ '#default_value' => variable_get(V_SITE_MAIL, ini_get('sendmail_from')),
'#description' => t("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"),
'#required' => TRUE,
);
$form['site_slogan'] = array(
'#type' => 'textfield',
'#title' => t('Slogan'),
- '#default_value' => variable_get('site_slogan', ''),
+ '#default_value' => variable_get(V_SITE_SLOGAN, ''),
'#description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).")
);
$form['site_mission'] = array(
'#type' => 'textarea',
'#title' => t('Mission'),
- '#default_value' => variable_get('site_mission', ''),
+ '#default_value' => variable_get(V_SITE_MISSION, ''),
'#description' => t("Your site's mission or focus statement (often prominently displayed on the front page).")
);
$form['site_footer'] = array(
'#type' => 'textarea',
'#title' => t('Footer message'),
- '#default_value' => variable_get('site_footer', ''),
+ '#default_value' => variable_get(V_SITE_FOOTER, ''),
'#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')
);
$form['anonymous'] = array(
'#type' => 'textfield',
'#title' => t('Anonymous user'),
- '#default_value' => variable_get('anonymous', t('Anonymous')),
+ '#default_value' => variable_get(V_ANONYMOUS, t('Anonymous')),
'#description' => t('The name used to indicate anonymous users.'),
'#required' => TRUE,
);
$form['site_frontpage'] = array(
'#type' => 'textfield',
'#title' => t('Default front page'),
- '#default_value' => variable_get('site_frontpage', 'node'),
+ '#default_value' => variable_get(V_SITE_FRONTPAGE, 'node'),
'#size' => 40,
'#description' => t('The home page displays content from this relative URL. If unsure, specify "node".'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get(V_CLEAN_URL, 0) ? '' : '?q='),
'#required' => TRUE,
);
$form['#validate'][] = 'system_site_information_settings_validate';
@@ -1272,23 +1290,23 @@ function system_error_reporting_settings
$form['site_403'] = array(
'#type' => 'textfield',
'#title' => t('Default 403 (access denied) page'),
- '#default_value' => variable_get('site_403', ''),
+ '#default_value' => variable_get(V_SITE_403, ''),
'#size' => 40,
'#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get(V_CLEAN_URL, 0) ? '' : '?q=')
);
$form['site_404'] = array(
'#type' => 'textfield',
'#title' => t('Default 404 (not found) page'),
- '#default_value' => variable_get('site_404', ''),
+ '#default_value' => variable_get(V_SITE_404, ''),
'#size' => 40,
'#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get(V_CLEAN_URL, 0) ? '' : '?q=')
);
$form['error_level'] = array(
- '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),
+ '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get(V_ERROR_LEVEL, 1),
'#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')),
'#description' => t('Specify where Drupal, PHP and SQL errors are logged. While it is recommended that a site running in a production environment write errors to the log only, in a development or testing environment it may be helpful to write errors both to the log and to the screen.')
);
@@ -1336,7 +1354,7 @@ function system_performance_settings() {
$form['page_cache']['cache'] = array(
'#type' => 'radios',
'#title' => t('Caching mode'),
- '#default_value' => variable_get('cache', CACHE_DISABLED),
+ '#default_value' => variable_get(V_CACHE, CACHE_DISABLED),
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')),
'#description' => $description
);
@@ -1346,14 +1364,14 @@ function system_performance_settings() {
$form['page_cache']['cache_lifetime'] = array(
'#type' => 'select',
'#title' => t('Minimum cache lifetime'),
- '#default_value' => variable_get('cache_lifetime', 0),
+ '#default_value' => variable_get(V_CACHE_LIFETIME, 0),
'#options' => $period,
'#description' => t('On high-traffic sites, it may be necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated, and is applied to both page and block caches. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
);
$form['page_cache']['page_compression'] = array(
'#type' => 'radios',
'#title' => t('Page compression'),
- '#default_value' => variable_get('page_compression', TRUE),
+ '#default_value' => variable_get(V_PAGE_COMPRESSION, TRUE),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."),
);
@@ -1367,7 +1385,7 @@ function system_performance_settings() {
$form['block_cache']['block_cache'] = array(
'#type' => 'radios',
'#title' => t('Block cache'),
- '#default_value' => variable_get('block_cache', CACHE_DISABLED),
+ '#default_value' => variable_get(V_BLOCK_CACHE, CACHE_DISABLED),
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Enabled (recommended)')),
'#disabled' => count(module_implements('node_grants')),
'#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'),
@@ -1380,11 +1398,11 @@ function system_performance_settings() {
);
$directory = file_directory_path();
- $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
+ $is_writable = is_dir($directory) && is_writable($directory) && (variable_get(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
$form['bandwidth_optimizations']['preprocess_css'] = array(
'#type' => 'radios',
'#title' => t('Optimize CSS files'),
- '#default_value' => intval(variable_get('preprocess_css', 0) && $is_writable),
+ '#default_value' => intval(variable_get(V_PREPROCESS_CSS, 0) && $is_writable),
'#disabled' => !$is_writable,
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option can interfere with theme development and should only be enabled in a production environment.'),
@@ -1392,7 +1410,7 @@ function system_performance_settings() {
$form['bandwidth_optimizations']['preprocess_js'] = array(
'#type' => 'radios',
'#title' => t('Optimize JavaScript files'),
- '#default_value' => intval(variable_get('preprocess_js', 0) && $is_writable),
+ '#default_value' => intval(variable_get(V_PREPROCESS_JS, 0) && $is_writable),
'#disabled' => !$is_writable,
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option can interfere with module development and should only be enabled in a production environment.'),
@@ -1455,7 +1473,7 @@ function system_file_system_settings() {
$form['file_downloads'] = array(
'#type' => 'radios',
'#title' => t('Download method'),
- '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
+ '#default_value' => variable_get(V_FILE_DOWNLOADS, FILE_DOWNLOADS_PUBLIC),
'#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
'#description' => t('Choose the Public download method unless you wish to enforce fine-grained access controls over file downloads. Changing the download method will modify all download paths and may cause unexpected problems on an existing site.')
);
@@ -1475,12 +1493,12 @@ function system_image_toolkit_settings()
$form['image_toolkit'] = array(
'#type' => 'radios',
'#title' => t('Select an image processing toolkit'),
- '#default_value' => variable_get('image_toolkit', image_get_toolkit()),
+ '#default_value' => variable_get(V_IMAGE_TOOLKIT, image_get_toolkit()),
'#options' => $toolkits_available
);
}
elseif (count($toolkits_available) == 1) {
- variable_set('image_toolkit', key($toolkits_available));
+ variable_set(V_IMAGE_TOOLKIT, key($toolkits_available));
}
$form['image_toolkit_settings'] = image_toolkit_invoke('settings');
@@ -1499,14 +1517,14 @@ function system_rss_feeds_settings() {
$form['feed_default_items'] = array(
'#type' => 'select',
'#title' => t('Number of items in each feed'),
- '#default_value' => variable_get('feed_default_items', 10),
+ '#default_value' => variable_get(V_FEED_DEFAULT_ITEMS, 10),
'#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
'#description' => t('Default number of items to include in each feed.')
);
$form['feed_item_length'] = array(
'#type' => 'select',
'#title' => t('Feed content'),
- '#default_value' => variable_get('feed_item_length', 'teaser'),
+ '#default_value' => variable_get(V_FEED_ITEM_LENGTH, 'teaser'),
'#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')),
'#description' => t('Global setting for the default display of content items in each feed.')
);
@@ -1561,7 +1579,7 @@ function system_date_time_settings() {
$form['locale']['date_default_timezone'] = array(
'#type' => 'select',
'#title' => t('Default time zone'),
- '#default_value' => variable_get('date_default_timezone', 0),
+ '#default_value' => variable_get(V_DATE_DEFAULT_TIMEZONE, 0),
'#options' => $zones,
'#description' => t('Select the default site time zone.')
);
@@ -1569,7 +1587,7 @@ function system_date_time_settings() {
$form['locale']['configurable_timezones'] = array(
'#type' => 'radios',
'#title' => t('User-configurable time zones'),
- '#default_value' => variable_get('configurable_timezones', 1),
+ '#default_value' => variable_get(V_CONFIGURABLE_TIMEZONES, 1),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.')
);
@@ -1577,7 +1595,7 @@ function system_date_time_settings() {
$form['locale']['date_first_day'] = array(
'#type' => 'select',
'#title' => t('First day of week'),
- '#default_value' => variable_get('date_first_day', 0),
+ '#default_value' => variable_get(V_DATE_FIRST_DAY, 0),
'#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')),
'#description' => t('The first day of the week for calendar views.')
);
@@ -1587,7 +1605,7 @@ function system_date_time_settings() {
'#title' => t('Formatting'),
);
- $date_format_short = variable_get('date_format_short', $date_short[1]);
+ $date_format_short = variable_get(V_DATE_FORMAT_SHORT, $date_short[1]);
$form['date_formats']['date_format_short'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1599,7 +1617,7 @@ function system_date_time_settings() {
'#description' => t('The short format of date display.'),
);
- $default_short_custom = variable_get('date_format_short_custom', (isset($date_short_choices[$date_format_short]) ? $date_format_short : ''));
+ $default_short_custom = variable_get(V_DATE_FORMAT_SHORT_CUSTOM, (isset($date_short_choices[$date_format_short]) ? $date_format_short : ''));
$form['date_formats']['date_format_short_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1610,7 +1628,7 @@ function system_date_time_settings() {
'#description' => t('A user-defined short date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_short_custom))),
);
- $date_format_medium = variable_get('date_format_medium', $date_medium[1]);
+ $date_format_medium = variable_get(V_DATE_FORMAT_MEDIUM, $date_medium[1]);
$form['date_formats']['date_format_medium'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1622,7 +1640,7 @@ function system_date_time_settings() {
'#description' => t('The medium sized date display.'),
);
- $default_medium_custom = variable_get('date_format_medium_custom', (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : ''));
+ $default_medium_custom = variable_get(V_DATE_FORMAT_MEDIUM_CUSTOM, (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : ''));
$form['date_formats']['date_format_medium_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1633,7 +1651,7 @@ function system_date_time_settings() {
'#description' => t('A user-defined medium date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(time(), 'custom', $default_medium_custom))),
);
- $date_format_long = variable_get('date_format_long', $date_long[0]);
+ $date_format_long = variable_get(V_DATE_FORMAT_LONG, $date_long[0]);
$form['date_formats']['date_format_long'] = array(
'#prefix' => '',
'#suffix' => '
',
@@ -1645,7 +1663,7 @@ function system_date_time_settings() {
'#description' => t('Longer date format used for detailed display.')
);
- $default_long_custom = variable_get('date_format_long_custom', (isset($date_long_choices[$date_format_long]) ? $date_format_long : ''));
+ $default_long_custom = variable_get(V_DATE_FORMAT_LONG_CUSTOM, (isset($date_long_choices[$date_format_long]) ? $date_format_long : ''));
$form['date_formats']['date_format_long_custom'] = array(
'#prefix' => '
',
'#suffix' => '
',
@@ -1698,7 +1716,7 @@ function system_site_maintenance_setting
$form['site_offline'] = array(
'#type' => 'radios',
'#title' => t('Site status'),
- '#default_value' => variable_get('site_offline', 0),
+ '#default_value' => variable_get(V_SITE_OFFLINE, 0),
'#options' => array(t('Online'), t('Off-line')),
'#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the user login page.', array('@user-login' => url('user'))),
);
@@ -1706,7 +1724,7 @@ function system_site_maintenance_setting
$form['site_offline_message'] = array(
'#type' => 'textarea',
'#title' => t('Site off-line message'),
- '#default_value' => variable_get('site_offline_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))),
+ '#default_value' => variable_get(V_SITE_OFFLINE_MESSAGE, t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get(V_SITE_NAME, 'Drupal')))),
'#description' => t('Message to show visitors when the site is in off-line mode.')
);
@@ -1723,12 +1741,12 @@ function system_clean_url_settings() {
$form['clean_url'] = array(
'#type' => 'radios',
'#title' => t('Clean URLs'),
- '#default_value' => variable_get('clean_url', 0),
+ '#default_value' => variable_get(V_CLEAN_URL, 0),
'#options' => array(t('Disabled'), t('Enabled')),
'#description' => t('This option makes Drupal emit "clean" URLs (i.e. without ?q=
in the URL).'),
);
- if (!variable_get('clean_url', 0)) {
+ if (!variable_get(V_CLEAN_URL, 0)) {
if (strpos(request_uri(), '?q=') !== FALSE) {
drupal_add_js(drupal_get_path('module', 'system') . '/system.js', 'module');
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.254
diff -u -F^f -r1.254 system.install
--- modules/system/system.install 15 May 2008 20:55:58 -0000 1.254
+++ modules/system/system.install 20 May 2008 20:40:00 -0000
@@ -1,6 +1,18 @@
configuring cron jobs