Index: modules/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi.module,v retrieving revision 1.46 diff -u -F^f -r1.46 blogapi.module --- modules/blogapi.module 17 Jul 2005 18:29:31 -0000 1.46 +++ modules/blogapi.module 17 Jul 2005 19:24:36 -0000 @@ -535,7 +535,7 @@ function blogapi_blogger_title(&$content function blogapi_settings() { $output = form_select(t('XML-RPC Engine'), 'blogapi_engine', variable_get('blogapi_engine', 0), array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')); - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { $node_types[$type] = node_invoke($type, 'node_name'); if (in_array($type, array('blog'))) { $defaults[] = $type; @@ -707,7 +707,7 @@ function _blogapi_blogid($id) { function _blogapi_get_node_types() { $available_types = variable_get('blogapi_node_types', array('blog')); $types = array(); - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { if (node_access('create', $type) && in_array($type, $available_types)) { $types[] = $type; } Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.504 diff -u -F^f -r1.504 node.module --- modules/node.module 17 Jul 2005 18:29:31 -0000 1.504 +++ modules/node.module 17 Jul 2005 19:24:37 -0000 @@ -32,7 +32,7 @@ function node_help($section) {
Published
When using Drupal's moderation system a node remains unpublished -- unavailable to non-moderators -- until it is marked Published.

Now that you know what is in a node, here are some of the types of nodes available.

", array("%teaser" => url("admin/node/configure/settings"))); - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { $output .= '

'. t('Node type: %module', array('%module' => node_invoke($type, 'node_name'))). '

'; $output .= implode("\n", module_invoke_all('help', 'node/add#'. $type)); } @@ -212,49 +212,39 @@ function node_teaser($body, $format = NU */ function node_get_module_name($node) { if (is_array($node)) { - if ($pos = strpos($node['type'], '-')) { - return substr($node['type'], 0, $pos); - } - else { - return $node['type']; - } + $type = $node['type']; } else if (is_object($node)) { - if ($pos = strpos($node->type, '-')) { - return substr($node->type, 0, $pos); - } - else { - return $node->type; - } + $type = $node->type; } else if (is_string($node)) { - if ($pos = strpos($node, '-')) { - return substr($node, 0, $pos); - } - else { - return $node; - } + $type = $node; } + $modules = node_list(); + return $modules ? $modules[$type] : $modules; } /** * Get a list of all the defined node types. * * @return - * A list of all node types. + * An associate array of consisting of (node type, modulename) pairs for all node types. */ function node_list() { - $types = array(); - foreach (module_list() as $module) { - if (module_hook($module, 'node_name')) { - $module_types = module_invoke($module, 'node_types'); - if (is_array($module_types)) { - foreach ($module_types as $type) { - $types[] = $type; + static $types = array(); + + if (empty($types)) { + foreach (module_list() as $module) { + if (module_hook($module, 'node_name')) { + $module_types = module_invoke($module, 'node_types'); + if (is_array($module_types)) { + foreach ($module_types as $type) { + $types[$type] = $module; + } + } + else { + $types[$module] = $module; } - } - else { - $types[] = $module; } } } @@ -781,7 +771,7 @@ function node_admin_nodes() { /* ** Filters */ - $node_types = drupal_map_assoc(node_list()); + $node_types = drupal_map_assoc(array_keys(node_list())); foreach ($node_types as $k => $v) { $node_types[$k] = node_invoke($v, 'node_name'); } @@ -955,7 +945,7 @@ function node_types_configure($type = NU $header = array(t('Type'), t('Operations')); $rows = array(); - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { $rows[] = array(node_invoke($type, 'node_name'), l(t('configure'), 'admin/settings/content-types/'. $type)); } @@ -1388,7 +1378,7 @@ function node_add($type) { $edit = $_POST['edit']; // If a node type has been specified, validate its existence. - if (in_array($type, node_list()) && node_access('create', $type)) { + if (array_key_exists($type, node_list()) && node_access('create', $type)) { // Initialize settings: $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); @@ -1404,7 +1394,7 @@ function node_add($type) { } else { // If no (valid) node type has been provided, display a node type overview. - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { if (node_access('create', $type)) { $out = '
'. l(node_invoke($type, 'node_name'), "node/add/$type", array('title' => t('Add a new %s.', array('%s' => node_invoke($type, 'node_name'))))) .'
'; $out .= '
'. implode("\n", module_invoke_all('help', 'node/add#'. $type)) .'
'; Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.216 diff -u -F^f -r1.216 system.module --- modules/system.module 27 Jun 2005 18:33:33 -0000 1.216 +++ modules/system.module 17 Jul 2005 19:24:38 -0000 @@ -716,7 +716,7 @@ function system_theme_settings($key = '' $node_list = module_invoke('node', 'list'); if ($node_list) { $group = ''; - foreach (node_list() as $type) { + foreach ($node_list as $type => $module_name) { $group .= form_checkbox(node_invoke($type, 'node_name'), "$var][toggle_node_info_$type", 1, $settings["toggle_node_info_$type"]); } $form .= form_group(t('Display post information on'), $group, t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type')); Index: modules/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v retrieving revision 1.210 diff -u -F^f -r1.210 taxonomy.module --- modules/taxonomy.module 17 Jul 2005 18:29:32 -0000 1.210 +++ modules/taxonomy.module 17 Jul 2005 19:24:38 -0000 @@ -109,7 +109,7 @@ function taxonomy_menu($may_cache) { } function taxonomy_form_vocabulary($edit = array()) { - foreach (node_list() as $type) { + foreach (node_list() as $type => $module_name) { $node_type = node_invoke($type, 'node_name'); $nodes[$type] = $node_type ? $node_type : $type; }