/
template-landingpage.php
executable file
·232 lines (195 loc) · 8.63 KB
/
template-landingpage.php
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
<?php
/**
* Template Name: Landing Page
*/
?>
<div class="custom-landing <?php the_field( "page_style" ); ?>">
<div class="container">
<div class="col-md-8">
<div class="content-block<?php if (get_field('content_box_color_scheme') == "dark") { echo " dark-scheme"; } ?>">
<h1><?php the_title(); ?></h1>
<?php the_content() ; ?>
</div>
</div>
<div class="col-md-4">
<div class="content-form">
<?php if(get_field('form_title')) { ?>
<h3><?php the_field( 'form_title' ); ?></h3>
<?php } ?>
<?php if(is_page('30542')){ ?>
<form id="mktoForm_1124"></form>
<?php } elseif(is_page('37281')) { ?>
<form id="mktoForm_1632"></form>
<?php } elseif(is_page('28585')) { ?>
<form id="mktoForm_1131"></form>
<?php } if(get_field('marketo_form_version') == 'global') { ?>
<form id="mktoForm_<?php the_field('form_type');?>"></form>
<?php } else { ?>
<form id="mktoForm_<?php if(get_field('product_download') && get_field('license_type') == "community") { ?>503<?php } elseif(get_field('product_download') && get_field('license_type') == "trial") { ?>502<?php } elseif(get_field('product_download') && get_field('license_type') == "freemium") { ?>1015<?php } elseif(get_field('product_download') && get_field('license_type') == "freemiumTrial") { ?>1014<?php } elseif(get_field('product_download') && get_field('license_type') == "saas") { ?>1131<?php } else { the_field('marketo_form_code'); } ?>"></form>
<?php } ?>
<script type="text/javascript">
<?php if(get_field('product_download') && !is_page('28585')) { ?>
function tH(str) {
var rndPre=Math.floor(Math.random()*10)
var rndPos=Math.floor(Math.random()*10)
var hex = ''+rndPre.toString();
for(var i=0;i<str.length;i++) {
hex += ''+str.charCodeAt(i).toString(16);
}
hex += ''+rndPos.toString();
return hex;
}
jQuery(document).ready(function($){
var $jQ = jQuery.noConflict();
MktoForms2.loadForm("//app-sjp.marketo.com", "303-ZIH-630", <?php if(is_page('30542')) { ?>1124<?php } elseif(is_page('37281')) { ?>1632<?php } elseif(get_field('license_type') == "community") { ?>503<?php } elseif(get_field('license_type') == "trial") { ?>502<?php } elseif(get_field('license_type') == "freemium") { ?>1015<?php } elseif(get_field('license_type') == "freemiumTrial") { ?>1014<?php } elseif(get_field('license_type') == "saas") { ?>1131<?php } else { the_field('marketo_form_code'); } ?>, function(form){
jQuery( ".mktoButton" ).addClass( "btn btn-vmt" );
jQuery( ".mktoButtonWrap.mktoSimple" ).removeClass( "mktoSimple mktoButtonWrap" );
form.onSubmit(function(){
var fi = tH($jQ("#FirstName").val());
var la = tH($jQ("#LastName").val());
var em = tH($jQ("#Email").val());
var co = tH($jQ("#Company").val());
var ty = tH("<?php the_field( 'license_type' ) ?>");
<?php if(is_page('30542') || is_page('37281')) { ?>
var query = "?a=" + encodeURI(em) + "&b=" + encodeURI(fi) + "&c=" + encodeURI(la)+ "&d=" + encodeURI(ty) + "&e=" + encodeURI(co) + "&v=" + encodeURI("v4");
<?php } else { ?>
var query = "?a=" + encodeURI(em) + "&b=" + encodeURI(fi) + "&c=" + encodeURI(la)+ "&d=" + encodeURI(ty) + "&e=" + encodeURI(co);
<?php } ?>
var url = "http://license.vmturbo.com/regcomplete.php";
// post data
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST",url,true);
xmlhttp.send(query);
}); // end on submit form
<?php if(is_page('16412') || is_page('30542') || is_page('37281')) { ?>
form.onSuccess(function(){
window['optimizely'] = window['optimizely'] || [];
window.optimizely.push(["trackEvent", "form_success"]);
});
<?php } ?>
});
})
<?php } elseif(is_page('28585')) { ?>
// VMTURBO SAAS
function tH(str) {
var rndPre=Math.floor(Math.random()*10)
var rndPos=Math.floor(Math.random()*10)
var hex = ''+rndPre.toString();
for(var i=0;i<str.length;i++) {
hex += ''+str.charCodeAt(i).toString(16);
}
hex += ''+rndPos.toString();
return hex;
}
MktoForms2.loadForm("//app-sjp.marketo.com", "303-ZIH-630", 1131, function(form){
var sassSuccess = true;
var $jQ = jQuery.noConflict();
form.onSubmit(function(){
var fname = $jQ("#FirstName").val();
var emailaddressVal = $jQ("#Email").val();
// post to saas servlet
var urlSaas = "http://54.68.88.66/SaaS/vmt_saas?Email="+encodeURI(emailaddressVal)+"&firstName="+encodeURI(fname)+"&type=requestSaaSAccess";
$jQ.ajax({
type: "POST",
url: urlSaas
}).error(function(){
sassSuccess = false;
});
});
form.onSuccess(function(values, followUpUrl){
if (sassSuccess==false){
form.getFormElem().fadeToggle('400', function() {
$jQ('.content-form').append('<p class="saasErrorMsg" style="padding: 10px 5% !important;font-weight: bold;color: red;display:none;">There was an error during your request. Please try again in a few minutes. If you experience this error more than once, contact <a href="mailto:evalTeam@vmturbo.com">evalTeam@vmturbo.com</a> for further assistance</p>');
$jQ('.content-form .saasErrorMsg').fadeToggle('400');
});
return false;
}
});
});
<?php } elseif(get_field('marketo_form_version') == 'global') { ?>
MktoForms2.loadForm("//app-sjp.marketo.com", "303-ZIH-630", <?php the_field('form_type');?>, function(form){
jQuery( ".mktoButton" ).addClass( "btn btn-vmt" );
jQuery( ".mktoButtonWrap.mktoSimple" ).removeClass( "mktoSimple mktoButtonWrap" );
form.onSuccess(function(values, followUpUrl) {
location.href = "<?php the_field('thank_you_page_url'); ?>";
return false;
});
});
<?php } else { ?>
MktoForms2.loadForm("//app-sjp.marketo.com", "303-ZIH-630", <?php the_field('marketo_form_code');?>, function(form){
jQuery( ".mktoButton" ).addClass( "btn btn-vmt" );
jQuery( ".mktoButtonWrap.mktoSimple" ).removeClass( "mktoSimple mktoButtonWrap" );
});
<?php if(is_page('28092')) { ?>
// wistiaEmbed = document.getElementById("wistiaframe").wistiaApi;wistiaEmbed.bind("end", function() {
// jQuery( "#fademe" ).fadeOut( "slow", function() {});
// });
// wistiaEmbed.bind("secondchange", function (s) {if(s === 180) {
// jQuery('.mktoButtonRow .alert').hide();jQuery('.mktoButtonRow .btn-vmt').fadeIn();
// }});
// jQuery('.mktoButtonRow span').append('<div class="alert">You must watch the video before submitting this form</div>');
<?php } ?>
<?php } ?>
</script>
<?php if(get_field('page_style') == "image") { ?>
<script type="text/javascript">
jQuery(document).ready(function($){
MktoForms2.whenReady(function (form) {
jQuery.backstretch("<?php the_field('page_background_image'); ?>");
});
});
</script>
<?php } ?>
<?php if(is_page('28092')) { ?>
<script type="text/javascript">
jQuery(window).load(function(){
MktoForms2.whenReady(function (form) {
//jQuery('.mktoButtonRow .btn-vmt').hide();
//jQuery('.mktoButtonRow span').append('<div class="alert" style="background: #860202;text-align: center;padding: 10px;font-size: .9em;font-weight: bold;color: #fff;">You must watch the video before submitting this form</div>');
});
/*
var video = wistiaEmbeds[0];
video.bind("secondchange", function (s) {
if(s >= 180) {
jQuery('.mktoButtonRow .alert').hide();
jQuery('.mktoButtonRow .btn-vmt').fadeIn();
}
});
*/
jQuery('.content-block h1').insertAfter('#main-head');
})
</script>
<?php } ?>
<?php if(is_page('34478') || is_page('25720')) { // work email a/b test ?>
<script type="text/javascript">
jQuery(window).load(function(){
MktoForms2.whenReady(function (form) {
var obj = optimizely.variationMap
if (jQuery("input[name='testValue']").filter(function() { return jQuery(this).val(); }).length == 0) {
var object = JSON.stringify(optimizely.variationMap);
jQuery("input[name='testValue']").val('optimizely: ' + object);
}
});
})
</script>
<?php } ?>
</div>
</div>
</div>
</div>
<?php if(get_field('custom_css')) { ?>
<style type="text/css">
<?php the_field('custom_css') ?>
</style>
<?php } ?>
<?php if(get_field('custom_js')) { ?>
<script type="text/javascript">
jQuery(document).ready(function($){
<?php the_field('custom_js') ?>
});
</script>
<?php } ?>