-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfront-page.php
More file actions
436 lines (253 loc) · 11.9 KB
/
Copy pathfront-page.php
File metadata and controls
436 lines (253 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<?php get_header();
if ( get_option( 'show_on_front' ) == 'page' ) {
?>
<div class="clear"></div>
</header> <!-- / END HOME SECTION -->
<div id="content" class="site-content">
<div class="container">
<div class="content-left-wrap col-md-9">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post();
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
openlab_paging_nav();
else :
get_template_part( 'content', 'none' );
endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .content-left-wrap -->
<div class="sidebar-wrap col-md-3 content-left-wrap">
<?php get_sidebar(); ?>
</div><!-- .sidebar-wrap -->
</div><!-- .container -->
<?php
}else {
if(isset($_POST['submitted']) && !defined('PIRATE_FORMS_VERSION') && !shortcode_exists( 'pirate_forms' ) ) :
/* recaptcha */
$openlab_contactus_sitekey = get_theme_mod('openlab_contactus_sitekey');
$openlab_contactus_secretkey = get_theme_mod('openlab_contactus_secretkey');
$openlab_contactus_recaptcha_show = get_theme_mod('openlab_contactus_recaptcha_show');
if( isset($openlab_contactus_recaptcha_show) && $openlab_contactus_recaptcha_show != 1 && !empty($openlab_contactus_sitekey) && !empty($openlab_contactus_secretkey) ) :
$captcha;
if( isset($_POST['g-recaptcha-response']) ){
$captcha=$_POST['g-recaptcha-response'];
}
if( !$captcha ){
$hasError = true;
}
$response = wp_remote_get( "https://www.google.com/recaptcha/api/siteverify?secret=".$openlab_contactus_secretkey."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR'] );
if($response['body'].success==false) {
$hasError = true;
}
endif;
/* name */
if(trim($_POST['myname']) === ''):
$nameError = __('* Please enter your name.','openlab-txtd');
$hasError = true;
else:
$name = trim($_POST['myname']);
endif;
/* email */
if(trim($_POST['myemail']) === ''):
$emailError = __('* Please enter your email address.','openlab-txtd');
$hasError = true;
elseif (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['myemail']))) :
$emailError = __('* You entered an invalid email address.','openlab-txtd');
$hasError = true;
else:
$email = trim($_POST['myemail']);
endif;
/* subject */
if(trim($_POST['mysubject']) === ''):
$subjectError = __('* Please enter a subject.','openlab-txtd');
$hasError = true;
else:
$subject = trim($_POST['mysubject']);
endif;
/* message */
if(trim($_POST['mymessage']) === ''):
$messageError = __('* Please enter a message.','openlab-txtd');
$hasError = true;
else:
$message = stripslashes(trim($_POST['mymessage']));
endif;
/* send the email */
if(!isset($hasError)):
$openlab_contactus_email = get_theme_mod('openlab_contactus_email');
if( empty($openlab_contactus_email) ):
$emailTo = get_theme_mod('openlab_email');
else:
$emailTo = $openlab_contactus_email;
endif;
if(isset($emailTo) && $emailTo != ""):
if( empty($subject) ):
$subject = 'From '.$name;
endif;
$body = "Name: $name \n\nEmail: $email \n\n Subject: $subject \n\n Message: $message";
/* FIXED HEADERS FOR EMAIL NOT GOING TO SPAM */
$openlab_admin_email = get_option( 'admin_email' );
$openlab_sitename = strtolower( $_SERVER['SERVER_NAME'] );
function openlab_is_localhost() {
$openlab_server_name = strtolower( $_SERVER['SERVER_NAME'] );
return in_array( $openlab_server_name, array( 'localhost', '127.0.0.1' ) );
}
if ( openlab_is_localhost() ) {
$headers = 'From: '.$name.' <'.$openlab_admin_email.'>' . "\r\n" . 'Reply-To: ' . $email;
} else {
if ( substr( $openlab_sitename, 0, 4 ) == 'www.' ) {
$openlab_sitename = substr( $openlab_sitename, 4 );
}
$headers = 'From: '.$name.' <wordpress@'.$openlab_sitename.'>' . "\r\n" . 'Reply-To: ' . $email;
}
wp_mail($emailTo, $subject, $body, $headers);
$emailSent = true;
else:
$emailSent = false;
endif;
endif;
endif;
$openlab_bigtitle_show = get_theme_mod('openlab_bigtitle_show');
if( isset($openlab_bigtitle_show) && $openlab_bigtitle_show != 1 ):
get_template_part( 'sections/big_title' );
endif;
?>
</header> <!-- / END HOME SECTION -->
<div id="content" class="site-content">
<?php
/* OUR FOCUS SECTION */
$openlab_ourfocus_show = get_theme_mod('openlab_ourfocus_show');
if( isset($openlab_ourfocus_show) && $openlab_ourfocus_show != 1 ):
get_template_part( 'sections/our_focus' );
endif;
/* RIBBON WITH BOTTOM BUTTON */
get_template_part( 'sections/ribbon_with_bottom_button' );
/* ABOUT US */
$openlab_aboutus_show = get_theme_mod('openlab_aboutus_show');
if( isset($openlab_aboutus_show) && $openlab_aboutus_show != 1 ):
get_template_part( 'sections/about_us' );
endif;
/* OUR TEAM */
$openlab_ourteam_show = get_theme_mod('openlab_ourteam_show');
if( isset($openlab_ourteam_show) && $openlab_ourteam_show != 1 ):
get_template_part( 'sections/our_team' );
endif;
/* TESTIMONIALS */
$openlab_testimonials_show = get_theme_mod('openlab_testimonials_show');
if( isset($openlab_testimonials_show) && $openlab_testimonials_show != 1 ):
get_template_part( 'sections/testimonials' );
endif;
/* RIBBON WITH RIGHT SIDE BUTTON */
get_template_part( 'sections/ribbon_with_right_button' );
/* CONTACT US */
$openlab_contactus_show = get_theme_mod('openlab_contactus_show');
if( isset($openlab_contactus_show) && $openlab_contactus_show != 1 ):
?>
<?php
$openlab_sections_bg = get_theme_mod('openlab_bg_home_sections', get_template_directory_uri().'/images/home-bg.jpg');
if($openlab_sections_bg != ""):
echo '<section class="contact-us" id="contact" style="background-image:url('.esc_url($openlab_sections_bg).');">';
else:
echo '<section class="contact-us" id="contact">';
endif;
?>
<div class="colored-mask"></div>
<div class="container">
<!-- SECTION HEADER -->
<div class="section-header">
<?php
$openlab_contactus_title = get_theme_mod('openlab_contactus_title',__('Contact','openlab-txtd'));
if ( !empty($openlab_contactus_title) ):
echo '<h2 class="white-text">'.$openlab_contactus_title.'</h2>';
endif;
$openlab_contactus_subtitle = get_theme_mod('openlab_contactus_subtitle');
if(isset($openlab_contactus_subtitle) && $openlab_contactus_subtitle != ""):
echo '<div class="white-text section-legend">'.$openlab_contactus_subtitle.'</div>';
endif;
?>
</div>
<!-- / END SECTION HEADER -->
<?php
if ( defined('PIRATE_FORMS_VERSION') && shortcode_exists( 'pirate_forms' ) ):
echo '<div class="row">';
echo do_shortcode('[pirate_forms]');
echo '</div>';
else:
?>
<!-- CONTACT FORM-->
<div class="row">
<?php
if(isset($emailSent) && $emailSent == true) :
echo '<div class="notification success"><p>'.__('Thanks, your email was sent successfully!','openlab-txtd').'</p></div>';
elseif(isset($_POST['submitted'])):
echo '<div class="notification error"><p>'.__('Sorry, an error occured.','openlab-txtd').'</p></div>';
endif;
if(isset($nameError) && $nameError != '') :
echo '<div class="notification error"><p>'.esc_html($nameError).'</p></div>';
endif;
if(isset($emailError) && $emailError != '') :
echo '<div class="notification error"><p>'.esc_html($emailError).'</p></div>';
endif;
if(isset($subjectError) && $subjectError != '') :
echo '<div class="notification error"><p>'.esc_html($subjectError).'</p></div>';
endif;
if(isset($messageError) && $messageError != '') :
echo '<div class="notification error"><p>'.esc_html($messageError).'</p></div>';
endif;
?>
<form role="form" method="POST" action="" onSubmit="this.scrollPosition.value=(document.body.scrollTop || document.documentElement.scrollTop)" class="contact-form">
<input type="hidden" name="scrollPosition">
<input type="hidden" name="submitted" id="submitted" value="true" />
<div class="col-lg-4 col-sm-4 openlab-rtl-contact-name" data-scrollreveal="enter left after 0s over 1s">
<label for="myname" class="screen-reader-text"><?php _e( 'Your Name', 'openlab-txtd' ); ?></label>
<input required="required" type="text" name="myname" id="myname" placeholder="<?php _e('Your Name','openlab-txtd'); ?>" class="form-control input-box" value="<?php if(isset($_POST['myname'])) echo esc_attr($_POST['myname']);?>">
</div>
<div class="col-lg-4 col-sm-4 openlab-rtl-contact-email" data-scrollreveal="enter left after 0s over 1s">
<label for="myemail" class="screen-reader-text"><?php _e( 'Your Email', 'openlab-txtd' ); ?></label>
<input required="required" type="email" name="myemail" id="myemail" placeholder="<?php _e('Your Email','openlab-txtd'); ?>" class="form-control input-box" value="<?php if(isset($_POST['myemail'])) echo is_email($_POST['myemail']) ? $_POST['myemail'] : ""; ?>">
</div>
<div class="col-lg-4 col-sm-4 openlab-rtl-contact-subject" data-scrollreveal="enter left after 0s over 1s">
<label for="mysubject" class="screen-reader-text"><?php _e( 'Subject', 'openlab-txtd' ); ?></label>
<input required="required" type="text" name="mysubject" id="mysubject" placeholder="<?php _e('Subject','openlab-txtd'); ?>" class="form-control input-box" value="<?php if(isset($_POST['mysubject'])) echo esc_attr($_POST['mysubject']);?>">
</div>
<div class="col-lg-12 col-sm-12" data-scrollreveal="enter right after 0s over 1s">
<label for="mymessage" class="screen-reader-text"><?php _e( 'Your Message', 'openlab-txtd' ); ?></label>
<textarea name="mymessage" id="mymessage" class="form-control textarea-box" placeholder="<?php _e('Your Message','openlab-txtd'); ?>"><?php if(isset($_POST['mymessage'])) { echo esc_html($_POST['mymessage']); } ?></textarea>
</div>
<?php
$openlab_contactus_button_label = get_theme_mod('openlab_contactus_button_label',__('Send Message','openlab-txtd'));
if( !empty($openlab_contactus_button_label) ):
echo '<button class="btn btn-primary custom-button red-btn" type="submit" data-scrollreveal="enter left after 0s over 1s">'.$openlab_contactus_button_label.'</button>';
endif;
?>
<?php
$openlab_contactus_sitekey = get_theme_mod('openlab_contactus_sitekey');
$openlab_contactus_secretkey = get_theme_mod('openlab_contactus_secretkey');
$openlab_contactus_recaptcha_show = get_theme_mod('openlab_contactus_recaptcha_show');
if( isset($openlab_contactus_recaptcha_show) && $openlab_contactus_recaptcha_show != 1 && !empty($openlab_contactus_sitekey) && !empty($openlab_contactus_secretkey) ) :
echo '<div class="g-recaptcha openlab-g-recaptcha" data-sitekey="' . $openlab_contactus_sitekey . '"></div>';
endif;
?>
</form>
</div>
<!-- / END CONTACT FORM-->
<?php
endif;
?>
</div> <!-- / END CONTAINER -->
</section> <!-- / END CONTACT US SECTION-->
<?php
endif;
/* LATEST NEWS */
$openlab_latestnews_show = get_theme_mod('openlab_latestnews_show');
if( isset($openlab_latestnews_show) && $openlab_latestnews_show != 1 ):
get_template_part( 'sections/latest_news' );
endif;
}
get_footer(); ?>