Skip to content

Commit 83a6e97

Browse files
authored
Merge pull request #19 from eighteen73/feature/branded-emails
Added branded emails for non html and GF Notifications
2 parents 5db1597 + fa00bf2 commit 83a6e97

File tree

123 files changed

+13632
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+13632
-9
lines changed

README.md

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,21 @@ If necessary, you may install it manually by downloading a Zip archive from [Git
1616

1717
## Summary of Features
1818

19+
### Branded Emails
20+
- Adds branding to emails that aren't set to be 'text/html'
21+
- Adds branding to Gravity Forms notification emails
22+
- When possible uses WooCommerce email branding for consistenty
23+
- Main email template can be overriden by copying `templates/branded-emails/email-template.php` into `yourtheme/orbit/branded-emails`
24+
- Email styles template can be overriden by copying `templates/branded-emails/email-styles.php` into `yourtheme/orbit/branded-emails`
25+
1926
### UI Cleanup
2027

2128
- Remove unwanted items from the menu (with limited configuration)
2229
- Remove unwanted items from the toolbar (with limited configuration)
2330
- Remove unwanted dashboard widgets
2431
- Replace the login logo (configurable)
2532
- Remove the footer message in CMS
33+
- Adds an environment icon to indicate the configured environment type
2634

2735
### Security
2836

@@ -53,22 +61,57 @@ If necessary, you may install it manually by downloading a Zip archive from [Git
5361

5462
## Available Filters
5563

64+
### Branded Emails
65+
66+
The following filters can be used to override default behaviour/values of branded email features.
67+
68+
- `orbit_enable_branded_emails`: Enable Orbit's branded emails feature. Default `true` (enabled).
69+
- `orbit_branded_emails_header_logo`: Set the logo image in branded emails. Default `''` (empty).
70+
- `orbit_branded_emails_background_color`: Set the background color of branded emails. Default `woocommerce_email_background_color || '#ffffff'`.
71+
- `orbit_branded_emails_body_background_color`: Set the body background color of branded emails. Default `woocommerce_email_body_background_color || '#ffffff'`.
72+
- `orbit_branded_emails_body_border_color`: Set the border color of branded emails. Default `var(--wp--custom--color--border) || '#edeff1'`.
73+
- `orbit_branded_emails_body_text_color`: Set the body text color of branded emails. Default `woocommerce_email_text_color || var(--wp--preset--color--contrast) || '#3f474d'`.
74+
- `orbit_branded_emails_link_color`: Set the link color of branded emails. Default `woocommerce_email_base_color || var(--wp--custom--color--link) || '#8549ff'`.
75+
- `orbit_branded_emails_footer_text_color`: Set the footer text color of branded emails. Default `woocommerce_email_footer_text_color || var(--wp--preset--color--contrast) || '#3F474d'`.
76+
- `orbit_branded_emails_font_family`: Set the font family of branded emails. Default `woocommerce_email_font_family || '"Helvetica Neue", Helvetica, Roboto, Arial, sans-serif'`.
77+
- `orbit_branded_emails_logo_image_width`: Set the logo image width in branded emails. Default `woocommerce_email_header_image_width || 120`.
78+
79+
### UI Cleanup
80+
5681
The following filters can be used to override the default behavior of certain features. Set the filter to `true` to enable the feature, or `false` to disable it.
5782

58-
- `orbit_enable_wordpress_updates`: Control the visibility of the WordPress updates item in the toolbar. Default `false` (hidden).
59-
- `orbit_enable_xmlrpc`: Enable or disable XML-RPC functionality. Default `false` (disabled).
60-
- `orbit_enable_user_caps_access`: Enable Orbit's user capability restrictions. Default `true` (enabled).
61-
- `orbit_enable_editor_caps_access`: Enable Orbit's editor capability restrictions. Default `true` (enabled).
62-
- `orbit_enable_gravity_forms_access`: Enable Orbit's Gravity Forms capability restrictions. Default `true` (enabled).
63-
- `orbit_enable_expose_wordpress_version`: Show or hide the WordPress version in the site's frontend markup. Default `false` (hidden).
64-
- `orbit_enable_admin_environment_name`: Control the display of the environment name in the admin area. Default `true` (enabled).
6583
- `orbit_enable_menu_item_dashboard`: Control the visibility of the Dashboard menu item. Default `true` (visible).
6684
- `orbit_enable_menu_item_posts`: Control the visibility of the Posts menu item. Default `true` (visible).
6785
- `orbit_enable_menu_item_comments`: Control the visibility of the Comments menu item and toolbar item. Default `false` (hidden).
6886
- `orbit_enable_toolbar_item_new_content`: Control the visibility of the "New Content" item in the toolbar. Default `true` (visible).
6987
- `orbit_enable_login_logo`: Enable replacement of the login logo. Default `true` (enabled).
7088
- `orbit_login_logo_url`: Provide a URL to replace the default WordPress login logo. No default.
89+
- `orbit_enable_admin_environment_name`: Control the display of the environment name in the admin area. Default `true` (enabled).
90+
91+
### Security
92+
93+
The following filters can be used to override the default behavior of certain features. Set the filter to `true` to enable the feature, or `false` to disable it.
94+
7195
- `orbit_enable_rest_api_user_endpoints`: Enable or disable REST API user endpoints. Default `false` (disabled).
96+
- `orbit_enable_xmlrpc`: Enable or disable XML-RPC functionality. Default `false` (disabled).
97+
- `orbit_enable_expose_wordpress_version`: Show or hide the WordPress version in the site's frontend markup. Default `false` (hidden).
98+
99+
### Capabilities
100+
101+
The following filters can be used to override the default behavior of certain features. Set the filter to `true` to enable the feature, or `false` to disable it.
102+
103+
- `orbit_enable_user_caps_access`: Enable Orbit's user capability restrictions. Default `true` (enabled).
104+
- `orbit_enable_editor_caps_access`: Enable Orbit's editor capability restrictions. Default `true` (enabled).
105+
- `orbit_enable_gravity_forms_access`: Enable Orbit's Gravity Forms capability restrictions. Default `true` (enabled).
106+
107+
### Other Safety Measures
108+
109+
The following filters can be used to override the default behavior of certain features. Set the filter to `true` to enable the feature, or `false` to disable it.
110+
111+
- `orbit_enable_wordpress_updates`: Control the visibility of the WordPress updates item in the toolbar. Default `false` (hidden).
112+
113+
### Other Features
114+
72115
- `orbit_remote_files_url`: Override the production URL used for loading remote media files. Default value comes from `ORBIT_REMOTE_FILES_URL`.
73116

74117
### Examples

autoload.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
function ( $class ) {
1717
$namspaces = [
1818
'Eighteen73\\Orbit\\' => __DIR__ . '/includes/classes/',
19+
'Eighteen73\\Orbit\\Dependencies\\' => __DIR__ . '/includes/dependencies/',
1920
];
2021
foreach ( $namspaces as $prefix => $base_dir ) {
2122
$len = strlen( $prefix );

composer.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"license": "MIT",
66
"minimum-stability": "stable",
77
"require": {
8-
"php": ">=8.0"
8+
"php": ">=8.0",
9+
"pelago/emogrifier": "^8.0"
910
},
1011
"autoload": {
1112
"psr-4": {
@@ -18,11 +19,31 @@
1819
}
1920
},
2021
"require-dev": {
21-
"eighteen73/wordpress-coding-standards": "^2.0.0"
22+
"eighteen73/wordpress-coding-standards": "^2.0.0",
23+
"coenjacobs/mozart": "^0.7.1"
2224
},
25+
"extra": {
26+
"mozart": {
27+
"dep_namespace": "Eighteen73\\Orbit\\Dependencies\\",
28+
"dep_directory": "/includes/Dependencies/",
29+
"classmap_directory": "/includes/classes/dependencies/",
30+
"classmap_prefix": "Eighteen73_Orbit_",
31+
"packages": [
32+
"pelago/emogrifier"
33+
]
34+
}
35+
},
2336
"scripts": {
2437
"test": [
2538
"phpcs"
39+
],
40+
"post-install-cmd": [
41+
"\"vendor/bin/mozart\" compose",
42+
"composer dump-autoload"
43+
],
44+
"post-update-cmd": [
45+
"\"vendor/bin/mozart\" compose",
46+
"composer dump-autoload"
2647
]
2748
}
2849
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Eighteen73\Orbit\Dependencies\Pelago\Emogrifier\Caching;
6+
7+
/**
8+
* This cache caches string values with string keys. It is not PSR-6-compliant.
9+
*
10+
* Usage:
11+
*
12+
* ```php
13+
* $cache = new SimpleStringCache();
14+
* $cache->set($key, $value);
15+
* …
16+
* if ($cache->has($key) {
17+
* $cachedValue = $cache->get($value);
18+
* }
19+
* ```
20+
*
21+
* @internal
22+
*/
23+
final class SimpleStringCache
24+
{
25+
/**
26+
* @var array<string, string>
27+
*/
28+
private $values = [];
29+
30+
/**
31+
* Checks whether there is an entry stored for the given key.
32+
*
33+
* @param string $key the key to check; must not be empty
34+
*
35+
* @throws \InvalidArgumentException
36+
*/
37+
public function has(string $key): bool
38+
{
39+
$this->assertNotEmptyKey($key);
40+
41+
return isset($this->values[$key]);
42+
}
43+
44+
/**
45+
* Returns the entry stored for the given key, and throws an exception if the value does not exist
46+
* (which helps keep the return type simple).
47+
*
48+
* @param string $key the key to of the item to retrieve; must not be empty
49+
*
50+
* @return string the retrieved value; may be empty
51+
*
52+
* @throws \BadMethodCallException
53+
*/
54+
public function get(string $key): string
55+
{
56+
if (!$this->has($key)) {
57+
throw new \BadMethodCallException('You can only call `get` with a key for an existing value.', 1625996246);
58+
}
59+
60+
return $this->values[$key];
61+
}
62+
63+
/**
64+
* Sets or overwrites an entry.
65+
*
66+
* @param string $key the key to of the item to set; must not be empty
67+
* @param string $value the value to set; can be empty
68+
*
69+
* @throws \BadMethodCallException
70+
*/
71+
public function set(string $key, string $value): void
72+
{
73+
$this->assertNotEmptyKey($key);
74+
75+
$this->values[$key] = $value;
76+
}
77+
78+
/**
79+
* @throws \InvalidArgumentException
80+
*/
81+
private function assertNotEmptyKey(string $key): void
82+
{
83+
if ($key === '') {
84+
throw new \InvalidArgumentException('Please provide a non-empty key.', 1625995840);
85+
}
86+
}
87+
}

0 commit comments

Comments
 (0)