Skip to content

Commit

Permalink
Merge branch 'release/4.0.4' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jun 18, 2024
2 parents 43a147c + c7bab6e commit 5186842
Show file tree
Hide file tree
Showing 12 changed files with 1,229 additions and 330 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Typogrify Changelog

## 4.0.4 - 2024.06.18
### Added
* Added `ServicesTrait` for the plugin service component registration

## 4.0.3 - 2024.03.27
### Fixed
* Fixed a regression that happened when modernizing the `default_escape` functionality ([#86](https://github.com/nystudio107/craft-typogrify/issues/86))
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 nystudio107
Copyright (c) nystudio107

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:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-typogrify",
"description": "Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more",
"type": "craft-plugin",
"version": "4.0.3",
"version": "4.0.4",
"keywords": [
"craft",
"cms",
Expand Down
1,442 changes: 1,146 additions & 296 deletions docs/package-lock.json

Large diffs are not rendered by default.

32 changes: 12 additions & 20 deletions src/Typogrify.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify;
Expand All @@ -15,7 +15,7 @@
use craft\base\Plugin;
use craft\web\twig\variables\CraftVariable;
use nystudio107\typogrify\models\Settings;
use nystudio107\typogrify\services\TypogrifyService;
use nystudio107\typogrify\services\ServicesTrait;
use nystudio107\typogrify\twigextensions\TypogrifyTwigExtension;
use nystudio107\typogrify\variables\TypogrifyVariable;
use yii\base\Event;
Expand All @@ -28,22 +28,26 @@
* @since 1.0.0
*
* @property Settings $settings
* @property TypogrifyService $typogrify
*/
class Typogrify extends Plugin
{
// Traits
// =========================================================================

use ServicesTrait;

// Static Properties
// =========================================================================

/**
* @var Typogrify
* @var ?Typogrify
*/
public static $plugin;
public static ?Typogrify $plugin = null;

/**
* @var TypogrifyVariable
* @var ?TypogrifyVariable
*/
public static $variable;
public static ?TypogrifyVariable $variable = null;

// Public Properties
// =========================================================================
Expand All @@ -65,18 +69,6 @@ class Typogrify extends Plugin
// Public Methods
// =========================================================================

/**
* @inheritdoc
*/
public function __construct($id, $parent = null, array $config = [])
{
$config['components'] = [
'typogrify' => TypogrifyService::class,
];

parent::__construct($id, $parent, $config);
}

/**
* @inheritdoc
*/
Expand Down
4 changes: 2 additions & 2 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

use PHP_Typography\Settings\Dash_Style;
Expand Down
4 changes: 2 additions & 2 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify\models;
Expand Down
53 changes: 53 additions & 0 deletions src/services/ServicesTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and
* 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify\services;

use yii\base\InvalidConfigException;

/**
* @author nystudio107
* @package Typogrify
* @since 1.0.0
*
* @property TypogrifyService $typogrify
*/
trait ServicesTrait
{
// Public Static Methods
// =========================================================================

/**
* @inheritdoc
*/
public static function config(): array
{
return [
'components' => [
'typogrify' => TypogrifyService::class,
],
];
}

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

/**
* Returns the typogrify service
*
* @return TypogrifyService The typogrify service
* @throws InvalidConfigException
*/
public function getTypogrify(): TypogrifyService
{
return $this->get('typogrify');
}
}
4 changes: 2 additions & 2 deletions src/services/TypogrifyService.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and
* 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify\services;
Expand Down
4 changes: 2 additions & 2 deletions src/translations/en/typogrify.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions src/twigextensions/TypogrifyTwigExtension.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify\twigextensions;
Expand Down
4 changes: 2 additions & 2 deletions src/variables/TypogrifyVariable.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Typogrify plugin for Craft CMS 3.x
* Typogrify plugin for Craft CMS
*
* Typogrify prettifies your web typography by preventing ugly quotes and 'widows' and more
*
* @link https://nystudio107.com/
* @copyright Copyright (c) 2017 nystudio107
* @copyright Copyright (c) nystudio107
*/

namespace nystudio107\typogrify\variables;
Expand Down

0 comments on commit 5186842

Please sign in to comment.