You are here

function authcache_p13n_admin_routes in Authenticated User Page Caching (Authcache) 7.2

Display a list of available routes and frontcontroller settings.

1 string reference to 'authcache_p13n_admin_routes'
authcache_p13n_menu in modules/authcache_p13n/authcache_p13n.module
Implements hook_menu().

File

modules/authcache_p13n/authcache_p13n.admin.inc, line 10
Administrative interface for the authcache personalization module.

Code

function authcache_p13n_admin_routes($form, &$form_state) {
  $router = authcache_p13n_request_get_router();
  $resources = authcache_p13n_request_resources();
  $form['help'] = array(
    '#title' => t('Frontcontroller'),
    '#type' => 'fieldset',
  );
  $form['help']['description'] = array(
    '#markup' => '<p>' . t('The personalization frontcontroller is responsible for dispatching Ajax / ESI requests to an appropriate handler class and serving fragments to the browser or to a reverse caching proxy server.') . '</p>' . '<p>' . t('The table below lists all defined routes. The second table shows important variables and their values. Normally those settings need not to be changed. If this is nontheless necessary, customization may be done through <code>settings.php</code> file.') . '</p>',
  );
  $variables = array(
    'authcache_p13n_frontcontroller_path' => array(
      'title' => t('Front controller path'),
      'description' => t('The path to the frontcontroller script used to serve personalized content. By copying the safe frontcontroller script into the drupal root directory, it is possible to reduce the URL length. See the README.txt for more information.'),
      'value' => variable_get('authcache_p13n_frontcontroller_path', drupal_get_path('module', 'authcache_p13n') . '/frontcontroller/authcache.php'),
    ),
    'authcache_p13n_checkheader' => array(
      'title' => t('Check header flag'),
      'description' => t('Specifies whether the X-Authcache header should be examined on incomming requests to the personalization frontcontroller in order to prevent XSS attacks'),
      'value' => variable_get('authcache_p13n_checkheader', TRUE) ? t('Yes') : t('No'),
    ),
    'authcache_p13n_router' => array(
      'title' => t('Router class'),
      'description' => t('The class used to dispatch incomming personalization requests to appropriate handler objects.'),
      'value' => variable_get('authcache_p13n_router', 'AuthcacheP13nDefaultRequestRouter'),
    ),
    'authcache_p13n_default_request_router_autorebuild' => array(
      'title' => t('Autorebuild router'),
      'description' => t('Specifies whether the request router should try to rebuild the routing information when a request handler is missing'),
      'value' => variable_get('authcache_p13n_default_request_router_autorebuild', TRUE) ? t('Yes') : t('No'),
    ),
  );
  $header = array(
    t('Route ID'),
    t('Request handler'),
    t('URL generator'),
    t('Route exists'),
    '',
  );
  $rows = array();
  foreach ($resources as $route_id => $resource) {
    $rows[] = array(
      $route_id,
      $resource['handler']['#class'],
      $resource['url generator']['#class'],
      authcache_p13n_request_exists($route_id) ? t('Yes') : t('No'),
      l(t('Details'), 'admin/config/system/authcache/p13n/frontcontroller/route/' . $route_id),
    );
  }
  $form['routes'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  $header = array(
    t('Variable'),
    t('Value and description'),
  );
  $rows = array();
  foreach ($variables as $varname => $record) {
    $rows[] = array(
      array(
        'valign' => 'top',
        'rowspan' => 2,
        'data' => '<strong>' . $record['title'] . '</strong>' . ' (' . check_plain($varname) . ')',
      ),
      $record['value'],
    );
    $rows[] = array(
      array(
        'data' => $record['description'],
      ),
    );
  }
  $form['variables'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['rebuild'] = array(
    '#type' => 'submit',
    '#value' => t('Rebuild routes'),
  );
  return $form;
}