// pre-existing logic
if (isset($path)) {
$queryParts[] = 'page=CiviCRM';
- // Encode all but the *path* placeholder
- if ($path !== '*path*') {
- $path = rawurlencode($path);
- }
- $queryParts[] = "q={$path}";
+ $queryParts[] = 'q=' . rawurlencode($path);
}
if ($wpPageParam) {
$queryParts[] = $wpPageParam;
* Determine the native ID of the CMS user.
*
* @param string $username
- * @return int|NULL
+ *
+ * @return int|null
*/
public function getUfId($username) {
$userdata = get_user_by('login', $username);
];
}
+ /**
+ * Send an HTTP Response base on PSR HTTP RespnseInterface response.
+ *
+ * @param \Psr\Http\Message\ResponseInterface $response
+ */
+ public function sendResponse(\Psr\Http\Message\ResponseInterface $response) {
+ // use WordPress function status_header to ensure 404 response is sent
+ status_header($response->getStatusCode());
+ foreach ($response->getHeaders() as $name => $values) {
+ CRM_Utils_System::setHttpHeader($name, implode(', ', (array) $values));
+ }
+ echo $response->getBody();
+ CRM_Utils_System::civiExit();
+ }
+
}