| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | ]; | 
| 29 | 29 | |
| 30 | 30 |          if (!Plugin::getInstance()->getVideos()->useDevServer) { | 
| 31 | - $this->sourcePath = __DIR__ . '/dist'; | |
| 31 | + $this->sourcePath = __DIR__.'/dist'; | |
| 32 | 32 | $this->js[] = 'main.js'; | 
| 33 | 33 | $this->css[] = 'css/main.css'; | 
| 34 | 34 |          } else { | 
| @@ -42,7 +42,7 @@ | ||
| 42 | 42 |          try { | 
| 43 | 43 | return Videos::$plugin->getVideos()->getVideoByUrl($videoUrl, $enableCache, $cacheExpiry); | 
| 44 | 44 |          } catch (\Exception $exception) { | 
| 45 | -            Craft::info('Couldn’t get video from its url (' . $videoUrl . '): ' . $exception->getMessage(), __METHOD__); | |
| 45 | +            Craft::info('Couldn’t get video from its url ('.$videoUrl.'): '.$exception->getMessage(), __METHOD__); | |
| 46 | 46 | } | 
| 47 | 47 | |
| 48 | 48 | return null; | 
| @@ -176,7 +176,7 @@ | ||
| 176 | 176 | $event->options[] = [ | 
| 177 | 177 | 'key' => 'videos-caches', | 
| 178 | 178 |                  'label' => Craft::t('videos', 'Videos caches'), | 
| 179 | - 'action' => Craft::$app->path->getRuntimePath() . '/videos' | |
| 179 | + 'action' => Craft::$app->path->getRuntimePath().'/videos' | |
| 180 | 180 | ]; | 
| 181 | 181 | }); | 
| 182 | 182 | } | 
| @@ -88,6 +88,6 @@ | ||
| 88 | 88 | |
| 89 | 89 | $hash = md5(serialize($request)); | 
| 90 | 90 | |
| 91 | - return 'videos.' . $hash; | |
| 91 | + return 'videos.'.$hash; | |
| 92 | 92 | } | 
| 93 | 93 | } | 
| @@ -36,7 +36,7 @@ | ||
| 36 | 36 | |
| 37 | 37 | // Rebuild OAuth provider options | 
| 38 | 38 |              foreach ($oauthProviderOptions as $providerHandle => $provider) { | 
| 39 | -                $projectConfig->set('plugins.videos.settings.oauthProviderOptions.' . $providerHandle, $provider, sprintf('Save the “%s” provider', $providerHandle)); | |
| 39 | +                $projectConfig->set('plugins.videos.settings.oauthProviderOptions.'.$providerHandle, $provider, sprintf('Save the “%s” provider', $providerHandle)); | |
| 40 | 40 | } | 
| 41 | 41 | } | 
| 42 | 42 | } | 
| @@ -135,7 +135,7 @@ | ||
| 135 | 135 | ]; | 
| 136 | 136 | |
| 137 | 137 | $key = 'plugins.videos.settings.oauthProviderOptions'; | 
| 138 | - $configPath = $key . '.' . $gateway->getHandle(); | |
| 138 | + $configPath = $key.'.'.$gateway->getHandle(); | |
| 139 | 139 | |
| 140 | 140 |          Craft::$app->getProjectConfig()->set($configPath, $configData, sprintf('Save the “%s” integration', $gateway->getHandle())); | 
| 141 | 141 | |
| @@ -55,8 +55,8 @@ discard block | ||
| 55 | 55 | $id = Html::id($name); | 
| 56 | 56 | |
| 57 | 57 | // Init CSRF Token | 
| 58 | - $jsTemplate = 'window.csrfTokenName = "' . Craft::$app->getConfig()->getGeneral()->csrfTokenName . '";'; | |
| 59 | - $jsTemplate .= 'window.csrfTokenValue = "' . Craft::$app->getRequest()->getCsrfToken() . '";'; | |
| 58 | + $jsTemplate = 'window.csrfTokenName = "'.Craft::$app->getConfig()->getGeneral()->csrfTokenName.'";'; | |
| 59 | + $jsTemplate .= 'window.csrfTokenValue = "'.Craft::$app->getRequest()->getCsrfToken().'";'; | |
| 60 | 60 | $js = $view->renderString($jsTemplate); | 
| 61 | 61 | $view->registerJs($js); | 
| 62 | 62 | |
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | |
| 93 | 93 | // Instantiate Videos Field | 
| 94 | 94 |          // $view->registerJs('new Videos.Field("'.$view->namespaceInputId($id).'");'); | 
| 95 | -        $view->registerJs('new VideoFieldConstructor({data: {fieldVariables: ' . \json_encode($variables) . '}}).$mount("#' . $view->namespaceInputId($id) . '-vue");'); | |
| 95 | +        $view->registerJs('new VideoFieldConstructor({data: {fieldVariables: '.\json_encode($variables).'}}).$mount("#'.$view->namespaceInputId($id).'-vue");'); | |
| 96 | 96 | |
| 97 | 97 |          return $view->renderTemplate('videos/_components/fieldtypes/Video/input', $variables); | 
| 98 | 98 | } | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | return $video; | 
| 134 | 134 | } | 
| 135 | 135 |          } catch (\Exception $exception) { | 
| 136 | -            Craft::info("Couldn't get video in field normalizeValue: " . $exception->getMessage(), __METHOD__); | |
| 136 | +            Craft::info("Couldn't get video in field normalizeValue: ".$exception->getMessage(), __METHOD__); | |
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | 139 | return null; | 
| @@ -194,7 +194,7 @@ discard block | ||
| 194 | 194 | */ | 
| 195 | 195 | public function getVideoById(string $id): Video | 
| 196 | 196 |      { | 
| 197 | -        $data = $this->get('videos/' . $id, [ | |
| 197 | +        $data = $this->get('videos/'.$id, [ | |
| 198 | 198 | 'query' => [ | 
| 199 | 199 | 'fields' => 'created_time,description,duration,height,link,name,pictures,pictures,privacy,stats,uri,user,width,download,review_link,files' | 
| 200 | 200 | ], | 
| @@ -274,8 +274,8 @@ discard block | ||
| 274 | 274 | $options = [ | 
| 275 | 275 | 'base_uri' => $this->getApiUrl(), | 
| 276 | 276 | 'headers' => [ | 
| 277 | - 'Accept' => 'application/vnd.vimeo.*+json;version=' . $this->getApiVersion(), | |
| 278 | - 'Authorization' => 'Bearer ' . $this->getOauthToken()->getToken() | |
| 277 | + 'Accept' => 'application/vnd.vimeo.*+json;version='.$this->getApiVersion(), | |
| 278 | + 'Authorization' => 'Bearer '.$this->getOauthToken()->getToken() | |
| 279 | 279 | ], | 
| 280 | 280 | ]; | 
| 281 | 281 | |
| @@ -296,7 +296,7 @@ discard block | ||
| 296 | 296 | unset($params['id']); | 
| 297 | 297 | |
| 298 | 298 | // albums/#album_id | 
| 299 | -        return $this->performVideosRequest('me/albums/' . $albumId . '/videos', $params); | |
| 299 | +        return $this->performVideosRequest('me/albums/'.$albumId.'/videos', $params); | |
| 300 | 300 | } | 
| 301 | 301 | |
| 302 | 302 | /** | 
| @@ -313,7 +313,7 @@ discard block | ||
| 313 | 313 | unset($params['id']); | 
| 314 | 314 | |
| 315 | 315 | // folders/#folder_id | 
| 316 | -        return $this->performVideosRequest('me/folders/' . $folderId . '/videos', $params); | |
| 316 | +        return $this->performVideosRequest('me/folders/'.$folderId.'/videos', $params); | |
| 317 | 317 | } | 
| 318 | 318 | |
| 319 | 319 | /** | 
| @@ -329,7 +329,7 @@ discard block | ||
| 329 | 329 | $params['channel_id'] = $params['id']; | 
| 330 | 330 | unset($params['id']); | 
| 331 | 331 | |
| 332 | -        return $this->performVideosRequest('channels/' . $params['channel_id'] . '/videos', $params); | |
| 332 | +        return $this->performVideosRequest('channels/'.$params['channel_id'].'/videos', $params); | |
| 333 | 333 | } | 
| 334 | 334 | |
| 335 | 335 | /** | 
| @@ -472,7 +472,7 @@ discard block | ||
| 472 | 472 | break; | 
| 473 | 473 | |
| 474 | 474 | default: | 
| 475 | -                    throw new CollectionParsingException('Couldn’t parse collection of type ”' . $type . '“.'); | |
| 475 | +                    throw new CollectionParsingException('Couldn’t parse collection of type ”'.$type.'“.'); | |
| 476 | 476 | } | 
| 477 | 477 | |
| 478 | 478 | $parseCollections[] = $parsedCollection; | 
| @@ -566,10 +566,10 @@ discard block | ||
| 566 | 566 | $video->description = $data['description']; | 
| 567 | 567 | $video->gatewayHandle = 'vimeo'; | 
| 568 | 568 | $video->gatewayName = 'Vimeo'; | 
| 569 | -        $video->id = (int)substr($data['uri'], \strlen('/videos/')); | |
| 569 | +        $video->id = (int) substr($data['uri'], \strlen('/videos/')); | |
| 570 | 570 | $video->plays = $data['stats']['plays'] ?? 0; | 
| 571 | 571 | $video->title = $data['name']; | 
| 572 | - $video->url = 'https://vimeo.com/' . substr($data['uri'], 8); | |
| 572 | + $video->url = 'https://vimeo.com/'.substr($data['uri'], 8); | |
| 573 | 573 | $video->width = $data['width']; | 
| 574 | 574 | $video->height = $data['height']; | 
| 575 | 575 | |
| @@ -267,7 +267,7 @@ discard block | ||
| 267 | 267 | $options = [ | 
| 268 | 268 | 'base_uri' => $this->getApiUrl(), | 
| 269 | 269 | 'headers' => [ | 
| 270 | - 'Authorization' => 'Bearer ' . $this->getOauthToken()->getToken() | |
| 270 | + 'Authorization' => 'Bearer '.$this->getOauthToken()->getToken() | |
| 271 | 271 | ] | 
| 272 | 272 | ]; | 
| 273 | 273 | |
| @@ -604,7 +604,7 @@ discard block | ||
| 604 | 604 | $video = new Video; | 
| 605 | 605 | $video->raw = $data; | 
| 606 | 606 | $video->authorName = $data['snippet']['channelTitle']; | 
| 607 | - $video->authorUrl = 'http://youtube.com/channel/' . $data['snippet']['channelId']; | |
| 607 | + $video->authorUrl = 'http://youtube.com/channel/'.$data['snippet']['channelId']; | |
| 608 | 608 | $video->date = strtotime($data['snippet']['publishedAt']); | 
| 609 | 609 | $video->description = $data['snippet']['description']; | 
| 610 | 610 | $video->gatewayHandle = 'youtube'; | 
| @@ -612,11 +612,11 @@ discard block | ||
| 612 | 612 | $video->id = $data['id']; | 
| 613 | 613 | $video->plays = $data['statistics']['viewCount']; | 
| 614 | 614 | $video->title = $data['snippet']['title']; | 
| 615 | - $video->url = 'http://youtu.be/' . $video->id; | |
| 615 | + $video->url = 'http://youtu.be/'.$video->id; | |
| 616 | 616 | |
| 617 | 617 | // Video Duration | 
| 618 | 618 | $interval = new \DateInterval($data['contentDetails']['duration']); | 
| 619 | -        $video->durationSeconds = (int)date_create('@0')->add($interval)->getTimestamp(); | |
| 619 | +        $video->durationSeconds = (int) date_create('@0')->add($interval)->getTimestamp(); | |
| 620 | 620 | $video->duration8601 = $data['contentDetails']['duration']; | 
| 621 | 621 | |
| 622 | 622 | // Thumbnails |