@@ -196,8 +196,8 @@ |
||
196 | 196 | $this->searchTerm = preg_replace('#\s#', '-', strtolower($this->searchTerm)); |
197 | 197 | if ($this->getUrl(self::DESURAURL . '/games/' . $this->searchTerm) !== false) { |
198 | 198 | if (!preg_match('#(Games system error)#i', $this->_response)) { |
199 | - if($this->_ret = $this->_html->find("a#watchtoggle", 0)){ |
|
200 | - if(preg_match('#siteareaid=(?<gameid>\d+)#', $this->_ret->href, $matches)){ |
|
199 | + if($this->_ret = $this->_html->find("a#watchtoggle", 0)) { |
|
200 | + if(preg_match('#siteareaid=(?<gameid>\d+)#', $this->_ret->href, $matches)) { |
|
201 | 201 | $this->_desuraGameID = $matches['gameid']; |
202 | 202 | $this->_directURL = self::DESURAURL . '/games/' . $this->searchTerm; |
203 | 203 | $result = true; |
@@ -40,8 +40,9 @@ |
||
40 | 40 | */ |
41 | 41 | public function overWriteHeader($message, $reset = False) |
42 | 42 | { |
43 | - if ($reset) |
|
44 | - $this->lastMessageLength = 0; |
|
43 | + if ($reset) { |
|
44 | + $this->lastMessageLength = 0; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | echo str_repeat(chr(8), $this->lastMessageLength); |
47 | 48 | echo str_repeat(" ", $this->lastMessageLength); |
@@ -653,18 +653,12 @@ |
||
653 | 653 | // Empty because we exhausted all possibilities. |
654 | 654 | } |
655 | 655 | } |
656 | - if ($response === false) |
|
657 | - { |
|
656 | + if ($response === false) { |
|
658 | 657 | throw new \Exception("Could not connect to Amazon"); |
659 | - } |
|
660 | - else |
|
661 | - { |
|
662 | - if (isset($response->Items->Item->ItemAttributes->Title)) |
|
663 | - { |
|
658 | + } else { |
|
659 | + if (isset($response->Items->Item->ItemAttributes->Title)) { |
|
664 | 660 | return $response; |
665 | - } |
|
666 | - else |
|
667 | - { |
|
661 | + } else { |
|
668 | 662 | return false; |
669 | 663 | } |
670 | 664 | } |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | public function images() |
100 | 100 | { |
101 | 101 | if ($ret = $this->_html->find("div.workshopItemPreviewImageMain", 0)) { |
102 | - if(preg_match('#\'(?<largeimage>.*)\'#i', $ret->outertext, $matches)){ |
|
102 | + if(preg_match('#\'(?<largeimage>.*)\'#i', $ret->outertext, $matches)) { |
|
103 | 103 | $this->_res['cover'] = trim($matches['largeimage']); |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | $this->_res['cover'] = $this->_html->find("img#previewImageMain", 0)->src; |
106 | 106 | } |
107 | 107 | } |
108 | 108 | if ($ret = $this->_html->find("div.screenshot_holder", 0)) { |
109 | 109 | if ($ret = $ret->find("a", 0)) { |
110 | - if(preg_match('#\'(?<backdropimage>.*)\'#', $ret->outertext, $matches)){ |
|
110 | + if(preg_match('#\'(?<backdropimage>.*)\'#', $ret->outertext, $matches)) { |
|
111 | 111 | $this->_res['backdrop'] = trim($matches['backdropimage']); |
112 | 112 | } |
113 | 113 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $result = true; |
188 | 188 | break; |
189 | 189 | } |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | $result = false; |
192 | 192 | } |
193 | 193 | } |
@@ -783,8 +783,7 @@ |
||
783 | 783 | 'release_id' => 0, |
784 | 784 | 'method' => '' |
785 | 785 | ] |
786 | - ) |
|
787 | - { |
|
786 | + ) { |
|
788 | 787 | echo |
789 | 788 | PHP_EOL . |
790 | 789 | ColorCLI::headerOver('New name: ') . ColorCLI::primaryOver($data['new_name']) . PHP_EOL . |
@@ -37,10 +37,11 @@ discard block |
||
37 | 37 | |
38 | 38 | private function getListQuery($type = '', $activeonly = false) |
39 | 39 | { |
40 | - if (!empty($type)) |
|
41 | - $typesql = sprintf(" AND g.type = %d", $type); |
|
42 | - else |
|
43 | - $typesql = ''; |
|
40 | + if (!empty($type)) { |
|
41 | + $typesql = sprintf(" AND g.type = %d", $type); |
|
42 | + } else { |
|
43 | + $typesql = ''; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | if ($activeonly) { |
46 | 47 | $sql = sprintf(" |
@@ -81,13 +82,14 @@ discard block |
||
81 | 82 | |
82 | 83 | public function getCount($type = '', $activeonly = false) |
83 | 84 | { |
84 | - if (!empty($type)) |
|
85 | - $typesql = sprintf(" AND g.type = %d", $type); |
|
86 | - else |
|
87 | - $typesql = ''; |
|
85 | + if (!empty($type)) { |
|
86 | + $typesql = sprintf(" AND g.type = %d", $type); |
|
87 | + } else { |
|
88 | + $typesql = ''; |
|
89 | + } |
|
88 | 90 | |
89 | - if ($activeonly) |
|
90 | - $sql = sprintf(" |
|
91 | + if ($activeonly) { |
|
92 | + $sql = sprintf(" |
|
91 | 93 | SELECT COUNT(id) AS num |
92 | 94 | FROM genres g |
93 | 95 | INNER JOIN |
@@ -107,8 +109,9 @@ discard block |
||
107 | 109 | ON x.genres_id = g.id %1\$s", |
108 | 110 | $typesql |
109 | 111 | ); |
110 | - else |
|
111 | - $sql = sprintf("SELECT COUNT(g.id) AS num FROM genres g WHERE 1 %s ORDER BY g.title", $typesql); |
|
112 | + } else { |
|
113 | + $sql = sprintf("SELECT COUNT(g.id) AS num FROM genres g WHERE 1 %s ORDER BY g.title", $typesql); |
|
114 | + } |
|
112 | 115 | |
113 | 116 | $res = $this->pdo->queryOneRow($sql); |
114 | 117 |
@@ -15,26 +15,24 @@ |
||
15 | 15 | */ |
16 | 16 | function smarty_modifier_daysAgo($date) |
17 | 17 | { |
18 | - if ($date == "") |
|
19 | - return "n/a"; |
|
18 | + if ($date == "") { |
|
19 | + return "n/a"; |
|
20 | + } |
|
20 | 21 | $sec = mktime(0,0,0,date("m"), date("d"), date("Y")) - (( strtotime($date)) ? strtotime(date("Y-m-d", strtotime($date))) : strtotime(date("Y-m-d", $date))); |
21 | 22 | $min = $sec / 60; |
22 | 23 | $hrs = $min / 60; |
23 | 24 | $days = $sec/60/60/24; |
24 | - if ( $hrs <= 24) return ' Today'; |
|
25 | - if ($days >= 365) |
|
26 | - { |
|
25 | + if ( $hrs <= 24) { |
|
26 | + return ' Today'; |
|
27 | + } |
|
28 | + if ($days >= 365) { |
|
27 | 29 | $years = round(($days/365), 1); |
28 | 30 | return $years.' Yr'.($years!=1?"s":"").' ago'; |
29 | - } |
|
30 | - else if ($days >= 90) |
|
31 | - { |
|
31 | + } else if ($days >= 90) { |
|
32 | 32 | return round($days/7).' Wks ago'; |
33 | - } |
|
34 | - else if ($days <= 2) |
|
35 | - return 'Yesterday'; |
|
36 | - else |
|
37 | - { |
|
33 | + } else if ($days <= 2) { |
|
34 | + return 'Yesterday'; |
|
35 | + } else { |
|
38 | 36 | return round($days, 0).'d ago'; |
39 | 37 | } |
40 | 38 | } |
@@ -59,8 +59,8 @@ |
||
59 | 59 | $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); |
60 | 60 | $format = str_replace($_win_from, $_win_to, $format); |
61 | 61 | }*/ |
62 | - if (substr($format,0,5)=='DATE_'){ |
|
63 | - switch ($format){ |
|
62 | + if (substr($format,0,5)=='DATE_') { |
|
63 | + switch ($format) { |
|
64 | 64 | case 'DATE_ATOM': $nformat=DATE_ATOM; break; |
65 | 65 | case 'DATE_COOKIE': $nformat=DATE_COOKIE; break; |
66 | 66 | case 'DATE_ISO8601': $nformat=DATE_ISO8601; break; |
@@ -15,34 +15,44 @@ |
||
15 | 15 | */ |
16 | 16 | function smarty_modifier_timeAgo( $date) |
17 | 17 | { |
18 | - if ($date == "") |
|
19 | - return "n/a"; |
|
18 | + if ($date == "") { |
|
19 | + return "n/a"; |
|
20 | + } |
|
20 | 21 | $timeStrings = array( 'now', // 0 |
21 | 22 | 'Sec', 'Secs', // 1,1 |
22 | 23 | 'Min','Mins', // 3,3 |
23 | 24 | 'Hour', 'Hrs', // 5,5 |
24 | 25 | 'Day', 'Days'); |
25 | 26 | $sec = time() - (( !is_numeric($date) && strtotime($date)) ? strtotime($date) : $date); |
26 | - if ( $sec <= 0) return $timeStrings[0]; |
|
27 | - if ( $sec < 2) return $sec." ".$timeStrings[1]; |
|
28 | - if ( $sec < 60) return $sec." ".$timeStrings[2]; |
|
27 | + if ( $sec <= 0) { |
|
28 | + return $timeStrings[0]; |
|
29 | + } |
|
30 | + if ( $sec < 2) { |
|
31 | + return $sec." ".$timeStrings[1]; |
|
32 | + } |
|
33 | + if ( $sec < 60) { |
|
34 | + return $sec." ".$timeStrings[2]; |
|
35 | + } |
|
29 | 36 | $min = $sec / 60; |
30 | - if ( floor($min+0.5) < 2) return floor($min+0.5)." ".$timeStrings[3]; |
|
31 | - if ( $min < 60) return floor($min+0.5)." ".$timeStrings[4]; |
|
37 | + if ( floor($min+0.5) < 2) { |
|
38 | + return floor($min+0.5)." ".$timeStrings[3]; |
|
39 | + } |
|
40 | + if ( $min < 60) { |
|
41 | + return floor($min+0.5)." ".$timeStrings[4]; |
|
42 | + } |
|
32 | 43 | $hrs = $min / 60; |
33 | - if ( floor($hrs+0.5) < 2) return floor($hrs+0.5)." ".$timeStrings[5]; |
|
34 | - if ( $hrs < 24) return floor($hrs+0.5)." ".$timeStrings[6]; |
|
44 | + if ( floor($hrs+0.5) < 2) { |
|
45 | + return floor($hrs+0.5)." ".$timeStrings[5]; |
|
46 | + } |
|
47 | + if ( $hrs < 24) { |
|
48 | + return floor($hrs+0.5)." ".$timeStrings[6]; |
|
49 | + } |
|
35 | 50 | $days = $sec/60/60/24; |
36 | - if ($days > 365) |
|
37 | - { |
|
51 | + if ($days > 365) { |
|
38 | 52 | return round(($days/365), 1).' Yrs'; |
39 | - } |
|
40 | - else if ($days > 90) |
|
41 | - { |
|
53 | + } else if ($days > 90) { |
|
42 | 54 | return round($days/7).' Wks'; |
43 | - } |
|
44 | - else |
|
45 | - { |
|
55 | + } else { |
|
46 | 56 | return round($days, 1).'d'; |
47 | 57 | } |
48 | 58 | } |