function advagg_get_root_files_dir in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7.2 advagg.module \advagg_get_root_files_dir()
- 7 advagg.module \advagg_get_root_files_dir()
Get the CSS & JS path for advagg.
Parameters
$reset: reset the static variables.
Return value
array($css_path, $js_path)
17 calls to advagg_get_root_files_dir()
- advagg_admin_info_form in ./
advagg.admin.inc - Form builder; Configure advagg settings.
- advagg_admin_master_reset in ./
advagg.admin.inc - Master reset button.
- advagg_admin_recreate_htaccess in ./
advagg.admin.inc - Rebuild htaccess files.
- advagg_admin_settings_form_submit in ./
advagg.admin.inc - Validate form values. Used to unset variables before they get saved.
- advagg_admin_settings_form_validate in ./
advagg.admin.inc - Validate form values. Used to unset variables before they get saved.
File
- ./
advagg.module, line 433 - Advanced CSS/JS aggregation module
Code
function advagg_get_root_files_dir($reset = FALSE) {
static $css_path = '';
static $js_path = '';
if ($reset) {
$css_path = '';
$js_path = '';
}
if (!empty($css_path) && !empty($js_path)) {
return array(
$css_path,
$js_path,
);
}
$public_downloads = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC;
if (!$public_downloads) {
$custom_path = variable_get('advagg_custom_files_dir', ADVAGG_CUSTOM_FILES_DIR);
}
if (empty($custom_path)) {
$file_path = file_directory_path();
$css_path = file_create_path($file_path . '/advagg_css');
$js_path = file_create_path($file_path . '/advagg_js');
return array(
$css_path,
$js_path,
);
}
file_check_directory($custom_path, FILE_CREATE_DIRECTORY);
// Get path name
if (!variable_get('advagg_no_conf_path', FALSE)) {
$conf_path = conf_path();
if (is_link($conf_path)) {
$path = readlink($conf_path);
}
$conf_path = str_replace("\\", '/', $conf_path);
$conf_path = explode('/', $conf_path);
$conf_path = array_pop($conf_path);
$custom_path = $custom_path . '/' . $conf_path;
}
file_check_directory($custom_path, FILE_CREATE_DIRECTORY);
$css_path = $custom_path . '/advagg_css';
$js_path = $custom_path . '/advagg_js';
file_check_directory($css_path, FILE_CREATE_DIRECTORY);
file_check_directory($js_path, FILE_CREATE_DIRECTORY);
return array(
$css_path,
$js_path,
);
}