@@ -192,8 +192,6 @@ |
||
| 192 | 192 | * set name of image |
| 193 | 193 | * |
| 194 | 194 | * @access public |
| 195 | - * @param int $iWeek number of week |
|
| 196 | - * @param int $iYear year |
|
| 197 | 195 | * @return array |
| 198 | 196 | */ |
| 199 | 197 | public static function getActualMiddleWeek() : array |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function getWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : Date |
| 43 | 43 | { |
| 44 | - $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear)); |
|
| 44 | + $iFirstDayInYear = date("N", mktime(0, 0, 0, 1, 1, $iYear)); |
|
| 45 | 45 | |
| 46 | 46 | if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } |
| 47 | 47 | else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
| 48 | 48 | |
| 49 | - if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } |
|
| 49 | + if ($iWeek > 1) { $iWeekInSeconds = ($iWeek - 1) * 604800; } |
|
| 50 | 50 | else { $iWeekInSeconds = 0; } |
| 51 | 51 | |
| 52 | 52 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift; |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array |
| 160 | 160 | { |
| 161 | - $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear)); |
|
| 161 | + $iFirstDayInYear = date("N", mktime(0, 0, 0, 1, 1, $iYear)); |
|
| 162 | 162 | |
| 163 | 163 | if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } |
| 164 | 164 | else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
| 165 | 165 | |
| 166 | - if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } |
|
| 166 | + if ($iWeek > 1) { $iWeekInSeconds = ($iWeek - 1) * 604800; } |
|
| 167 | 167 | else { $iWeekInSeconds = 0; } |
| 168 | 168 | |
| 169 | 169 | if (date('N') > 2) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) { |
| 183 | 183 | |
| 184 | 184 | $aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]); |
| 185 | - $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]); |
|
| 185 | + $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y') + 1).'$1', $aDates[1]); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $aDates; |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | $oDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $sDateTime); |
| 226 | 226 | $iTimeStamp = time() - $oDateTime->getTimestamp(); |
| 227 | 227 | |
| 228 | - if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; } |
|
| 229 | - if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; } |
|
| 230 | - if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; } |
|
| 231 | - if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } |
|
| 232 | - else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; } |
|
| 228 | + if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp / 60).' '.$sMinutes.$sEndReturn; } |
|
| 229 | + if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp / 3600).' '.$sHours.$sEndReturn; } |
|
| 230 | + if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp / 86400).' '.$sDays.$sEndReturn; } |
|
| 231 | + if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp / 2592000).' '.$sMonths.$sEndReturn; } |
|
| 232 | + else { return $sStartReturn.' '.(int)($iTimeStamp / 31536000).' '.$sYears.$sEndReturn; } |
|
| 233 | 233 | } |
| 234 | 234 | } |
@@ -43,11 +43,9 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear)); |
| 45 | 45 | |
| 46 | - if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } |
|
| 47 | - else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 46 | + if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 48 | 47 | |
| 49 | - if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } |
|
| 50 | - else { $iWeekInSeconds = 0; } |
|
| 48 | + if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; } |
|
| 51 | 49 | |
| 52 | 50 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift; |
| 53 | 51 | $iTimestampLastDay = mktime(0, 0, 0, 1, 6, $iYear) + $iWeekInSeconds + $iShift + 604800; |
@@ -78,18 +76,7 @@ discard block |
||
| 78 | 76 | { |
| 79 | 77 | if ($sLanguage == 'fr') { |
| 80 | 78 | |
| 81 | - if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; } |
|
| 82 | - else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; } |
|
| 83 | - else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; } |
|
| 84 | - else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; } |
|
| 85 | - else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; } |
|
| 86 | - else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; } |
|
| 87 | - else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; } |
|
| 88 | - else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; } |
|
| 89 | - else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; } |
|
| 90 | - else if ($sMonth == 10) { return 'Octobre'; } |
|
| 91 | - else if ($sMonth == 11) { return 'Novembre'; } |
|
| 92 | - else if ($sMonth == 12) { return 'Décembre'; } |
|
| 79 | + if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; } else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; } else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; } else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; } else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; } else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; } else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; } else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; } else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; } else if ($sMonth == 10) { return 'Octobre'; } else if ($sMonth == 11) { return 'Novembre'; } else if ($sMonth == 12) { return 'Décembre'; } |
|
| 93 | 80 | } |
| 94 | 81 | } |
| 95 | 82 | |
@@ -105,13 +92,7 @@ discard block |
||
| 105 | 92 | { |
| 106 | 93 | if ($sLanguage == 'fr') { |
| 107 | 94 | |
| 108 | - if ($sDay == 0) { return 'dimanche'; } |
|
| 109 | - else if ($sDay == 1) { return 'lundi'; } |
|
| 110 | - else if ($sDay == 2) { return 'mardi'; } |
|
| 111 | - else if ($sDay == 3) { return 'mercredi'; } |
|
| 112 | - else if ($sDay == 4) { return 'jeudi'; } |
|
| 113 | - else if ($sDay == 5) { return 'vendredi'; } |
|
| 114 | - else if ($sDay == 6) { return 'samedi'; } |
|
| 95 | + if ($sDay == 0) { return 'dimanche'; } else if ($sDay == 1) { return 'lundi'; } else if ($sDay == 2) { return 'mardi'; } else if ($sDay == 3) { return 'mercredi'; } else if ($sDay == 4) { return 'jeudi'; } else if ($sDay == 5) { return 'vendredi'; } else if ($sDay == 6) { return 'samedi'; } |
|
| 115 | 96 | } |
| 116 | 97 | } |
| 117 | 98 | |
@@ -138,8 +119,7 @@ discard block |
||
| 138 | 119 | if ($iMonth == $aToday['mois']) { |
| 139 | 120 | |
| 140 | 121 | if ($iDay > $aToday['jour']) { $iYears--; } |
| 141 | - } |
|
| 142 | - else { |
|
| 122 | + } else { |
|
| 143 | 123 | |
| 144 | 124 | $iYears--; |
| 145 | 125 | } |
@@ -160,18 +140,15 @@ discard block |
||
| 160 | 140 | { |
| 161 | 141 | $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear)); |
| 162 | 142 | |
| 163 | - if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } |
|
| 164 | - else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 143 | + if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 165 | 144 | |
| 166 | - if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } |
|
| 167 | - else { $iWeekInSeconds = 0; } |
|
| 145 | + if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; } |
|
| 168 | 146 | |
| 169 | 147 | if (date('N') > 2) { |
| 170 | 148 | |
| 171 | 149 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800; |
| 172 | 150 | $iTimestampLastDay = $iTimestamp + 604800; |
| 173 | - } |
|
| 174 | - else { |
|
| 151 | + } else { |
|
| 175 | 152 | |
| 176 | 153 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000; |
| 177 | 154 | $iTimestampLastDay = $iTimestamp + 604800; |
@@ -228,7 +205,6 @@ discard block |
||
| 228 | 205 | if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; } |
| 229 | 206 | if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; } |
| 230 | 207 | if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; } |
| 231 | - if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } |
|
| 232 | - else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; } |
|
| 208 | + if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; } |
|
| 233 | 209 | } |
| 234 | 210 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * add one scope |
| 151 | 151 | * |
| 152 | 152 | * @access public |
| 153 | - * @return object |
|
| 153 | + * @return Object |
|
| 154 | 154 | */ |
| 155 | 155 | public function getUserInfo() : object |
| 156 | 156 | { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @access public |
| 165 | 165 | * @param string $sName name to call |
| 166 | - * @return object |
|
| 166 | + * @return Object |
|
| 167 | 167 | * @throws Exception |
| 168 | 168 | */ |
| 169 | 169 | public function getInfo(string $sName) : object |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @access public |
| 187 | 187 | * @param string $sFql fql query |
| 188 | - * @return object |
|
| 188 | + * @return Object |
|
| 189 | 189 | * @throws Exception |
| 190 | 190 | */ |
| 191 | 191 | public function getInfoByFql(string $sFql) : object |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @param string $sImg |
| 218 | 218 | * @param string $sName |
| 219 | 219 | * @param string $sDescription |
| 220 | - * @return object |
|
| 220 | + * @return Object |
|
| 221 | 221 | * @throws Exception |
| 222 | 222 | */ |
| 223 | 223 | public function publishWallPost(string $sMessage, string $sLink, string $sImg, string $sName, string $sDescription) : object |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @param string $sLink |
| 251 | 251 | * @param string $sImg |
| 252 | 252 | * @param string $sDescription |
| 253 | - * @return object |
|
| 253 | + * @return Object |
|
| 254 | 254 | * @throws Exception |
| 255 | 255 | */ |
| 256 | 256 | public function publishMyWallPost(string $sPageId, string $sMessage, string $sLink, string $sImg, string $sDescription) : object |
@@ -227,12 +227,12 @@ |
||
| 227 | 227 | try { |
| 228 | 228 | |
| 229 | 229 | $this->_oFacebook->api('/'.$sUser.'/feed', 'post', array( |
| 230 | - 'message' => $sMessage, |
|
| 231 | - 'link' => $sLink, |
|
| 232 | - 'picture' => $sImg, |
|
| 233 | - 'name' => $sName, |
|
| 234 | - 'description'=> $sDescription |
|
| 235 | - ) |
|
| 230 | + 'message' => $sMessage, |
|
| 231 | + 'link' => $sLink, |
|
| 232 | + 'picture' => $sImg, |
|
| 233 | + 'name' => $sName, |
|
| 234 | + 'description'=> $sDescription |
|
| 235 | + ) |
|
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | catch(Exception $e) { |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * app secret of Facebook |
| 56 | 56 | * @var array |
| 57 | 57 | */ |
| 58 | - private $_aScope = array('email','user_birthday','user_location','user_work_history', |
|
| 59 | - 'user_about_me','user_hometown'); |
|
| 58 | + private $_aScope = array('email', 'user_birthday', 'user_location', 'user_work_history', |
|
| 59 | + 'user_about_me', 'user_hometown'); |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * object Facebook of the SDK |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | return $this->_oFacebook->api('/'.$sUser.'/'.$sName); |
| 176 | 176 | } |
| 177 | - catch(Exception $e) { |
|
| 177 | + catch (Exception $e) { |
|
| 178 | 178 | |
| 179 | 179 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/'.$sName.' !'); |
| 180 | 180 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | try { |
| 196 | 196 | |
| 197 | - $aParam = array( |
|
| 197 | + $aParam = array( |
|
| 198 | 198 | 'method' => 'fql.query', |
| 199 | 199 | 'query' => $sFql, |
| 200 | 200 | 'callback' => '' |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | return $this->_oFacebook->api($aParam); |
| 204 | 204 | } |
| 205 | - catch(Exception $e) { |
|
| 205 | + catch (Exception $e) { |
|
| 206 | 206 | |
| 207 | 207 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.$sFql.' !'); |
| 208 | 208 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | ) |
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | - catch(Exception $e) { |
|
| 238 | + catch (Exception $e) { |
|
| 239 | 239 | |
| 240 | 240 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/feed'.' !'); |
| 241 | 241 | } |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | $user = $this->_oFacebook->getUser(); |
| 259 | 259 | |
| 260 | - if ($user){ |
|
| 260 | + if ($user) { |
|
| 261 | 261 | |
| 262 | - try{ |
|
| 262 | + try { |
|
| 263 | 263 | |
| 264 | 264 | $accounts = $this->_oFacebook->api('/me/accounts'); |
| 265 | 265 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | ) |
| 291 | 291 | ); |
| 292 | 292 | } |
| 293 | - catch(Exception $e) { |
|
| 293 | + catch (Exception $e) { |
|
| 294 | 294 | |
| 295 | 295 | var_dump($e); |
| 296 | 296 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sPageId.'/feed'.' !'); |
@@ -102,8 +102,7 @@ discard block |
||
| 102 | 102 | if ($this->_oFacebook->getUser()) { |
| 103 | 103 | |
| 104 | 104 | return '<a href="'.$this->_oFacebook->getLogoutUrl().'">'.$sLabelName.'</a>'; |
| 105 | - } |
|
| 106 | - else { |
|
| 105 | + } else { |
|
| 107 | 106 | |
| 108 | 107 | return '<a href="'.$this->_oFacebook->getLoginUrl( |
| 109 | 108 | array( |
@@ -173,8 +172,7 @@ discard block |
||
| 173 | 172 | try { |
| 174 | 173 | |
| 175 | 174 | return $this->_oFacebook->api('/'.$sUser.'/'.$sName); |
| 176 | - } |
|
| 177 | - catch(Exception $e) { |
|
| 175 | + } catch(Exception $e) { |
|
| 178 | 176 | |
| 179 | 177 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/'.$sName.' !'); |
| 180 | 178 | } |
@@ -201,8 +199,7 @@ discard block |
||
| 201 | 199 | ); |
| 202 | 200 | |
| 203 | 201 | return $this->_oFacebook->api($aParam); |
| 204 | - } |
|
| 205 | - catch(Exception $e) { |
|
| 202 | + } catch(Exception $e) { |
|
| 206 | 203 | |
| 207 | 204 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.$sFql.' !'); |
| 208 | 205 | } |
@@ -234,8 +231,7 @@ discard block |
||
| 234 | 231 | 'description'=> $sDescription |
| 235 | 232 | ) |
| 236 | 233 | ); |
| 237 | - } |
|
| 238 | - catch(Exception $e) { |
|
| 234 | + } catch(Exception $e) { |
|
| 239 | 235 | |
| 240 | 236 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/feed'.' !'); |
| 241 | 237 | } |
@@ -265,8 +261,7 @@ discard block |
||
| 265 | 261 | |
| 266 | 262 | echo '<pre>'; |
| 267 | 263 | print_r($accounts); /* on affiche les informations retournées */ |
| 268 | - } |
|
| 269 | - catch (\Exception $e) { |
|
| 264 | + } catch (\Exception $e) { |
|
| 270 | 265 | |
| 271 | 266 | print_r($e); |
| 272 | 267 | $user = null; |
@@ -289,8 +284,7 @@ discard block |
||
| 289 | 284 | 'description'=> $sDescription |
| 290 | 285 | ) |
| 291 | 286 | ); |
| 292 | - } |
|
| 293 | - catch(Exception $e) { |
|
| 287 | + } catch(Exception $e) { |
|
| 294 | 288 | |
| 295 | 289 | var_dump($e); |
| 296 | 290 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sPageId.'/feed'.' !'); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * get global object form |
| 305 | 305 | * |
| 306 | 306 | * @access public |
| 307 | - * @return object |
|
| 307 | + * @return \stdClass |
|
| 308 | 308 | */ |
| 309 | 309 | public function getFormInObject() |
| 310 | 310 | { |
@@ -411,7 +411,6 @@ discard block |
||
| 411 | 411 | * set the entity to synchronize with the formular |
| 412 | 412 | * |
| 413 | 413 | * @access public |
| 414 | - * @param string $sSeparator separator between the fields |
|
| 415 | 414 | * @param int $iId id of the primary key |
| 416 | 415 | * @return \Venus\lib\Form |
| 417 | 416 | */ |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function add($sName, $mType, $sLabel = null, $mValue = null, $mOptions = null) |
| 143 | 143 | { |
| 144 | - if ($mType instanceof Container) { |
|
| 144 | + if ($mType instanceof Container) { |
|
| 145 | 145 | |
| 146 | - $this->_aElement[$sName] = $mType; |
|
| 147 | - } |
|
| 146 | + $this->_aElement[$sName] = $mType; |
|
| 147 | + } |
|
| 148 | 148 | else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel' |
| 149 | - || $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time' |
|
| 150 | - || $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range' |
|
| 151 | - || $mType === 'color') { |
|
| 149 | + || $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time' |
|
| 150 | + || $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range' |
|
| 151 | + || $mType === 'color') { |
|
| 152 | 152 | |
| 153 | 153 | $this->_aElement[$sName] = new Input($sName, $mType, $sLabel, $mValue); |
| 154 | 154 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $oContainer = new Container; |
| 296 | 296 | $oContainer->setView($sFormContent) |
| 297 | - ->setForm($this); |
|
| 297 | + ->setForm($this); |
|
| 298 | 298 | |
| 299 | 299 | return $oContainer; |
| 300 | 300 | } |
@@ -308,67 +308,67 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function getFormInObject() |
| 310 | 310 | { |
| 311 | - if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) { |
|
| 311 | + if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) { |
|
| 312 | 312 | |
| 313 | - $sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity); |
|
| 314 | - $oModel = new $sModelName; |
|
| 313 | + $sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity); |
|
| 314 | + $oModel = new $sModelName; |
|
| 315 | 315 | |
| 316 | - $oEntity = new $this->_sSynchronizeEntity; |
|
| 317 | - $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity); |
|
| 318 | - $sMethodName = 'findOneBy'.$sPrimaryKey; |
|
| 319 | - $oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity)); |
|
| 316 | + $oEntity = new $this->_sSynchronizeEntity; |
|
| 317 | + $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity); |
|
| 318 | + $sMethodName = 'findOneBy'.$sPrimaryKey; |
|
| 319 | + $oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity)); |
|
| 320 | 320 | |
| 321 | - if (is_object($oCompleteEntity)) { |
|
| 321 | + if (is_object($oCompleteEntity)) { |
|
| 322 | 322 | |
| 323 | - foreach ($this->_aElement as $sKey => $sValue) { |
|
| 323 | + foreach ($this->_aElement as $sKey => $sValue) { |
|
| 324 | 324 | |
| 325 | - if ($sValue instanceof \Venus\lib\Form\Radio) { |
|
| 325 | + if ($sValue instanceof \Venus\lib\Form\Radio) { |
|
| 326 | 326 | |
| 327 | - $sExKey = $sKey; |
|
| 328 | - $sKey = substr($sKey, 0, -6); |
|
| 329 | - } |
|
| 327 | + $sExKey = $sKey; |
|
| 328 | + $sKey = substr($sKey, 0, -6); |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - if ($sValue instanceof Form) { |
|
| 331 | + if ($sValue instanceof Form) { |
|
| 332 | 332 | |
| 333 | - ; |
|
| 334 | - } |
|
| 335 | - else { |
|
| 333 | + ; |
|
| 334 | + } |
|
| 335 | + else { |
|
| 336 | 336 | |
| 337 | - $sMethodNameInEntity = 'get_'.$sKey; |
|
| 338 | - $mValue = $oCompleteEntity->$sMethodNameInEntity(); |
|
| 337 | + $sMethodNameInEntity = 'get_'.$sKey; |
|
| 338 | + $mValue = $oCompleteEntity->$sMethodNameInEntity(); |
|
| 339 | 339 | |
| 340 | - if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) { |
|
| 340 | + if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) { |
|
| 341 | 341 | |
| 342 | - $this->_aElement[$sExKey]->setValueChecked($mValue); |
|
| 343 | - } |
|
| 344 | - else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) { |
|
| 342 | + $this->_aElement[$sExKey]->setValueChecked($mValue); |
|
| 343 | + } |
|
| 344 | + else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) { |
|
| 345 | 345 | |
| 346 | - $this->_aElement[$sKey]->setValue($mValue); |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - } |
|
| 350 | - } |
|
| 351 | - } |
|
| 346 | + $this->_aElement[$sKey]->setValue($mValue); |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - $oForm = new \StdClass(); |
|
| 354 | - $oForm->start = '<form name="form'.$this->_iFormNumber.'" method="post"><input type="hidden" value="1" name="validform'.$this->_iFormNumber.'">'; |
|
| 355 | - $oForm->form = array(); |
|
| 353 | + $oForm = new \StdClass(); |
|
| 354 | + $oForm->start = '<form name="form'.$this->_iFormNumber.'" method="post"><input type="hidden" value="1" name="validform'.$this->_iFormNumber.'">'; |
|
| 355 | + $oForm->form = array(); |
|
| 356 | 356 | |
| 357 | - foreach ($this->_aElement as $sKey => $sValue) { |
|
| 357 | + foreach ($this->_aElement as $sKey => $sValue) { |
|
| 358 | 358 | |
| 359 | - if ($sValue instanceof Container) { |
|
| 359 | + if ($sValue instanceof Container) { |
|
| 360 | 360 | |
| 361 | - $oForm->form[$sKey] = $sValue; |
|
| 362 | - } |
|
| 363 | - else { |
|
| 361 | + $oForm->form[$sKey] = $sValue; |
|
| 362 | + } |
|
| 363 | + else { |
|
| 364 | 364 | |
| 365 | - $oForm->form[$sKey] = $sValue->fetch(); |
|
| 366 | - } |
|
| 367 | - } |
|
| 365 | + $oForm->form[$sKey] = $sValue->fetch(); |
|
| 366 | + } |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | - $oForm->end = '</form>'; |
|
| 369 | + $oForm->end = '</form>'; |
|
| 370 | 370 | |
| 371 | - return $oForm; |
|
| 371 | + return $oForm; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function getElement() { |
| 451 | 451 | |
| 452 | - return $this->_aElement; |
|
| 452 | + return $this->_aElement; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | public function getIdEntity() { |
| 462 | 462 | |
| 463 | - return $this->_iIdEntity; |
|
| 463 | + return $this->_iIdEntity; |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -471,6 +471,6 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | public function getSynchronizeEntity() { |
| 473 | 473 | |
| 474 | - return $this->_sSynchronizeEntity; |
|
| 474 | + return $this->_sSynchronizeEntity; |
|
| 475 | 475 | } |
| 476 | 476 | } |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | else if ($mType === 'radio') { |
| 183 | 183 | |
| 184 | - $this->_aElement[$sName.rand(100000,999999)] = new Radio($sName, $sLabel, $mValue, $mOptions); |
|
| 184 | + $this->_aElement[$sName.rand(100000, 999999)] = new Radio($sName, $sLabel, $mValue, $mOptions); |
|
| 185 | 185 | } |
| 186 | 186 | else if ($mType === 'date') { |
| 187 | 187 | |
| 188 | 188 | $aDay = array(); |
| 189 | 189 | |
| 190 | - for ($i = 1 ; $i <= 31 ; $i++) { |
|
| 190 | + for ($i = 1; $i <= 31; $i++) { |
|
| 191 | 191 | |
| 192 | 192 | if ($i < 10) { $aDay['0'.$i] = '0'.$i; } |
| 193 | 193 | else { $aDay[$i] = $i; } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $aYear = array(); |
| 216 | 216 | |
| 217 | - for ($i = 1900 ; $i <= 2013 ; $i++) { |
|
| 217 | + for ($i = 1900; $i <= 2013; $i++) { |
|
| 218 | 218 | |
| 219 | 219 | $aYear[$i] = $i; |
| 220 | 220 | } |
@@ -144,27 +144,22 @@ discard block |
||
| 144 | 144 | if ($mType instanceof Container) { |
| 145 | 145 | |
| 146 | 146 | $this->_aElement[$sName] = $mType; |
| 147 | - } |
|
| 148 | - else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel' |
|
| 147 | + } else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel' |
|
| 149 | 148 | || $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time' |
| 150 | 149 | || $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range' |
| 151 | 150 | || $mType === 'color') { |
| 152 | 151 | |
| 153 | 152 | $this->_aElement[$sName] = new Input($sName, $mType, $sLabel, $mValue); |
| 154 | - } |
|
| 155 | - elseif ($mType === 'textarea') { |
|
| 153 | + } elseif ($mType === 'textarea') { |
|
| 156 | 154 | |
| 157 | 155 | $this->_aElement[$sName] = new Textarea($sName, $sLabel, $mValue); |
| 158 | - } |
|
| 159 | - else if ($mType === 'select') { |
|
| 156 | + } else if ($mType === 'select') { |
|
| 160 | 157 | |
| 161 | 158 | $this->_aElement[$sName] = new Select($sName, $mOptions, $sLabel, $mValue); |
| 162 | - } |
|
| 163 | - else if ($mType === 'label') { |
|
| 159 | + } else if ($mType === 'label') { |
|
| 164 | 160 | |
| 165 | 161 | $this->_aElement[$sName] = new Label($sName); |
| 166 | - } |
|
| 167 | - else if ($mType === 'list_checkbox') { |
|
| 162 | + } else if ($mType === 'list_checkbox') { |
|
| 168 | 163 | |
| 169 | 164 | $i = 0; |
| 170 | 165 | |
@@ -174,23 +169,19 @@ discard block |
||
| 174 | 169 | |
| 175 | 170 | $this->_aElement[$sName.'_'.$i++] = new Checkbox($sName, $sValue, $mKey, $mOptions); |
| 176 | 171 | } |
| 177 | - } |
|
| 178 | - else if ($mType === 'checkbox') { |
|
| 172 | + } else if ($mType === 'checkbox') { |
|
| 179 | 173 | |
| 180 | 174 | $this->_aElement[$sName] = new Checkbox($sName, $sLabel, $mValue, $mOptions); |
| 181 | - } |
|
| 182 | - else if ($mType === 'radio') { |
|
| 175 | + } else if ($mType === 'radio') { |
|
| 183 | 176 | |
| 184 | 177 | $this->_aElement[$sName.rand(100000,999999)] = new Radio($sName, $sLabel, $mValue, $mOptions); |
| 185 | - } |
|
| 186 | - else if ($mType === 'date') { |
|
| 178 | + } else if ($mType === 'date') { |
|
| 187 | 179 | |
| 188 | 180 | $aDay = array(); |
| 189 | 181 | |
| 190 | 182 | for ($i = 1 ; $i <= 31 ; $i++) { |
| 191 | 183 | |
| 192 | - if ($i < 10) { $aDay['0'.$i] = '0'.$i; } |
|
| 193 | - else { $aDay[$i] = $i; } |
|
| 184 | + if ($i < 10) { $aDay['0'.$i] = '0'.$i; } else { $aDay[$i] = $i; } |
|
| 194 | 185 | } |
| 195 | 186 | |
| 196 | 187 | $this->_aElement[$sName.'_day'] = new Select($sName, $aDay); |
@@ -331,8 +322,7 @@ discard block |
||
| 331 | 322 | if ($sValue instanceof Form) { |
| 332 | 323 | |
| 333 | 324 | ; |
| 334 | - } |
|
| 335 | - else { |
|
| 325 | + } else { |
|
| 336 | 326 | |
| 337 | 327 | $sMethodNameInEntity = 'get_'.$sKey; |
| 338 | 328 | $mValue = $oCompleteEntity->$sMethodNameInEntity(); |
@@ -340,8 +330,7 @@ discard block |
||
| 340 | 330 | if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) { |
| 341 | 331 | |
| 342 | 332 | $this->_aElement[$sExKey]->setValueChecked($mValue); |
| 343 | - } |
|
| 344 | - else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) { |
|
| 333 | + } else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) { |
|
| 345 | 334 | |
| 346 | 335 | $this->_aElement[$sKey]->setValue($mValue); |
| 347 | 336 | } |
@@ -359,8 +348,7 @@ discard block |
||
| 359 | 348 | if ($sValue instanceof Container) { |
| 360 | 349 | |
| 361 | 350 | $oForm->form[$sKey] = $sValue; |
| 362 | - } |
|
| 363 | - else { |
|
| 351 | + } else { |
|
| 364 | 352 | |
| 365 | 353 | $oForm->form[$sKey] = $sValue->fetch(); |
| 366 | 354 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * get the Value |
| 70 | 70 | * |
| 71 | 71 | * @access public |
| 72 | - * @return object |
|
| 72 | + * @return \stdClass |
|
| 73 | 73 | */ |
| 74 | 74 | public function createView() |
| 75 | 75 | { |
@@ -73,24 +73,24 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function createView() |
| 75 | 75 | { |
| 76 | - $oView = new \stdClass; |
|
| 77 | - $oView->form = $this->_sView; |
|
| 78 | - $oView->form_start = $this->_oForm->getFormInObject()->start; |
|
| 79 | - $oView->form_end = $this->_oForm->getFormInObject()->end; |
|
| 80 | - $oView->form_row = array(); |
|
| 76 | + $oView = new \stdClass; |
|
| 77 | + $oView->form = $this->_sView; |
|
| 78 | + $oView->form_start = $this->_oForm->getFormInObject()->start; |
|
| 79 | + $oView->form_end = $this->_oForm->getFormInObject()->end; |
|
| 80 | + $oView->form_row = array(); |
|
| 81 | 81 | |
| 82 | - foreach ($this->_oForm->getFormInObject()->form as $sKey => $mValue) { |
|
| 82 | + foreach ($this->_oForm->getFormInObject()->form as $sKey => $mValue) { |
|
| 83 | 83 | |
| 84 | - if ($mValue instanceof Container) { |
|
| 84 | + if ($mValue instanceof Container) { |
|
| 85 | 85 | |
| 86 | - $oNewForm = $mValue->createView(); |
|
| 87 | - $oView->form_row[$sKey] = $oNewForm->form_row; |
|
| 88 | - } |
|
| 89 | - else { |
|
| 86 | + $oNewForm = $mValue->createView(); |
|
| 87 | + $oView->form_row[$sKey] = $oNewForm->form_row; |
|
| 88 | + } |
|
| 89 | + else { |
|
| 90 | 90 | |
| 91 | - $oView->form_row[$sKey] = $mValue; |
|
| 92 | - } |
|
| 93 | - } |
|
| 91 | + $oView->form_row[$sKey] = $mValue; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | return $oView; |
| 96 | 96 | } |
@@ -117,48 +117,48 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function handleRequest(array $aRequest) : bool |
| 119 | 119 | { |
| 120 | - if (!count($_POST)) { return true; } |
|
| 120 | + if (!count($_POST)) { return true; } |
|
| 121 | 121 | |
| 122 | - // Validation |
|
| 123 | - foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 122 | + // Validation |
|
| 123 | + foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 124 | 124 | |
| 125 | - if (!$sValue instanceof self && !$this->_validate($sValue)) { |
|
| 125 | + if (!$sValue instanceof self && !$this->_validate($sValue)) { |
|
| 126 | 126 | |
| 127 | - return false; |
|
| 128 | - } |
|
| 129 | - } |
|
| 127 | + return false; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - // Save |
|
| 131 | + // Save |
|
| 132 | 132 | if ($this->_oForm->getIdEntity() > 0 && $this->_oForm->getSynchronizeEntity() !== null && count($aRequest) > 0) { |
| 133 | 133 | |
| 134 | - $sModelName = str_replace('Entity', 'Model', $this->_oForm->getSynchronizeEntity()); |
|
| 135 | - $oModel = new $sModelName; |
|
| 134 | + $sModelName = str_replace('Entity', 'Model', $this->_oForm->getSynchronizeEntity()); |
|
| 135 | + $oModel = new $sModelName; |
|
| 136 | 136 | |
| 137 | - $oEntity = new $this->_oForm->getSynchronizeEntity(); |
|
| 138 | - $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity); |
|
| 139 | - $sMethodName = 'set_'.$sPrimaryKey; |
|
| 137 | + $oEntity = new $this->_oForm->getSynchronizeEntity(); |
|
| 138 | + $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity); |
|
| 139 | + $sMethodName = 'set_'.$sPrimaryKey; |
|
| 140 | 140 | |
| 141 | - call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity())); |
|
| 141 | + call_user_func_array(array(&$oEntity, $sMethodName), array($this->_oForm->getIdEntity())); |
|
| 142 | 142 | |
| 143 | - foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 143 | + foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 144 | 144 | |
| 145 | - $sMethodName = 'set_'.$sValue->getName().''; |
|
| 146 | - call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()])); |
|
| 147 | - } |
|
| 145 | + $sMethodName = 'set_'.$sValue->getName().''; |
|
| 146 | + call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()])); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - $oEntity->save(); |
|
| 149 | + $oEntity->save(); |
|
| 150 | 150 | } |
| 151 | 151 | else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) { |
| 152 | 152 | |
| 153 | - $oEntity = new $this->_oForm->_sSynchronizeEntity; |
|
| 153 | + $oEntity = new $this->_oForm->_sSynchronizeEntity; |
|
| 154 | 154 | |
| 155 | - foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 155 | + foreach ($this->_oForm->getElement() as $sKey => $sValue) { |
|
| 156 | 156 | |
| 157 | - $sMethodName = 'set_'.$sValue->getName().''; |
|
| 158 | - call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()])); |
|
| 159 | - } |
|
| 157 | + $sMethodName = 'set_'.$sValue->getName().''; |
|
| 158 | + call_user_func_array(array(&$oEntity, $sMethodName), array($aRequest[$sValue->getName()])); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - $this->_oForm->setIdEntityCreated($oEntity->save()); |
|
| 161 | + $this->_oForm->setIdEntityCreated($oEntity->save()); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $this->_bHandleRequestActivate = true; |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function isSubmitted() : bool |
| 201 | 201 | { |
| 202 | - if (isset($_POST['validform'.$this->_oForm->getFormNumber()]) && $_POST['validform'.$this->_oForm->getFormNumber()] == 1) { |
|
| 202 | + if (isset($_POST['validform'.$this->_oForm->getFormNumber()]) && $_POST['validform'.$this->_oForm->getFormNumber()] == 1) { |
|
| 203 | 203 | |
| 204 | - return true; |
|
| 205 | - } |
|
| 204 | + return true; |
|
| 205 | + } |
|
| 206 | 206 | else { |
| 207 | 207 | |
| 208 | - return false; |
|
| 208 | + return false; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function isClicked(string $sElementName) : bool |
| 220 | 220 | { |
| 221 | - if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } |
|
| 221 | + if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } |
|
| 222 | 222 | else { return false; } |
| 223 | 223 | } |
| 224 | 224 | |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | private function _validate($oElement) : bool |
| 233 | 233 | { |
| 234 | - foreach ($oElement->getConstraint() as $oConstraint) { |
|
| 234 | + foreach ($oElement->getConstraint() as $oConstraint) { |
|
| 235 | 235 | |
| 236 | - if (!$oConstraint->validate($_POST[$oElement->getName()])) { |
|
| 236 | + if (!$oConstraint->validate($_POST[$oElement->getName()])) { |
|
| 237 | 237 | |
| 238 | - return false; |
|
| 239 | - } |
|
| 240 | - } |
|
| 238 | + return false; |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - return true; |
|
| 242 | + return true; |
|
| 243 | 243 | } |
| 244 | 244 | } |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $oNewForm = $mValue->createView(); |
| 87 | 87 | $oView->form_row[$sKey] = $oNewForm->form_row; |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | |
| 91 | 90 | $oView->form_row[$sKey] = $mValue; |
| 92 | 91 | } |
@@ -147,8 +146,7 @@ discard block |
||
| 147 | 146 | } |
| 148 | 147 | |
| 149 | 148 | $oEntity->save(); |
| 150 | - } |
|
| 151 | - else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) { |
|
| 149 | + } else if ($this->_oForm->getSynchronizeEntity() !== null && isset($aRequest) && count($aRequest) > 0) { |
|
| 152 | 150 | |
| 153 | 151 | $oEntity = new $this->_oForm->_sSynchronizeEntity; |
| 154 | 152 | |
@@ -187,8 +185,7 @@ discard block |
||
| 187 | 185 | */ |
| 188 | 186 | public function isValid() : bool |
| 189 | 187 | { |
| 190 | - if ($this->_bHandleRequestActivate === true) { return true; } |
|
| 191 | - else { return false; } |
|
| 188 | + if ($this->_bHandleRequestActivate === true) { return true; } else { return false; } |
|
| 192 | 189 | } |
| 193 | 190 | |
| 194 | 191 | /** |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | if (isset($_POST['validform'.$this->_oForm->getFormNumber()]) && $_POST['validform'.$this->_oForm->getFormNumber()] == 1) { |
| 203 | 200 | |
| 204 | 201 | return true; |
| 205 | - } |
|
| 206 | - else { |
|
| 202 | + } else { |
|
| 207 | 203 | |
| 208 | 204 | return false; |
| 209 | 205 | } |
@@ -218,8 +214,7 @@ discard block |
||
| 218 | 214 | */ |
| 219 | 215 | public function isClicked(string $sElementName) : bool |
| 220 | 216 | { |
| 221 | - if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } |
|
| 222 | - else { return false; } |
|
| 217 | + if (isset($_POST[$sElementName]) && $_POST[$sElementName]) { return true; } else { return false; } |
|
| 223 | 218 | } |
| 224 | 219 | |
| 225 | 220 | /** |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | * |
| 152 | 152 | * @access public |
| 153 | 153 | * @param string $sType type of input; |
| 154 | - * @return bool |
|
| 154 | + * @return string |
|
| 155 | 155 | */ |
| 156 | 156 | public function isClicked(string $sType) : string |
| 157 | 157 | { |
@@ -174,10 +174,10 @@ |
||
| 174 | 174 | $sContent = ''; |
| 175 | 175 | |
| 176 | 176 | if ($this->getType() === 'text' || $this->getType() === 'password' || $this->getType() === 'file' |
| 177 | - || $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email' |
|
| 178 | - || $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time' |
|
| 179 | - || $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week' |
|
| 180 | - || $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') { |
|
| 177 | + || $this->getType() === 'tel' || $this->getType() === 'url' || $this->getType() === 'email' |
|
| 178 | + || $this->getType() === 'search' || $this->getType() === 'date' || $this->getType() === 'time' |
|
| 179 | + || $this->getType() === 'datetime' || $this->getType() === 'month' || $this->getType() === 'week' |
|
| 180 | + || $this->getType() === 'number' || $this->getType() === 'range' || $this->getType() === 'color') { |
|
| 181 | 181 | |
| 182 | 182 | $sContent .= '<label>'.$this->getLabel().'</label> '; |
| 183 | 183 | } |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | $this->setName($sName); |
| 61 | 61 | $this->setValue($sValue); |
| 62 | 62 | |
| 63 | - if ($sLabel !== null) { $this->setLabel($sLabel); } |
|
| 64 | - else { $this->setLabel($sName); } |
|
| 63 | + if ($sLabel !== null) { $this->setLabel($sLabel); } else { $this->setLabel($sName); } |
|
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @access public |
| 98 | 98 | * @param string $sValue Value of input; |
| 99 | - * @return \Venus\lib\Form\Input |
|
| 99 | + * @return Radio |
|
| 100 | 100 | */ |
| 101 | 101 | public function setValue(string $sValue) : Input |
| 102 | 102 | { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @access public |
| 122 | 122 | * @param string $sValueChecked Value of input; |
| 123 | - * @return \Venus\lib\Form\Input |
|
| 123 | + * @return Radio |
|
| 124 | 124 | */ |
| 125 | 125 | public function setValueChecked(string $sValueChecked) : Input |
| 126 | 126 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @access public |
| 146 | 146 | * @param string $sLabel Label of input; |
| 147 | - * @return \Venus\lib\Form\Input |
|
| 147 | + * @return Radio |
|
| 148 | 148 | */ |
| 149 | 149 | public function setLabel(string $sLabel) : Input |
| 150 | 150 | { |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | * if the request is ajax |
| 60 | 60 | * |
| 61 | 61 | * @access public |
| 62 | - * @param string $sName name of the template |
|
| 63 | - * @return bool |
|
| 62 | + * @return boolean|null |
|
| 64 | 63 | */ |
| 65 | 64 | public static function isXmlHttpRequest() |
| 66 | 65 | { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function __construct() |
| 49 | 49 | { |
| 50 | - $this->cookies = function() { return new Cookies(); }; |
|
| 51 | - $this->files = function() { return new Files(); }; |
|
| 52 | - $this->headers = function() { return new Headers(); }; |
|
| 53 | - $this->query = function() { return new Query(); }; |
|
| 54 | - $this->request = function() { return new RequestPost(); }; |
|
| 50 | + $this->cookies = function() { return new Cookies(); }; |
|
| 51 | + $this->files = function() { return new Files(); }; |
|
| 52 | + $this->headers = function() { return new Headers(); }; |
|
| 53 | + $this->query = function() { return new Query(); }; |
|
| 54 | + $this->request = function() { return new RequestPost(); }; |
|
| 55 | 55 | $this->server = function() { return new Server(); }; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @access public |
| 122 | 122 | * @return bool |
| 123 | - * @deprecated don't use this method because they return a false result |
|
| 124 | - * delete in the version 5 |
|
| 125 | - * @throws \Exception |
|
| 123 | + * @deprecated don't use this method because they return a false result |
|
| 124 | + * delete in the version 5 |
|
| 125 | + * @throws \Exception |
|
| 126 | 126 | */ |
| 127 | 127 | public static function getPreferredLanguage() |
| 128 | 128 | { |
| 129 | - throw new \Exception("Use getLanguages() method now!"); |
|
| 129 | + throw new \Exception("Use getLanguages() method now!"); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @access public |
| 172 | 172 | * @param string $name |
| 173 | 173 | * @return mixed |
| 174 | - * @deprecated please use $this->request->get() |
|
| 175 | - * delete in the version 5 |
|
| 174 | + * @deprecated please use $this->request->get() |
|
| 175 | + * delete in the version 5 |
|
| 176 | 176 | */ |
| 177 | 177 | public function getPost(string $name) |
| 178 | 178 | { |
@@ -187,22 +187,22 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public static function getPut() |
| 189 | 189 | { |
| 190 | - $aPut = array(); |
|
| 190 | + $aPut = array(); |
|
| 191 | 191 | |
| 192 | - $rPutResource = fopen("php://input", "r"); |
|
| 192 | + $rPutResource = fopen("php://input", "r"); |
|
| 193 | 193 | |
| 194 | - while ($sData = fread($rPutResource, 1024)) { |
|
| 194 | + while ($sData = fread($rPutResource, 1024)) { |
|
| 195 | 195 | |
| 196 | - $aSeparatePut = explode('&', $sData); |
|
| 196 | + $aSeparatePut = explode('&', $sData); |
|
| 197 | 197 | |
| 198 | - foreach($aSeparatePut as $sOne) { |
|
| 198 | + foreach($aSeparatePut as $sOne) { |
|
| 199 | 199 | |
| 200 | - $aOnePut = explode('=', $sOne); |
|
| 201 | - $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
| 202 | - } |
|
| 203 | - } |
|
| 200 | + $aOnePut = explode('=', $sOne); |
|
| 201 | + $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - return $aPut; |
|
| 205 | + return $aPut; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -221,29 +221,29 @@ discard block |
||
| 221 | 221 | else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * get http method |
|
| 226 | - * @return string |
|
| 227 | - */ |
|
| 228 | - public function getMethod() : string |
|
| 229 | - { |
|
| 230 | - return $this->server->get('REQUEST_METHOD'); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * return languages accepted by the customer |
|
| 235 | - * @return array |
|
| 236 | - */ |
|
| 237 | - public function getLanguages() : array |
|
| 238 | - { |
|
| 239 | - if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
| 240 | - else { return array(); } |
|
| 241 | - } |
|
| 224 | + /** |
|
| 225 | + * get http method |
|
| 226 | + * @return string |
|
| 227 | + */ |
|
| 228 | + public function getMethod() : string |
|
| 229 | + { |
|
| 230 | + return $this->server->get('REQUEST_METHOD'); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * return languages accepted by the customer |
|
| 235 | + * @return array |
|
| 236 | + */ |
|
| 237 | + public function getLanguages() : array |
|
| 238 | + { |
|
| 239 | + if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
| 240 | + else { return array(); } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * get path info |
| 245 | 245 | * @return string |
| 246 | - */ |
|
| 246 | + */ |
|
| 247 | 247 | public function getPathInfo() : string |
| 248 | 248 | { |
| 249 | 249 | return $this->server->get('REQUEST_URI'); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $aSeparatePut = explode('&', $sData); |
| 197 | 197 | |
| 198 | - foreach($aSeparatePut as $sOne) { |
|
| 198 | + foreach ($aSeparatePut as $sOne) { |
|
| 199 | 199 | |
| 200 | 200 | $aOnePut = explode('=', $sOne); |
| 201 | 201 | $aPut[$aOnePut[0]] = $aOnePut[1]; |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public static function setStatus($iCode) |
| 216 | 216 | { |
| 217 | - if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
| 218 | - else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
| 219 | - else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
| 217 | + if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
| 218 | + else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
| 219 | + else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
| 220 | 220 | else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } |
| 221 | 221 | else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
| 222 | 222 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | if (array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { |
| 70 | 70 | |
| 71 | 71 | return true; |
| 72 | - } |
|
| 73 | - else { |
|
| 72 | + } else { |
|
| 74 | 73 | |
| 75 | 74 | return false; |
| 76 | 75 | } |
@@ -85,8 +84,7 @@ discard block |
||
| 85 | 84 | */ |
| 86 | 85 | public static function isHttpRequest() |
| 87 | 86 | { |
| 88 | - if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) { return true; } |
|
| 89 | - else { return false; } |
|
| 87 | + if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) { return true; } else { return false; } |
|
| 90 | 88 | } |
| 91 | 89 | |
| 92 | 90 | /** |
@@ -97,8 +95,7 @@ discard block |
||
| 97 | 95 | */ |
| 98 | 96 | public static function isHttpsRequest() |
| 99 | 97 | { |
| 100 | - if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { return true; } |
|
| 101 | - else { return false; } |
|
| 98 | + if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { return true; } else { return false; } |
|
| 102 | 99 | } |
| 103 | 100 | |
| 104 | 101 | /** |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | { |
| 112 | 109 | $sSapiType = php_sapi_name(); |
| 113 | 110 | |
| 114 | - if (substr($sSapiType, 0, 3) == 'cgi' || defined('STDIN')) { return true; } |
|
| 115 | - else { return false; } |
|
| 111 | + if (substr($sSapiType, 0, 3) == 'cgi' || defined('STDIN')) { return true; } else { return false; } |
|
| 116 | 112 | } |
| 117 | 113 | |
| 118 | 114 | /** |
@@ -137,8 +133,7 @@ discard block |
||
| 137 | 133 | */ |
| 138 | 134 | public static function getParameters() |
| 139 | 135 | { |
| 140 | - if (isset($_GET)) { return $_GET; } |
|
| 141 | - else { return array(); } |
|
| 136 | + if (isset($_GET)) { return $_GET; } else { return array(); } |
|
| 142 | 137 | } |
| 143 | 138 | |
| 144 | 139 | /** |
@@ -149,8 +144,7 @@ discard block |
||
| 149 | 144 | */ |
| 150 | 145 | public static function getPostParameters() |
| 151 | 146 | { |
| 152 | - if (isset($_POST)) { return $_POST; } |
|
| 153 | - else { return array(); } |
|
| 147 | + if (isset($_POST)) { return $_POST; } else { return array(); } |
|
| 154 | 148 | } |
| 155 | 149 | |
| 156 | 150 | /** |
@@ -161,8 +155,7 @@ discard block |
||
| 161 | 155 | */ |
| 162 | 156 | public function isPost() |
| 163 | 157 | { |
| 164 | - if (isset($_POST) && count($_POST) > 0) { return true; } |
|
| 165 | - else { return false; } |
|
| 158 | + if (isset($_POST) && count($_POST) > 0) { return true; } else { return false; } |
|
| 166 | 159 | } |
| 167 | 160 | |
| 168 | 161 | /** |
@@ -214,11 +207,7 @@ discard block |
||
| 214 | 207 | */ |
| 215 | 208 | public static function setStatus($iCode) |
| 216 | 209 | { |
| 217 | - if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } |
|
| 218 | - else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } |
|
| 219 | - else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } |
|
| 220 | - else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } |
|
| 221 | - else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
|
| 210 | + if ($iCode === 200) { header('HTTP/1.1 200 Ok'); } else if ($iCode === 201) { header('HTTP/1.1 201 Created'); } else if ($iCode === 204) { header("HTTP/1.0 204 No Content"); } else if ($iCode === 403) { header('HTTP/1.1 403 Forbidden'); } else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
|
| 222 | 211 | } |
| 223 | 212 | |
| 224 | 213 | /** |
@@ -236,8 +225,7 @@ discard block |
||
| 236 | 225 | */ |
| 237 | 226 | public function getLanguages() : array |
| 238 | 227 | { |
| 239 | - if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
| 240 | - else { return array(); } |
|
| 228 | + if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } else { return array(); } |
|
| 241 | 229 | } |
| 242 | 230 | |
| 243 | 231 | /** |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | * |
| 82 | 82 | * @access public |
| 83 | 83 | * @param string $sFile |
| 84 | - * @return bool|object |
|
| 84 | + * @return null|boolean |
|
| 85 | 85 | */ |
| 86 | 86 | public function upload(string $sFile) |
| 87 | 87 | { |
@@ -118,10 +118,10 @@ |
||
| 118 | 118 | $aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']); |
| 119 | 119 | |
| 120 | 120 | $fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight); |
| 121 | - $iHeight = $aImageSizes[1] / $fRatio; |
|
| 122 | - $iWidth = $aImageSizes[0] / $fRatio; |
|
| 123 | - $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
| 124 | - $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
| 121 | + $iHeight = $aImageSizes[1] / $fRatio; |
|
| 122 | + $iWidth = $aImageSizes[0] / $fRatio; |
|
| 123 | + $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
|
| 124 | + $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
|
| 125 | 125 | |
| 126 | 126 | $rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']); |
| 127 | 127 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $sExtension = strtolower(substr(strrchr($_FILES[$sFile]['name'], '.'), 1)); |
| 101 | 101 | |
| 102 | - if (count($this->_aAllowExtension) > 0 && !in_array($sExtension ,$this->_aAllowExtension)) { |
|
| 102 | + if (count($this->_aAllowExtension) > 0 && !in_array($sExtension, $this->_aAllowExtension)) { |
|
| 103 | 103 | |
| 104 | 104 | $this->_sError = "The extension is not good"; |
| 105 | 105 | return false; |
@@ -111,24 +111,24 @@ discard block |
||
| 111 | 111 | if ($this->_sExtension === null) { $this->setExtension($sExtension); } |
| 112 | 112 | |
| 113 | 113 | if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } |
| 114 | - else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
| 114 | + else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension; } |
|
| 115 | 115 | |
| 116 | 116 | if ($this->_bProportion == true && ($this->_iWidth || $this->_iHeight)) { |
| 117 | 117 | |
| 118 | 118 | $aImageSizes = getimagesize($_FILES[$sFile]['tmp_name']); |
| 119 | 119 | |
| 120 | 120 | $fRatio = min($aImageSizes[0] / $this->_iWidth, $aImageSizes[1] / $this->_iHeight); |
| 121 | - $iHeight = $aImageSizes[1] / $fRatio; |
|
| 122 | - $iWidth = $aImageSizes[0] / $fRatio; |
|
| 121 | + $iHeight = $aImageSizes[1] / $fRatio; |
|
| 122 | + $iWidth = $aImageSizes[0] / $fRatio; |
|
| 123 | 123 | $fY = ($iHeight - $this->_iHeight) / 2 * $fRatio; |
| 124 | 124 | $fX = ($iWidth - $this->_iWidth) / 2 * $fRatio; |
| 125 | 125 | |
| 126 | 126 | $rNewImage = imagecreatefromjpeg($_FILES[$sFile]['tmp_name']); |
| 127 | 127 | |
| 128 | - $rNewImgTrueColor = imagecreatetruecolor($this->_iWidth , $this->_iHeight); |
|
| 129 | - imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
|
| 128 | + $rNewImgTrueColor = imagecreatetruecolor($this->_iWidth, $this->_iHeight); |
|
| 129 | + imagecopyresampled($rNewImgTrueColor, $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
|
| 130 | 130 | |
| 131 | - imagejpeg($rNewImgTrueColor , $sName, 100); |
|
| 131 | + imagejpeg($rNewImgTrueColor, $sName, 100); |
|
| 132 | 132 | } |
| 133 | 133 | else { |
| 134 | 134 | |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if ($this->_sExtension === null) { $this->setExtension($sExtension); } |
| 112 | 112 | |
| 113 | - if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } |
|
| 114 | - else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
| 113 | + if ($this->_sName) { $sName = $sPath.$this->_sName.'.'.$this->_sExtension; } else { $sName = $sPath.md5(uniqid(rand(), true)).'.'.$this->_sExtension;} |
|
| 115 | 114 | |
| 116 | 115 | if ($this->_bProportion == true && ($this->_iWidth || $this->_iHeight)) { |
| 117 | 116 | |
@@ -129,8 +128,7 @@ discard block |
||
| 129 | 128 | imagecopyresampled($rNewImgTrueColor , $rNewImage, 0, 0, $fX, $fY, $this->_iWidth, $this->_iHeight, $iWidth * $fRatio - $fX * 2, $iHeight * $fRatio - $fY * 2); |
| 130 | 129 | |
| 131 | 130 | imagejpeg($rNewImgTrueColor , $sName, 100); |
| 132 | - } |
|
| 133 | - else { |
|
| 131 | + } else { |
|
| 134 | 132 | |
| 135 | 133 | $bResultat = move_uploaded_file($_FILES[$sFile]['tmp_name'], $sName); |
| 136 | 134 | |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use \Venus\lib\Bash as Bash; |
| 6 | 6 | use \Venus\src\Batch\common\Controller as Controller; |
| 7 | -use PHPUnit_Util_Fileloader; |
|
| 8 | 7 | |
| 9 | 8 | class Phpunit extends Controller |
| 10 | 9 | { |
@@ -8,42 +8,42 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Phpunit extends Controller |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Constructs a test case with the given name. |
|
| 13 | - * |
|
| 14 | - */ |
|
| 15 | - public function __construct() |
|
| 16 | - { |
|
| 17 | - parent::__construct(); |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * new method to launch a web server |
|
| 22 | - * @param array $options |
|
| 23 | - * @tutorial php bin/console server:run |
|
| 24 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
| 25 | - */ |
|
| 26 | - public function phpunit(array $options = array()) |
|
| 27 | - { |
|
| 28 | - ob_get_clean(); |
|
| 29 | - |
|
| 30 | - $files = scandir(__DIR__.'/../../../../tests'); |
|
| 31 | - |
|
| 32 | - foreach ($files as $one) { |
|
| 33 | - |
|
| 34 | - if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
| 35 | - |
|
| 36 | - $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
| 37 | - |
|
| 38 | - foreach ($controllerFiles as $oneController) { |
|
| 39 | - |
|
| 40 | - if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
| 41 | - |
|
| 42 | - $unitTest = new \PHPUnit_TextUI_Command; |
|
| 43 | - $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
| 44 | - } |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 11 | + /** |
|
| 12 | + * Constructs a test case with the given name. |
|
| 13 | + * |
|
| 14 | + */ |
|
| 15 | + public function __construct() |
|
| 16 | + { |
|
| 17 | + parent::__construct(); |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * new method to launch a web server |
|
| 22 | + * @param array $options |
|
| 23 | + * @tutorial php bin/console server:run |
|
| 24 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
| 25 | + */ |
|
| 26 | + public function phpunit(array $options = array()) |
|
| 27 | + { |
|
| 28 | + ob_get_clean(); |
|
| 29 | + |
|
| 30 | + $files = scandir(__DIR__.'/../../../../tests'); |
|
| 31 | + |
|
| 32 | + foreach ($files as $one) { |
|
| 33 | + |
|
| 34 | + if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
| 35 | + |
|
| 36 | + $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
| 37 | + |
|
| 38 | + foreach ($controllerFiles as $oneController) { |
|
| 39 | + |
|
| 40 | + if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
| 41 | + |
|
| 42 | + $unitTest = new \PHPUnit_TextUI_Command; |
|
| 43 | + $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -37,10 +37,10 @@ |
||
| 37 | 37 | |
| 38 | 38 | foreach ($controllerFiles as $oneController) { |
| 39 | 39 | |
| 40 | - if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
| 40 | + if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/'.$oneController) && $oneController != '..' && $oneController != '.') { |
|
| 41 | 41 | |
| 42 | 42 | $unitTest = new \PHPUnit_TextUI_Command; |
| 43 | - $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
| 43 | + $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/'.$oneController]); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |