Skip to content

Commit ae13e9a

Browse files
committed
- (API) Refactored all plugin classes to use the new getName and getId methods.
- (API) Added getName and getId methods to the PluginInterface class
1 parent 5df2359 commit ae13e9a

37 files changed

+252
-132
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- (Feature) Added new Sent Messages dashboard widget to view sent messages statistics right from the Craft dashboard
1414
- (Feature) Added new notification for user inactivity like login reminders and reminders to change passwords
1515
- (Feature) Added Expired Entries notification type that will notify users after entries are expired.
16+
- (Feature) Added ability to create a front-end form that will trigger the "Front-end Email Form" parcel type to send emails dynamically from users
17+
- (API) Added new craft.postmaster.email template tag to return a new Postmaster_EmailModel
1618
- (API) Added new PostmasterHelper class to keep code dry that need to perform misc common functions to validate data
1719
- (API) Refactored BasePlugin class to make the settings property public.
1820
- (API) Refactored template fields into a new Twig Macro for convenience
@@ -22,6 +24,7 @@
2224
- (Bug Fix) Fixed a link on the notification index page that was going to the wrong url
2325
- (Bug Fix) Fixed an issue with templates not translating text strings properly
2426
- (Bug Fix) Fixed an issue with the Extra Conditionals not working in the default notification type
27+
- (Bug Fix) Fixed an issue with the templates path being wrong. Replace with the CRAFT_TEMPLATES_PATH constant.
2528

2629
#### 0.4.2
2730
##### 12/16/2014

PostmasterPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function getName()
1010

1111
public function getVersion()
1212
{
13-
return '0.4.2.1';
13+
return '0.5.0';
1414
}
1515

1616
public function getDeveloper()

core/components/BaseNotificationType.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
abstract class BaseNotificationType extends BasePlugin implements NotificationTypeInterface {
1010

11-
public $name;
12-
13-
public $id;
14-
1511
protected $service;
1612

1713
protected $notification;

core/components/BaseParcelType.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
abstract class BaseParcelType extends BasePlugin implements ParcelTypeInterface {
1010

11-
public $name;
12-
13-
public $id;
14-
1511
protected $service;
1612

1713
protected $parcel;

core/components/BasePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function registerCpRoutes()
4141

4242
public function is($id)
4343
{
44-
if($this->id == $id || $this->name == $id)
44+
if($this->getId() == $id || $this->getName() == $id)
4545
{
4646
return true;
4747
}

core/components/BaseSchedule.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
abstract class BaseSchedule extends BasePlugin implements ScheduleInterface {
1010

11-
public $name;
12-
13-
public $id;
14-
1511
public function onBeforeSend(Postmaster_TransportModel $model)
1612
{
1713
return true;

core/components/BaseService.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
abstract class BaseService extends BasePlugin implements ServiceInterface {
1010

11-
public $name;
12-
13-
public $id;
14-
1511
protected $requireModels = array();
1612

1713
public function getInputHtml(Array $data = array())

core/interfaces/PluginInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
interface PluginInterface {
55

6+
public function getName();
7+
8+
public function getId();
9+
610
public function init();
711

812
public function is($id);

core/notification_schedules/AnyTimeNotificationSchedule.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
<?php
22
namespace Craft\Plugins\Postmaster\NotificationSchedules;
33

4-
use Carbon\Carbon;
5-
use Craft\Postmaster_TransportModel;
4+
use Craft\Craft;
65
use Craft\Plugins\Postmaster\Components\BaseNotificationSchedule;
76

87
class AnyTimeNotificationSchedule extends BaseNotificationSchedule {
98

10-
public $name = 'Any Time';
11-
12-
public $id = 'anytime';
13-
14-
protected $now;
15-
169
public function __construct($attributes = null)
1710
{
1811
parent::__construct($attributes);
12+
}
1913

20-
$this->now = Carbon::now(new \DateTimeZone(\Craft\craft()->getTimezone()));
14+
public function getName()
15+
{
16+
return Craft::t('Any Time');
17+
}
18+
19+
public function getId()
20+
{
21+
return 'anytime';
2122
}
2223

2324
public function getSettingsModelClassName()

core/notification_schedules/DefaultNotificationSchedule.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
namespace Craft\Plugins\Postmaster\NotificationSchedules;
33

44
use Carbon\Carbon;
5+
use Craft\Craft;
56
use Craft\Postmaster_TransportModel;
67
use Craft\Plugins\Postmaster\Components\BaseNotificationSchedule;
78

89
class DefaultNotificationSchedule extends BaseNotificationSchedule {
910

10-
public $name = 'Basic Reoccuring';
11-
12-
public $id = 'default';
13-
1411
protected $now;
1512

1613
public function __construct($attributes = null)
@@ -20,6 +17,16 @@ public function __construct($attributes = null)
2017
$this->now = Carbon::now(new \DateTimeZone(\Craft\craft()->getTimezone()));
2118
}
2219

20+
public function getName()
21+
{
22+
return Craft::t('Basic Reoccurring');
23+
}
24+
25+
public function getId()
26+
{
27+
return 'default';
28+
}
29+
2330
public function shouldSend($lastSent = false)
2431
{
2532
if(!$this->hasElapsedTimePassed($lastSent))

0 commit comments

Comments
 (0)