Révision 74f6bef0
Ajouté par Assos Assos il y a plus de 10 ans
drupal7/sites/all/themes/adaptivetheme/at_core/inc/forms/at_core.submit.info.inc | ||
---|---|---|
8 | 8 |
* current values - useful for migration or simply capturing the current |
9 | 9 |
* theme settings as defaults. |
10 | 10 |
*/ |
11 |
|
|
12 |
$theme_settings = $values; |
|
13 |
if ($theme_settings) { |
|
14 |
$dynamic_settings_info = array(); |
|
15 |
$static_settings_info = array(); |
|
16 |
$lt = list_themes(); |
|
17 |
foreach ($lt as $key => $value) { |
|
18 |
if ($theme_name == $key) { |
|
19 |
$this_themes_info = $lt[$theme_name]->info; |
|
20 |
foreach ($this_themes_info as $k => $v) { |
|
21 |
// Basic info - name, desc, base theme, release, core, engine and screenshot |
|
22 |
if ($k == 'name') { |
|
23 |
$static_settings_info[] = 'name = ' . $v; |
|
24 |
} |
|
25 |
if ($k == 'description') { |
|
26 |
$v = $v ? $v : $theme_name . ' is rocking the hardest!'; |
|
27 |
$static_settings_info[] = 'description = ' . $v; |
|
28 |
} |
|
29 |
if ($k == 'base theme') { |
|
30 |
$static_settings_info[] = 'base theme = ' . $v; |
|
31 |
} |
|
32 |
if ($k == 'release') { |
|
33 |
$static_settings_info[] = 'release = ' . $v; |
|
34 |
} |
|
35 |
if ($k == 'core') { |
|
36 |
$static_settings_info[] = 'core = 7.x'; |
|
37 |
} |
|
38 |
if ($k == 'engine') { |
|
39 |
$static_settings_info[] = 'engine = phptemplate'; |
|
40 |
} |
|
41 |
if ($k == 'screenshot') { |
|
42 |
$static_settings_info[] = 'screenshot = screenshot.png'; |
|
43 |
} |
|
44 |
// Stylesheets |
|
45 |
if ($k == 'stylesheets' && !empty($k)) { |
|
46 |
foreach ($v as $media_target => $stylesheet_file) { |
|
47 |
foreach ($stylesheet_file as $stylesheet_file_name => $stylesheet_file_path) { |
|
48 |
$static_settings_info[] = "stylesheets[$media_target][] = $stylesheet_file_name"; |
|
11 |
function at_core_submit_info($values, $theme_name, $path) { |
|
12 |
$theme_settings = $values; |
|
13 |
if ($theme_settings) { |
|
14 |
$dynamic_settings_info = array(); |
|
15 |
$static_settings_info = array(); |
|
16 |
$lt = list_themes(); |
|
17 |
foreach ($lt as $key => $value) { |
|
18 |
if ($theme_name == $key) { |
|
19 |
$this_themes_info = $lt[$theme_name]->info; |
|
20 |
foreach ($this_themes_info as $k => $v) { |
|
21 |
// Basic info - name, desc, base theme, release, core, engine and screenshot |
|
22 |
if ($k == 'name') { |
|
23 |
$static_settings_info[] = 'name = ' . $v; |
|
24 |
} |
|
25 |
if ($k == 'description') { |
|
26 |
$v = $v ? $v : $theme_name . ' is rocking the hardest!'; |
|
27 |
$static_settings_info[] = 'description = ' . $v; |
|
28 |
} |
|
29 |
if ($k == 'base theme') { |
|
30 |
$static_settings_info[] = 'base theme = ' . $v; |
|
31 |
} |
|
32 |
if ($k == 'release') { |
|
33 |
$static_settings_info[] = 'release = ' . $v; |
|
34 |
} |
|
35 |
if ($k == 'core') { |
|
36 |
$static_settings_info[] = 'core = 7.x'; |
|
37 |
} |
|
38 |
if ($k == 'engine') { |
|
39 |
$static_settings_info[] = 'engine = phptemplate'; |
|
40 |
} |
|
41 |
if ($k == 'screenshot') { |
|
42 |
$static_settings_info[] = 'screenshot = screenshot.png'; |
|
43 |
} |
|
44 |
// Stylesheets |
|
45 |
if ($k == 'stylesheets' && !empty($k)) { |
|
46 |
foreach ($v as $media_target => $stylesheet_file) { |
|
47 |
foreach ($stylesheet_file as $stylesheet_file_name => $stylesheet_file_path) { |
|
48 |
$static_settings_info[] = "stylesheets[$media_target][] = $stylesheet_file_name"; |
|
49 |
} |
|
49 | 50 |
} |
50 | 51 |
} |
51 |
}
|
|
52 |
// IE Stylesheets
|
|
53 |
if ($k == 'ie_stylesheets' && !empty($k)) {
|
|
54 |
foreach ($v as $media_target => $condition) {
|
|
55 |
foreach ($condition as $conditional_comment => $condition_file) {
|
|
56 |
foreach ($condition_file as $conditional_file_path) {
|
|
57 |
$static_settings_info[] = "ie_stylesheets[$media_target][$conditional_comment][] = $conditional_file_path";
|
|
52 |
// IE Stylesheets
|
|
53 |
if ($k == 'ie_stylesheets' && !empty($k)) {
|
|
54 |
foreach ($v as $media_target => $condition) {
|
|
55 |
foreach ($condition as $conditional_comment => $condition_file) {
|
|
56 |
foreach ($condition_file as $conditional_file_path) {
|
|
57 |
$static_settings_info[] = "ie_stylesheets[$media_target][$conditional_comment][] = $conditional_file_path";
|
|
58 |
}
|
|
58 | 59 |
} |
59 | 60 |
} |
60 | 61 |
} |
61 |
}
|
|
62 |
// Scripts
|
|
63 |
if ($k == 'scripts' && !empty($k)) {
|
|
64 |
foreach ($v as $script => $file) {
|
|
65 |
$static_settings_info[] = "scripts[] = $script";
|
|
62 |
// Scripts
|
|
63 |
if ($k == 'scripts' && !empty($k)) {
|
|
64 |
foreach ($v as $script => $file) {
|
|
65 |
$static_settings_info[] = "scripts[] = $script";
|
|
66 |
}
|
|
66 | 67 |
} |
67 |
}
|
|
68 |
// IE Scripts
|
|
69 |
if ($k == 'ie_scripts' && !empty($k)) {
|
|
70 |
foreach ($v as $condition => $condition_file) {
|
|
71 |
foreach ($condition_file as $conditional_file_path) {
|
|
72 |
$static_settings_info[] = "ie_scripts[$condition][] = $conditional_file_path";
|
|
68 |
// IE Scripts
|
|
69 |
if ($k == 'ie_scripts' && !empty($k)) {
|
|
70 |
foreach ($v as $condition => $condition_file) {
|
|
71 |
foreach ($condition_file as $conditional_file_path) {
|
|
72 |
$static_settings_info[] = "ie_scripts[$condition][] = $conditional_file_path";
|
|
73 |
}
|
|
73 | 74 |
} |
74 | 75 |
} |
75 |
}
|
|
76 |
// Regions
|
|
77 |
if ($k == 'regions') {
|
|
78 |
foreach ($v as $name => $label) {
|
|
79 |
$static_settings_info[] = "regions[$name] = $label";
|
|
76 |
// Regions
|
|
77 |
if ($k == 'regions') {
|
|
78 |
foreach ($v as $name => $label) {
|
|
79 |
$static_settings_info[] = "regions[$name] = $label";
|
|
80 |
}
|
|
80 | 81 |
} |
81 |
}
|
|
82 |
// Features
|
|
83 |
if ($k == 'features') {
|
|
84 |
foreach ($v as $feature_key => $feature) {
|
|
85 |
$static_settings_info[] = "features[] = $feature";
|
|
82 |
// Features
|
|
83 |
if ($k == 'features') {
|
|
84 |
foreach ($v as $feature_key => $feature) {
|
|
85 |
$static_settings_info[] = "features[] = $feature";
|
|
86 |
}
|
|
86 | 87 |
} |
87 | 88 |
} |
88 | 89 |
} |
89 | 90 |
} |
90 |
} |
|
91 |
if (!empty($static_settings_info)) { |
|
92 |
$static_settings = implode("\n", $static_settings_info); |
|
93 |
} |
|
94 |
// Might need to check this and add some more exclusions |
|
95 |
$exclusions = array( |
|
96 |
'var', |
|
97 |
'default_logo', |
|
98 |
'logo_path', |
|
99 |
'logo_upload', |
|
100 |
'default_favicon', |
|
101 |
'favicon_path', |
|
102 |
'favicon_upload', |
|
103 |
'submit', |
|
104 |
'form_build_id', |
|
105 |
'form_token', |
|
106 |
'form_id', |
|
107 |
'check', |
|
108 |
'output', |
|
109 |
'op', |
|
110 |
'scheme', |
|
111 |
'palette', |
|
112 |
'theme', |
|
113 |
'info', |
|
114 |
'at-layout__active_tab', |
|
115 |
'at-settings__active_tab', |
|
116 |
'at__active_tab', |
|
117 |
); |
|
118 |
foreach ($theme_settings as $setting_name => $setting_value) { |
|
119 |
if ($setting_name == 'global_gutter_width') { |
|
120 |
if (empty($setting_value)) { |
|
121 |
$exclusions[] = 'global_gutter_width'; |
|
122 |
} |
|
91 |
if (!empty($static_settings_info)) { |
|
92 |
$static_settings = implode("\n", $static_settings_info); |
|
123 | 93 |
} |
124 |
if (isset($setting_value) && $setting_value !== '<none>' && !in_array($setting_name, $exclusions)) { |
|
125 |
if (empty($setting_value) && !is_numeric($setting_value)) { |
|
126 |
$setting_value = "''"; |
|
94 |
// Might need to check this and add some more exclusions |
|
95 |
$exclusions = array( |
|
96 |
'var', |
|
97 |
'default_logo', |
|
98 |
'logo_path', |
|
99 |
'logo_upload', |
|
100 |
'default_favicon', |
|
101 |
'favicon_path', |
|
102 |
'favicon_upload', |
|
103 |
'submit', |
|
104 |
'form_build_id', |
|
105 |
'form_token', |
|
106 |
'form_id', |
|
107 |
'check', |
|
108 |
'output', |
|
109 |
'op', |
|
110 |
'scheme', |
|
111 |
'palette', |
|
112 |
'theme', |
|
113 |
'info', |
|
114 |
'at-layout__active_tab', |
|
115 |
'at-settings__active_tab', |
|
116 |
'at__active_tab', |
|
117 |
'header_upload' // noggin setting |
|
118 |
); |
|
119 |
foreach ($theme_settings as $setting_name => $setting_value) { |
|
120 |
if ($setting_name == 'global_gutter_width') { |
|
121 |
if (empty($setting_value)) { |
|
122 |
$exclusions[] = 'global_gutter_width'; |
|
123 |
} |
|
124 |
} |
|
125 |
if (isset($setting_value) && $setting_value !== '<none>' && !in_array($setting_name, $exclusions)) { |
|
126 |
if (empty($setting_value) && !is_numeric($setting_value)) { |
|
127 |
$setting_value = "''"; |
|
128 |
} |
|
129 |
$dynamic_settings_info[] = "settings[$setting_name] = $setting_value"; |
|
127 | 130 |
} |
128 |
$dynamic_settings_info[] = "settings[$setting_name] = $setting_value"; |
|
129 | 131 |
} |
130 |
}
|
|
131 |
if (!empty($dynamic_settings_info)) {
|
|
132 |
$dynamic_settings_info = $dynamic_settings_info ? $dynamic_settings_info : "''";
|
|
133 |
$dynamic_settings = implode("\n", $dynamic_settings_info);
|
|
134 |
}
|
|
135 |
if (!empty($static_settings_info) && !empty($dynamic_settings_info)) {
|
|
136 |
$combined_values = $static_settings . "\n" . $dynamic_settings; // ideally run a sanity check but all of them convert entities, which won't work for code
|
|
137 |
$filepath = $path . '/' . $theme_name . '_settings.info';
|
|
138 |
file_unmanaged_save_data($combined_values, $filepath, FILE_EXISTS_REPLACE);
|
|
132 |
if (!empty($dynamic_settings_info)) {
|
|
133 |
$dynamic_settings_info = $dynamic_settings_info ? $dynamic_settings_info : "''";
|
|
134 |
$dynamic_settings = implode("\n", $dynamic_settings_info);
|
|
135 |
}
|
|
136 |
if (!empty($static_settings_info) && !empty($dynamic_settings_info)) {
|
|
137 |
$combined_values = $static_settings . "\n" . $dynamic_settings; // ideally run a sanity check but all of them convert entities
|
|
138 |
$filepath = $path . '/' . $theme_name . '_settings.info.txt';
|
|
139 |
file_unmanaged_save_data($combined_values, $filepath, FILE_EXISTS_REPLACE);
|
|
140 |
}
|
|
139 | 141 |
} |
140 | 142 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules