Unverified Commit 8de877d8 authored by mattwire's avatar mattwire Committed by GitHub
Browse files

Merge pull request #33 from mattwire/fix_staticcontext

Remove accessing $this in static context
parents b90c5779 4bf8f613
......@@ -42,7 +42,7 @@ class CRM_Civicrmpostcodelookup_Page_Afd extends CRM_Civicrmpostcodelookup_Page_
*/
public static function search() {
$postcode = self::getPostcode(TRUE); // FIXME: Check whether API requires space or not
$number = CRM_Utils_Request::retrieve('number', 'String', $this, false);
$number = CRM_Utils_Request::retrieve('number', 'String');
$querystring = self::getAFDCredentials(1);
$querystring = $querystring . "&postcode=" . $postcode . "&property=" . $number;
......@@ -95,7 +95,10 @@ class CRM_Civicrmpostcodelookup_Page_Afd extends CRM_Civicrmpostcodelookup_Page_
* Function to get address details based on the AFD addressid/postkey
*/
public static function getaddress() {
$moniker = CRM_Utils_Request::retrieve('id', 'String', $this, true);
$moniker = CRM_Utils_Request::retrieve('id', 'String');
if (empty($moniker)) {
exit;
}
$address = self::getAddressByMoniker($moniker);
$response = array(
......
......@@ -41,7 +41,7 @@ class CRM_Civicrmpostcodelookup_Page_Civipostcode extends CRM_Civicrmpostcodeloo
*/
public static function search() {
$postcode = self::getPostcode(TRUE);
$number = CRM_Utils_Request::retrieve('number', 'String', $this, false);
$number = CRM_Utils_Request::retrieve('number', 'String');
$querystring = self::getCivipostcodeCredentials(1);
$querystring = $querystring . "&postcode=" . urlencode($postcode) . "&property=" . $number;
......@@ -110,7 +110,10 @@ class CRM_Civicrmpostcodelookup_Page_Civipostcode extends CRM_Civicrmpostcodeloo
* Function to get address details based on the Civipostcode address id
*/
public static function getaddress() {
$moniker = CRM_Utils_Request::retrieve('id', 'String', $this, true);
$moniker = CRM_Utils_Request::retrieve('id', 'String');
if (empty($moniker)) {
exit;
}
$address = self::getAddressByMoniker($moniker);
$response = array(
......
......@@ -44,7 +44,10 @@ class CRM_PostcodeLookup_Page_Ajax extends CRM_Civicrmpostcodelookup_Page_Postco
public static function search() {
$postcode = self::getPostcode(TRUE); // FIXME: Check whether API requires space or not
$number = CRM_Utils_Request::retrieve('number', 'String', $this, true);
$number = CRM_Utils_Request::retrieve('number', 'String');
if (!$number) {
exit;
}
$qaCapture = self::getQACapture();
$ret = $qaCapture->Search("$number, $postcode", 'GBR', 'Singleline', true);//, $intensity, $promptset, $threshold, $timeout, $layout, $formattedAddressInPicklist, $requestTag, $localisation)
......@@ -80,7 +83,10 @@ class CRM_PostcodeLookup_Page_Ajax extends CRM_Civicrmpostcodelookup_Page_Postco
}
public static function getaddress() {
$moniker = CRM_Utils_Request::retrieve('id', 'String', $this, true);
$moniker = CRM_Utils_Request::retrieve('id', 'String');
if (empty($moniker)) {
exit;
}
$address = self::getAddressByMoniker($moniker);
$response = array(
......@@ -94,7 +100,10 @@ class CRM_PostcodeLookup_Page_Ajax extends CRM_Civicrmpostcodelookup_Page_Postco
private static function getQACapture() {
if(self::$qacampture === null) {
// @todo retrieved value should be encoded somehow, MD5 or whatever
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this, TRUE, '1');
$mode = CRM_Utils_Request::retrieve('mode', 'String');
if (!$mode) {
$mode = '1';
}
$params = self::getQasCredentials($mode);
self::$qacampture = new QASCapture($params);
}
......
......@@ -18,7 +18,7 @@ class CRM_Civicrmpostcodelookup_Page_GetAddressIo extends CRM_Civicrmpostcodeloo
if (!self::isValidPostcode($postcode)) {
exit;
}
$number = CRM_Utils_Request::retrieve('number', 'String', $this, FALSE);
$number = CRM_Utils_Request::retrieve('number', 'String');
$apiUrl = self::getAddressIoApiUrl($postcode, $number);
// get address result from getAddress.io
$addressData = self::addressAPIResult($apiUrl);
......@@ -47,10 +47,8 @@ class CRM_Civicrmpostcodelookup_Page_GetAddressIo extends CRM_Civicrmpostcodeloo
* Function to get address details based on the selected address
*/
public static function getaddress() {
try {
$selectedId = CRM_Utils_Request::retrieve('id', 'String', $this, TRUE, NULL, 'REQUEST', TRUE);
}
catch (CRM_Core_Exception $e) {
$selectedId = CRM_Utils_Request::retrieve('id', 'String');
if (empty($selectedId)) {
exit;
}
......
......@@ -11,7 +11,7 @@ abstract class CRM_Civicrmpostcodelookup_Page_Postcode extends CRM_Core_Page {
* @return string
*/
protected static function getPostcode($space = FALSE) {
$postcode = CRM_Utils_Request::retrieve('term', 'String', $this, true);
$postcode = CRM_Utils_Request::retrieve('term', 'String');
return self::format($postcode, $space);
}
......
......@@ -97,7 +97,10 @@ class CRM_Civicrmpostcodelookup_Page_PostcodeAnywhere extends CRM_Civicrmpostcod
* Function to get address details based on the PostcodeAnywhere addressid/postkey
*/
public static function getaddress() {
$moniker = CRM_Utils_Request::retrieve('id', 'String', $this, true);
$moniker = CRM_Utils_Request::retrieve('id', 'String');
if (empty($moniker)) {
exit;
}
$address = self::getAddressByMoniker($moniker);
$response = array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment