GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 7.x-1.x ( 94dab8...029788 )
by Devin
03:44
created

modules/df/df_admin/df_admin.page.inc::df_admin_page()   C

Complexity

Conditions 8
Paths 12

Size

Total Lines 41
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 8
eloc 23
c 2
b 0
f 1
nc 12
nop 0
dl 0
loc 41
rs 5.3846
1
<?php
2
/**
3
 * @file
4
 * DF Admin page handling functions.
5
 */
6
7
/**
8
 * DF Admin page callback used to list scenarios.
9
 * @return
10
 *   returns theme callback with scenario information array.
11
 */
12
function df_admin_page() {
13
  // Add DF Admin CSS.
14
  drupal_add_css(drupal_get_path('module', 'df_admin') . '/css/df_admin.page.css');
15
16
  // Get advanced help topics.
17
  $advanced_help = module_exists('advanced_help') ? advanced_help_get_topics() : array();
18
19
  // Check for developer mode.
20
  $developer_mode = variable_get('df_developer_mode', FALSE);
21
22
  // Render Scenarios
23
  $list = array();
24
  $modules = df_get_scenario_modules();
25
  foreach ($modules as $name => $module) {
26
    // Skip dev scenarios if we're not in developer mode.
27
    if (!$developer_mode && isset($module->info['dev_scenario']) && $module->info['dev_scenario'] == TRUE) {
28
      continue;
29
    }
30
    // Compile individual scenario info array.
31
    $list[$module->name] = array(
32
      'name' => $module->info['name'],
33
      'links' => _df_admin_dfs_links($module),
34
      'description' => $module->info['description'],
35
    );
36
    // Append optional screenshot to scenario's info array.
37
    $screenshot = drupal_get_path('module', $module->name) . '/screenshot.png';
38
    if (file_exists($screenshot)) {
39
      $list[$module->name]['screenshot'] = '/' . $screenshot;
40
    }
41
    // Add optional advanced_help topic to scenario info array.
42
    if (isset($advanced_help[$module->name])) {
43
      $first_topic = array_shift($advanced_help[$module->name]);
44
      $list[$module->name]['help'] = theme('advanced_help_topic', array('module' => $module->name, 'topic' => $first_topic['name'], 'type' => t('Scenario script')));
45
    }
46
  }
47
  $page = array(
48
    '#theme' => 'df_admin_page_template',
49
    '#scenarios' => $list,
50
  );
51
  return render($page);
52
}
53
54
/**
55
 * Psuedo-private function used by df_admin_page callback.
56
 * @return
57
 *   returns an array of links.
58
 */
59
function _df_admin_dfs_links($module) {
60
  $links = array();
61
  $action = !module_exists($module->name) ? 'enable' : 'reset';
62
  $path = 'admin/df/' . $action . '/' . $module->name;
63
  $token = drupal_get_token(DRUPAL_ROOT . '/df/' . $action . '/' . $module->name);
64
  $links[] = l(t(ucwords($action)), $path, array('attributes' => array('class' => array('dfs-link')), 'query' => array('token' => $token)));
65
  // Add an uninstall button if needed
66
  if ($action == 'reset') {
67
    $path = 'admin/df/uninstall';
68
    $token = drupal_get_token(DRUPAL_ROOT . '/df/uninstall');
69
    $links[] = l(t('Uninstall'), $path, array('attributes' => array('class' => array('dfs-link')), 'query' => array('token' => $token)));
70
  }
71
  return $links;
72
}
73