Skip to content

Commit 1ef884b

Browse files
update: to match wordpress requirements
1 parent 3d6d938 commit 1ef884b

9 files changed

Lines changed: 153 additions & 219 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,19 @@ jobs:
1919
2020
- name: Prepare plugin
2121
run: |
22-
mkdir build/stackverify
23-
cp admin.php build/stackverify/
24-
cp client.php build/stackverify/
25-
cp stackverify.php build/stackverify/
26-
cp uninstall.php build/stackverify/
27-
cp readme.txt build/stackverify/
22+
mkdir build/stackverify-connector
23+
cp stackverify-connector.php build/stackverify-connector/
24+
cp uninstall.php build/stackverify-connector/
25+
cp readme.txt build/stackverify-connector/
26+
cp -r includes build/stackverify-connector/
2827
2928
- name: Create ZIP
3029
run: |
3130
cd build
32-
zip -r stackverify.zip stackverify
31+
zip -r stackverify-connector.zip stackverify-connector
3332
3433
- name: Upload artifact
3534
uses: actions/upload-artifact@v4
3635
with:
37-
name: stackverify-plugin
38-
path: build/stackverify.zip
36+
name: stackverify-connector-plugin
37+
path: build/stackverify-connector.zip

‎includes/integrations/stackverify/actions/send_form.php‎

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public function get_details(){
1414

1515
'action' => 'stackverify_send_form',
1616

17-
'name' => 'Send Submission To StackVerify',
17+
'name' => __(
18+
'Send Submission To StackVerify',
19+
'stackverify-connector'
20+
),
1821

1922
'integration' => 'stackverify',
2023

@@ -23,14 +26,19 @@ public function get_details(){
2326

2427
'stackverify_form_id' => array(
2528

26-
'label' => 'StackVerify Form ID',
29+
'label' => __(
30+
'StackVerify Form ID',
31+
'stackverify-connector'
32+
),
2733

2834
'type' => 'text',
2935

3036
'required' => false,
3137

32-
'description' =>
33-
'Your StackVerify form ID. Example: frm_ERex6qDoGF'
38+
'description' => __(
39+
'Your StackVerify form ID. Example: frm_ERex6qDoGF',
40+
'stackverify-connector'
41+
)
3442

3543
)
3644

@@ -45,21 +53,7 @@ public function get_details(){
4553

4654

4755

48-
49-
public function execute($return_data, $response_body){
50-
51-
52-
53-
/*
54-
* WP Webhooks passes the trigger output here.
55-
* This can contain data from:
56-
*
57-
* WPForms
58-
* Elementor Forms
59-
* Contact Form 7
60-
* Gravity Forms
61-
* Other integrations
62-
*/
56+
public function execute( $return_data, $response_body ){
6357

6458

6559

@@ -72,7 +66,7 @@ public function execute($return_data, $response_body){
7266
*/
7367

7468
if(
75-
isset($response_body['stackverify_form_id'])
69+
isset( $response_body['stackverify_form_id'] )
7670
){
7771

7872
$form_id = sanitize_text_field(
@@ -88,7 +82,7 @@ public function execute($return_data, $response_body){
8882
* If empty use global admin connection
8983
*/
9084

91-
if(empty($form_id)){
85+
if( empty( $form_id ) ){
9286

9387

9488
$form_id = get_option(
@@ -102,11 +96,13 @@ public function execute($return_data, $response_body){
10296

10397

10498

105-
if(empty($form_id)){
99+
if( empty( $form_id ) ){
106100

107101

108-
$return_data['error'] =
109-
'StackVerify Form ID is missing';
102+
$return_data['error'] = __(
103+
'StackVerify Form ID is missing',
104+
'stackverify-connector'
105+
);
110106

111107

112108
return $return_data;
@@ -117,7 +113,6 @@ public function execute($return_data, $response_body){
117113

118114

119115

120-
121116
/*
122117
* Remove plugin configuration
123118
* before sending real form data
@@ -130,7 +125,6 @@ public function execute($return_data, $response_body){
130125

131126

132127

133-
134128
/*
135129
* Send submission to StackVerify
136130
*/
@@ -166,9 +160,8 @@ public function execute($return_data, $response_body){
166160

167161

168162

169-
170163
if(
171-
is_wp_error($request)
164+
is_wp_error( $request )
172165
){
173166

174167

‎includes/integrations/stackverify/admin/settings.php‎

Lines changed: 41 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ public function __construct(){
1010

1111
add_action(
1212
'admin_menu',
13-
array($this, 'menu')
13+
array( $this, 'menu' )
1414
);
1515

1616

1717
add_action(
1818
'admin_init',
19-
array($this, 'save')
19+
array( $this, 'save' )
2020
);
2121

2222
}
@@ -27,15 +27,15 @@ public function menu(){
2727

2828
add_options_page(
2929

30-
'StackVerify Connection',
30+
esc_html__( 'StackVerify Connection', 'stackverify-connector' ),
3131

32-
'StackVerify',
32+
esc_html__( 'StackVerify', 'stackverify-connector' ),
3333

3434
'manage_options',
3535

3636
'stackverify',
3737

38-
array($this,'page')
38+
array( $this, 'page' )
3939

4040
);
4141

@@ -55,61 +55,29 @@ public function page(){
5555

5656
<div class="wrap" style="max-width: 800px; margin-top: 20px;">
5757

58-
<!-- Saved Confirmation Notice -->
5958
<?php if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] === 'true' ) : ?>
6059
<div class="notice notice-success is-dismissible" style="margin: 0 0 20px 0; border-radius: 6px;">
61-
<p>StackVerify connection saved successfully.</p>
60+
<p><?php echo esc_html__( 'StackVerify connection saved successfully.', 'stackverify-connector' ); ?></p>
6261
</div>
6362
<?php endif; ?>
6463

65-
<!-- Header Banner -->
66-
<div style="
67-
background: #ffffff;
68-
padding: 24px 30px;
69-
border-radius: 8px;
70-
margin-bottom: 20px;
71-
border: 1px solid #e2e8f0;
72-
">
73-
<h1 style="
74-
color: #1e293b;
75-
margin: 0 0 8px 0;
76-
font-size: 24px;
77-
font-weight: 600;
78-
">
79-
StackVerify Connector
64+
<div style="background: #ffffff; padding: 24px 30px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e2e8f0;">
65+
<h1 style="color: #1e293b; margin: 0 0 8px 0; font-size: 24px; font-weight: 600;">
66+
<?php echo esc_html__( 'StackVerify Connector', 'stackverify-connector' ); ?>
8067
</h1>
81-
82-
<p style="
83-
font-size: 14px;
84-
color: #64748b;
85-
margin: 0;
86-
line-height: 1.5;
87-
">
88-
Connect WordPress forms with StackVerify using WP Webhooks.
89-
This connector adds StackVerify support while keeping your existing WP Webhooks setup unchanged.
68+
<p style="font-size: 14px; color: #64748b; margin: 0; line-height: 1.5;">
69+
<?php echo esc_html__( 'Connect WordPress forms with StackVerify using WP Webhooks. This connector adds StackVerify support while keeping your existing WP Webhooks setup unchanged.', 'stackverify-connector' ); ?>
9070
</p>
9171
</div>
9272

93-
<!-- Main Form Card -->
94-
<div style="
95-
background: #ffffff;
96-
padding: 30px;
97-
border-radius: 8px;
98-
border: 1px solid #e2e8f0;
99-
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
100-
">
73+
<div style="background: #ffffff; padding: 30px; border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.05);">
10174

102-
<h2 style="
103-
font-size: 18px;
104-
font-weight: 600;
105-
color: #0f172a;
106-
margin: 0 0 8px 0;
107-
">
108-
Connection Settings
75+
<h2 style="font-size: 18px; font-weight: 600; color: #0f172a; margin: 0 0 8px 0;">
76+
<?php echo esc_html__( 'Connection Settings', 'stackverify-connector' ); ?>
10977
</h2>
11078

11179
<p style="color: #64748b; font-size: 14px; margin-bottom: 24px;">
112-
Enter your StackVerify Form ID to automatically send incoming form submissions to your StackVerify workflows.
80+
<?php echo esc_html__( 'Enter your StackVerify Form ID to automatically send incoming form submissions to your StackVerify workflows.', 'stackverify-connector' ); ?>
11381
</p>
11482

11583
<form method="post" action="">
@@ -123,20 +91,20 @@ public function page(){
12391

12492
<div style="margin-bottom: 24px;">
12593
<label style="
126-
display: block;
127-
font-weight: 500;
128-
color: #334155;
94+
display: block;
95+
font-weight: 500;
96+
color: #334155;
12997
margin-bottom: 8px;
13098
font-size: 14px;
13199
">
132-
StackVerify Form ID
100+
<?php echo esc_html__( 'StackVerify Form ID', 'stackverify-connector' ); ?>
133101
</label>
134102

135-
<input
136-
type="text"
137-
name="stackverify_form_id"
138-
value="<?php echo esc_attr($form_id); ?>"
139-
placeholder="frm_ERex6qDoGF"
103+
<input
104+
type="text"
105+
name="stackverify_form_id"
106+
value="<?php echo esc_attr( $form_id ); ?>"
107+
placeholder="<?php echo esc_attr__( 'frm_ERex6qDoGF', 'stackverify-connector' ); ?>"
140108
style="
141109
padding: 10px 14px;
142110
width: 100%;
@@ -151,13 +119,16 @@ public function page(){
151119
>
152120

153121
<p class="description" style="margin-top: 6px; color: #94a3b8; font-size: 12px;">
154-
Example: <code>frm_ERex6qDoGF</code>
122+
<?php printf(
123+
esc_html__( 'Example: %s', 'stackverify-connector' ),
124+
'<code>frm_ERex6qDoGF</code>'
125+
); ?>
155126
</p>
156127
</div>
157128

158129
<?php
159130
submit_button(
160-
'Save StackVerify Connection',
131+
esc_html__( 'Save StackVerify Connection', 'stackverify-connector' ),
161132
'primary',
162133
'submit',
163134
true,
@@ -171,7 +142,6 @@ public function page(){
171142

172143
</div>
173144

174-
<!-- How It Works Section -->
175145
<div style="
176146
margin-top: 20px;
177147
padding: 24px;
@@ -185,20 +155,20 @@ public function page(){
185155
color: #1e293b;
186156
margin: 0 0 12px 0;
187157
">
188-
How StackVerify Connector Works
158+
<?php echo esc_html__( 'How StackVerify Connector Works', 'stackverify-connector' ); ?>
189159
</h3>
190160

191161
<ol style="
192-
margin: 0;
193-
padding-left: 20px;
194-
color: #475569;
162+
margin: 0;
163+
padding-left: 20px;
164+
color: #475569;
195165
font-size: 13px;
196166
line-height: 1.8;
197167
">
198-
<li>Your visitor submits a WordPress form.</li>
199-
<li>WP Webhooks receives the form submission.</li>
200-
<li>StackVerify Connector forwards the data to StackVerify.</li>
201-
<li>StackVerify processes the submission and sends notifications.</li>
168+
<li><?php echo esc_html__( 'Your visitor submits a WordPress form.', 'stackverify-connector' ); ?></li>
169+
<li><?php echo esc_html__( 'WP Webhooks receives the form submission.', 'stackverify-connector' ); ?></li>
170+
<li><?php echo esc_html__( 'StackVerify Connector forwards the data to StackVerify.', 'stackverify-connector' ); ?></li>
171+
<li><?php echo esc_html__( 'StackVerify processes the submission and sends notifications.', 'stackverify-connector' ); ?></li>
202172
</ol>
203173
</div>
204174

@@ -215,28 +185,19 @@ public function save(){
215185

216186

217187
if(
218-
!isset($_POST['stackverify_nonce'])
188+
! isset( $_POST['stackverify_nonce'] )
219189
){
220190
return;
221191
}
222192

223193

224194

225-
if(
226-
!wp_verify_nonce(
227-
sanitize_text_field($_POST['stackverify_nonce']),
228-
'stackverify_save'
229-
)
230-
){
231-
232-
return;
233-
234-
}
195+
check_admin_referer( 'stackverify_save', 'stackverify_nonce' );
235196

236197

237198

238199
if(
239-
!current_user_can('manage_options')
200+
! current_user_can( 'manage_options' )
240201
){
241202

242203
return;
@@ -246,7 +207,7 @@ public function save(){
246207

247208

248209
if (
249-
isset($_POST['stackverify_form_id'])
210+
isset( $_POST['stackverify_form_id'] )
250211
){
251212

252213
update_option(
@@ -259,7 +220,6 @@ public function save(){
259220

260221
);
261222

262-
// Redirect back to settings page with update confirmation argument
263223
wp_redirect(
264224
add_query_arg(
265225
array( 'page' => 'stackverify', 'settings-updated' => 'true' ),

0 commit comments

Comments
 (0)