@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Rafidion Michael |
|
| 5 | - * Date: 30/11/2014 |
|
| 6 | - * Time: 18:21 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Rafidion Michael |
|
| 5 | + * Date: 30/11/2014 |
|
| 6 | + * Time: 18:21 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Event; |
| 10 | 10 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | 'bundle'=>$bundle, |
| 86 | 86 | 'model_id'=>$model_id |
| 87 | 87 | ]); |
| 88 | - }else{ |
|
| 88 | + } else{ |
|
| 89 | 89 | $response = new Response(); |
| 90 | 90 | $response->setContent(json_encode(array( |
| 91 | 91 | 'error'=>"Le format n'est pas valid" |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | 'alt'=>$request->get('alt') |
| 148 | 148 | ]; |
| 149 | 149 | $params['media'] = $this->getManage()->getRepository('MykeesMediaBundle:Media')->findOneBy(['name'=>$params['alt'],'model'=>$model]); |
| 150 | - }else{ |
|
| 150 | + } else{ |
|
| 151 | 151 | $params = [ |
| 152 | 152 | 'media'=>$this->getManage()->getRepository('MykeesMediaBundle:Media')->find($id), |
| 153 | 153 | 'class'=>null |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: tetsu0o |
|
| 5 | - * Date: 29/12/14 |
|
| 6 | - * Time: 02:03 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: tetsu0o |
|
| 5 | + * Date: 29/12/14 |
|
| 6 | + * Time: 02:03 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Helper; |
| 10 | 10 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | ]); |
| 55 | 55 | |
| 56 | 56 | return '<iframe src="'.$url.'" style="width:100%;border: none;min-height:100%;" class="iframe-uploader"></iframe>'; |
| 57 | - }else{ |
|
| 57 | + } else{ |
|
| 58 | 58 | |
| 59 | 59 | return '<h3 style="font-weight: bold;text-align: center;color:#777">The <span style="color:#DD6F6F;border-bottom:2px dashed #777;">ID</span> from your entity <span style="color:#DD6F6F;border-bottom:2px dashed #777;">'.$model.'</span> is required to use the uploader</h3>'; |
| 60 | 60 | } |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Rafidion Michael |
|
| 5 | - * Date: 30/11/2014 |
|
| 6 | - * Time: 17:41 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Rafidion Michael |
|
| 5 | + * Date: 30/11/2014 |
|
| 6 | + * Time: 17:41 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Twig\Extension; |
| 10 | 10 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: tetsu0o |
|
| 5 | - * Date: 30/12/14 |
|
| 6 | - * Time: 02:47 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: tetsu0o |
|
| 5 | + * Date: 30/12/14 |
|
| 6 | + * Time: 02:47 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Twig\Extension; |
| 10 | 10 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Rafidion Michael |
|
| 5 | - * Date: 02/12/2014 |
|
| 6 | - * Time: 01:56 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Rafidion Michael |
|
| 5 | + * Date: 02/12/2014 |
|
| 6 | + * Time: 01:56 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Interfaces; |
| 10 | 10 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Rafidion Michael |
|
| 5 | - * Date: 30/11/2014 |
|
| 6 | - * Time: 18:22 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Rafidion Michael |
|
| 5 | + * Date: 30/11/2014 |
|
| 6 | + * Time: 18:22 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\EventListener; |
| 10 | 10 | |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return true; |
| 85 | - }else{ |
|
| 85 | + } else{ |
|
| 86 | 86 | |
| 87 | 87 | return new Response(); |
| 88 | 88 | } |
| 89 | - }else{ |
|
| 89 | + } else{ |
|
| 90 | 90 | |
| 91 | 91 | return new Response(); |
| 92 | 92 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $count++; |
| 143 | 143 | |
| 144 | 144 | return $this->mediaExist( $filename, $webroot, $count ); |
| 145 | - }else{ |
|
| 145 | + } else{ |
|
| 146 | 146 | $filename = $file; |
| 147 | 147 | |
| 148 | 148 | return $filename; |
@@ -227,18 +227,18 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * Tests a string as to whether it's valid UTF-8 and supported by the |
|
| 231 | - * Unicode standard |
|
| 232 | - * Note: this function has been modified to simple return true or false |
|
| 233 | - * @author <[email protected]> |
|
| 234 | - * @param string UTF-8 encoded string |
|
| 235 | - * @return boolean true if valid |
|
| 236 | - * @see http://hsivonen.iki.fi/php-utf8/ |
|
| 237 | - */ |
|
| 230 | + * Tests a string as to whether it's valid UTF-8 and supported by the |
|
| 231 | + * Unicode standard |
|
| 232 | + * Note: this function has been modified to simple return true or false |
|
| 233 | + * @author <[email protected]> |
|
| 234 | + * @param string UTF-8 encoded string |
|
| 235 | + * @return boolean true if valid |
|
| 236 | + * @see http://hsivonen.iki.fi/php-utf8/ |
|
| 237 | + */ |
|
| 238 | 238 | public static function validUtf8($str) |
| 239 | 239 | { |
| 240 | 240 | $mState = 0; // cached expected number of octets after the current octet |
| 241 | - // until the beginning of the next UTF8 character sequence |
|
| 241 | + // until the beginning of the next UTF8 character sequence |
|
| 242 | 242 | $mUcs4 = 0; // cached Unicode character |
| 243 | 243 | $mBytes = 1; // cached expected number of octets in the current sequence |
| 244 | 244 | |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | $tmp = ($tmp & 0x0000003F) << $shift; |
| 305 | 305 | $mUcs4 |= $tmp; |
| 306 | 306 | /** |
| 307 | - * End of the multi-octet sequence. mUcs4 now contains the final |
|
| 308 | - * Unicode codepoint to be output |
|
| 309 | - */ |
|
| 307 | + * End of the multi-octet sequence. mUcs4 now contains the final |
|
| 308 | + * Unicode codepoint to be output |
|
| 309 | + */ |
|
| 310 | 310 | if (0 == --$mState) { |
| 311 | 311 | /* |
| 312 | 312 | * Check for illegal sequences and codepoints. |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | } else { |
| 332 | 332 | /** |
| 333 | - *((0xC0 & (*in) != 0x80) && (mState != 0)) |
|
| 334 | - * Incomplete multi-octet sequence. |
|
| 335 | - */ |
|
| 333 | + *((0xC0 & (*in) != 0x80) && (mState != 0)) |
|
| 334 | + * Incomplete multi-octet sequence. |
|
| 335 | + */ |
|
| 336 | 336 | return false; |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | // More stripping. Replace spaces with dashes |
| 362 | 362 | $text = strtolower(preg_replace('/[^A-Z^a-z^0-9^\/]+/', $separator, |
| 363 | - preg_replace('/([a-z\d])([A-Z])/', '\1_\2', |
|
| 364 | - preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', |
|
| 365 | - preg_replace('/::/', '/', $text))))); |
|
| 363 | + preg_replace('/([a-z\d])([A-Z])/', '\1_\2', |
|
| 364 | + preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', |
|
| 365 | + preg_replace('/::/', '/', $text))))); |
|
| 366 | 366 | |
| 367 | 367 | return trim($text, $separator); |
| 368 | 368 | } |
@@ -39,17 +39,39 @@ |
||
| 39 | 39 | { |
| 40 | 40 | $stringLength = strlen($string); |
| 41 | 41 | for ($i = 0; $i < $stringLength; $i++) { |
| 42 | - if (ord($string[$i]) < 0x80) continue; # 0bbbbbbb |
|
| 43 | - elseif ((ord($string[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb |
|
| 44 | - elseif ((ord($string[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb |
|
| 45 | - elseif ((ord($string[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb |
|
| 46 | - elseif ((ord($string[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb |
|
| 47 | - elseif ((ord($string[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b |
|
| 48 | - else return false; # Does not match any model |
|
| 49 | - for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ? |
|
| 50 | - if ((++$i == strlen($string)) || ((ord($string[$i]) & 0xC0) != 0x80)) |
|
| 42 | + if (ord($string[$i]) < 0x80) { |
|
| 43 | + continue; |
|
| 44 | + } |
|
| 45 | + # 0bbbbbbb |
|
| 46 | + elseif ((ord($string[$i]) & 0xE0) == 0xC0) { |
|
| 47 | + $n=1; |
|
| 48 | + } |
|
| 49 | + # 110bbbbb |
|
| 50 | + elseif ((ord($string[$i]) & 0xF0) == 0xE0) { |
|
| 51 | + $n=2; |
|
| 52 | + } |
|
| 53 | + # 1110bbbb |
|
| 54 | + elseif ((ord($string[$i]) & 0xF8) == 0xF0) { |
|
| 55 | + $n=3; |
|
| 56 | + } |
|
| 57 | + # 11110bbb |
|
| 58 | + elseif ((ord($string[$i]) & 0xFC) == 0xF8) { |
|
| 59 | + $n=4; |
|
| 60 | + } |
|
| 61 | + # 111110bb |
|
| 62 | + elseif ((ord($string[$i]) & 0xFE) == 0xFC) { |
|
| 63 | + $n=5; |
|
| 64 | + } |
|
| 65 | + # 1111110b |
|
| 66 | + else { |
|
| 51 | 67 | return false; |
| 52 | 68 | } |
| 69 | + # Does not match any model |
|
| 70 | + for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ? |
|
| 71 | + if ((++$i == strlen($string)) || ((ord($string[$i]) & 0xC0) != 0x80)) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 74 | + } |
|
| 53 | 75 | } |
| 54 | 76 | return true; |
| 55 | 77 | } |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: tetsu0o |
|
| 5 | - * Date: 28/12/14 |
|
| 6 | - * Time: 12:45 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: tetsu0o |
|
| 5 | + * Date: 28/12/14 |
|
| 6 | + * Time: 12:45 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Mykees\MediaBundle\Util; |
| 10 | 10 | |