Skip to content

Commit 3d83035

Browse files
committed
🐛 k-section for k4 compatibility
Signed-off-by: bnomei <[email protected]>
1 parent 07faedc commit 3d83035

File tree

10 files changed

+54
-42
lines changed

10 files changed

+54
-42
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# OS files
22
.DS_Store
33
.idea
4+
.nova
45
*.cache
56

67
/tests/kirby

.nova/Configuration.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
"description": "Kirby 3 Section to display recently modified content pages",
44
"license": "MIT",
55
"type": "kirby-plugin",
6-
"version": "1.2.10",
6+
"version": "4.0.0",
77
"authors": [
88
{
99
"name": "Bruno Meilick",
1010
"email": "[email protected]"
1111
}
1212
],
1313
"keywords": [
14-
"kirby3",
15-
"kirby3-cms",
16-
"kirby3-plugin",
14+
"kirby",
15+
"kirby-cms",
16+
"kirby-plugin",
1717
"modified",
1818
"user",
1919
"page",
2020
"pages",
2121
"collection",
2222
"list",
2323
"section",
24-
"widget"
24+
"widget",
25+
"recently",
26+
"changes"
2527
],
2628
"require": {
2729
"getkirby/composer-installer": "^1.2"

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.

index.js

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

src/components/sections/RecentlyModified.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<section class="k-links-section">
2+
<section class="k-section k-links-section">
33
<header class="k-section-header">
44
<h2 class="k-headline">{{ headline }}</h2>
55
</header>

vendor/Expectation.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

vendor/composer/ClassLoader.php

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
*/
4343
class ClassLoader
4444
{
45+
/** @var \Closure(string):void */
46+
private static $includeFile;
47+
4548
/** @var ?string */
4649
private $vendorDir;
4750

@@ -106,6 +109,7 @@ class ClassLoader
106109
public function __construct($vendorDir = null)
107110
{
108111
$this->vendorDir = $vendorDir;
112+
self::initializeIncludeClosure();
109113
}
110114

111115
/**
@@ -425,7 +429,8 @@ public function unregister()
425429
public function loadClass($class)
426430
{
427431
if ($file = $this->findFile($class)) {
428-
includeFile($file);
432+
$includeFile = self::$includeFile;
433+
$includeFile($file);
429434

430435
return true;
431436
}
@@ -555,18 +560,26 @@ private function findFileWithExtension($class, $ext)
555560

556561
return false;
557562
}
558-
}
559563

560-
/**
561-
* Scope isolated include.
562-
*
563-
* Prevents access to $this/self from included files.
564-
*
565-
* @param string $file
566-
* @return void
567-
* @private
568-
*/
569-
function includeFile($file)
570-
{
571-
include $file;
564+
/**
565+
* @return void
566+
*/
567+
private static function initializeIncludeClosure()
568+
{
569+
if (self::$includeFile !== null) {
570+
return;
571+
}
572+
573+
/**
574+
* Scope isolated include.
575+
*
576+
* Prevents access to $this/self from included files.
577+
*
578+
* @param string $file
579+
* @return void
580+
*/
581+
self::$includeFile = \Closure::bind(static function($file) {
582+
include $file;
583+
}, null, null);
584+
}
572585
}

vendor/composer/InstalledVersions.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
9898
{
9999
foreach (self::getInstalled() as $installed) {
100100
if (isset($installed['versions'][$packageName])) {
101-
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
101+
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
102102
}
103103
}
104104

@@ -119,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
119119
*/
120120
public static function satisfies(VersionParser $parser, $packageName, $constraint)
121121
{
122-
$constraint = $parser->parseConstraints($constraint);
122+
$constraint = $parser->parseConstraints((string) $constraint);
123123
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124124

125125
return $provided->matches($constraint);
@@ -328,7 +328,9 @@ private static function getInstalled()
328328
if (isset(self::$installedByVendor[$vendorDir])) {
329329
$installed[] = self::$installedByVendor[$vendorDir];
330330
} elseif (is_file($vendorDir.'/composer/installed.php')) {
331-
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
331+
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332+
$required = require $vendorDir.'/composer/installed.php';
333+
$installed[] = self::$installedByVendor[$vendorDir] = $required;
332334
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
333335
self::$installed = $installed[count($installed) - 1];
334336
}
@@ -340,12 +342,17 @@ private static function getInstalled()
340342
// only require the installed.php file if this file is loaded from its dumped location,
341343
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
342344
if (substr(__DIR__, -8, 1) !== 'C') {
343-
self::$installed = require __DIR__ . '/installed.php';
345+
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
346+
$required = require __DIR__ . '/installed.php';
347+
self::$installed = $required;
344348
} else {
345349
self::$installed = array();
346350
}
347351
}
348-
$installed[] = self::$installed;
352+
353+
if (self::$installed !== array()) {
354+
$installed[] = self::$installed;
355+
}
349356

350357
return $installed;
351358
}

vendor/composer/installed.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php return array(
22
'root' => array(
33
'name' => 'bnomei/kirby3-recently-modified',
4-
'pretty_version' => '1.2.10',
5-
'version' => '1.2.10.0',
4+
'pretty_version' => '4.0.0',
5+
'version' => '4.0.0.0',
66
'reference' => NULL,
77
'type' => 'kirby-plugin',
88
'install_path' => __DIR__ . '/../../',
@@ -11,8 +11,8 @@
1111
),
1212
'versions' => array(
1313
'bnomei/kirby3-recently-modified' => array(
14-
'pretty_version' => '1.2.10',
15-
'version' => '1.2.10.0',
14+
'pretty_version' => '4.0.0',
15+
'version' => '4.0.0.0',
1616
'reference' => NULL,
1717
'type' => 'kirby-plugin',
1818
'install_path' => __DIR__ . '/../../',

0 commit comments

Comments
 (0)