Index: vocabindex/vocabindex.admin.inc =================================================================== --- vocabindex/vocabindex.admin.inc +++ vocabindex/vocabindex.admin.inc @@ -26,9 +26,9 @@ ); $form['vocabindex_pager'] = array( - '#type' => 'textfield', + '#type' => 'textfield', '#title' => t('Terms per page'), - '#description' => t('The amount of terms to display per page for browsable and alphabetical views. Use 0 to disable paging.'), + '#description' => t('The amount of terms to display per page for browsable and alphabetical views. Use 0 to disable paging.'), '#default_value' => variable_get('vocabindex_pager', 25), '#maxlength' => 3, '#size' => 3, @@ -41,9 +41,9 @@ ); $form['vocabindex_caching']['vocabindex_cache_lifetime'] = array( - '#type' => 'textfield', + '#type' => 'textfield', '#title' => t('Cache lifetime'), - '#description' => t('Specified in minutes. Use 0 to disable caching or if you are using a taxonomy access control module.'), + '#description' => t('Specified in minutes. Use 0 to disable caching or if you are using a taxonomy access control module.'), '#default_value' => variable_get('vocabindex_cache_lifetime', 60), '#maxlength' => 3, '#size' => 3, @@ -134,9 +134,9 @@ form_set_error($name, t('Path is already used as an alias.')); } } -} - -/** +} + +/** * Admin index pages/blocks. * * Display the form to add new index pages or blocks or to alter existing ones. @@ -146,7 +146,7 @@ * Type: constant; Either VOCABINDEX_VI_PAGE or VOCABINDEX_VI_BLOCK. * * @return - * Type: string; Either a rendered form or an empty string. + * Type: string; Either a rendered form or an empty string. */ function vocabindex_admin_vi($type) { if (count(vocabindex_vi_load($type, 0, FALSE))) { @@ -173,7 +173,7 @@ * * @return * Type: array; A Drupal form. - */ + */ function vocabindex_admin_vi_form($form, $type) { $vis = vocabindex_vi_load($type, 0, FALSE); $form = array(); @@ -191,20 +191,20 @@ else { $description = t('There is no index page set for this vocabulary.'); } - - $form[$id . 'path'] = array( + + $form[$id . 'path'] = array( '#type' => 'textfield', - '#description' => $description, - '#default_value' => check_plain($vi->path), + '#description' => $description, + '#default_value' => check_plain($vi->path), '#maxlength' => '255', '#size' => 30, - '#element_validate' => array('vocabindex_path_validate'), + '#element_validate' => array('vocabindex_path_validate'), ); } - elseif ($type == VOCABINDEX_VI_BLOCK) { - $form[$id . 'enabled'] = array( - '#type' => 'checkbox', - '#default_value' => $vi->enabled, + elseif ($type == VOCABINDEX_VI_BLOCK) { + $form[$id . 'enabled'] = array( + '#type' => 'checkbox', + '#default_value' => $vi->enabled, ); } @@ -218,27 +218,27 @@ $options[VOCABINDEX_VIEW_FLAT] = t('Flat'); } $form[$id . 'view'] = array( - '#type' => 'select', - '#default_value' => $default_value, + '#type' => 'select', + '#default_value' => $default_value, '#options' => $options, ); $form[$id . 'node_count'] = array( - '#type' => 'checkbox', + '#type' => 'checkbox', '#default_value' => $vi->node_count, - ); + ); } $form['vocabindex_type'] = array( '#type' => 'value', '#value' => $type, ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Save configuration') + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Save configuration') ); - + return $form; } @@ -247,7 +247,7 @@ * * @ingroup forms * @see vocabindex_admin_vi_form() - */ + */ function vocabindex_admin_vi_form_submit($form, &$form_state) { $values = $form_state['values']; $vis = vocabindex_vi_load($values['vocabindex_type'], 0, FALSE); @@ -264,7 +264,7 @@ menu_rebuild(); - drupal_set_message(t('The configuration options have been saved.')); + drupal_set_message(t('The configuration options have been saved.')); } /** @@ -279,5 +279,5 @@ db_query("UPDATE {vocabindex} SET path = '%s', view = %d, node_count = %d, enabled = %d WHERE vid = %d AND type = %d", $vi->path, $vi->view, $vi->node_count, $vi->enabled, $vi->vid, $vi->type); if ($vi->type == VOCABINDEX_VI_BLOCK && $vi->enabled == FALSE) { db_query("DELETE FROM {blocks} WHERE module = 'vocabindex' AND delta = %d", $vi->vid); - } + } } \ No newline at end of file Index: vocabindex/vocabindex.install =================================================================== --- vocabindex/vocabindex.install +++ vocabindex/vocabindex.install @@ -8,71 +8,71 @@ /** * Implementation of hook_schema(). - */ + */ function vocabindex_schema() { module_load_include('module', 'vocabindex'); - $schema['vocabindex'] = array( - 'description' => t('The table in which the settings for Vocabulary Index are stored.'), - 'fields' => array( - 'vid' => array( - 'description' => t('The VID associated with this index.'), + $schema['vocabindex'] = array( + 'description' => t('The table in which the settings for Vocabulary Index are stored.'), + 'fields' => array( + 'vid' => array( + 'description' => t('The VID associated with this index.'), 'type' => 'int', 'unsigned' => TRUE, 'default' => 0, - ), - 'path' => array( - 'description' => t('The path to a Vocabulary Index page.'), + ), + 'path' => array( + 'description' => t('The path to a Vocabulary Index page.'), 'type' => 'varchar', 'length' => '255', - 'default' => '', - ), - 'view' => array( - 'description' => t('The view, a tree or a flat list for instance.'), + 'default' => '', + ), + 'view' => array( + 'description' => t('The view, a tree or a flat list for instance.'), 'type' => 'int', 'size' => 'tiny', - 'default' => VOCABINDEX_VIEW_TREE, - ), - 'node_count' => array( - 'description' => t('Whether to count nodes per term.'), + 'default' => VOCABINDEX_VIEW_TREE, + ), + 'node_count' => array( + 'description' => t('Whether to count nodes per term.'), 'type' => 'int', 'size' => 'tiny', - 'default' => 0, - ), - 'type' => array( - 'description' => t('Index page or index block.'), + 'default' => 0, + ), + 'type' => array( + 'description' => t('Index page or index block.'), 'type' => 'int', 'size' => 'tiny', - 'default' => 0, - ), - 'enabled' => array( - 'description' => t('Indicates whether this index is enabled or not.'), + 'default' => 0, + ), + 'enabled' => array( + 'description' => t('Indicates whether this index is enabled or not.'), 'type' => 'int', 'size' => 'tiny', - 'default' => 0, + 'default' => 0, ), ), 'indexes' => array( 'vocabindex_vid' => array('vid'), 'vocabindex_type' => array('type'), - ), + ), ); - - return $schema; + + return $schema; } - + /** * Implementation of hook_install(). - */ -function vocabindex_install() { + */ +function vocabindex_install() { drupal_install_schema('vocabindex'); - vocabindex_create_vis(); + vocabindex_create_vis(); } - + /** * Implementation of hook_uninstall(). - */ + */ function vocabindex_uninstall() { vocabindex_delete_variables(); vocabindex_delete_menu_items(); @@ -86,8 +86,8 @@ db_query("DELETE FROM {blocks} WHERE module = 'vocabindex'"); db_query("DELETE FROM {blocks_roles} WHERE module = 'vocabindex'"); - //Delete DB table. - drupal_uninstall_schema('vocabindex'); + //Delete DB table. + drupal_uninstall_schema('vocabindex'); } /** Index: vocabindex/vocabindex.view.inc =================================================================== --- vocabindex/vocabindex.view.inc +++ vocabindex/vocabindex.view.inc @@ -330,7 +330,7 @@ drupal_set_title(check_plain($vi->name) . ' ยป ' . drupal_strtoupper($output['letter'])); } - return $output; + return $output; } /** @@ -362,7 +362,7 @@ vocabindex_pager_query($tree); } - $items = array(); + $items = array(); for ($i = 0, $len_i = count($tree); $i < $len_i; $i++) { $term = $tree[$i]; $zebra = ($i % 2 == 0 ? 'even' : 'odd'); Index: vocabindex/vocabindex.module =================================================================== --- vocabindex/vocabindex.module +++ vocabindex/vocabindex.module @@ -45,15 +45,15 @@ * A VI page. */ define('VOCABINDEX_VI_PAGE', 2); - -/** - * Implementation of hook_perm(). - */ -function vocabindex_perm() { + +/** + * Implementation of hook_perm(). + */ +function vocabindex_perm() { return array( 'administer vocabulary index', 'view vocabulary index pages', - ); + ); } /** @@ -64,74 +64,74 @@ $path = base_path() . 'update.php'; drupal_set_message(t("Please proceed to !update.php to update your database to Vocabulary Index 2.", array('!update.php' => 'update.php')), 'error'); } -} - -/** - * Implementation of hook_menu(). - */ +} + +/** + * Implementation of hook_menu(). + */ function vocabindex_menu() { if (vocabindex_update_status() == FALSE) { return array(); } - $items[_vocabindex_menu_paths('admin_main')] = array( + $items[_vocabindex_menu_paths('admin_main')] = array( 'title' => 'Vocabulary Index', - 'description' => 'Create index pages for vocabularies.', - 'access arguments' => array('administer vocabulary index'), + 'description' => 'Create index pages for vocabularies.', + 'access arguments' => array('administer vocabulary index'), 'page callback' => 'vocabindex_admin_vi', 'page arguments' => array((string) VOCABINDEX_VI_PAGE), - 'file' => 'vocabindex.admin.inc', - ); + 'file' => 'vocabindex.admin.inc', + ); $items[_vocabindex_menu_paths('admin_pages')] = array( - 'title' => 'Pages', + 'title' => 'Pages', 'access arguments' => array('administer vocabulary index'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'file' => 'vocabindex.admin.inc', 'weight' => 0, - ); + ); $items[_vocabindex_menu_paths('admin_blocks')] = array( 'title' => 'Blocks', - 'description' => 'Create index blocks for vocabularies.', - 'access arguments' => array('administer vocabulary index'), + 'description' => 'Create index blocks for vocabularies.', + 'access arguments' => array('administer vocabulary index'), 'page callback' => 'vocabindex_admin_vi', 'page arguments' => array((string) VOCABINDEX_VI_BLOCK), 'type' => MENU_LOCAL_TASK, 'file' => 'vocabindex.admin.inc', 'weight' => 1, - ); + ); - $items[_vocabindex_menu_paths('admin_settings')] = array( + $items[_vocabindex_menu_paths('admin_settings')] = array( 'title' => 'Settings', - 'description' => 'General settings.', + 'description' => 'General settings.', 'access arguments' => array('administer vocabulary index'), - 'page callback' => 'drupal_get_form', + 'page callback' => 'drupal_get_form', 'page arguments' => array('vocabindex_admin'), 'type' => MENU_LOCAL_TASK, 'file' => 'vocabindex.admin.inc', - 'weight' => 2, + 'weight' => 2, ); // VI pages. - $vis = vocabindex_vi_load(VOCABINDEX_VI_PAGE); + $vis = vocabindex_vi_load(VOCABINDEX_VI_PAGE); foreach ($vis as $vi) { $item = vocabindex_menu_base() + array( 'title' => $vi->name, 'description' => check_plain($vi->description), // We need to cast out the constant to a string, because the integer will - // otherwise be replaced with the corresponding part of the menu path. - 'page arguments' => array($vi->vid, (string) VOCABINDEX_VOC), + // otherwise be replaced with the corresponding part of the menu path. + 'page arguments' => array($vi->vid, (string) VOCABINDEX_VOC), ); // The menu item for alphabetical VIs using the letter wildcard. if ($vi->view == VOCABINDEX_VIEW_ALPHABETICAL) { $arg = (int) substr_count($vi->path, '/') + 1; $path = $vi->path . '/%vocabindex_letter'; $item['page arguments'][2] = $arg; - } - $items[$vi->path] = $item; + } + $items[$vi->path] = $item; } - + return $items; } @@ -142,7 +142,7 @@ * index pages. */ function vocabindex_menu_alter(&$items) { - $vis = vocabindex_vi_load(VOCABINDEX_VI_PAGE); + $vis = vocabindex_vi_load(VOCABINDEX_VI_PAGE); foreach ($vis as $vi) { if ($vi->view == VOCABINDEX_VIEW_FLAT) { $tree = taxonomy_get_tree($vi->vid); @@ -157,7 +157,7 @@ // integer will otherwise be replaced with the corresponding part // of the menu path. 'page arguments' => array($term->tid, (string) VOCABINDEX_TERM), - 'file path' => drupal_get_path('module', 'vocabindex'), + 'file path' => drupal_get_path('module', 'vocabindex'), ); } } @@ -369,10 +369,10 @@ */ function vocabindex_menu_base() { return array( - 'access arguments' => array('view vocabulary index pages'), - 'page callback' => 'vocabindex_view_page', + 'access arguments' => array('view vocabulary index pages'), + 'page callback' => 'vocabindex_view_page', 'type' => MENU_CALLBACK, - 'file' => 'vocabindex.view.inc', + 'file' => 'vocabindex.view.inc', ); } Index: vocabindex/vocabindex.info =================================================================== --- vocabindex/vocabindex.info +++ vocabindex/vocabindex.info @@ -1,5 +1,5 @@ -; $Id$ -name = Vocabulary Index +; $Id$ +name = Vocabulary Index description = "Easily browse through taxonomy. Display vocabularies like trees, a directory index or sort their terms alphabetically." core = 6.x dependencies[] = taxonomy