isGhosted() публичный метод

A property is ghosted if it is NOT listed in the SUPPORTED list sent by the client AND is NOT present in the request data.
public isGhosted ( string $property, array $options = [] ) : boolean
$property string The property to check
$options array An array of options: - ignoreEmptyPictureTagCheck: boolean If true, will not check for the QUIRK_INCORRECTLY_SENDS_EMPTY_PICTURE_TAG quirk. @since 2.32.0
Результат boolean
Пример #1
0
 public function testEmptySupportedTag()
 {
     $state = $this->getMockSkipConstructor('Horde_ActiveSync_State_Base');
     $fixture = array('userAgent' => 'Apple-iPad3C6/1202.435', 'properties' => array(Horde_ActiveSync_Device::OS => 'iOS 8.1.1'));
     $device = new Horde_ActiveSync_Device($state, $fixture);
     $contact = new Horde_ActiveSync_Message_Contact(array('device' => $device));
     $contact->setSupported(array(Horde_ActiveSync::ALL_GHOSTED));
     $this->assertEquals(true, $contact->isGhosted('fileas'));
 }
Пример #2
0
 public function testPictureGhosted()
 {
     $state = $this->getMockSkipConstructor('Horde_ActiveSync_State_Base');
     $fixture = array('deviceType' => 'iPod', 'userAgent' => 'Apple-iPod2C1/803.148');
     $device = new Horde_ActiveSync_Device($state, $fixture);
     $contact = new Horde_ActiveSync_Message_Contact(array('device' => $device));
     $this->assertEquals(true, $contact->isGhosted(Horde_ActiveSync_Message_Contact::PICTURE));
     $fixture = array('deviceType' => 'iPad', 'userAgent' => 'Apple-iPad3C6/1202.435', 'properties' => array(Horde_ActiveSync_Device::OS => 'iOS 8.1.1'));
     $device = new Horde_ActiveSync_Device($state, $fixture);
     $contact = new Horde_ActiveSync_Message_Contact(array('device' => $device));
     $this->assertEquals(false, $contact->isGhosted(Horde_ActiveSync_Message_Contact::PICTURE));
 }
Пример #3
0
 /**
  * Convert an ActiveSync contact message into a hash suitable for
  * importing via self::add().
  *
  * @param Horde_ActiveSync_Message_Contact $message  The contact message
  *                                                   object.
  *
  * @return array  A contact hash.
  */
 public function fromASContact(Horde_ActiveSync_Message_Contact $message)
 {
     $hash = array();
     foreach (self::$_asMap as $turbaField => $asField) {
         if (!$message->isGhosted($asField)) {
             try {
                 $hash[$turbaField] = $message->{$asField};
             } catch (InvalidArgumentException $e) {
             }
         }
     }
     /* Requires special handling */
     try {
         if ($message->getProtocolVersion() >= Horde_ActiveSync::VERSION_TWELVE) {
             if (!empty($message->airsyncbasebody)) {
                 $hash['notes'] = $message->airsyncbasebody->data;
             }
         } else {
             $hash['notes'] = $message->body;
         }
     } catch (InvalidArgumentException $e) {
     }
     // picture ($message->picture *should* already be base64 encdoed)
     if (!$message->isGhosted('picture')) {
         $hash['photo'] = base64_decode($message->picture);
     }
     /* Email addresses */
     $hash['emails'] = array();
     if (!$message->isGhosted('email1address')) {
         $e = Horde_Icalendar_Vcard::getBareEmail($message->email1address);
         $hash['emails'][] = $hash['email'] = $e ? $e : '';
     }
     if (!$message->isGhosted('email2address')) {
         $e = Horde_Icalendar_Vcard::getBareEmail($message->email2address);
         $hash['emails'][] = $hash['homeEmail'] = $e ? $e : '';
     }
     if (!$message->isGhosted('email3address')) {
         $e = Horde_Icalendar_Vcard::getBareEmail($message->email3address);
         $hash['emails'][] = $hash['workEmail'] = $e ? $e : '';
     }
     $hash['emails'] = implode(',', $hash['emails']);
     /* Categories */
     if (is_array($message->categories) && count($message->categories)) {
         $hash['__tags'] = $message->categories;
     }
     /* Children */
     if (is_array($message->children) && count($message->children)) {
         // We use a comma as incoming delimiter as it's the most
         // common even though it might be used withing a name string.
         $hash['children'] = implode(', ', $message->children);
     } elseif (!$message->isGhosted('children')) {
         $hash['children'] = '';
     }
     /* Birthday and Anniversary */
     if (!empty($message->birthday)) {
         $bday = new Horde_Date($message->birthday);
         $bday->setTimezone(date_default_timezone_get());
         $hash['birthday'] = $bday->format('Y-m-d');
     } elseif (!$message->isGhosted('birthday')) {
         $hash['birthday'] = '';
     }
     if (!empty($message->anniversary)) {
         $anniversary = new Horde_Date($message->anniversary);
         $anniversary->setTimezone(date_default_timezone_get());
         $hash['anniversary'] = $anniversary->format('Y-m-d');
     } elseif (!$message->isGhosted('anniversary')) {
         $hash['anniversary'] = '';
     }
     /* Countries */
     include 'Horde/Nls/Countries.php';
     if (!empty($message->homecountry)) {
         if (!empty($this->map['homeCountryFree'])) {
             $hash['homeCountryFree'] = $message->homecountry;
         } else {
             $country = array_search($message->homecountry, $countries);
             if ($country === false) {
                 $country = $message->homecountry;
             }
             $hash['homeCountry'] = $country;
         }
     } elseif (!$message->isGhosted('homecountry')) {
         $hash['homeCountry'] = '';
     }
     if (!empty($message->businesscountry)) {
         if (!empty($this->map['workCountryFree'])) {
             $hash['workCountryFree'] = $message->businesscountry;
         } else {
             $country = array_search($message->businesscountry, $countries);
             if ($country === false) {
                 $country = $message->businesscountry;
             }
             $hash['workCountry'] = $country;
         }
     } elseif (!$message->isGhosted('businesscountry')) {
         $hash['workCountry'] = '';
     }
     if (!empty($message->othercountry)) {
         if (!empty($this->map['otherCountryFree'])) {
             $hash['otherCountryFree'] = $message->othercountry;
         } else {
             $country = array_search($message->othercountry, $countries);
             if ($country === false) {
                 $country = $message->othercountry;
             }
             $hash['otherCountry'] = $country;
         }
     } elseif (!$message->isGhosted('othercountry')) {
         $hash['otherCountry'] = '';
     }
     return $hash;
 }