Commit d93ae75d authored by Jim Fisk's avatar Jim Fisk
Browse files

Add translation placeholders, wrapped long lines, add l().

parent 9c95319a
Loading
Loading
Loading
Loading
+25 −7
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Sets cache to false for user inputted paths stored in uncache_pages table.
 */

/**
 * Implements hook_menu().
 */
@@ -25,7 +30,7 @@ function uncache_menu() {
/**
 * Builds the admin settings page.
 *
 * @return array $output
 * @return Array $output
 *   Associative array of admin settings.
 */
function uncache_admin_settings() {
@@ -54,7 +59,8 @@ function uncache_page_listing_table() {
      $nid = $node_path[1];
      $alias = drupal_get_path_alias($path);
      $stored_paths[] = array(
        'path' => '<a href="/' . $path . '" target="_blank">' . $path . '</a>',
        //'path' => '<a href="/' . $path . '" target="_blank">' . $path . '</a>',
        'path' => l($path, $path, array('attributes' => array('target' => '_blank'))),
        'alias' => $alias,
        'remove' => l(
          t("Remove this page from Uncache"),
@@ -84,7 +90,7 @@ function uncache_delete_page($nid) {
      ->condition('path', 'node/' . $nid)
      ->execute();
  }
  drupal_set_message(t('node/' . $nid . ' has been removed from Uncache'));
  drupal_set_message(t('node/@nid has been removed from Uncache', array('@nid' => $nid)));
  $options = array('fragment' => 'nl/admin/config/development/uncache');
  drupal_goto("/admin/config/development/uncache", $options);
}
@@ -129,13 +135,20 @@ function uncache_form_submit($form, &$form_state) {
    $alias = $input;
  }
  else {
    drupal_set_message(t('"' . $input . '" is not a valid path or alias'), 'error');
    $message = t('"@input" is not a valid path or alias', array(
      '@input' => $input,
    ));
    drupal_set_message($message, 'error');
    return;
  }

  // Check if input is already uncached.
  if (in_array($path, $stored_paths)) {
    drupal_set_message("The page with path \"$path\" and alias \"$alias\" is already being uncached", 'error');
    $message = t('The page with path "@path" and alias "@alias" is already uncached', array(
      '@path' => $path,
      '@alias' => $alias,
    ));
    drupal_set_message($message, 'error');
    return;
  }

@@ -145,7 +158,11 @@ function uncache_form_submit($form, &$form_state) {
      'path' => $path,
    ))
    ->execute();
  drupal_set_message('The page with path "' . $path . '" and alias "' . $alias . '" has been uncached');
  $message = t('The page with path "@path" and alias "@alias" has been uncached', array(
    '@path' => $path,
    '@alias' => $alias,
  ));
  drupal_set_message($message);

}

@@ -160,7 +177,8 @@ if (db_table_exists('uncache_pages')) {
// Remove page caching from uncached pages.
if (isset($stored_paths)) {
  foreach ($stored_paths as $stored_path) {
    if ( current_path() == $stored_path || current_path() == drupal_get_path_alias($stored_path) ) {
    $stored_alias = drupal_get_path_alias($stored_path);
    if (current_path() == $stored_path || current_path() == $stored_alias) {
      $GLOBALS['conf']['cache'] = FALSE;
      // Uncomment line below to see message on uncached pages for debugging.
      // drupal_set_message(t("This page is not being cached!"), 'warning');