1 | Index: mythweb/modules/video/scan.php |
---|
2 | =================================================================== |
---|
3 | --- mythweb/modules/video/scan.php (revision 14707) |
---|
4 | +++ mythweb/modules/video/scan.php (working copy) |
---|
5 | @@ -89,25 +89,18 @@ |
---|
6 | |
---|
7 | // Strips out braces and the text inside the braces. |
---|
8 | // This is a direct port of the C++ code from mythvideo |
---|
9 | - function eatbraces($str, $left_brace, $right_brace) { |
---|
10 | - $keep_checking = TRUE; |
---|
11 | + // Rewritten as it failed to handle my brackets |
---|
12 | + function eatbraces($str, $lb, $rb) { |
---|
13 | |
---|
14 | - while ($keep_checking) { |
---|
15 | - $left_position = stripos($str, $left_brace); |
---|
16 | - $right_position = stripos($str, $right_brace); |
---|
17 | + $lb_pos = stripos($str, $lb); |
---|
18 | + $rb_pos = stripos($str, $rb); |
---|
19 | + if(!is_numeric($lb_pos)) return $str; |
---|
20 | |
---|
21 | - // No matching pairs left |
---|
22 | - if ($left_position === FALSE || $right_position === FALSE) |
---|
23 | - $keep_checking = FALSE; |
---|
24 | + $part1 = substr($str, 0, $lb_pos); |
---|
25 | + $part2 = substr($str, strpos($str, $rb)+1); |
---|
26 | |
---|
27 | - // Matching set: () |
---|
28 | - elseif ($left_position < $right_position) |
---|
29 | - $str = substr($str, 0, $left_postion) + substr($str, $right_position); |
---|
30 | + $output = $part1.$part2; |
---|
31 | |
---|
32 | - // Matching set: )( |
---|
33 | - elseif ($left_position > $right_position) |
---|
34 | - $str = substr($str, 0, $right_postion) + substr($str, $left_position); |
---|
35 | - } |
---|
36 | - return $str; |
---|
37 | + if(strpos($output, $lb) && strpos($str, $rb)) return eatbraces($output, $lb, $rb); |
---|
38 | + return $output; |
---|
39 | } |
---|
40 | - |
---|