You are here

function advagg_get_root_files_dir in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg.module \advagg_get_root_files_dir()
  2. 7.2 advagg.module \advagg_get_root_files_dir()

Get the CSS & JS path for advagg.

Return value

Example below: array( array( public://advagg_css, sites/default/files/advagg_css, ), array( public://advagg_js, sites/default/files/advagg_js, ), )

14 calls to advagg_get_root_files_dir()
advagg_admin_master_reset in includes/admin.inc
Master reset button.
advagg_admin_recreate_htaccess in includes/admin.inc
Rebuild htaccess files.
advagg_admin_settings_form_submit in includes/admin.inc
Validate form values. Used to unset variables before they get saved.
advagg_admin_settings_form_validate in includes/admin.inc
Validate form values. Used to unset variables before they get saved.
advagg_check_missing_handler in ./advagg.install
Check to see if the CSS/JS generator is working.

... See full list

File

./advagg.module, line 587
Advanced CSS/JS aggregation module

Code

function advagg_get_root_files_dir() {
  static $css_path;
  static $js_path;

  // Make sure directories are available and writable.
  if (empty($css_path) || empty($js_path)) {
    $css_path = 'public://advagg_css';
    $js_path = 'public://advagg_js';
    file_prepare_directory($css_path, FILE_CREATE_DIRECTORY);
    file_prepare_directory($js_path, FILE_CREATE_DIRECTORY);
    $css_path = parse_url(file_create_url($css_path));
    $js_path = parse_url(file_create_url($js_path));
  }
  return array(
    ltrim($css_path['path'], '/'),
    ltrim($js_path['path'], '/'),
  );
}