You are here

function advagg_menu in Advanced CSS/JS Aggregation 7.2

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

Implements hook_menu().

2 calls to advagg_menu()
advagg_password_policy_force_change_allowed_paths_alter in ./advagg.module
Implements hook_password_policy_force_change_allowed_paths_alter().
_advagg_process_html in ./advagg.module
Replacement for template_process_html().

File

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

Code

function advagg_menu() {
  list($css_path, $js_path) = advagg_get_root_files_dir();
  $file_path = drupal_get_path('module', 'advagg');
  $config_path = advagg_admin_config_root_path();
  $path_defined = FALSE;
  if (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) {
    $external_css = trim(parse_url(str_replace('/test.css', '/%', file_create_url($css_path[0] . '/test.css')), PHP_URL_PATH));
    if (strpos($external_css, $GLOBALS['base_path']) === 0) {
      $external_css = substr($external_css, strlen($GLOBALS['base_path']));
    }
    $external_js = trim(parse_url(str_replace('/test.js', '/%', file_create_url($js_path[0] . '/test.js')), PHP_URL_PATH));
    if (strpos($external_js, $GLOBALS['base_path']) === 0) {
      $external_js = substr($external_js, strlen($GLOBALS['base_path']));
    }
    $items[$external_css] = array(
      'title' => "Generate CSS Aggregate",
      'page callback' => 'advagg_missing_aggregate',
      'type' => MENU_CALLBACK,
      // Allow anyone to access these public css files.
      'access callback' => TRUE,
      'file path' => $file_path,
      'file' => 'advagg.missing.inc',
    );
    $items[$external_js] = array(
      'title' => "Generate JS Aggregate",
      'page callback' => 'advagg_missing_aggregate',
      'type' => MENU_CALLBACK,
      // Allow anyone to access these public js files.
      'access callback' => TRUE,
      'file path' => $file_path,
      'file' => 'advagg.missing.inc',
    );
    $path_defined = TRUE;
  }
  if (!$path_defined) {
    $items[$css_path[1] . '/%'] = array(
      'title' => "Generate CSS Aggregate",
      'page callback' => 'advagg_missing_aggregate',
      'type' => MENU_CALLBACK,
      // Allow anyone to access these public css files.
      'access callback' => TRUE,
      'file path' => $file_path,
      'file' => 'advagg.missing.inc',
    );
    $items[$js_path[1] . '/%'] = array(
      'title' => "Generate JS Aggregate",
      'page callback' => 'advagg_missing_aggregate',
      'type' => MENU_CALLBACK,
      // Allow anyone to access these public js files.
      'access callback' => TRUE,
      'file path' => $file_path,
      'file' => 'advagg.missing.inc',
    );
  }

  // If mutiple paths are symlinked to the same location; allow advagg to handle
  // those addtional locations.
  $advagg_additional_generate_paths = variable_get('advagg_additional_generate_paths', array());
  if (!empty($advagg_additional_generate_paths)) {
    foreach ($advagg_additional_generate_paths as $path) {
      $items[$path] = array(
        'title' => "Generate CSS/JS Aggregate",
        'page callback' => 'advagg_missing_aggregate',
        'type' => MENU_CALLBACK,
        // Allow anyone to access these public css files.
        'access callback' => TRUE,
        'file path' => $file_path,
        'file' => 'advagg.missing.inc',
      );
    }
  }
  $items[$config_path . '/default'] = array(
    'title' => 'Performance',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file path' => drupal_get_path('module', 'system'),
    'weight' => -10,
  );
  $items[$config_path . '/advagg'] = array(
    'title' => 'Advanced CSS/JS Aggregation',
    'description' => 'Configuration for Advanced CSS/JS Aggregation.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'advagg_admin_settings_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer site configuration',
    ),
    'file path' => $file_path,
    'file' => 'advagg.admin.inc',
    'weight' => 1,
  );
  $items[$config_path . '/advagg/config'] = array(
    'title' => 'Configuration',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items[$config_path . '/advagg/info'] = array(
    'title' => 'Information',
    'description' => 'More detailed information about advagg.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'advagg_admin_info_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer site configuration',
    ),
    'file path' => $file_path,
    'file' => 'advagg.admin.inc',
    'weight' => 18,
  );
  $items[$config_path . '/advagg/operations'] = array(
    'title' => 'Operations',
    'description' => 'Flush caches, set the bypass cookie, take drastic actions.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'advagg_admin_operations_form',
    ),
    'type' => MENU_LOCAL_TASK,
    'access arguments' => array(
      'administer site configuration',
    ),
    'file path' => $file_path,
    'file' => 'advagg.admin.inc',
    'weight' => 20,
  );
  return $items;
}