-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxray.module
More file actions
112 lines (103 loc) · 3.03 KB
/
Copy pathxray.module
File metadata and controls
112 lines (103 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* @file
* Helps site builders and module developers investigate a site.
*/
/**
* Implements hook_form_alter() to show each form's indentifier.
*
* More description after an empty line.
*/
function xray_form_alter(&$form, &$form_state, $form_id) {
//debug($form, $form_id, TRUE);
$form['xray_display_form_id'] = array(
'#type' => 'item',
'#title' => t('Form ID'),
'#markup' => $form_id,
'#theme_wrappers' => array('container__xray__form'),
'#attributes' => array('class' => array('xray')),
'#weight' => -100,
);
}
/**
* Implements hook_help().
*/
function xray_help($path, $arg) {
switch($path) {
case 'admin/appearance':
return t(_xray_help_admin_appearance());
case 'admin/structure':
return t('This site has stuff');
}
}
/**
* Fetch information about themes
*/
function xray_stats_enabled_themes() {
$themes = list_themes();
$num_themes = count($themes);
$num_enabled = 0;
$summaries = array();
//print_r($themes);
$num_hidden = 1;
foreach ($themes as $themename => $theme) {
//print(' HERE theme[filename] = ' . $theme->filename);
if (isset($theme->info['hidden']) && $theme->info['hidden']) {
$num_hidden++;
//print(' themename = ' . $themename);
}
else {
if ($theme->status) {
$num_enabled++;
$summaries[$theme->info['name']] = array(
'regions' => count($theme->info['regions']),
'overlay_regions' => count($theme->info['overlay_regions']),
'regions_hidden' => count($theme->info['regions_hidden']),
'features' => count($theme->info['features']),
//'kindsofstylesheets' => count($themes->info['stylesheets']),
'allstylesheets' => isset($theme->info['stylesheets']['all']) ? count($theme->info['stylesheets']['all']) : 0,
);
}
}
}
return compact('num_themes','num_hidden','num_enabled','summaries');
}
/**
* Help text for the admin/appearance page
*/
function _xray_help_admin_appearance() {
//debug(list_themes());
$output = '';
$data = xray_stats_enabled_themes();
$output .= format_plural(
$data['num_hidden'],
'There is one hidden theme.',
'There are @count hidden themes.'
);
$output .= '<br />' . format_plural($data['num_enabled'],
'There is one theme enabled.',
'There are @count themes enabled.'
);
//print_r($data);
return $output;
//return theme('xray_help', array('text' => $output));
}
//menu_rebuild();
/**
* Implements hook_menu().
*/
function xray_menu() {
$items['admin/reports/xray'] = array(
'title' => 'X-ray technical site overview',
'description' => 'See the guts of the site',
'page callback' => 'xray_overview_page',
'access callback' => TRUE,
);
$items['admin/reports/xray/overview'] = array(
'title' => 'Overview',
'description' => "Overview of the site's internals.",
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
return $items;
}