You are here

function _advpoll_list_modes in Advanced Poll 6

Same name and namespace in other branches
  1. 5 advpoll.module \_advpoll_list_modes()
  2. 6.3 advpoll.module \_advpoll_list_modes()
  3. 6.2 advpoll.module \_advpoll_list_modes()

Load the available modes.

This scans the modes subdirectory to find mode.inc files, where mode is considered to be the mode name. Found files are loaded and added to the mode list.

4 calls to _advpoll_list_modes()
advpoll_init in ./advpoll.module
Implementation of hook_init().
advpoll_menu in ./advpoll.module
Implementation of hook_menu().
advpoll_node_info in ./advpoll.module
Implementation of hook_node_info().
advpoll_uninstall in ./advpoll.install
Implementation of hook_uninstall().

File

./advpoll.module, line 1323
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function _advpoll_list_modes() {
  static $advpoll_modes;
  if (!$advpoll_modes) {
    $files = file_scan_directory(dirname(__FILE__) . '/modes/', '^([^\\.].*)\\.inc$', array(
      '.',
      '..',
      'CVS',
    ), 0, FALSE);
    foreach ($files as $file) {
      require_once $file->filename;
      $mode = $file->name;
      if (function_exists('advpoll_info_' . $mode)) {
        $advpoll_modes[$mode] = call_user_func('advpoll_info_' . $mode);
      }
    }
  }
  return $advpoll_modes;
}