public static function validatePermalink($permalink_array, $pid = null, $type = null, $lid = null) { $validated = true; if (is_array($permalink_array)) { foreach ($permalink_array as $permalink) { if (preg_match('/^[a-z0-9_-]+$/iD', $permalink) !== 1) { $validated = false; } if (lC_Products_Admin::getPermalinkCount($permalink, $pid, $type, $lid) > 0) { $validated = false; } } } else { if (preg_match('/^[a-z0-9_-]+$/iD', $permalink_array) !== 1) { $validated = false; } if (lC_Products_Admin::getPermalinkCount($permalink_array, $pid, $type, $lid) > 0) { $validated = false; } } return $validated; }