Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
niektenhoopen committed Aug 31, 2019
0 parents commit 4387dc5
Show file tree
Hide file tree
Showing 16 changed files with 1,022 additions and 0 deletions.
1 change: 1 addition & 0 deletions .craftplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pluginName":"Entry GPS Coordinates","pluginDescription":"Pick a GPS location for an entry","pluginVersion":"1.0.0","pluginAuthorName":"NTH media","pluginVendorName":"nthmedia","pluginAuthorUrl":"https://nthmedia.nl","pluginAuthorGithub":"nthmedia","codeComments":"yes","pluginComponents":["fieldtypes"],"consolecommandName":"","controllerName":"","cpsectionName":"","elementName":"","fieldName":"EntryCoordinates","modelName":"","purchasableName":"","recordName":"","serviceName":"","taskName":"","utilityName":"","widgetName":"","apiVersion":"api_version_3_0"}
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CRAFT ENVIRONMENT
.env.php
.env.sh
.env

# COMPOSER
/vendor

# BUILD FILES
/bower_components/*
/node_modules/*
/build/*
/yarn-error.log

# MISC FILES
.cache
.DS_Store
.idea
.project
.settings
*.esproj
*.sublime-workspace
*.sublime-project
*.tmproj
*.tmproject
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
config.codekit3
prepros-6.config
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Entry GPS Coordinates Changelog

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/).

## 1.0.0 - 2019-08-31
### Added
- Initial release
40 changes: 40 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Copyright © NTH media

Permission is hereby granted to any person obtaining a copy of this software
(the “Software”) to use, copy, modify, merge, publish and/or distribute copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

1. **Don’t plagiarize.** The above copyright notice and this license shall be
included in all copies or substantial portions of the Software.

2. **Don’t use the same license on more than one project.** Each licensed copy
of the Software shall be actively installed in no more than one production
environment at a time.

3. **Don’t mess with the licensing features.** Software features related to
licensing shall not be altered or circumvented in any way, including (but
not limited to) license validation, payment prompts, feature restrictions,
and update eligibility.

4. **Pay up.** Payment shall be made immediately upon receipt of any notice,
prompt, reminder, or other message indicating that a payment is owed.

5. **Follow the law.** All use of the Software shall not violate any applicable
law or regulation, nor infringe the rights of any other person or entity.

Failure to comply with the foregoing conditions will automatically and
immediately result in termination of the permission granted hereby. This
license does not include any right to receive updates to the Software or
technical support. Licensees bear all risk related to the quality and
performance of the Software and any modifications made or obtained to it,
including liability for actual and consequential harm, such as loss or
corruption of data, and any necessary service, repair, or correction.

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, INCLUDING SPECIAL, INCIDENTAL AND CONSEQUENTIAL DAMAGES, 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: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Entry GPS Coordinates plugin for Craft CMS 3.x

Pick a GPS location for an entry

![PluginImpression](https://user-images.githubusercontent.com/3450011/64065265-e3cbc680-cc0b-11e9-89fc-ed682123b109.gif)

40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "nthmedia/entry-gps-coordinates",
"description": "Pick a GPS location for an entry",
"type": "craft-plugin",
"version": "1.0.0",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"entry gps coordinates"
],
"support": {
"docs": "https://github.com/nthmedia/entry-gps-coordinates",
"issues": "https://github.com/nthmedia/entry-gps-coordinates/issues"
},
"license": "MIT",
"authors": [
{
"name": "NTH media",
"homepage": "https://nthmedia.nl"
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1"
},
"autoload": {
"psr-4": {
"nthmedia\\entrygpscoordinates\\": "src/"
}
},
"extra": {
"name": "Entry GPS Coordinates",
"handle": "entry-gps-coordinates",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://github.com/nthmedia/entry-gps-coordinates/CHANGELOG.md",
"class": "nthmedia\\entrygpscoordinates\\EntryGpsCoordinates"
}
}
132 changes: 132 additions & 0 deletions src/EntryGpsCoordinates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php
/**
* Entry GPS Coordinates plugin for Craft CMS 3.x
*
* Pick a GPS location for an entry
*
* @link https://nthmedia.nl
* @copyright Copyright (c) 2019 NTH media
*/

namespace nthmedia\entrygpscoordinates;

use nthmedia\entrygpscoordinates\fields\EntryCoordinates as EntryCoordinatesField;

use Craft;
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;
use craft\services\Fields;
use craft\events\RegisterComponentTypesEvent;

use yii\base\Event;

/**
* Craft plugins are very much like little applications in and of themselves. We’ve made
* it as simple as we can, but the training wheels are off. A little prior knowledge is
* going to be required to write a plugin.
*
* For the purposes of the plugin docs, we’re going to assume that you know PHP and SQL,
* as well as some semi-advanced concepts like object-oriented programming and PHP namespaces.
*
* https://craftcms.com/docs/plugins/introduction
*
* @author NTH media
* @package EntryGpsCoordinates
* @since 1.0.0
*
*/
class EntryGpsCoordinates extends Plugin
{
// Static Properties
// =========================================================================

/**
* Static property that is an instance of this plugin class so that it can be accessed via
* EntryGpsCoordinates::$plugin
*
* @var EntryGpsCoordinates
*/
public static $plugin;

// Public Properties
// =========================================================================

/**
* To execute your plugin’s migrations, you’ll need to increase its schema version.
*
* @var string
*/
public $schemaVersion = '1.0.0';

// Public Methods
// =========================================================================

/**
* Set our $plugin static property to this class so that it can be accessed via
* EntryGpsCoordinates::$plugin
*
* Called after the plugin class is instantiated; do any one-time initialization
* here such as hooks and events.
*
* If you have a '/vendor/autoload.php' file, it will be loaded for you automatically;
* you do not need to load it in your init() method.
*
*/
public function init()
{
parent::init();
self::$plugin = $this;

// Register our fields
Event::on(
Fields::class,
Fields::EVENT_REGISTER_FIELD_TYPES,
function (RegisterComponentTypesEvent $event) {
$event->types[] = EntryCoordinatesField::class;
}
);

// Do something after we're installed
Event::on(
Plugins::class,
Plugins::EVENT_AFTER_INSTALL_PLUGIN,
function (PluginEvent $event) {
if ($event->plugin === $this) {
// We were just installed
}
}
);

/**
* Logging in Craft involves using one of the following methods:
*
* Craft::trace(): record a message to trace how a piece of code runs. This is mainly for development use.
* Craft::info(): record a message that conveys some useful information.
* Craft::warning(): record a warning message that indicates something unexpected has happened.
* Craft::error(): record a fatal error that should be investigated as soon as possible.
*
* Unless `devMode` is on, only Craft::warning() & Craft::error() will log to `craft/storage/logs/web.log`
*
* It's recommended that you pass in the magic constant `__METHOD__` as the second parameter, which sets
* the category to the method (prefixed with the fully qualified class name) where the constant appears.
*
* To enable the Yii debug toolbar, go to your user account in the AdminCP and check the
* [] Show the debug toolbar on the front end & [] Show the debug toolbar on the Control Panel
*
* http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html
*/
Craft::info(
Craft::t(
'entry-gps-coordinates',
'{name} plugin loaded',
['name' => $this->name]
),
__METHOD__
);
}

// Protected Methods
// =========================================================================

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
* Entry GPS Coordinates plugin for Craft CMS 3.x
*
* Pick a GPS location for an entry
*
* @link https://nthmedia.nl
* @copyright Copyright (c) 2019 NTH media
*/

namespace nthmedia\entrygpscoordinates\assetbundles\entrycoordinatesfield;

use Craft;
use craft\web\AssetBundle;
use craft\web\assets\cp\CpAsset;

/**
* EntryCoordinatesFieldAsset AssetBundle
*
* AssetBundle represents a collection of asset files, such as CSS, JS, images.
*
* Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application.
* The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php)
* of the class representing it.
*
* An asset bundle can depend on other asset bundles. When registering an asset bundle
* with a view, all its dependent asset bundles will be automatically registered.
*
* http://www.yiiframework.com/doc-2.0/guide-structure-assets.html
*
* @author NTH media
* @package EntryGpsCoordinates
* @since 1.0.0
*/
class EntryCoordinatesFieldAsset extends AssetBundle
{
// Public Methods
// =========================================================================

/**
* Initializes the bundle.
*/
public function init()
{
// define the path that your publishable resources live
$this->sourcePath = "@nthmedia/entrygpscoordinates/assetbundles/entrycoordinatesfield/dist";

// define the dependencies
$this->depends = [
CpAsset::class,
];

// define the relative path to CSS/JS files that should be registered with the page
// when this asset bundle is registered
$this->js = [
'js/EntryCoordinates.js',
];

$this->css = [
'css/EntryCoordinates.css',
];

parent::init();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Entry GPS Coordinates plugin for Craft CMS
*
* EntryCoordinates Field CSS
*
* @author NTH media
* @copyright Copyright (c) 2019 NTH media
* @link https://nthmedia.nl
* @package EntryGpsCoordinates
* @since 1.0.0
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4387dc5

Please sign in to comment.