Skip to content

Commit

Permalink
Fix guards for FetLifeEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabacab committed Mar 12, 2016
1 parent f788de2 commit 92736cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions FetLife.php
Original file line number Diff line number Diff line change
Expand Up @@ -1220,15 +1220,15 @@ private function parseEventHtml ($html) {
@$doc->loadHTML($html);
$ret = array();
$ret['title'] = $this->usr->doXPathQuery('//h1[@itemprop="name"]', $doc)->item(0)->textContent;
if(!empty($this->usr->doXPathQuery('//h1[contains(@itemprop, "name")]/following-sibling::p', $doc)->item(0)->nodeValue)) {
if(!empty($this->usr->doXPathQuery('//h1[contains(@itemprop, "name")]/following-sibling::p', $doc)->item(0))) {
$ret['tagline'] = $this->usr->doXPathQuery('//h1[contains(@itemprop, "name")]/following-sibling::p', $doc)->item(0)->nodeValue;
}
$ret['dtstart'] = $this->usr->doXPathQuery('//*[contains(@itemprop, "startDate")]/@content', $doc)->item(0)->nodeValue;
$ret['dtend'] = $this->usr->doXPathQuery('//*[contains(@itemprop, "endDate")]/@content', $doc)->item(0)->nodeValue;
if(!empty($this->usr->doXPathQuery('//*[contains(@itemprop, "name")]', $doc)->item(1)->nodeValue)) {
if(!empty($this->usr->doXPathQuery('//*[contains(@itemprop, "name")]', $doc)->item(1))) {
$ret['venue_name'] = $this->usr->doXPathQuery('//*[contains(@itemprop, "name")]', $doc)->item(1)->nodeValue;
}
if(!empty($this->usr->doXPathQuery('//th/*[text()="Location:"]/../../td/*[contains(@class, "s")]/text()[1]', $doc)->item(0)->nodeValue)) {
if(!empty($this->usr->doXPathQuery('//th/*[text()="Location:"]/../../td/*[contains(@class, "s")]/text()[1]', $doc)->item(0))) {
$ret['venue_address'] = $this->usr->doXPathQuery('//th/*[text()="Location:"]/../../td/*[contains(@class, "s")]/text()[1]', $doc)->item(0)->nodeValue;
}
if ($location = $this->usr->doXPathQuery('//*[contains(@itemprop, "location")]', $doc)->item(0)) {
Expand All @@ -1238,11 +1238,11 @@ private function parseEventHtml ($html) {
$ret['adr']['locality'] = $locality->attributes->getNamedItem('content')->value;
}
}
if (!empty($this->usr->doXPathQuery('//th[text()="Cost:"]/../td', $doc)->item(0)->nodeValue)) {
if (!empty($this->usr->doXPathQuery('//th[text()="Cost:"]/../td', $doc)->item(0))) {
$ret['cost'] = $this->usr->doXPathQuery('//th[text()="Cost:"]/../td', $doc)->item(0)->nodeValue;
}

if (!empty($this->usr->doXPathQuery('//th[text()="Dress code:"]/../td', $doc)->item(0)->textContent)) {
if (!empty($this->usr->doXPathQuery('//th[text()="Dress code:"]/../td', $doc)->item(0))) {
$ret['dress_code'] = $this->usr->doXPathQuery('//th[text()="Dress code:"]/../td', $doc)->item(0)->textContent;
}
// TODO: Save an HTML representation of the description, then make a getter that returns a text-only version.
Expand Down

0 comments on commit 92736cb

Please sign in to comment.