@@ -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 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $enableCache = VideosPlugin::$plugin->getSettings()->enableCache === false ? false : $enableCache; |
115 | 115 | |
116 | 116 | if ($enableCache) { |
117 | - $key = 'videos.video.' . $gatewayHandle . '.' . md5($id); |
|
117 | + $key = 'videos.video.'.$gatewayHandle.'.'.md5($id); |
|
118 | 118 | |
119 | 119 | $response = VideosPlugin::$plugin->getCache()->get([$key]); |
120 | 120 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private function requestVideoByUrl($videoUrl, bool $enableCache = true, int $cacheExpiry = 3600) |
146 | 146 | { |
147 | - $key = 'videos.video.' . md5($videoUrl); |
|
147 | + $key = 'videos.video.'.md5($videoUrl); |
|
148 | 148 | $enableCache = VideosPlugin::$plugin->getSettings()->enableCache === false ? false : $enableCache; |
149 | 149 | |
150 | 150 | if ($enableCache) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return $video; |
188 | 188 | } |
189 | 189 | } catch (\Exception $exception) { |
190 | - Craft::info('Couldn’t get video: ' . $exception->getMessage(), __METHOD__); |
|
190 | + Craft::info('Couldn’t get video: '.$exception->getMessage(), __METHOD__); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 |
@@ -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 |