Skip to content

Commit

Permalink
Craft 4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
niektenhoopen committed May 4, 2022
1 parent 2831ac3 commit 281ac7b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
!.vscode/extensions.json
config.codekit3
prepros-6.config
composer.lock
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 2.0.0 - 2022-05-04
### Added
- Craft v4 support

## 1.0.0 - 2019-08-12
### Added
- Initial release
22 changes: 16 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
"name": "nthmedia/photo-exif",
"description": "The plugin reads EXIF data from photos",
"type": "craft-plugin",
"version": "0.0.1",
"version": "2.0",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"photo exif"
],
"support": {
"docs": "???",
"issues": "???"
},
"license": "MIT",
"authors": [
{
Expand All @@ -22,7 +18,8 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1"
"php": "^8.0",
"craftcms/cms": "^4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -39,5 +36,18 @@
"metadata": "nthmedia\\photoexif\\services\\Metadata"
},
"class": "nthmedia\\photoexif\\PhotoExif"
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"craftcms/rector": "dev-main",
"craftcms/ecs": "dev-main",
"phpstan/phpstan": "^1.6"
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true,
"craftcms/plugin-installer": true
}
}
}
2 changes: 1 addition & 1 deletion src/PhotoExif.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PhotoExif extends Plugin
/**
* @var string
*/
public $schemaVersion = '1.0.0';
public string $schemaVersion = '1.0.0';

// Public Methods
// =========================================================================
Expand Down
10 changes: 5 additions & 5 deletions src/fields/Coordinates.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ public function getElementValidationRules(): array
/**
* @inheritdoc
*/
public function getContentColumnType(): string
public function getContentColumnType(): array|string
{
return Schema::TYPE_STRING;
}

/**
* @inheritdoc
*/
public function normalizeValue($value, ElementInterface $element = null)
public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
return $value;
}

/**
* @inheritdoc
*/
public function serializeValue($value, ElementInterface $element = null)
public function serializeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
// Replace spaces in the string
$value = str_replace(' ', '', $value);
Expand All @@ -97,7 +97,7 @@ public function serializeValue($value, ElementInterface $element = null)
/**
* @inheritdoc
*/
public function getInputHtml($value, ElementInterface $element = null): string
public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $element = null): string
{
// Get our id and namespace
$id = Craft::$app->getView()->formatInputId($this->handle);
Expand Down Expand Up @@ -131,7 +131,7 @@ public function getInputHtml($value, ElementInterface $element = null): string
/**
* @inheritdoc
*/
public function getTableAttributeHtml($value, ElementInterface $element): string
public function getTableAttributeHtml(mixed $value, ElementInterface $element): string
{
if ($value) {
$value = preg_replace_callback(
Expand Down
6 changes: 3 additions & 3 deletions src/twigextensions/PhotoExifTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @package PhotoExif
* @since 1.0.0
*/
class PhotoExifTwigExtension extends \Twig_Extension
class PhotoExifTwigExtension extends \Twig\Extension\AbstractExtension
{
// Public Methods
// =========================================================================
Expand All @@ -38,7 +38,7 @@ public function getName()
public function getFilters()
{
return [
new \Twig_SimpleFilter('someFilter', [$this, 'someInternalFunction']),
new \Twig\TwigFilter('someFilter', [$this, 'someInternalFunction']),
];
}

Expand All @@ -48,7 +48,7 @@ public function getFilters()
public function getFunctions()
{
return [
new \Twig_SimpleFunction('someFunction', [$this, 'someInternalFunction']),
new \Twig\TwigFunction('someFunction', [$this, 'someInternalFunction']),
];
}

Expand Down

0 comments on commit 281ac7b

Please sign in to comment.