Skip to content

Commit c1fa33c

Browse files
authored
Version: 2.1.3 (#137)
* Improved management of Google Maps, Mailchimp, and reCAPTCHA API keys.
1 parent 649cc04 commit c1fa33c

11 files changed

Lines changed: 165 additions & 116 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The plugin has two build scripts. The first one is responsible for building bloc
3333
Before running any of the scripts, you must complete several steps:
3434
1. Clone the GitHub repository into your plugins directory.
3535
1. In the plugin directory run `npm i`.
36+
1. `nvm use 14.21.3`
3637

3738
For the first option (build blocks into one file):
3839
* Run `npm run dev` to compile your files automatically whenever you've made changes to the associated files.
@@ -45,8 +46,8 @@ For the second option (generating separate files for each block):
4546
### Update/generate POT(languages) file
4647
1. Install WP-CLI and add it to PATH (check out [official guide](https://wp-cli.org/#installing))
4748
1. Navigate to ./languages
48-
1. Run `wp i18n make-pot ./.. getwid.pot --exclude="src/"`
49-
1. To subtract new strings run `wp i18n make-pot ./.. getwid-new.pot --subtract="getwid.pot" --exclude="src/"`
49+
1. Run `wp i18n make-pot ./.. getwid.pot --exclude="src/,vendors/"`
50+
1. To subtract new strings run `wp i18n make-pot ./.. getwid-new.pot --subtract="getwid.pot" --exclude="src/,vendors/"`
5051

5152
## Support
5253
This is a developer's portal for the Getwid plugin and should not be used for support. Please visit the support page if you need to submit a support request.

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
= 2.0.14, Dec 27 2024 =
3+
* Resolved an issue with the Instagram widget. An Instagram Business account is required, and the app must be reauthorized to function properly.
4+
15
= 2.0.13, Nov 14 2024 =
26
* Minor bugfixes and improvements.
37

getwid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Getwid
44
* Plugin URI: https://motopress.com/products/getwid/
55
* Description: Extra Gutenberg blocks for building seamless and aesthetic websites in the WordPress block editor.
6-
* Version: 2.1.2
6+
* Version: 2.1.3
77
* Author: MotoPress
88
* Author URI: https://motopress.com/
99
* License: GPLv2 or later

includes/scripts-manager.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ public function enqueueEditorAssets() {
110110
}
111111
}
112112

113+
$current_user_can_manage_options = current_user_can( 'manage_options' );
114+
115+
$mailchimp_api_key = get_option( 'getwid_mailchimp_api_key', '' );
116+
117+
if ( !$current_user_can_manage_options ) {
118+
$mailchimp_api_key = $mailchimp_api_key ? '1' : '';
119+
}
120+
121+
$recaptcha_site_key = $current_user_can_manage_options ? get_option( 'getwid_recaptcha_v2_site_key' , '' ) : '1';
122+
$recaptcha_secret_key = $current_user_can_manage_options ? get_option( 'getwid_recaptcha_v2_secret_key', '' ) : '1';
123+
113124
wp_localize_script(
114125
"{$this->prefix}-blocks-editor-js",
115126
'Getwid',
@@ -128,9 +139,9 @@ public function enqueueEditorAssets() {
128139
'image_sizes' => $this->get_image_sizes(),
129140

130141
'excerpt_length' => apply_filters( 'excerpt_length', 55 ),
131-
'recaptcha_site_key' => get_option( 'getwid_recaptcha_v2_site_key' , '' ),
132-
'recaptcha_secret_key' => get_option( 'getwid_recaptcha_v2_secret_key', '' ),
133-
'mailchimp_api_key' => get_option( 'getwid_mailchimp_api_key' , '' ),
142+
'recaptcha_site_key' => $recaptcha_site_key,
143+
'recaptcha_secret_key' => $recaptcha_secret_key,
144+
'mailchimp_api_key' => $mailchimp_api_key,
134145
'debug' => ( defined( 'WP_DEBUG' ) ? WP_DEBUG : false )
135146
],
136147
'templates' => [
@@ -157,6 +168,9 @@ public function enqueueEditorAssets() {
157168
'check_instagram_token' => wp_create_nonce( 'getwid_nonce_check_instagram_token' )
158169
),
159170
'acf_exist' => getwid_acf_is_active(),
171+
'current_user' => [
172+
'can_manage_options' => $current_user_can_manage_options,
173+
]
160174
]
161175
)
162176
);

languages/getwid.pot

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1-
# Copyright (C) 2024 MotoPress
1+
# Copyright (C) 2025 MotoPress
22
# This file is distributed under the GPLv2 or later.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Getwid 2.0.11\n"
5+
"Project-Id-Version: Getwid 2.1.3\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/getwid\n"
77
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
88
"Language-Team: LANGUAGE <LL@li.org>\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=UTF-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"POT-Creation-Date: 2024-07-16T14:52:03+03:00\n"
12+
"POT-Creation-Date: 2025-10-03T11:57:27+00:00\n"
1313
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14-
"X-Generator: WP-CLI 2.9.0\n"
14+
"X-Generator: WP-CLI 2.11.0\n"
1515
"X-Domain: getwid\n"
1616

1717
#. Plugin Name of the plugin
18+
#: getwid.php
1819
msgid "Getwid"
1920
msgstr ""
2021

2122
#. Plugin URI of the plugin
23+
#: getwid.php
2224
msgid "https://motopress.com/products/getwid/"
2325
msgstr ""
2426

2527
#. Description of the plugin
28+
#: getwid.php
2629
msgid "Extra Gutenberg blocks for building seamless and aesthetic websites in the WordPress block editor."
2730
msgstr ""
2831

2932
#. Author of the plugin
33+
#: getwid.php
3034
msgid "MotoPress"
3135
msgstr ""
3236

3337
#. Author URI of the plugin
38+
#: getwid.php
3439
msgid "https://motopress.com/"
3540
msgstr ""
3641

@@ -2827,6 +2832,10 @@ msgstr ""
28272832
msgid "Save API Key"
28282833
msgstr ""
28292834

2835+
#: assets/js/editor.blocks.js:23
2836+
msgid "Contact the site administrator to set up the required keys."
2837+
msgstr ""
2838+
28302839
#: assets/js/editor.blocks.js:23
28312840
msgid "Delete Marker"
28322841
msgstr ""

readme.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: gutenberg, gutenberg blocks, wordpress blocks, blocks, editor, block, gute
55
Requires at least: 5.8
66
Tested up to: 6.8
77
Requires PHP: 5.6
8-
Stable tag: 2.1.2
8+
Stable tag: 2.1.3
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1111

@@ -225,6 +225,9 @@ Getwid plugin is distributed under the terms of the GNU GPL.
225225

226226
== Changelog ==
227227

228+
= 2.1.3, Oct 3 2025 =
229+
* Improved management of Google Maps, Mailchimp, and reCAPTCHA API keys.
230+
228231
= 2.1.2, Jul 24 2025 =
229232
* Fixed an issue where text highlight colors or inline images in the Table block were not editable.
230233
* Fixed an issue where Section blocks with entrance animations might not be visible in the block editor.
@@ -237,9 +240,6 @@ Getwid plugin is distributed under the terms of the GNU GPL.
237240
= 2.1.0, May 1 2025 =
238241
* Improved compatibility with WordPress 6.8.
239242

240-
= 2.0.14, Dec 27 2024 =
241-
* Resolved an issue with the Instagram widget. An Instagram Business account is required, and the app must be reauthorized to function properly.
242-
243243
--------
244244

245245
[See the previous changelogs here](https://plugins.svn.wordpress.org/getwid/trunk/changelog.txt).

src/blocks/contact-form/recaptcha.js

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { Button, TextControl, PanelBody, ButtonGroup, BaseControl, ExternalLink,
66

77
export default function Recaptcha( props ) {
88

9+
const currentUserCanManageOptions = Getwid?.current_user?.can_manage_options;
910
const [ siteKey, setSiteKey ] = useState( Getwid.settings.recaptcha_site_key );
1011
const [ secretKey, setSecretKey ] = useState( Getwid.settings.recaptcha_secret_key );
1112

@@ -51,49 +52,52 @@ export default function Recaptcha( props ) {
5152
{ value: 'light', label: __( 'Light', 'getwid' ) }
5253
]}
5354
/>
54-
<TextControl
55-
label={ __( 'reCAPTCHA v2 Site Key', 'getwid' ) }
56-
value={ siteKey }
57-
onChange={ value => {
58-
setSiteKey( value );
59-
}}
60-
/>
61-
<TextControl
62-
label={ __( 'reCAPTCHA v2 Secret Key', 'getwid' ) }
63-
value={ secretKey }
64-
onChange={ value => {
65-
setSecretKey( value )
66-
}}
67-
/>
68-
69-
<BaseControl>
70-
<ButtonGroup>
71-
<Button
72-
isPrimary
73-
disabled={ siteKey == '' && secretKey == '' }
74-
onClick={ () => { updateCaptchaCredentials( siteKey, secretKey ) } }
75-
isBusy={ isLoading }
76-
>
77-
{ __( 'Update', 'getwid' ) }
78-
</Button>
55+
{ currentUserCanManageOptions && (
56+
<>
57+
<TextControl
58+
label={ __( 'reCAPTCHA v2 Site Key', 'getwid' ) }
59+
value={ siteKey }
60+
onChange={ value => {
61+
setSiteKey( value );
62+
}}
63+
/>
64+
<TextControl
65+
label={ __( 'reCAPTCHA v2 Secret Key', 'getwid' ) }
66+
value={ secretKey }
67+
onChange={ value => {
68+
setSecretKey( value )
69+
}}
70+
/>
71+
<BaseControl>
72+
<ButtonGroup>
73+
<Button
74+
isPrimary
75+
disabled={ siteKey == '' && secretKey == '' }
76+
onClick={ () => { updateCaptchaCredentials( siteKey, secretKey ) } }
77+
isBusy={ isLoading }
78+
>
79+
{ __( 'Update', 'getwid' ) }
80+
</Button>
7981

80-
<Button
81-
isSecondary
82-
onClick={ () => {
83-
setSiteKey('');
84-
setSecretKey('');
85-
updateCaptchaCredentials( '', '' );
86-
} }
87-
isBusy={ isLoading }
88-
>
89-
{ __( 'Delete', 'getwid' ) }
90-
</Button>
91-
</ButtonGroup>
92-
</BaseControl>
82+
<Button
83+
isSecondary
84+
onClick={ () => {
85+
setSiteKey('');
86+
setSecretKey('');
87+
updateCaptchaCredentials( '', '' );
88+
} }
89+
isBusy={ isLoading }
90+
>
91+
{ __( 'Delete', 'getwid' ) }
92+
</Button>
93+
</ButtonGroup>
94+
</BaseControl>
9395

94-
<BaseControl>
95-
<ExternalLink href={ 'https://www.google.com/recaptcha/admin/create' }> { __( 'Get your key.', 'getwid' ) } </ExternalLink>
96-
</BaseControl>
96+
<BaseControl>
97+
<ExternalLink href={ 'https://www.google.com/recaptcha/admin/create' }> { __( 'Get your key.', 'getwid' ) } </ExternalLink>
98+
</BaseControl>
99+
</>
100+
)}
97101
</PanelBody>
98102
</InspectorControls>
99103
)

src/blocks/mailchimp/edit.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ class GetwidSubscribeForm extends Component {
5656
this.setGroupsName = this.setGroupsName.bind( this );
5757

5858
this.state = {
59-
mailchimpApiKey: Getwid.settings.mailchimp_api_key != '' ? Getwid.settings.mailchimp_api_key : '',
60-
checkApiKey : Getwid.settings.mailchimp_api_key != '' ? Getwid.settings.mailchimp_api_key : '',
59+
apiKey: Getwid?.settings?.mailchimp_api_key || '',
6160

6261
waitLoadList: true,
6362
error: '',
@@ -75,20 +74,26 @@ class GetwidSubscribeForm extends Component {
7574

7675
renderMailchimpApiKeyForm() {
7776
const { baseClass } = this.props;
77+
78+
if ( !Getwid?.current_user?.can_manage_options ) {
79+
return <div><p>{__('Contact the site administrator to set up the required keys.', 'getwid')}</p></div>
80+
}
81+
7882
return (
7983
<form className={`${baseClass}__key-form`} onSubmit={ event => this.manageMailchimpApiKey( event, 'save' ) }>
8084
<span className={'form-title'}>{__( 'Mailchimp API key.', 'getwid' )} <a href='https://mailchimp.com/help/about-api-keys/#Find_or_Generate_Your_API_Key' target='_blank'>{__( 'Get your key.', 'getwid' )}</a></span>
8185

8286
<div className={'form-wrapper'}>
8387
<TextControl
8488
placeholder={__( 'Mailchimp API Key', 'getwid' )}
85-
onChange={ value => this.changeData( { checkApiKey: value } ) }
89+
onChange={ value => this.changeData( { apiKey: value } ) }
8690
/>
8791

8892
<Button
8993
isPrimary
9094
type='submit'
91-
disabled={this.getData( 'checkApiKey' ) != '' ? null : true}
95+
isBusy={this.state.waitLoadList}
96+
disabled={this.getData( 'apiKey' ) != '' ? null : true}
9297
>
9398
{__( 'Save API Key', 'getwid' )}
9499
</Button>
@@ -109,7 +114,7 @@ class GetwidSubscribeForm extends Component {
109114
const data = {
110115
'action': 'getwid_mailchimp_api_key_manage',
111116
'data': {
112-
'api_key': getData( 'checkApiKey' )
117+
'api_key': getData( 'apiKey' )
113118
},
114119
'option': option,
115120
'nonce' : Getwid.nonces.mailchimp_api_key
@@ -127,7 +132,7 @@ class GetwidSubscribeForm extends Component {
127132
} else {
128133
switch ( option ) {
129134
case 'save':
130-
Getwid.settings.mailchimp_api_key = getData( 'checkApiKey' );
135+
Getwid.settings.mailchimp_api_key = getData( 'apiKey' );
131136
case 'sync':
132137
case 'save':
133138
case 'load':
@@ -140,7 +145,7 @@ class GetwidSubscribeForm extends Component {
140145
Getwid.settings.mailchimp_api_key = '';
141146
changeData( {
142147
error: '',
143-
checkApiKey: '',
148+
apiKey: '',
144149
} );
145150
break;
146151
}
@@ -173,14 +178,14 @@ class GetwidSubscribeForm extends Component {
173178
}
174179

175180
componentDidMount() {
176-
if ( Getwid.settings.mailchimp_api_key != '' ) {
181+
if ( this.state.apiKey != '' ) {
177182
this.manageMailchimpApiKey( null, 'load' );
178183
}
179184
}
180185

181186
render() {
182187

183-
if ( Getwid.settings.mailchimp_api_key == '' ) {
188+
if ( Getwid?.settings?.mailchimp_api_key == '' ) {
184189
return this.renderMailchimpApiKeyForm();
185190
}
186191

0 commit comments

Comments
 (0)