Avoid some notices

This commit is contained in:
Tobias Hößl 2012-02-26 20:43:51 +00:00
parent ac86407fdf
commit 4b1de0f538
3 changed files with 12 additions and 11 deletions

View File

@ -163,7 +163,7 @@ function bbtoevent($s) {
if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match))
$ev['adjust'] = $match[1]; $ev['adjust'] = $match[1];
$match = ''; $match = '';
$ev['nofinish'] = (($ev['start'] && (! $ev['finish'])) ? 1 : 0); $ev['nofinish'] = (($ev['start'] && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0);
return $ev; return $ev;
} }

View File

@ -308,7 +308,7 @@ function get_atom_elements($feed,$item) {
if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
$base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) { foreach($base as $link) {
if(! $res['author-avatar']) { if(!x($res, 'author-avatar') || !$res['author-avatar']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
$res['author-avatar'] = unxmlify($link['attribs']['']['href']); $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
} }
@ -323,7 +323,7 @@ function get_atom_elements($feed,$item) {
foreach($base as $link) { foreach($base as $link) {
if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link'])) if($link['attribs']['']['rel'] === 'alternate' && (! $res['author-link']))
$res['author-link'] = unxmlify($link['attribs']['']['href']); $res['author-link'] = unxmlify($link['attribs']['']['href']);
if(! $res['author-avatar']) { if(!x($res, 'author-avatar') || !$res['author-avatar']) {
if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo') if($link['attribs']['']['rel'] === 'avatar' || $link['attribs']['']['rel'] === 'photo')
$res['author-avatar'] = unxmlify($link['attribs']['']['href']); $res['author-avatar'] = unxmlify($link['attribs']['']['href']);
} }
@ -503,7 +503,7 @@ function get_atom_elements($feed,$item) {
$base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) { foreach($base as $link) {
if(! $res['owner-avatar']) { if(!x($res, 'owner-avatar') || !$res['owner-avatar']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
$res['owner-avatar'] = unxmlify($link['attribs']['']['href']); $res['owner-avatar'] = unxmlify($link['attribs']['']['href']);
} }

View File

@ -32,11 +32,12 @@
if(is_array($r) && count($r)) { if(is_array($r) && count($r)) {
foreach ($r as $k => $v ) { foreach ($r as $k => $v ) {
if (is_array($v)) if (is_array($v)) {
$this->_build_replace($v, "$prefix$k."); $this->_build_replace($v, "$prefix$k.");
} else {
$this->search[] = $prefix . $k; $this->search[] = $prefix . $k;
$this->replace[] = $v; $this->replace[] = $v;
}
} }
} }
} }
@ -53,7 +54,7 @@
$keys = array_map('trim',explode(".",$name)); $keys = array_map('trim',explode(".",$name));
$val = $this->r; $val = $this->r;
foreach($keys as $k) { foreach($keys as $k) {
$val = $val[$k]; $val = (isset($val[$k]) ? $val[$k] : null);
} }
return $val; return $val;
} }
@ -79,8 +80,8 @@
} else { } else {
$val = $this->_get_var($args[2]); $val = $this->_get_var($args[2]);
} }
list($strue, $sfalse)= preg_split("|{{ *else *}}|", $args[3]); $x = preg_split("|{{ *else *}}|", $args[3]);
return ($val?$strue:$sfalse); return ( $val ? $x[0] : (isset($x[1]) ? $x[1] : ""));
} }
/** /**