Same name in other branches
  1. 7.x-1.x advagg.module \advagg_get_root_files_dir()

Get the CSS and JS path for advagg.


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

Paramètres

bool $reset: Set to TRUE to reset the static variables.

Return value

array Example return below:

43 calls to advagg_get_root_files_dir()
advagg_admin_clear_file_aggregates dans ./advagg.admin.inc
Remove the aggregates that contain the given filename.
advagg_admin_flush_cache_button dans ./advagg.admin.inc
Perform a smart flush.
advagg_admin_get_file_info dans ./advagg.admin.inc
Get detailed info about the given filename.
advagg_admin_info_form dans ./advagg.admin.inc
Form builder; Show info about advagg and advagg settings.
advagg_admin_operations_form dans ./advagg.admin.inc
Form builder; Do advagg operations.

... See full list

1 string reference to 'advagg_get_root_files_dir'
advagg_mod_admin_settings_form_submit dans advagg_mod/advagg_mod.admin.inc
Submit callback, clear out the advagg cache bin.

Fichier

./advagg.module, line 3656

Code

function advagg_get_root_files_dir($reset = FALSE) {
    $css_paths =& drupal_static(__FUNCTION__ . '_css');
    $js_paths =& drupal_static(__FUNCTION__ . '_js');
    // Make sure directories are available and writable.
    if (empty($css_paths) || empty($js_paths) || $reset) {
        // Default is public://.
        $prefix = variable_get('advagg_root_dir_prefix', ADVAGG_ROOT_DIR_PREFIX);
        $css_paths[0] = $prefix . 'advagg_css';
        $js_paths[0] = $prefix . 'advagg_js';
        file_prepare_directory($css_paths[0], FILE_CREATE_DIRECTORY);
        file_prepare_directory($js_paths[0], FILE_CREATE_DIRECTORY);
        // Set the URI of the directory.
        $css_paths[1] = advagg_get_relative_path($css_paths[0], 'css');
        $js_paths[1] = advagg_get_relative_path($js_paths[0], 'js');
        // If the css or js got a path, use it for the other missing one.
        if (empty($css_paths[1]) && !empty($js_paths[1])) {
            $css_paths[1] = str_replace('/advagg_js', '/advagg_css', $js_paths[1]);
        }
        elseif (empty($js_paths[1]) && !empty($css_paths[1])) {
            $js_paths[1] = str_replace('/advagg_css', '/advagg_js', $css_paths[1]);
        }
        // Fix if empty.
        if (empty($css_paths[1])) {
            $css_paths[1] = $css_paths[0];
        }
        if (empty($js_paths[1])) {
            $js_paths[1] = $js_paths[0];
        }
        // Allow other modules to alter css and js paths.
        // Call hook_advagg_get_root_files_dir_alter()
        drupal_alter('advagg_get_root_files_dir', $css_paths, $js_paths);
    }
    return array(
        $css_paths,
        $js_paths,
    );
}