You are here

public function AcquiaPurgeProcessorAjax::isPathBlacklisted in Acquia Purge 7

Determine if the current request path is blacklisted.

On-screen notifications and interactive on-screen purge processing is not always appreciated or can break the layout at places like popups or AJAX callbacks. Therefore this helper attempts to prevent user annoyances the best it can, but if error messages or the on-screen purge processor are shown on a certain page, you know what to patch ;).

Return value

bool FALSE indicates pass, TRUE indicates that the path is blacklisted.

1 call to AcquiaPurgeProcessorAjax::isPathBlacklisted()
AcquiaPurgeProcessorAjax::onInit in lib/processor/AcquiaPurgeProcessorAjax.php
Implements event onInit.

File

lib/processor/AcquiaPurgeProcessorAjax.php, line 133
Contains AcquiaPurgeProcessorAjax.

Class

AcquiaPurgeProcessorAjax
Process the queue using a AJAX client-side UI.

Code

public function isPathBlacklisted() {

  // If we're called too early, don't make any noise.
  if (!isset($_GET['q'])) {
    return FALSE;
  }
  elseif (in_array($_GET['q'], $this->blacklist)) {
    return TRUE;
  }

  // Avoid paths that contain any of these snippets.
  $snippets = array(
    'autocomplete',
    'ajax',
  );
  foreach ($snippets as $snippet) {
    if (stristr($_GET['q'], $snippet)) {
      return TRUE;
    }
  }
  return FALSE;
}