diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d65b27..1d6d6e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## 1.1.0 - 2018-06-06 + +### Changed +- Plugin name changed to `Read Time` + ## 1.0.0 - 2018-06-06 + ### Added - Initial release diff --git a/README.md b/README.md index 216fc81..7c0b075 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ icon -# Reading Time plugin for Craft CMS 3 +# Read Time plugin for Craft CMS 3 -Calculate the estimated reading time for content. +Calculate the estimated read time for content. ## Installation @@ -12,7 +12,7 @@ This plugin requires Craft CMS 3.0.0, or later. #### Plugin Store -Log into your control panel and click on 'Plugin Store'. Search for 'Reading Time'. +Log into your control panel and click on 'Plugin Store'. Search for 'Read Time'. #### Composer @@ -25,44 +25,44 @@ cd /path/to/project 2. Then tell Composer to load the plugin: ```bash -composer require lukeyouell/craft-readingtime +composer require lukeyouell/craft-readtime ``` -3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Reading Time. +3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Read Time. ## Configuration -The average user reading speed is set at 200 words per minute by default, this can be changed in the plugin settings. +The average user read speed is set at 200 words per minute by default, this can be changed in the plugin settings. ## Using the Filter -The `|readingTime` filter returns a human time duration of how long it takes the average user to read the provided content. The value provided can be a string or an array of values. +The `|readTime` filter returns a human time duration of how long it takes the average user to read the provided content. The value provided can be a string or an array of values. -Seconds are included by default, but can be disabled by using `|readingTime(false)` +Seconds are included by default, but can be disabled by using `|readTime(false)` #### Examples ```twig -{{ string|readingTime }} +{{ string|readTime }} Returns: 30 second ``` ```twig -{{ richTextField|readingTime }} +{{ richTextField|readTime }} Returns: 2 minutes, 40 seconds ``` ```twig -{{ richTextField|readingTime(false) }} +{{ richTextField|readTime(false) }} Returns: 3 minutes ``` ## Overriding Plugin Settings -If you create a [config file](https://docs.craftcms.com/v3/configuration.html) in your `config` folder called `reading-time.php`, you can override the plugin’s settings in the Control Panel. Since that config file is fully [multi-environment](https://docs.craftcms.com/v3/configuration.html) aware, this is a handy way to have different settings across multiple environments. +If you create a [config file](https://docs.craftcms.com/v3/configuration.html) in your `config` folder called `read-time.php`, you can override the plugin’s settings in the Control Panel. Since that config file is fully [multi-environment](https://docs.craftcms.com/v3/configuration.html) aware, this is a handy way to have different settings across multiple environments. Here’s what that config file might look like along with a list of all of the possible values you can override. diff --git a/composer.json b/composer.json index 74dcd68..b7efa1a 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,18 @@ { - "name": "lukeyouell/craft-readingtime", - "description": "Calculate the estimated reading time for content.", + "name": "lukeyouell/craft-readtime", + "description": "Calculate the estimated read time for content.", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.1.0", "keywords": [ "craft", "cms", "craftcms", "craft-plugin", - "average reading time" + "average read time" ], "support": { - "docs": "https://github.com/lukeyouell/craft-readingtime/blob/master/README.md", - "issues": "https://github.com/lukeyouell/craft-readingtime/issues" + "docs": "https://github.com/lukeyouell/craft-readtime/blob/master/README.md", + "issues": "https://github.com/lukeyouell/craft-readtime/issues" }, "license": "MIT", "authors": [ @@ -26,15 +26,15 @@ }, "autoload": { "psr-4": { - "lukeyouell\\readingtime\\": "src/" + "lukeyouell\\readtime\\": "src/" } }, "extra": { - "name": "Reading Time", - "handle": "reading-time", + "name": "Read Time", + "handle": "read-time", "hasCpSettings": true, "hasCpSection": false, - "changelogUrl": "https://raw.githubusercontent.com/lukeyouell/craft-readingtime/master/CHANGELOG.md", - "class": "lukeyouell\\readingtime\\ReadingTime" + "changelogUrl": "https://raw.githubusercontent.com/lukeyouell/craft-readtime/master/CHANGELOG.md", + "class": "lukeyouell\\readtime\\ReadTime" } } diff --git a/src/ReadingTime.php b/src/ReadTime.php similarity index 79% rename from src/ReadingTime.php rename to src/ReadTime.php index ca98dab..bd614ee 100644 --- a/src/ReadingTime.php +++ b/src/ReadTime.php @@ -1,17 +1,17 @@ view->registerTwigExtension(new ReadingTimeTwigExtension()); + Craft::$app->view->registerTwigExtension(new ReadTimeTwigExtension()); Craft::info( Craft::t( - 'reading-time', + 'read-time', '{name} plugin loaded', ['name' => $this->name] ), @@ -70,7 +70,7 @@ protected function settingsHtml(): string $overrides = Craft::$app->getConfig()->getConfigFromFile(strtolower($this->handle)); return Craft::$app->view->renderTemplate( - 'reading-time/settings', + 'read-time/settings', [ 'settings' => $settings, 'overrides' => array_keys($overrides) diff --git a/src/icon.svg b/src/icon.svg index dd16151..da0d1f3 100644 --- a/src/icon.svg +++ b/src/icon.svg @@ -2,11 +2,11 @@ - average-reading-time-icon - - + read-time-icon + + diff --git a/src/models/Settings.php b/src/models/Settings.php index 1a47422..9e7ba4d 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -1,16 +1,16 @@ getSettings(); + $settings = ReadTime::$plugin->getSettings(); $value = is_array($value) ? implode(' ', $value) : (string)$value; $wpm = $settings->wordsPerMinute;