Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Welch <[email protected]>
  • Loading branch information
khalwat committed May 24, 2019
1 parent a34eba4 commit f8dde7f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/Transcoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

use yii\base\ErrorException;
use yii\base\Event;
use yii\base\InvalidArgumentException;

/**
* Class Transcode
Expand Down Expand Up @@ -90,7 +89,7 @@ public function init()
*/
public function clearAllCaches()
{
$transcoderPaths = Transcoder::$plugin->getSettings()->transcoderPaths;
$transcoderPaths = self::$plugin->getSettings()->transcoderPaths;

foreach ($transcoderPaths as $key => $value) {
$dir = Craft::getAlias($value);
Expand Down
24 changes: 14 additions & 10 deletions src/variables/ManifestVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
use Craft;
use craft\helpers\Template;

use yii\web\NotFoundHttpException;

use Twig\Markup;

class ManifestVariable
{
// Protected Static Properties
Expand All @@ -17,17 +21,17 @@ class ManifestVariable
// If `devMode` is on, use webpack-dev-server to all for HMR (hot module reloading)
'useDevServer' => true,
// Manifest names
'manifest' => [
'manifest' => [
'legacy' => 'manifest-legacy.json',
'modern' => 'manifest.json',
],
// Public server config
'server' => [
'server' => [
'manifestPath' => '/',
'publicPath' => '/',
],
// webpack-dev-server config
'devServer' => [
'devServer' => [
'manifestPath' => 'http://127.0.0.1:8080',
'publicPath' => '/',
],
Expand All @@ -51,8 +55,8 @@ public function __construct()
* @param bool $async
* @param null|array $config
*
* @return null|\Twig_Markup
* @throws \yii\web\NotFoundHttpException
* @return null|Markup
* @throws NotFoundHttpException
*/
public function includeCssModule(string $moduleName, bool $async = false, $config = null)
{
Expand Down Expand Up @@ -80,8 +84,8 @@ public static function includeCssRelPreloadPolyfill(): string
* @param bool $async
* @param null|array $config
*
* @return null|\Twig_Markup
* @throws \yii\web\NotFoundHttpException
* @return null|Markup
* @throws NotFoundHttpException
*/
public function includeJsModule(string $moduleName, bool $async = false, $config = null)
{
Expand All @@ -97,8 +101,8 @@ public function includeJsModule(string $moduleName, bool $async = false, $config
* @param string $type
* @param null $config
*
* @return null|\Twig_Markup
* @throws \yii\web\NotFoundHttpException
* @return null|Markup
* @throws NotFoundHttpException
*/
public function getModuleUri(string $moduleName, string $type = 'modern', $config = null)
{
Expand All @@ -110,7 +114,7 @@ public function getModuleUri(string $moduleName, string $type = 'modern', $confi
/**
* Include the Safari 10.1 nomodule fix JavaScript
*
* @return \Twig_Markup
* @return Markup
*/
public function includeSafariNomoduleFix()
{
Expand Down
8 changes: 4 additions & 4 deletions src/variables/TranscoderVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TranscoderVariable extends ManifestVariable
*
* @param $filePath
* @param $videoOptions
* @bool $generate
* @bool $generate
*
* @return string
*/
Expand Down Expand Up @@ -144,7 +144,7 @@ public function getGifProgressUrl($filePath, $gifOptions): string

return $result;
}

/**
* Get a download URL
*
Expand All @@ -156,7 +156,7 @@ public function getDownloadUrl($url): string
{
$result = '';
$filePath = parse_url($url, PHP_URL_PATH);
$filePath = $_SERVER['DOCUMENT_ROOT'] . $filePath;
$filePath = $_SERVER['DOCUMENT_ROOT'].$filePath;
if (file_exists($filePath)) {
$urlParams = [
'url' => $url,
Expand All @@ -166,7 +166,7 @@ public function getDownloadUrl($url): string

return $result;
}

/**
* Returns a URL to a GIF file
*
Expand Down

0 comments on commit f8dde7f

Please sign in to comment.