Skip to content

Commit 123b858

Browse files
committed
fix notice warnings
1 parent ff7f30d commit 123b858

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

plugin/SlideShow.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function macro_SlideShow($formatter,$value='',$options=array()) {
1414
if (!empty($options['d'])) $depth=intval($options['d']);
1515
$args=explode(',',$value);
1616
$sz=sizeof($args);
17-
for($i=0,$sz=sizeof($args);$i<$sz;$i++) {
17+
for($i=0;$i<$sz;$i++) {
1818
if (($p=strpos($args[$i],'='))!==false) {
1919
$k=substr($args[$i],0,$p);
2020
$v=substr($args[$i],$p+1);
@@ -23,7 +23,7 @@ function macro_SlideShow($formatter,$value='',$options=array()) {
2323
$pgname=$args[$i];
2424
}
2525
}
26-
if ($pgname) {
26+
if (isset($pgname[0])) {
2727
if (!$DBInfo->hasPage($pgname))
2828
return '[[SlideShow('._("No page found").')]]';
2929
$pg=$DBInfo->getPage($pgname);
@@ -35,9 +35,9 @@ function macro_SlideShow($formatter,$value='',$options=array()) {
3535
}
3636

3737
if (!empty($options['p'])) {
38-
list($sect,$dum)=explode('/',$options['p']);
39-
$sect=abs(intval($sect));
40-
$sect= $sect ? $sect:1;
38+
$dum = explode('/',$options['p']);
39+
$sect=abs(intval($dum[0]));
40+
$sect= !empty($sect) ? $sect:1;
4141
} else $sect=1;
4242

4343
$act=!empty($options['action']) ? $options['action']:'SlideShow';
@@ -46,9 +46,10 @@ function macro_SlideShow($formatter,$value='',$options=array()) {
4646
$icon_dir=$formatter->imgs_dir.'/plugin/SlideShow/'.$iconset.'/';
4747

4848
// get head title section
49+
$dep = '';
4950
if ($depth==2) {
50-
list($secthead,$dumm)=explode("\n",$sections[0]);
51-
preg_match('/^\s*=\s*([^=].*[^=])\s*=\s?$/',$secthead,$match);
51+
$dumm = explode("\n",$sections[0]);
52+
preg_match('/^\s*=\s*([^=].*[^=])\s*=\s?$/',$dumm[0], $match);
5253
$secthead=rtrim($sections[0]);
5354
if (isset($match[1])) $title=$match[1];
5455
} else {
@@ -64,30 +65,30 @@ function macro_SlideShow($formatter,$value='',$options=array()) {
6465

6566
// get prev,next subtitle
6667
if ($sz > ($sect)) {
67-
list($n_title,$dumm)=explode("\n",$sections[$sect+1]);
68-
preg_match("/^\s*={".$depth.'}\s*(.*)\s*={'.$depth.'}\s?$/',$n_title,$match);
68+
$dumm = explode("\n",$sections[$sect+1]);
69+
preg_match("/^\s*={".$depth.'}\s*(.*)\s*={'.$depth.'}\s?$/', $dumm[0], $match);
6970
if (isset($match[1]))
7071
$n_title=$match[1];
7172
else
7273
$n_title='';
7374

74-
list($e_title,$dumm)=explode("\n",$sections[$sz]);
75-
preg_match("/^[ ]*={".$depth."}\s+(.*)\s+={".$depth."}\s?/",$e_title,$match);
75+
$dumm = explode("\n",$sections[$sz]);
76+
preg_match("/^[ ]*={".$depth."}\s+(.*)\s+={".$depth."}\s?/", $dumm[0], $match);
7677
if (isset($match[1]))
7778
$e_title=$match[1];
7879
else
7980
$e_title='';
8081
}
8182
$s_title = '';
8283
if (!empty($sections[1]) and (empty($options['action']) or $sect > 1)) {
83-
list($s_title,$dumm)=explode("\n",$sections[1]);
84-
preg_match("/^\s*={".$depth."}\s*(.*)\s*={".$depth."}\s?$/",$s_title,$match);
84+
$dumm = explode("\n",$sections[1]);
85+
preg_match("/^\s*={".$depth."}\s*(.*)\s*={".$depth."}\s?$/", $dumm[0], $match);
8586
if (isset($match[1]))
8687
$s_title=$match[1];
8788
}
8889
if ($sect >= 1) {
89-
list($p_title,$dumm)=explode("\n",$sections[$sect-1]);
90-
preg_match('/^\s*={'.$depth.'}\s*(.*)\s*={'.$depth.'}\s?$/',$p_title,$match);
90+
$dumm = explode("\n",$sections[$sect-1]);
91+
preg_match('/^\s*={'.$depth.'}\s*(.*)\s*={'.$depth.'}\s?$/', $dumm[0], $match);
9192
if (isset($match[1]))
9293
$p_title=$match[1];
9394
else

0 commit comments

Comments
 (0)