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

Commit

Permalink
update TDE > OYM
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyschmitz87 committed Mar 4, 2024
1 parent d0f331b commit 5789aec
Show file tree
Hide file tree
Showing 19 changed files with 182 additions and 60 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# TDE - Geo Address Changelog
# OYM - Geo Address Changelog

## 2.1.0 - 2024-03-04
### Updated
- Updated TDE > OYM

## 2.0.1 - 2023-10-18
### Added
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The MIT License (MIT)

Copyright (c) 2018 TDE
Copyright (c) 2024 On Your Marks

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TDE - Geo Address plugin for Craft CMS 4.x
# OYM - Geo Address plugin for Craft CMS 4.x

Geo Address field for Craft 4 Sections.

Expand All @@ -16,9 +16,9 @@ To install the plugin, follow these instructions.

2. Then tell Composer to load the plugin:

composer require tde/craftplugin-geoaddress
composer require oym/craftplugin-geoaddress

3. In the Control Panel, go to Settings → Plugins and click the “Install” button for TDE - Geo Address.
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for OYM - Geo Address.

4. In the Control Panel, go to Settings → Plugins and click the “Settings” link to insert your Google Maps Geocoding API key to increase the allowed API calls.

Expand Down
25 changes: 13 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
{
"name": "tde/craftplugin-geoaddress",
"name": "oym/craftplugin-geoaddress",
"description": "Geo Address fields for Craft Sections",
"type": "craft-plugin",
"support": {
"docs": "https://github.com/tdeNL/craft-geoaddress/blob/master/README.md",
"issues": "https://github.com/tdeNL/craft-geoaddress/issues"
"docs": "https://github.com/onyourmarks-agency/craft-geoaddress/blob/master/README.md",
"issues": "https://github.com/onyourmarks-agency/craft-geoaddress/issues"
},
"license": "MIT",
"authors": [
{
"name": "TDE",
"homepage": "https://www.tde.nl"
"name": "On Your Marks",
"homepage": "https://www.onyourmarks.agency"
}
],
"require": {
"php": "^8.0",
"craftcms/cms": "^4.0.0",
"ext-curl": "*"
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"tde\\craft\\geoaddress\\": "src/"
}
"oym\\craft\\geoaddress\\": "src/"
},
"files": ["src/deprecated.php"]
},
"extra": {
"name": "TDE - Geo Address Fields",
"name": "OYM - Geo Address Fields",
"handle": "geoaddress",
"schemaVersion": "1.0.1",
"hasCpSettings": true,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/tdeNL/craft-geoaddress/master/CHANGELOG.md",
"changelogUrl": "https://raw.githubusercontent.com/onyourmarks-agency/craft-geoaddress/master/CHANGELOG.md",
"components": {
"geoAddressService": "tde\\craft\\geoaddress\\services\\GeoAddressService"
"geoAddressService": "oym\\craft\\geoaddress\\services\\GeoAddressService"
},
"class": "tde\\craft\\geoaddress\\GeoAddress"
"class": "oym\\craft\\geoaddress\\GeoAddress"
},
"config": {
"allow-plugins": {
Expand Down
12 changes: 12 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="OYM">
<description>The OYM coding standard.</description>
<rule ref="PSR12">
<exclude name="Generic.Files.LineLength"/>
</rule>

<file>src/</file>

<exclude-pattern type="relative-root">*.js</exclude-pattern>
<exclude-pattern type="relative-root">deprecated.php</exclude-pattern>
</ruleset>
14 changes: 7 additions & 7 deletions src/GeoAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace tde\craft\geoaddress;
namespace oym\craft\geoaddress;

use Craft;
use craft\base\Model;
Expand All @@ -11,11 +11,11 @@
use craft\services\Fields;
use craft\events\RegisterComponentTypesEvent;
use craft\services\Gql;
use tde\craft\geoaddress\fields\GeoAddressField;
use tde\craft\geoaddress\gql\types\AddressType;
use tde\craft\geoaddress\models\GeoAddressSettingsModel;
use tde\craft\geoaddress\services\GeoAddressService;
use tde\craft\geoaddress\twigextensions\GeoAddressTwigExtension;
use oym\craft\geoaddress\fields\GeoAddressField;
use oym\craft\geoaddress\gql\types\AddressType;
use oym\craft\geoaddress\models\GeoAddressSettingsModel;
use oym\craft\geoaddress\services\GeoAddressService;
use oym\craft\geoaddress\twigextensions\GeoAddressTwigExtension;
use yii\base\Event;

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ static function (RegisterComponentTypesEvent $event) {
Event::on(
Gql::class,
Gql::EVENT_REGISTER_GQL_TYPES,
function(RegisterGqlTypesEvent $event) {
function (RegisterGqlTypesEvent $event) {
$event->types[] = AddressType::class;
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/assetbundles/geoaddressfield/GeoAddressFieldAsset.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace tde\craft\geoaddress\assetbundles\geoaddressfield;
namespace oym\craft\geoaddress\assetbundles\geoaddressfield;

use Craft;
use craft\web\AssetBundle;
Expand All @@ -10,7 +10,7 @@ class GeoAddressFieldAsset extends AssetBundle
{
public function init(): void
{
$this->sourcePath = "@tde/craft/geoaddress/assetbundles/geoaddressfield/dist";
$this->sourcePath = "@oym/craft/geoaddress/assetbundles/geoaddressfield/dist";

$this->depends = [
CpAsset::class,
Expand Down
96 changes: 96 additions & 0 deletions src/deprecated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace tde\craft\geoaddress {
spl_autoload_register(
static function (string $className) {
$old = 'tde\\craft\\geoaddress\\';
$new = 'oym\\craft\\geoaddress\\';

if (0 !== strpos($className, $old)) {
return;
}

$newName = substr_replace($className, $new, 0, strlen($old));
class_alias($newName, $className);
},
true,
false,
);

if (!\class_exists(GeoAddress::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\GeoAddress */
class GeoAddress
{
}
}
}

namespace tde\craft\geoaddress\assetbundles\geoaddressfield {
if (!\class_exists(GeoAddressFieldAsset::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\assetbundles\geoaddressfield\GeoAddressFieldAsset */
class GeoAddressFieldAsset
{
}
}
}

namespace tde\craft\geoaddress\fields {
if (!\class_exists(GeoAddressField::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\fields\GeoAddressField */
class GeoAddressField
{
}
}
}

namespace tde\craft\geoaddress\gql\types {
if (!\class_exists(AddressType::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\gql\types\AddressType */
class AddressType
{
}
}
}

namespace tde\craft\geoaddress\migrations {
if (!\class_exists(m220516_144416_update_field_handle::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\migrations\m220516_144416_update_field_handle */
class m220516_144416_update_field_handle
{
}
}
}

namespace tde\craft\geoaddress\models {
if (!\class_exists(GeoAddressModel::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\models\GeoAddressModel */
class GeoAddressModel
{
}
}

if (!\class_exists(GeoAddressSettingsModel::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\models\GeoAddressSettingsModel */
class GeoAddressSettingsModel
{
}
}
}

namespace tde\craft\geoaddress\services {
if (!\class_exists(GeoAddressService::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\services\GeoAddressService */
class GeoAddressService
{
}
}
}

namespace tde\craft\geoaddress\twigextensions {
if (!\class_exists(GeoAddressTwigExtension::class)) {
/** @deprecated this is an alias for \oym\craft\geoaddress\twigextensions\GeoAddressTwigExtension */
class GeoAddressTwigExtension
{
}
}
}
16 changes: 8 additions & 8 deletions src/fields/GeoAddressField.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

declare(strict_types=1);

namespace tde\craft\geoaddress\fields;
namespace oym\craft\geoaddress\fields;

use Craft;
use craft\base\ElementInterface;
use craft\base\Field;
use craft\base\PreviewableFieldInterface;
use craft\helpers\Html;
use GraphQL\Type\Definition\Type;
use tde\craft\geoaddress\GeoAddress;
use tde\craft\geoaddress\gql\types\AddressType;
use tde\craft\geoaddress\models\GeoAddressModel;
use oym\craft\geoaddress\GeoAddress;
use oym\craft\geoaddress\gql\types\AddressType;
use oym\craft\geoaddress\models\GeoAddressModel;
use yii\db\Schema;
use craft\helpers\Json;

Expand All @@ -25,15 +25,15 @@ public static function displayName(): string

public function getInputHtml($value, ElementInterface $element = null): string
{
if (!$value) {
$value = $this->normalizeValue($value);
}
if (!$value) {
$value = $this->normalizeValue($value);
}

$id = Html::id($this->handle);
$namespacedId = Craft::$app->getView()->namespaceInputId($id);

return Craft::$app->getView()->renderTemplate(
'geoaddress/_components/fields/GeoAddressField_input',
'geoaddress/_components/fields/GeoAddressField_input',
[
'name' => $this->handle,
'value' => $value,
Expand Down
2 changes: 1 addition & 1 deletion src/gql/types/AddressType.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace tde\craft\geoaddress\gql\types;
namespace oym\craft\geoaddress\gql\types;

use craft\gql\GqlEntityRegistry;
use GraphQL\Type\Definition\ObjectType;
Expand Down
11 changes: 10 additions & 1 deletion src/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/migrations/m220516_144416_update_field_handle.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace tde\craft\geoaddress\migrations;
namespace oym\craft\geoaddress\migrations;

use Craft;
use craft\db\Migration;
use craft\db\Table;
use tde\craft\geoaddress\fields\GeoAddressField;
use oym\craft\geoaddress\fields\GeoAddressField;

/**
* m220516_144416_update_field_handle migration.
Expand All @@ -23,7 +23,7 @@ public function safeUp(): bool
'type' => GeoAddressField::class,
],
[
'type' => 'TDE\GeoAddress\fields\GeoAddressField',
'type' => 'OYM\GeoAddress\fields\GeoAddressField',
]
);

Expand All @@ -38,7 +38,7 @@ public function safeDown(): bool
$this->update(
Table::FIELDS,
[
'type' => 'TDE\GeoAddress\fields\GeoAddressField',
'type' => 'OYM\GeoAddress\fields\GeoAddressField',
],
[
'type' => GeoAddressField::class,
Expand Down
2 changes: 1 addition & 1 deletion src/models/GeoAddressModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace tde\craft\geoaddress\models;
namespace oym\craft\geoaddress\models;

use craft\base\Model;

Expand Down
2 changes: 1 addition & 1 deletion src/models/GeoAddressSettingsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace tde\craft\geoaddress\models;
namespace oym\craft\geoaddress\models;

use craft\base\Model;

Expand Down
8 changes: 4 additions & 4 deletions src/services/GeoAddressService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace tde\craft\geoaddress\services;
namespace oym\craft\geoaddress\services;

use Craft;
use craft\base\Component;
use tde\craft\geoaddress\GeoAddress;
use tde\craft\geoaddress\models\GeoAddressModel;
use oym\craft\geoaddress\GeoAddress;
use oym\craft\geoaddress\models\GeoAddressModel;

class GeoAddressService extends Component
{
Expand All @@ -22,7 +22,7 @@ public function getCoordsByAddress(string $addressQuery, string $country): array
'countryName' => null,
'countryCode' => null,
];

if (!GeoAddress::getInstance()?->getSettings()->googleApiKey) {
return $address;
}
Expand Down
Loading

0 comments on commit 5789aec

Please sign in to comment.