Skip to content
This repository was archived by the owner on Aug 21, 2019. It is now read-only.

Commit 63c7995

Browse files
committed
phpcsfixer, compser update
1 parent 25594b7 commit 63c7995

File tree

9 files changed

+94
-26
lines changed

9 files changed

+94
-26
lines changed

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# OS files
2+
.DS_Store
3+
.php_cs.cache
4+
5+
/node_modules
6+
7+
# files of Composer dependencies that are not needed for the plugin
8+
/vendor/**/.*
9+
/vendor/**/*.json
10+
/vendor/**/*.txt
11+
/vendor/**/*.md
12+
/vendor/**/*.yml
13+
/vendor/**/*.yaml
14+
/vendor/**/*.xml
15+
/vendor/**/*.dist
16+
/vendor/**/readme.php
17+
/vendor/**/LICENSE
18+
/vendor/**/COPYING
19+
/vendor/**/VERSION
20+
/vendor/**/docs/*
21+
/vendor/**/example/*
22+
/vendor/**/examples/*
23+
/vendor/**/test/*
24+
/vendor/**/tests/*
25+
/vendor/**/php4/*
26+
/vendor/getkirby/composer-installer

.php_cs.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude('vendor')
5+
->exclude('node_modules')
6+
->in(__DIR__)
7+
;
8+
9+
return PhpCsFixer\Config::create()
10+
->setRules([
11+
'@PSR2' => true,
12+
])
13+
->setFinder($finder)
14+
;

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"require": {
33
"imageoptim/imageoptim": "^1.3"
4+
},
5+
"config": {
6+
"optimize-autoloader": true,
7+
"sort-packages": true
48
}
59
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kirby-imageoptim.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public static function is_localhost()
1313
}
1414

1515
public static function imageoptim(
16-
$file,
17-
$width = null,
18-
$height = null,
19-
$crop = 'fit',
20-
$dpr = 1,
21-
$quality = 'medium',
22-
$media = null
16+
$file,
17+
$width = null,
18+
$height = null,
19+
$crop = 'fit',
20+
$dpr = 1,
21+
$quality = 'medium',
22+
$media = null
2323
) {
2424
$url = $file->url();
2525

@@ -55,15 +55,15 @@ public static function imageoptim(
5555
}
5656

5757
$filepath = str_replace(
58-
$file->filename(),
59-
$hash,
60-
kirby()->roots()->thumbs().DS.$file->uri()
58+
$file->filename(),
59+
$hash,
60+
kirby()->roots()->thumbs().DS.$file->uri()
6161
);
6262

6363
$urlOptim = str_replace(
64-
$file->filename(),
65-
$hash,
66-
kirby()->urls()->thumbs().'/'.$file->uri()
64+
$file->filename(),
65+
$hash,
66+
kirby()->urls()->thumbs().'/'.$file->uri()
6767
);
6868

6969
if (!f::exists($filepath)) {
@@ -103,13 +103,13 @@ public static function imageoptim(
103103
}
104104

105105
public static function imageoptimAndSrcset(
106-
$file,
107-
$width = null,
108-
$height = null,
109-
$crop = 'fit',
110-
$dpr = 1,
111-
$quality = 'medium',
112-
$options = []
106+
$file,
107+
$width = null,
108+
$height = null,
109+
$crop = 'fit',
110+
$dpr = 1,
111+
$quality = 'medium',
112+
$options = []
113113
) {
114114
if (!$file || get_class($file) != 'File') {
115115
return '';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "kirby-imageoptim",
33
"description": "Kirby CMS file method to optimize images using ImageOptim within your template code.",
4-
"version": "1.2.2",
4+
"version": "1.3.0",
55
"type": "kirby-plugin",
66
"license": "MIT"
77
}

vendor/composer/ClassLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function isClassMapAuthoritative()
279279
*/
280280
public function setApcuPrefix($apcuPrefix)
281281
{
282-
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
282+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283283
}
284284

285285
/**
@@ -377,11 +377,11 @@ private function findFileWithExtension($class, $ext)
377377
$subPath = $class;
378378
while (false !== $lastPos = strrpos($subPath, '\\')) {
379379
$subPath = substr($subPath, 0, $lastPos);
380-
$search = $subPath.'\\';
380+
$search = $subPath . '\\';
381381
if (isset($this->prefixDirsPsr4[$search])) {
382+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
382383
foreach ($this->prefixDirsPsr4[$search] as $dir) {
383-
$length = $this->prefixLengthsPsr4[$first][$search];
384-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
384+
if (file_exists($file = $dir . $pathEnd)) {
385385
return $file;
386386
}
387387
}

vendor/composer/autoload_classmap.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9+
'ImageOptim\\API' => $vendorDir . '/imageoptim/imageoptim/src/API.php',
10+
'ImageOptim\\APIException' => $vendorDir . '/imageoptim/imageoptim/src/APIException.php',
11+
'ImageOptim\\AccessDeniedException' => $vendorDir . '/imageoptim/imageoptim/src/AccessDeniedException.php',
12+
'ImageOptim\\FileRequest' => $vendorDir . '/imageoptim/imageoptim/src/FileRequest.php',
13+
'ImageOptim\\InvalidArgumentException' => $vendorDir . '/imageoptim/imageoptim/src/InvalidArgumentException.php',
14+
'ImageOptim\\NetworkException' => $vendorDir . '/imageoptim/imageoptim/src/NetworkException.php',
15+
'ImageOptim\\NotFoundException' => $vendorDir . '/imageoptim/imageoptim/src/NotFoundException.php',
16+
'ImageOptim\\OriginServerException' => $vendorDir . '/imageoptim/imageoptim/src/OriginServerException.php',
17+
'ImageOptim\\Request' => $vendorDir . '/imageoptim/imageoptim/src/Request.php',
18+
'ImageOptim\\URLRequest' => $vendorDir . '/imageoptim/imageoptim/src/URLRequest.php',
919
);

vendor/composer/autoload_static.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,25 @@ class ComposerStaticInitdb60f64c7c86327cd38317daa842af05
2020
),
2121
);
2222

23+
public static $classMap = array (
24+
'ImageOptim\\API' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/API.php',
25+
'ImageOptim\\APIException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/APIException.php',
26+
'ImageOptim\\AccessDeniedException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/AccessDeniedException.php',
27+
'ImageOptim\\FileRequest' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/FileRequest.php',
28+
'ImageOptim\\InvalidArgumentException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/InvalidArgumentException.php',
29+
'ImageOptim\\NetworkException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/NetworkException.php',
30+
'ImageOptim\\NotFoundException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/NotFoundException.php',
31+
'ImageOptim\\OriginServerException' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/OriginServerException.php',
32+
'ImageOptim\\Request' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/Request.php',
33+
'ImageOptim\\URLRequest' => __DIR__ . '/..' . '/imageoptim/imageoptim/src/URLRequest.php',
34+
);
35+
2336
public static function getInitializer(ClassLoader $loader)
2437
{
2538
return \Closure::bind(function () use ($loader) {
2639
$loader->prefixLengthsPsr4 = ComposerStaticInitdb60f64c7c86327cd38317daa842af05::$prefixLengthsPsr4;
2740
$loader->prefixDirsPsr4 = ComposerStaticInitdb60f64c7c86327cd38317daa842af05::$prefixDirsPsr4;
41+
$loader->classMap = ComposerStaticInitdb60f64c7c86327cd38317daa842af05::$classMap;
2842

2943
}, null, ClassLoader::class);
3044
}

0 commit comments

Comments
 (0)