Add country field to vCard QR codes
Also fixes the ADR component order to match the vCard 4.0 spec (pobox;ext;street;locality;region;code;country) - postcode and state were previously swapped.
This commit is contained in:
@@ -138,7 +138,14 @@
|
||||
<input type="text" name="state" value="" placeholder="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Country</label>
|
||||
<input type="text" name="country" value="" placeholder="" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class StaticQrcode {
|
||||
* create a qr code of type "vcard"
|
||||
*
|
||||
*/
|
||||
public function vcardQrcode($fullname, $nickname, $email, $website, $phone, $home_phone, $work_phone, $company, $role, $categories, $note, $photo, $address, $city, $postcode, $state)
|
||||
public function vcardQrcode($fullname, $nickname, $email, $website, $phone, $home_phone, $work_phone, $company, $role, $categories, $note, $photo, $address, $city, $postcode, $state, $country)
|
||||
{
|
||||
if($fullname != NULL && $phone != NULL){
|
||||
|
||||
@@ -188,7 +188,7 @@ class StaticQrcode {
|
||||
$vcard->categories($categories);
|
||||
$vcard->note($note);
|
||||
$vcard->photo($photo);
|
||||
$vcard->address($address, $city, $postcode, $state);
|
||||
$vcard->address($address, $city, $state, $postcode, $country);
|
||||
$vcard->create();
|
||||
|
||||
$this->sData = $vcard->get();
|
||||
@@ -202,7 +202,7 @@ class StaticQrcode {
|
||||
|
||||
$this->sContent .= '<div class="col-sm-4">';
|
||||
|
||||
$this->sContent .= '<strong>Phone:</strong> '.$phone.'<br>'.'<strong>Home Phone:</strong> '.$home_phone.'<br>'.'<strong>Work phone:</strong> '.$work_phone.'<br>'.'<strong>Address:</strong> '.$address.' '.$city.' '.$postcode.' '.$state.'</div>';
|
||||
$this->sContent .= '<strong>Phone:</strong> '.$phone.'<br>'.'<strong>Home Phone:</strong> '.$home_phone.'<br>'.'<strong>Work phone:</strong> '.$work_phone.'<br>'.'<strong>Address:</strong> '.$address.' '.$city.' '.$postcode.' '.$state.' '.$country.'</div>';
|
||||
|
||||
$this->sContent .= '</div>';
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ class vCard
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function address($sAddress, $sCity, $sPostcode, $sState)
|
||||
public function address($sAddress, $sCity, $sState, $sPostcode, $sCountry)
|
||||
{
|
||||
// Component order per vCard 4.0 ADR: pobox;ext;street;locality;region;code;country
|
||||
$this->sData .= 'ADR:;;'.$sAddress.';';
|
||||
$this->sData .= $sCity.';'.$sPostcode.';'.$sState."\n";
|
||||
$this->sData .= $sCity.';'.$sState.';'.$sPostcode.';'.$sCountry."\n";
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ if($_SERVER["REQUEST_METHOD"] === "POST" && !isset($_POST["edit"]) && !isset($_P
|
||||
case 'location': $static_qrcode_instance->locationQrcode($_POST['latitude'], $_POST['longitude']);
|
||||
break;
|
||||
|
||||
case 'vcard': $static_qrcode_instance->vcardQrcode($_POST['full_name'], $_POST['nickname'], $_POST['email'], $_POST['website'], $_POST['phone'], $_POST['home_phone'], $_POST['work_phone'], $_POST['company'], $_POST['role'], $_POST['categories'], $_POST['note'], $_POST['photo'], $_POST['address'], $_POST['city'], $_POST['post_code'], $_POST['state']);
|
||||
case 'vcard': $static_qrcode_instance->vcardQrcode($_POST['full_name'], $_POST['nickname'], $_POST['email'], $_POST['website'], $_POST['phone'], $_POST['home_phone'], $_POST['work_phone'], $_POST['company'], $_POST['role'], $_POST['categories'], $_POST['note'], $_POST['photo'], $_POST['address'], $_POST['city'], $_POST['post_code'], $_POST['state'], $_POST['country']);
|
||||
break;
|
||||
|
||||
case 'event': $static_qrcode_instance->eventQrcode($_POST['title'], $_POST['start'], $_POST['end'], $_POST['timezone'], $_POST['location'], $_POST['description'], $_POST['url']);
|
||||
|
||||
Reference in New Issue
Block a user