-
Notifications
You must be signed in to change notification settings - Fork 1
/
wp_hubspot_visual.php
322 lines (309 loc) · 12.9 KB
/
wp_hubspot_visual.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
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
<?php
/**
* @package TinyMCE
* @author Moxiecode
* @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
*/
/** @ignore */
require_once('../../../wp-load.php');
header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php _e('HubSpot Shortcodes') ?></title>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/tinymce/tiny_mce_popup.js?ver=3223"></script>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/ui.core.js"></script>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/ui.widget.js"></script>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/ui.mouse.js"></script>
<script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/ui.sortable.js"></script>
<script type="text/javascript" src="<?php echo HUBSPOT_URL; ?>/js/wp_hubspot_visual.js"></script>
<?php
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
?>
<style type="text/css">
.ui-socialize-highlight {
height:15px;
width:120px;
background:#ffebd6;
border:2px dashed #ff8a10;
}
#wphead {
font-size: 80%;
border-top: 0;
color: #555;
background-color: #f1f1f1;
}
#wphead h1 {
font-size: 24px;
color: #555;
margin: 0;
padding: 10px;
}
#tabs {
padding: 15px 15px 3px;
background-color: #f1f1f1;
border-bottom: 1px solid #dfdfdf;
}
#tabs li {
display: inline;
}
#tabs a.current {
background-color: #fff;
border-color: #dfdfdf;
border-bottom-color: #fff;
color: #d54e21;
}
#tabs a {
color: #2583AD;
padding: 6px;
border-width: 1px 1px 0;
border-style: solid solid none;
border-color: #f1f1f1;
text-decoration: none;
}
#tabs a:hover {
color: #d54e21;
}
.wrap h2 {
border-bottom-color: #dfdfdf;
color: #555;
margin: 5px 0;
padding: 0;
font-size: 18px;
}
#user_info {
right: 5%;
top: 5px;
}
h3 {
font-size: 1.1em;
margin-top: 10px;
margin-bottom: 0px;
}
#flipper {
margin: 0;
padding: 5px 20px 10px;
background-color: #fff;
border-left: 1px solid #dfdfdf;
border-bottom: 1px solid #dfdfdf;
}
* html {
overflow-x: hidden;
overflow-y: scroll;
}
#flipper div p {
margin-top: 0.4em;
margin-bottom: 0.8em;
text-align: justify;
}
th {
text-align: center;
}
.top th {
text-decoration: underline;
}
.top .key {
text-align: center;
width: 5em;
}
.top .action {
text-align: left;
}
.align {
border-left: 3px double #333;
border-right: 3px double #333;
}
.keys {
margin-bottom: 15px;
}
.keys p {
display: inline-block;
margin: 0px;
padding: 0px;
}
.keys .left { text-align: left; }
.keys .center { text-align: center; }
.keys .right { text-align: right; }
td b {
font-family: "Times New Roman" Times serif;
}
#buttoncontainer {
text-align: center;
margin-bottom: 20px;
}
#buttoncontainer a, #buttoncontainer a:hover {
border-bottom: 0px;
}
.hs-tinymce-pu-text{
width:175px;
}
</style>
<?php if ( is_rtl() ) : ?>
<style type="text/css">
#wphead, #tabs {
padding-left: auto;
padding-right: 15px;
}
#flipper {
margin: 5px 0 3px 10px;
}
.keys .left, .top, .action { text-align: right; }
.keys .right { text-align: left; }
td b { font-family: Tahoma, "Times New Roman", Times, serif }
</style>
<?php endif; ?>
<script type="text/javascript">
function d(id) { return document.getElementById(id); }
function flipTab(n) {
for (i=1;i<=4;i++) {
c = d('content'+i.toString());
t = d('tab'+i.toString());
if(c != null){
if ( n == i ) {
c.className = '';
t.className = 'current';
} else {
c.className = 'hidden';
t.className = '';
}
}
}
}
</script>
</head>
<body>
<?php
global $wpdb, $myhubspotwp_action, $myhubspotwp, $myhubspotusage;
$hs_settings = array();
$hs_settings = get_option('hs_settings');
$myhubspotusage->check_shortcode('Display shortcode popup');
?>
<ul id="tabs">
<li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Contact Info') ?>" accesskey="1" tabindex="1" class="current"><?php _e('Contact Info') ?></a></li>
<li><a id="tab2" href="javascript:flipTab(2)" title="<?php _e('Team List') ?>" accesskey="2" tabindex="2"><?php _e('Team List') ?></a></li>
<?php if($myhubspotwp_leads->hs_leads_enabled() && $myhubspotwp->hs_is_customer($hs_settings['hs_portal'], $hs_settings['hs_appdomain'])){?>
<li><a id="tab3" href="javascript:flipTab(3)" title="<?php _e('Custom Form') ?>" accesskey="3" tabindex="3"><?php _e('Custom Form') ?></a></li>
<?php } ?>
<?php if($myhubspotwp_action->hs_actions_enabled()){ ?>
<li><a id="tab4" href="javascript:flipTab(4)" title="<?php _e('Calls to Action') ?>" accesskey="4" tabindex="4"><?php _e('Calls to Action') ?></a></li>
<?php } ?>
</ul>
<div id="flipper" class="wrap">
<div id="content1">
<h2><?php _e('Contact Info') ?></h2>
<table class="form-table">
<form onsubmit="HubSpotInsertCompanyShortcode(<?php echo $hs_settings["hs_portal"]; ?>);return false" action="#" name="popup_form1">
<tr><th scope="row"><label for="hs_company_name"><?php _e("Company Name") ?></label></th><td><input type="text" class="hs-tinymce-pu-text" name="hs_company_name" id ="hs_company_name" value="<?php echo $hs_settings['hs_company_name'] ?>" /></td></tr>
<tr><th scope="row"><label for="hs_company_address"><?php _e("Company Address") ?></label></th><td><input type="text" class="hs-tinymce-pu-text" name="hs_company_address" id="hs_company_address" value="<?php echo $hs_settings['hs_company_address'] ?>" /></td></tr>
<tr><th scope="row"><label for="hs_company_citystate"><?php _e("Company City/State/Zip") ?></label></th><td><input type="text" class="hs-tinymce-pu-text" name="hs_company_citystate" id="hs_company_citystate" value="<?php echo $hs_settings['hs_company_citystate'] ?>" /></td></tr>
<tr><th scope="row"><label for="hs_company_phone"><?php _e("Company Phone") ?></label></th><td><input type="text" class="hs-tinymce-pu-text" name="hs_company_phone" id="hs_company_phone" value="<?php echo $hs_settings['hs_company_phone'] ?>" /></td></tr>
<tr><th scope="row"><label for="hs_company_phone"><?php _e("Display") ?></label></th><td><select class="widefat" id="hs_contact_display" name="hs_contact_display">
<?php
foreach (array('both' => 'Address & Map', 'address' => 'Address', 'map' => 'Map') as $display_key => $display_val){
echo '<option value="' . $display_key.'" >' . $display_val . '</option>';
}
?>
</select></td></tr>
<tr><td scope="row" colspan="2">
<div style="margin: 8px auto; text-align: right;padding-bottom: 10px;">
<input type="button" id="cancel" name="cancel" value="<?php _e('Cancel'); ?>" title="<?php _e('Cancel'); ?>" onclick="tinyMCEPopup.close();" />
<input type="submit" id="insert" name="insert" value="Insert" />
</div>
</td></tr>
</form>
</table>
</div>
<div id="content2" class="hidden">
<h2><?php _e('Team List') ?></h2>
<table class="form-table">
<form onsubmit="HubSpotInsertTeamShortcode(<?php echo $hs_settings["hs_portal"]; ?>);return false" action="#" name="popup_form2">
<tr><th scope="row">Select which team members to include on this team page.</th>
<td><ul id="team-sortable">
<?php
$team_results = $wpdb->get_results('SELECT DISTINCT ID FROM '.$wpdb->users);
foreach($team_results as $team_member){
$member_ID = $team_member->ID;
$userdata = get_userdata($member_ID);
?>
<li class="ui-state-default"><label class="selectit" for="team-member-<?php echo $member_ID; ?>"><input type="checkbox" name="team_members" id ="team-member-<?php echo $member_ID; ?>" value="<?php echo $member_ID; ?>"/> <span><?php echo get_the_author_meta('display_name', $member_ID); ?></span></label></li>
<?php
}
?>
</ul></td></tr>
<tr><td scope="row" colspan="2">
<div style="margin: 8px auto; text-align: right;padding-bottom: 10px;">
<input type="button" id="cancel" name="cancel" value="<?php _e('Cancel'); ?>" title="<?php _e('Cancel'); ?>" onclick="tinyMCEPopup.close();" />
<input type="submit" id="insert" name="insert" value="Insert" />
</div>
</td></tr>
</form>
</table>
</div>
<?php if($myhubspotwp_leads->hs_leads_enabled() && $myhubspotwp->hs_is_customer($hs_settings['hs_portal'], $hs_settings['hs_appdomain'])){?>
<div id="content3" class="hidden">
<h2><?php _e('Custom Form') ?></h2>
<table class="form-table">
<form onsubmit="HubSpotInsertFormShortcode(<?php echo $hs_settings["hs_portal"]; ?>);return false" action="#" name="popup_form3">
<tr><th scope="row">Select which custom form to include on this team page.</th>
<td>
<select class="widefat" id="lead-form" name="lead_form">
<?php
$form_options = array();
$formid = 0;
while($form_option = get_option("hs_form_settings_" . $formid)){
$form_options[$formid] = $form_option;
$formid++;
}
for ($formid = 0; $formid < count($form_options); $formid++){ ?>
<option value="<?php echo $formid; ?>"><?php echo 'Form ID: ' . $formid; ?></option>
<?php } ?>
</select>
</td></tr>
<tr><td scope="row" colspan="2">
<div style="margin: 8px auto; text-align: right;padding-bottom: 10px;">
<input type="button" id="cancel" name="cancel" value="<?php _e('Cancel'); ?>" title="<?php _e('Cancel'); ?>" onclick="tinyMCEPopup.close();" />
<input type="submit" id="insert" name="insert" value="Insert" />
</div>
</td></tr>
</form>
</table>
</div>
<?php } ?>
<?php if($myhubspotwp_action->hs_actions_enabled()){ ?>
<div id="content4" class="hidden">
<h2><?php _e('Calls to Action'); ?></h2>
<table class="form-table">
<form onsubmit="HubSpotInsertActionShortcode(<?php echo $hs_settings["hs_portal"]; ?>);return false" action="#" name="popup_form4">
<tr><th scope="row">Select which Calls to Action you want to randomly rotate through.</th></tr>
<tr><td><ul>
<?php
$args = array('post_type' => 'hs-action', 'numberposts' => -1);
$hs_actions = new WP_Query($args);
global $post;
if($hs_actions->have_posts()):
while ($hs_actions->have_posts()):
$hs_actions->the_post(); ?>
<li class="checkbox"><label class="selectit" for="hs-action-<?php _e($post->ID); ?>"><input type="checkbox" name="hs_action" id ="hs-action-<?php _e($post->ID); ?>" value="<?php _e($post->ID); ?>"/> <span><?php _e($post->post_title); ?></span></label></li>
<?php
endwhile;
endif;
wp_reset_query();
?>
</ul></td></tr>
<tr><td scope="row">
<div style="margin: 8px auto; text-align: right;padding-bottom: 10px;">
<input type="button" id="cancel" name="cancel" value="<?php _e('Cancel'); ?>" title="<?php _e('Cancel'); ?>" onclick="tinyMCEPopup.close();" />
<input type="submit" id="insert" name="insert" value="Insert" />
</div>
</td></tr>
</form>
</table>
</div>
<?php } ?>
</div>
</body>
</html>