function _acquia_purge_input_validate in Acquia Purge 7
Validate a user provided path string.
Parameters
string $path: The Drupal path (for example: '<front>', 'user/1' or a alias).
Return value
false|string FALSE on success (!!) or a translated string describing what's wrong with the given user input.
4 calls to _acquia_purge_input_validate()
- acquia_purge_expire_cache in ./
acquia_purge.module - Implements hook_expire_cache().
- drush_acquia_purge_ap_purge in ./
acquia_purge.drush.inc - Purge a specified path from your balancers.
- _acquia_purge_action_flush_url in ./
acquia_purge.rules.inc - Purge URL(s) and Path(s), directly using Acquia Purge's APIs.
- __acquia_purge_manualpurge_validate in ./
acquia_purge.admin.inc - Form validation callback.
File
- ./
acquia_purge.module, line 545 - Acquia Purge, Top-notch Varnish purging on Acquia Cloud!
Code
function _acquia_purge_input_validate($path) {
static $history;
if (is_null($history)) {
$history = array();
}
// Start all the validation checks.
if (empty($path)) {
return _acquia_purge_input_validate_msgs('empty');
}
if (!is_string($path)) {
return _acquia_purge_input_validate_msgs('nostring');
}
if (stristr($path, 'http:') || stristr($path, 'https:')) {
return _acquia_purge_input_validate_msgs('url');
}
if (preg_match('/\\s/', $path)) {
return _acquia_purge_input_validate_msgs('space');
}
if (in_array($path, $history)) {
return _acquia_purge_input_validate_msgs('double');
}
// All tests passed, remember it for future duplication testing.
$history[] = $path;
return FALSE;
}