Wp-Insert - Version 2.3

Version Description

Download this release

Release Info

Developer namith.jawahar
Plugin Icon 128x128 Wp-Insert
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

Files changed (43) hide show
  1. includes/assets/css/wp-insert.css +0 -320
  2. includes/assets/js/wp-insert.js +0 -980
  3. includes/common/abtesting.php +1 -1
  4. includes/common/adstxt.php +0 -42
  5. includes/common/control-panel.php +4 -1
  6. includes/controls/assets/css/controls.css +0 -1
  7. includes/controls/controls.php +22 -22
  8. includes/inpostads.php +0 -573
  9. includes/modules/adstxt/css/module.css +0 -0
  10. includes/{adstxt.php → modules/adstxt/functions.php} +47 -22
  11. includes/modules/adstxt/js/module.js +94 -0
  12. includes/modules/adstxt/module.php +37 -0
  13. includes/{adwidgets.php → modules/adwidgets/functions.php} +1 -100
  14. includes/modules/adwidgets/js/module.js +145 -0
  15. includes/modules/adwidgets/module.php +41 -0
  16. includes/modules/inpostads/functions.php +484 -0
  17. includes/modules/inpostads/js/module.js +235 -0
  18. includes/modules/inpostads/module.php +60 -0
  19. includes/{inthemeads.php → modules/inthemeads/functions.php} +0 -103
  20. includes/modules/inthemeads/js/module.js +145 -0
  21. includes/modules/inthemeads/module.php +41 -0
  22. includes/{legal-pages.php → modules/legalpages/functions.php} +0 -19
  23. includes/modules/legalpages/js/module.js +96 -0
  24. includes/modules/legalpages/module.php +36 -0
  25. includes/modules/modules.php +11 -0
  26. includes/modules/pagelevelads/functions.php +239 -0
  27. includes/modules/pagelevelads/js/module.js +145 -0
  28. includes/modules/pagelevelads/module.php +41 -0
  29. includes/modules/shortcodeads/functions.php +242 -0
  30. includes/modules/shortcodeads/js/module.js +145 -0
  31. includes/modules/shortcodeads/module.php +41 -0
  32. includes/{tracking-codes.php → modules/trackingcodes/functions.php} +0 -41
  33. includes/modules/trackingcodes/js/module.js +66 -0
  34. includes/modules/trackingcodes/module.php +34 -0
  35. includes/{apis/vi/api.php → modules/videointelligence/api/vi.php} +0 -0
  36. includes/modules/videointelligence/css/module.css +319 -0
  37. includes/modules/videointelligence/functions.php +296 -0
  38. includes/modules/videointelligence/js/module.js +325 -0
  39. includes/modules/videointelligence/module.php +121 -0
  40. includes/modules/videointelligence/vi-constants.php +444 -0
  41. includes/vi-integration.php +0 -1227
  42. readme.txt +23 -10
  43. wp-insert.php +5 -11
includes/assets/css/wp-insert.css CHANGED
@@ -31,26 +31,10 @@
31
  transition: height 0;
32
  }
33
 
34
- .wp-insert .plugin-card.vi-card {
35
- position: relative;
36
- }
37
-
38
  .wp-insert .plugin-card .plugin-card-top {
39
  background: #ffffff;
40
  }
41
 
42
- .wp-insert .plugin-card.vi-card .plugin-card-top {
43
- padding-bottom: 100px;
44
- }
45
-
46
-
47
- .wp-insert .vi-card .plugin-card-bottom {
48
- bottom: 0;
49
- left: 0;
50
- right: 0;
51
- position: absolute;
52
- }
53
-
54
  .wp-insert .plugin-card-bottom .wp_insert_delete_icon {
55
  color: #b20a0a;
56
  cursor: pointer;
@@ -186,310 +170,6 @@
186
  word-wrap: break-word;
187
  }
188
 
189
- .vi-card .plugin-card-top {
190
- padding: 0;
191
- }
192
-
193
- .vi-card .plugin-card-top h4 {
194
- color: #000;
195
- font-size: 14px;
196
- font-weight: 600;
197
- line-height: 18px;
198
- margin: 0;
199
- }
200
-
201
- .vi-card .plugin-card-top .plugin-card-top-header {
202
- border-bottom: 1px solid #eee;
203
- padding: 5px 10px;
204
- }
205
-
206
- .vi-card .plugin-card-top .plugin-card-top-content {
207
- padding: 0 10px 5px;
208
- font-family: arial;
209
- font-size: 13px;
210
- line-height: 18px;
211
- color: #444444;
212
- }
213
-
214
- .vi-card .plugin-card-top .plugin-card-top-content p {
215
- font-family: arial;
216
- font-size: 13px;
217
- line-height: 18px;
218
- color: #444444;
219
- }
220
-
221
-
222
- .vi-card .plugin-card-top .plugin-card-top-content p.strong {
223
- color: #000;
224
- font-size: 15px;
225
- }
226
-
227
- .vi-card .plugin-card-top .plugin-card-top-content ul {
228
- margin: 10px 0;
229
- padding: 0 0 0 15px;
230
- }
231
-
232
- .vi-card .plugin-card-top .plugin-card-top-content ul li {
233
- list-style: outside none "\2022";
234
- margin: 0;
235
- padding: 0 0 0 20px;
236
- }
237
-
238
- .vi-card .plugin-card-bottom {
239
- text-align: right;
240
- padding: 24px 20px;
241
- }
242
-
243
- .vi-card .plugin-card-bottom .button {
244
- height: 32px;
245
- line-height: 28px;
246
- padding: 0 15px;
247
- margin: 5px 0;
248
- }
249
-
250
- .vi-card .plugin-card-bottom .button#wp_insert_vi_signup {
251
- margin: 5px 0 5px 15px;
252
- }
253
-
254
- .vi-card .plugin-card-bottom span {
255
- display: inline;
256
- float: left;
257
- font-size: 13px;
258
- text-align: left;
259
- width: calc(100% - 200px);
260
- font-family: arial;
261
- line-height: 18px;
262
- }
263
-
264
- p.viError {
265
- font-weight: bold;
266
- color: #fd5740;
267
- }
268
-
269
- .vi-card #wp_insert_vi_earnings_wrapper {
270
- margin-top: 50px;
271
- }
272
-
273
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings {
274
- float: left;
275
- width: calc(100% - 348px);
276
- margin-top: 38px;
277
- min-width: 150px;
278
- margin-bottom: 15px;
279
- }
280
-
281
- @media only screen and (max-width: 1256px) {
282
- .vi-card #wp_insert_vi_earnings_wrapper {
283
- margin-top: 0;
284
- }
285
-
286
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings {
287
- margin-top: 0;
288
- }
289
- }
290
-
291
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings #wp_insert_vi_earnings_label {
292
- color: rgb(35, 40, 45);
293
- display: block;
294
- font-size: 14px;
295
- line-height: 18px;
296
- font-family: Arial;
297
- }
298
-
299
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings #wp_insert_vi_earnings_value {
300
- color: rgb(35, 40, 45);
301
- display: block;
302
- font-size: 32px;
303
- font-weight: bold;
304
- line-height: 44px;
305
- font-family: Arial;
306
- }
307
-
308
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_chart_wrapper {
309
- float: right;
310
- height: 139px;
311
- width: 348px;
312
- max-width: 100%;
313
- }
314
-
315
- .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_chart_wrapper canvas {
316
- border: 1px solid #ddd
317
- }
318
-
319
- .wp_insert_vi_login_error {
320
- color: #ff0000;
321
- font-size: 10px;
322
- margin: -10px 0 0;
323
- }
324
-
325
- #wp_insert_vi_customize_adcode {
326
- margin-left: 10px;
327
- }
328
-
329
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_right_column {
330
- width: calc(50% - 30px);
331
- float: right;
332
- margin-top: 10px;
333
- }
334
-
335
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column {
336
- width: calc(50% - 30px);
337
- float: left;
338
- margin-top: 10px;
339
- font-family: Arial;
340
- font-size: 13px;
341
- line-height: 18px;
342
- }
343
-
344
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p {
345
- position: relative;
346
- }
347
-
348
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p label {
349
- float: left;
350
- display: inline-block;
351
- width: 180px;
352
- }
353
-
354
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p br {
355
- display: none;
356
- }
357
-
358
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p input,
359
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p select,
360
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p textarea {
361
- float: right;
362
- width: calc(100% - 210px);
363
- display: inline-block;
364
- clear: none;
365
- margin-right: 20px;
366
- }
367
-
368
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper {
369
- position: absolute;
370
- display: inline-block;
371
- background: #bababa;
372
- width: 13px;
373
- height: 13px;
374
- border-radius: 7px;
375
- right: 0;
376
- top: 5px;
377
- cursor: pointer;
378
- }
379
-
380
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:after {
381
- content: "i";
382
- font-size: 10px;
383
- font-weight: 600;
384
- color: #fff;
385
- line-height: 13px;
386
- position: relative;
387
- left: 0;
388
- right: 0;
389
- margin: 0 auto 0;
390
- width: 13px;
391
- height: 13px;
392
- display: block;
393
- text-align: center;
394
- }
395
-
396
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:hover {
397
- background: #000000;
398
- }
399
-
400
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip {
401
- visibility: hidden;
402
- width: 142px;
403
- background-color: #363636;
404
- color: #fff;
405
- text-align: left;
406
- padding: 5px;
407
- border-radius: 4px;
408
- position: absolute;
409
- top: -10px;
410
- left: 20px;
411
- z-index: 1;
412
- font-size: 9px;
413
- }
414
-
415
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip br {
416
- display: block;
417
- }
418
-
419
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:hover span.tooltip {
420
- visibility: visible;
421
- }
422
-
423
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip::after {
424
- /*content: " ";
425
- position: absolute;
426
- top: 50%;
427
- right: 100%;
428
- margin-top: -5px;
429
- border-width: 5px;
430
- border-style: solid;
431
- border-color: transparent black transparent transparent;*/
432
- }
433
-
434
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column .minicolors {
435
- width: calc(100% - 190px);
436
- float: right;
437
- }
438
-
439
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column .minicolors input {
440
- width: calc(100% - 20px);
441
- height: 30px;
442
- }
443
-
444
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p small {
445
- clear: both;
446
- height: 1px;
447
- width: 100%;
448
- display: block;
449
- }
450
-
451
- .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p a.textTip {
452
- position: absolute;
453
- right: -92px;
454
- top: 5px;
455
- font-size: 11px;
456
- display: block;
457
- font-style: italic;
458
- }
459
-
460
- .wp_insert_popup_content_wrapper .wp_insert_vi_delay_notice {
461
- float: right;
462
- width: calc(100% - 190px);
463
- display: inline-block;
464
- clear: both;
465
- margin: 0 20px 0 0;
466
- color: #5f5f5f;
467
- font-size: 13px;
468
- font-style: italic;
469
- }
470
-
471
- .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper {
472
- line-height: 24px;
473
- margin: 18px 0 20px;
474
- }
475
-
476
- .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper label {
477
- width: 144px;
478
- display: block;
479
- font-size: 12px;
480
- font-family: Arial;
481
- position: absolute;
482
- color: #444444;
483
- }
484
-
485
- .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper b {
486
- margin-left: 164px;
487
- display: block;
488
- font-size: 13px;
489
- font-family: Arial;
490
- color: #444444;
491
- }
492
-
493
  @media screen and (max-width:768px) {
494
  .wp_insert_rule_block {
495
  width: auto;
31
  transition: height 0;
32
  }
33
 
 
 
 
 
34
  .wp-insert .plugin-card .plugin-card-top {
35
  background: #ffffff;
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  .wp-insert .plugin-card-bottom .wp_insert_delete_icon {
39
  color: #b20a0a;
40
  cursor: pointer;
170
  word-wrap: break-word;
171
  }
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  @media screen and (max-width:768px) {
174
  .wp_insert_rule_block {
175
  width: auto;
includes/assets/js/wp-insert.js CHANGED
@@ -34,612 +34,8 @@ jQuery(document).ready(function() {
34
  },
35
  function() { }
36
  );
37
-
38
- wp_insert_click_handler(
39
- 'wp_insert_trackingcodes_google_analytics',
40
- 'Tracking Codes : Google Analytics',
41
- '480',
42
- '480',
43
- function() {
44
- jQuery('#wp_insert_trackingcodes_analytics_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
45
- },
46
- function() {
47
- jQuery.post(
48
- jQuery('#wp_insert_admin_ajax').val(), {
49
- 'action': 'wp_insert_trackingcodes_google_analytics_form_save_action',
50
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
51
- 'wp_insert_trackingcodes_analytics_status': jQuery('#wp_insert_trackingcodes_analytics_status').prop('checked'),
52
- 'wp_insert_trackingcodes_analytics_code': jQuery('#wp_insert_trackingcodes_analytics_code').val(),
53
- }, function(response) { }
54
- );
55
- },
56
- function() { }
57
- );
58
-
59
- wp_insert_click_handler(
60
- 'wp_insert_trackingcodes_header',
61
- 'Tracking Codes : Header',
62
- jQuery("body").width() * 0.8,
63
- jQuery("body").height() * 0.8,
64
- function() {
65
- jQuery('#wp_insert_trackingcodes_header_code').css('height', (jQuery("body").height() * 0.5)+'px');
66
- jQuery('#wp_insert_trackingcodes_header_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
67
- },
68
- function() {
69
- jQuery.post(
70
- jQuery('#wp_insert_admin_ajax').val(), {
71
- 'action': 'wp_insert_trackingcodes_header_form_save_action',
72
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
73
- 'wp_insert_trackingcodes_header_status': jQuery('#wp_insert_trackingcodes_header_status').prop('checked'),
74
- 'wp_insert_trackingcodes_header_code': jQuery('#wp_insert_trackingcodes_header_code').val(),
75
- }, function(response) { }
76
- );
77
- },
78
- function() { }
79
- );
80
-
81
- wp_insert_click_handler(
82
- 'wp_insert_trackingcodes_footer',
83
- 'Tracking Codes : Footer',
84
- jQuery("body").width() * 0.8,
85
- jQuery("body").height() * 0.8,
86
- function() {
87
- jQuery('#wp_insert_trackingcodes_footer_code').css('height', (jQuery("body").height() * 0.5)+'px');
88
- jQuery('#wp_insert_trackingcodes_footer_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
89
- },
90
- function() {
91
- jQuery.post(
92
- jQuery('#wp_insert_admin_ajax').val(), {
93
- 'action': 'wp_insert_trackingcodes_footer_form_save_action',
94
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
95
- 'wp_insert_trackingcodes_footer_status': jQuery('#wp_insert_trackingcodes_footer_status').prop('checked'),
96
- 'wp_insert_trackingcodes_footer_code': jQuery('#wp_insert_trackingcodes_footer_code').val(),
97
- }, function(response) { }
98
- );
99
- },
100
- function() { }
101
- );
102
-
103
- wp_insert_click_handler(
104
- 'wp_insert_legalpages_privacy_policy',
105
- 'Legal Pages : Privacy Policy',
106
- jQuery("body").width() * 0.8,
107
- jQuery("body").height() * 0.8,
108
- function() { },
109
- function() {
110
- jQuery.post(
111
- jQuery('#wp_insert_admin_ajax').val(), {
112
- 'action': 'wp_insert_legalpages_privacy_policy_form_save_action',
113
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
114
- 'wp_insert_legalpages_privacy_policy_content': jQuery('#wp_insert_legalpages_privacy_policy_content').val(),
115
- 'wp_insert_legalpages_privacy_policy_assigned_page': jQuery('#wp_insert_legalpages_privacy_policy_assigned_page').val(),
116
- }, function(response) { }
117
- );
118
- },
119
- function() { }
120
- );
121
-
122
- wp_insert_click_handler(
123
- 'wp_insert_legalpages_terms_conditions',
124
- 'Legal Pages : Terms and Conditions',
125
- jQuery("body").width() * 0.8,
126
- jQuery("body").height() * 0.8,
127
- function() { },
128
- function() {
129
- jQuery.post(
130
- jQuery('#wp_insert_admin_ajax').val(), {
131
- 'action': 'wp_insert_legalpages_terms_conditions_form_save_action',
132
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
133
- 'wp_insert_legalpages_terms_conditions_content': jQuery('#wp_insert_legalpages_terms_conditions_content').val(),
134
- 'wp_insert_legalpages_terms_conditions_assigned_page': jQuery('#wp_insert_legalpages_terms_conditions_assigned_page').val(),
135
- }, function(response) { }
136
- );
137
- },
138
- function() { }
139
- );
140
-
141
- wp_insert_click_handler(
142
- 'wp_insert_legalpages_disclaimer',
143
- 'Legal Pages : Disclaimer',
144
- jQuery("body").width() * 0.8,
145
- jQuery("body").height() * 0.8,
146
- function() { },
147
- function() {
148
- jQuery.post(
149
- jQuery('#wp_insert_admin_ajax').val(), {
150
- 'action': 'wp_insert_legalpages_disclaimer_form_save_action',
151
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
152
- 'wp_insert_legalpages_disclaimer_content': jQuery('#wp_insert_legalpages_disclaimer_content').val(),
153
- 'wp_insert_legalpages_disclaimer_assigned_page': jQuery('#wp_insert_legalpages_disclaimer_assigned_page').val(),
154
- }, function(response) { }
155
- );
156
- },
157
- function() { }
158
- );
159
-
160
- wp_insert_click_handler(
161
- 'wp_insert_legalpages_copyright',
162
- 'Legal Pages : Copyright Notice',
163
- jQuery("body").width() * 0.8,
164
- jQuery("body").height() * 0.8,
165
- function() { },
166
- function() {
167
- jQuery.post(
168
- jQuery('#wp_insert_admin_ajax').val(), {
169
- 'action': 'wp_insert_legalpages_copyright_form_save_action',
170
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
171
- 'wp_insert_legalpages_copyright_content': jQuery('#wp_insert_legalpages_copyright_content').val(),
172
- 'wp_insert_legalpages_copyright_assigned_page': jQuery('#wp_insert_legalpages_copyright_assigned_page').val(),
173
- }, function(response) { }
174
- );
175
- },
176
- function() { }
177
- );
178
-
179
- wp_insert_click_handler(
180
- 'wp_insert_adstxt_generate',
181
- 'Create / Update ads.txt',
182
- jQuery("body").width() * 0.8,
183
- jQuery("body").height() * 0.8,
184
- function() {
185
- jQuery('#wp_insert_adstxt_content').css('height', (jQuery('body').height() * 0.5)+'px');
186
- jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
187
- jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
188
- jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
189
- var wp_insert_adstxt_content = jQuery('#wp_insert_adstxt_content').val();
190
- jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
191
- jQuery('.wp_insert_ajaxloader').show();
192
- jQuery.post(
193
- jQuery('#wp_insert_admin_ajax').val(), {
194
- 'action': 'wp_insert_adstxt_generate_form_save_action',
195
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
196
- 'wp_insert_adstxt_content': wp_insert_adstxt_content,
197
- }, function(response) {
198
- if(response == '###SUCCESS###') {
199
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
200
- } else {
201
- jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
202
- jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
203
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
204
- jQuery('.ui-dialog-content').html(response);
205
- }
206
- }
207
- );
208
- });
209
- },
210
- function() { },
211
- function() { }
212
- );
213
-
214
- wp_insert_inpostads_click_handler('above');
215
- wp_insert_inpostads_click_handler('middle');
216
- wp_insert_inpostads_click_handler('below');
217
- wp_insert_inpostads_click_handler('left');
218
- wp_insert_inpostads_click_handler('right');
219
-
220
- wp_insert_click_handler(
221
- 'wp_insert_adwidgets_new',
222
- 'Ad Widget : Add New',
223
- jQuery("body").width() * 0.8,
224
- jQuery("body").height() * 0.8,
225
- function() {
226
- jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
227
- },
228
- function() {
229
- var identifier = jQuery(".wp_insert_adwidgets_identifier").val();
230
- var adwidgetLink = jQuery("<a></a>");
231
- adwidgetLink.attr("id", "wp_insert_adwidgets_"+identifier);
232
- adwidgetLink.attr("href", "javascript:;");
233
- adwidgetLink.attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
234
- adwidgetLink.html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
235
- var deleteButton = jQuery("<span></span>");
236
- deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
237
- deleteButton.attr("onClick", "wp_insert_adwidgets_remove(\'"+identifier+"\')");
238
- jQuery("#wp_insert_adwidgets_new").parent().before(jQuery("<p></p>").append(adwidgetLink, deleteButton));
239
- wp_insert_adwidgets_update(identifier);
240
- },
241
- function() { }
242
- );
243
-
244
- wp_insert_click_handler(
245
- 'wp_insert_inthemeads_new',
246
- 'In-Theme Ad : Add New',
247
- jQuery("body").width() * 0.8,
248
- jQuery("body").height() * 0.8,
249
- function() {
250
- jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
251
- },
252
- function() {
253
- var identifier = jQuery(".wp_insert_inthemeads_identifier").val();
254
- var inthemeadLink = jQuery("<a></a>");
255
- inthemeadLink.attr("id", "wp_insert_inthemeads_"+identifier);
256
- inthemeadLink.attr("href", "javascript:;");
257
- inthemeadLink.attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
258
- inthemeadLink.html("Ad Widget : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
259
- var deleteButton = jQuery("<span></span>");
260
- deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
261
- deleteButton.attr("onClick", "wp_insert_inthemeads_remove(\'"+identifier+"\')");
262
- jQuery("#wp_insert_inthemeads_new").parent().before(jQuery("<p></p>").append(inthemeadLink, deleteButton));
263
- wp_insert_inthemeads_update(identifier);
264
- },
265
- function() { }
266
- );
267
-
268
- wp_insert_vi_signup_handler();
269
- wp_insert_vi_login_handler();
270
- wp_insert_vi_logout_handler();
271
- wp_insert_vi_customize_adcode();
272
- wp_insert_vi_chart_draw()
273
  });
274
 
275
- function primary_ad_code_type_change() {
276
- var location = '';
277
- if(jQuery('#wp_insert_inpostads_above_primary_ad_code_type').length != 0) {
278
- location = 'above';
279
- } else if(jQuery('#wp_insert_inpostads_middle_primary_ad_code_type').length != 0) {
280
- location = 'middle';
281
- } else {
282
- location = '';
283
- }
284
- if(location != '') {
285
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').parent().hide();
286
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change(function() {
287
- jQuery('.isSelectedIndicator').removeClass('active');
288
- jQuery('#primary_ad_code_type_'+jQuery(this).val()).addClass('active');
289
- });
290
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change();
291
-
292
- jQuery('#primary_ad_code_type_generic').click(function() {
293
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').val('generic');
294
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change();
295
- });
296
- jQuery('#primary_ad_code_type_generic').parent().click(function() {
297
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').val('generic');
298
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change();
299
- });
300
-
301
- jQuery('#primary_ad_code_type_vicode').click(function() {
302
- if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
303
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').val('vicode');
304
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change();
305
- }
306
- });
307
- jQuery('#primary_ad_code_type_vicode').parent().click(function() {
308
- if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
309
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').val('vicode');
310
- jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').change();
311
- }
312
- });
313
- }
314
- }
315
-
316
- function wp_insert_inpostads_vi_customize_adcode() {
317
- jQuery('#wp_insert_inpostads_vi_customize_adcode').click(function() {
318
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
319
- jQuery('#wp_insert_vi_customize_adcode').click();
320
- });
321
- }
322
-
323
- function wp_insert_inpostads_click_handler(location) {
324
- wp_insert_click_handler(
325
- 'wp_insert_inpostads_'+location,
326
- 'Inpost Ads : Ad '+location.charAt(0).toUpperCase()+location.slice(1)+' Post Content',
327
- jQuery("body").width() * 0.8,
328
- jQuery("body").height() * 0.9,
329
- function() {
330
- jQuery('#wp_insert_inpostads_'+location+'_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
331
- },
332
- function() {
333
- args = {};
334
- args['action'] = 'wp_insert_inpostads_'+location+'_form_save_action';
335
- args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
336
- args['wp_insert_inpostads_'+location+'_status'] = jQuery('#wp_insert_inpostads_'+location+'_status').prop('checked');
337
-
338
- if(location == 'above' || location == 'middle') {
339
- args['wp_insert_inpostads_'+location+'_primary_ad_code_type'] = jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code_type').val();
340
- }
341
- args['wp_insert_inpostads_'+location+'_primary_ad_code'] = jQuery('#wp_insert_inpostads_'+location+'_primary_ad_code').val();
342
- args['wp_insert_inpostads_'+location+'_secondary_ad_code'] = jQuery('#wp_insert_inpostads_'+location+'_secondary_ad_code').val();
343
- args['wp_insert_inpostads_'+location+'_tertiary_ad_code'] = jQuery('#wp_insert_inpostads_'+location+'_tertiary_ad_code').val();
344
-
345
- args['wp_insert_inpostads_'+location+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_loggedin').prop('checked');
346
- args['wp_insert_inpostads_'+location+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_mobile_devices').prop('checked');
347
- args['wp_insert_inpostads_'+location+'_rules_exclude_404'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_404').prop('checked');
348
- args['wp_insert_inpostads_'+location+'_rules_exclude_home'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_home').prop('checked');
349
- args['wp_insert_inpostads_'+location+'_rules_home_instances'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_home_instances :selected'), function(e) { return jQuery(e).val(); });
350
- args['wp_insert_inpostads_'+location+'_rules_exclude_archives'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_archives').prop('checked');
351
- args['wp_insert_inpostads_'+location+'_rules_archives_instances'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_archives_instances :selected'), function(e) { return jQuery(e).val(); });
352
- args['wp_insert_inpostads_'+location+'_rules_exclude_search'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_search').prop('checked');
353
- args['wp_insert_inpostads_'+location+'_rules_search_instances'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_search_instances :selected'), function(e) { return jQuery(e).val(); });
354
- args['wp_insert_inpostads_'+location+'_rules_exclude_page'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_page').prop('checked');
355
- args['wp_insert_inpostads_'+location+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
356
- args['wp_insert_inpostads_'+location+'_rules_exclude_post'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_post').prop('checked');
357
- args['wp_insert_inpostads_'+location+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
358
- args['wp_insert_inpostads_'+location+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
359
- args['wp_insert_inpostads_'+location+'_rules_exclude_categories'] = jQuery('#wp_insert_inpostads_'+location+'_rules_exclude_categories').prop('checked');
360
- args['wp_insert_inpostads_'+location+'_rules_categories_instances'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_categories_instances :selected'), function(e) { return jQuery(e).val(); });
361
- args['wp_insert_inpostads_'+location+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
362
-
363
- args['wp_insert_inpostads_'+location+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
364
- args['wp_insert_inpostads_'+location+'_geo_group1_adcode'] = jQuery('#wp_insert_inpostads_'+location+'_geo_group1_adcode').val();
365
- args['wp_insert_inpostads_'+location+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+location+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
366
- args['wp_insert_inpostads_'+location+'_geo_group2_adcode'] = jQuery('#wp_insert_inpostads_'+location+'_geo_group2_adcode').val();
367
-
368
- args['wp_insert_inpostads_'+location+'_styles'] = jQuery('#wp_insert_inpostads_'+location+'_styles').val();
369
-
370
- args['wp_insert_inpostads_'+location+'_notes'] = jQuery('#wp_insert_inpostads_'+location+'_notes').val();
371
-
372
- if(location == 'middle') {
373
- args['wp_insert_inpostads_'+location+'_minimum_character_count'] = jQuery('#wp_insert_inpostads_'+location+'_minimum_character_count').val();
374
- args['wp_insert_inpostads_'+location+'_paragraph_buffer_count'] = jQuery('#wp_insert_inpostads_'+location+'_paragraph_buffer_count').val();
375
- }
376
- jQuery.post(
377
- jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
378
- );
379
- },
380
- function() { }
381
- );
382
- }
383
-
384
- function wp_insert_adwidgets_click_handler(identifier, title) {
385
- jQuery('<div id="wp_insert_adwidgets_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
386
- 'modal': true,
387
- 'resizable': false,
388
- 'width': jQuery("body").width() * 0.8,
389
- 'maxWidth': jQuery("body").width() * 0.8,
390
- 'maxHeight': jQuery("body").height() * 0.9,
391
- 'title': 'Ad Widget : '+title,
392
- position: { my: 'center', at: 'center', of: window },
393
- open: function (event, ui) {
394
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
395
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
396
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
397
- jQuery.post(
398
- jQuery('#wp_insert_admin_ajax').val(), {
399
- 'action': 'wp_insert_adwidgets_existing_form_get_content',
400
- 'wp_insert_adwidgets_identifier': identifier,
401
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
402
- }, function(response) {
403
- jQuery('.wp_insert_ajaxloader').hide();
404
- jQuery('.ui-dialog-content').html(response);
405
- jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
406
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
407
- jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
408
- jQuery('.ui-dialog').css({'position': 'fixed'});
409
- jQuery('#wp_insert_adwidgets_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
410
- }
411
- );
412
- },
413
- buttons: {
414
- 'Update': function() {
415
- jQuery("#wp_insert_adwidgets_"+identifier).html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
416
- jQuery("#wp_insert_adwidgets_"+identifier).attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
417
- wp_insert_adwidgets_update(identifier);
418
- jQuery(this).dialog('close');
419
- },
420
- Cancel: function() {
421
- jQuery(this).dialog('close');
422
- }
423
- },
424
- close: function() {
425
- jQuery(this).dialog('destroy');
426
- }
427
- });
428
- }
429
-
430
- function wp_insert_adwidgets_update(identifier) {
431
- args = {};
432
- args['action'] = 'wp_insert_adwidgets_existing_form_save_action';
433
- args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
434
- args['wp_insert_adwidgets_identifier'] = identifier;
435
- args['wp_insert_adwidgets_'+identifier+'_status'] = jQuery('#wp_insert_adwidgets_'+identifier+'_status').prop('checked');
436
-
437
- args['wp_insert_adwidgets_'+identifier+'_title'] = jQuery('#wp_insert_adwidgets_'+identifier+'_title').val();
438
-
439
- args['wp_insert_adwidgets_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_primary_ad_code').val();
440
- args['wp_insert_adwidgets_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_secondary_ad_code').val();
441
- args['wp_insert_adwidgets_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_tertiary_ad_code').val();
442
-
443
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin').prop('checked');
444
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
445
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_404').prop('checked');
446
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_home').prop('checked');
447
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_archives').prop('checked');
448
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_search').prop('checked');
449
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_page').prop('checked');
450
- args['wp_insert_adwidgets_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
451
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_post').prop('checked');
452
- args['wp_insert_adwidgets_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
453
- args['wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
454
- args['wp_insert_adwidgets_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_categories').prop('checked');
455
- args['wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
456
-
457
- args['wp_insert_adwidgets_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
458
- args['wp_insert_adwidgets_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_adcode').val();
459
- args['wp_insert_adwidgets_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
460
- args['wp_insert_adwidgets_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_adcode').val();
461
-
462
- args['wp_insert_adwidgets_'+identifier+'_styles'] = jQuery('#wp_insert_adwidgets_'+identifier+'_styles').val();
463
-
464
- args['wp_insert_adwidgets_'+identifier+'_notes'] = jQuery('#wp_insert_adwidgets_'+identifier+'_notes').val();
465
-
466
- jQuery.post(
467
- jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
468
- );
469
- }
470
-
471
- function wp_insert_adwidgets_remove(identifier) {
472
- jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
473
- 'modal': true,
474
- 'resizable': false,
475
- 'title': 'Deletion Confirmation',
476
- position: { my: 'center', at: 'center', of: window },
477
- open: function (event, ui) {
478
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
479
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
480
- },
481
- buttons : {
482
- 'Confirm': function() {
483
- jQuery("#wp_insert_adwidgets_"+identifier).parent().remove();
484
- jQuery.post(
485
- jQuery('#wp_insert_admin_ajax').val(), {
486
- 'action': 'wp_insert_adwidgets_remove',
487
- 'wp_insert_adwidgets_identifier': identifier,
488
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
489
- }, function(response) {
490
- }
491
- );
492
- jQuery(this).dialog("close");
493
- },
494
- 'Cancel': function() {
495
- jQuery(this).dialog("close");
496
- }
497
- },
498
- close: function() {
499
- jQuery(this).dialog('destroy');
500
- }
501
- });
502
- }
503
-
504
- function wp_insert_inthemeads_click_handler(identifier, title) {
505
- jQuery('<div id="wp_insert_inthemeads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
506
- 'modal': true,
507
- 'resizable': false,
508
- 'width': jQuery("body").width() * 0.8,
509
- 'maxWidth': jQuery("body").width() * 0.8,
510
- 'maxHeight': jQuery("body").height() * 0.9,
511
- 'title': 'In-Theme Ad : '+title,
512
- position: { my: 'center', at: 'center', of: window },
513
- open: function (event, ui) {
514
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
515
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
516
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
517
- jQuery.post(
518
- jQuery('#wp_insert_admin_ajax').val(), {
519
- 'action': 'wp_insert_inthemeads_existing_form_get_content',
520
- 'wp_insert_inthemeads_identifier': identifier,
521
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
522
- }, function(response) {
523
- jQuery('.wp_insert_ajaxloader').hide();
524
- jQuery('.ui-dialog-content').html(response);
525
- jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
526
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
527
- jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
528
- jQuery('.ui-dialog').css({'position': 'fixed'});
529
- jQuery('#wp_insert_inthemeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
530
- }
531
- );
532
- },
533
- buttons: {
534
- 'Update': function() {
535
- jQuery("#wp_insert_inthemeads_"+identifier).html("In-Theme Ad : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
536
- jQuery("#wp_insert_inthemeads_"+identifier).attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
537
- wp_insert_inthemeads_update(identifier);
538
- jQuery(this).dialog('close');
539
- },
540
- Cancel: function() {
541
- jQuery(this).dialog('close');
542
- }
543
- },
544
- close: function() {
545
- jQuery(this).dialog('destroy');
546
- }
547
- });
548
- }
549
-
550
- function wp_insert_inthemeads_update(identifier) {
551
- args = {};
552
- args['action'] = 'wp_insert_inthemeads_existing_form_save_action';
553
- args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
554
- args['wp_insert_inthemeads_identifier'] = identifier;
555
- args['wp_insert_inthemeads_'+identifier+'_status'] = jQuery('#wp_insert_inthemeads_'+identifier+'_status').prop('checked');
556
-
557
- args['wp_insert_inthemeads_'+identifier+'_title'] = jQuery('#wp_insert_inthemeads_'+identifier+'_title').val();
558
-
559
- args['wp_insert_inthemeads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_primary_ad_code').val();
560
- args['wp_insert_inthemeads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_secondary_ad_code').val();
561
- args['wp_insert_inthemeads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_tertiary_ad_code').val();
562
-
563
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
564
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
565
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_404').prop('checked');
566
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_home').prop('checked');
567
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_archives').prop('checked');
568
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_search').prop('checked');
569
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_page').prop('checked');
570
- args['wp_insert_inthemeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
571
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_post').prop('checked');
572
- args['wp_insert_inthemeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
573
- args['wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
574
- args['wp_insert_inthemeads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_categories').prop('checked');
575
- args['wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
576
-
577
- args['wp_insert_inthemeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
578
- args['wp_insert_inthemeads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_adcode').val();
579
- args['wp_insert_inthemeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
580
- args['wp_insert_inthemeads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_adcode').val();
581
-
582
- args['wp_insert_inthemeads_'+identifier+'_styles'] = jQuery('#wp_insert_inthemeads_'+identifier+'_styles').val();
583
-
584
- args['wp_insert_inthemeads_'+identifier+'_notes'] = jQuery('#wp_insert_inthemeads_'+identifier+'_notes').val();
585
-
586
- jQuery.post(
587
- jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
588
- );
589
- }
590
-
591
- function wp_insert_inthemeads_remove(identifier) {
592
- jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
593
- 'modal': true,
594
- 'resizable': false,
595
- 'title': 'Deletion Confirmation',
596
- position: { my: 'center', at: 'center', of: window },
597
- open: function (event, ui) {
598
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
599
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
600
- },
601
- buttons : {
602
- 'Confirm': function() {
603
- jQuery("#wp_insert_inthemeads_"+identifier).parent().remove();
604
- jQuery.post(
605
- jQuery('#wp_insert_admin_ajax').val(), {
606
- 'action': 'wp_insert_inthemeads_remove',
607
- 'wp_insert_inthemeads_identifier': identifier,
608
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
609
- }, function(response) {
610
- }
611
- );
612
- jQuery(this).dialog("close");
613
- },
614
- 'Cancel': function() {
615
- jQuery(this).dialog("close");
616
- }
617
- },
618
- close: function() {
619
- jQuery(this).dialog('destroy');
620
- }
621
- });
622
- }
623
-
624
- function wp_insert_legalpages_generate_page(target, title) {
625
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
626
- jQuery('#'+target+'_generate_page').hide();
627
- jQuery('#'+target+'_accordion .wp_insert_ajaxloader_flat').show();
628
- jQuery.post(
629
- jQuery('#wp_insert_admin_ajax').val(), {
630
- 'action': target+'_form_generate_page_action',
631
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
632
- }, function(response) {
633
- if(response != '0') {
634
- jQuery('#'+target+'_assigned_page').append(jQuery('<option>', {value: response, text: title})).val(response);
635
- }
636
- jQuery('#'+target+'_generate_page').show();
637
- jQuery('#'+target+'_accordion .wp_insert_ajaxloader_flat').hide();
638
- jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
639
- }
640
- );
641
- }
642
-
643
  function wp_insert_click_handler(target, title, width, height, openAction, UpdateAction, closeAction) {
644
  jQuery('#'+target).click(function() {
645
  jQuery('<div id="'+target+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
@@ -697,380 +93,4 @@ function wp_insert_click_handler(target, title, width, height, openAction, Updat
697
  }
698
  })
699
  });
700
- }
701
-
702
- function wp_insert_adstxt_add_entry() {
703
- var wp_insert_adstxt_new_entry_domain = jQuery("#wp_insert_adstxt_new_entry_domain").val();
704
- var wp_insert_adstxt_new_entry_pid = jQuery("#wp_insert_adstxt_new_entry_pid").val();
705
- var wp_insert_adstxt_new_entry_type = jQuery("#wp_insert_adstxt_new_entry_type").val();
706
- var wp_insert_adstxt_new_entry_certauthority = jQuery("#wp_insert_adstxt_new_entry_certauthority").val();
707
- var wp_insert_adstxt_content = jQuery("#wp_insert_adstxt_content").val();
708
- var defaultBorderColor = jQuery("#wp_insert_adstxt_new_entry_domain").css("border-color");
709
- var defaultLabelColor = jQuery("#wp_insert_adstxt_new_entry_domain").parent().find("small").css("color");
710
-
711
- var isValidated = true;
712
- jQuery("#wp_insert_adstxt_new_entry_domain").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
713
- jQuery("#wp_insert_adstxt_new_entry_pid").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
714
-
715
-
716
- if(wp_insert_adstxt_new_entry_domain == '') {
717
- jQuery("#wp_insert_adstxt_new_entry_domain").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
718
- isValidated = false;
719
- }
720
- if(wp_insert_adstxt_new_entry_pid == '') {
721
- jQuery("#wp_insert_adstxt_new_entry_pid").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
722
- isValidated = false;
723
- }
724
-
725
- if(isValidated) {
726
- if((wp_insert_adstxt_content != '') && (jQuery.inArray((wp_insert_adstxt_content[wp_insert_adstxt_content.length -1]), ["\r", "\n"]) == -1)) {
727
- wp_insert_adstxt_content += '\r\n';
728
- }
729
- wp_insert_adstxt_content += wp_insert_adstxt_new_entry_domain + ', ' + wp_insert_adstxt_new_entry_pid + ', ' + wp_insert_adstxt_new_entry_type;
730
- if(wp_insert_adstxt_new_entry_certauthority != '') {
731
- wp_insert_adstxt_content += ', ' + wp_insert_adstxt_new_entry_certauthority;
732
- }
733
- jQuery("#wp_insert_adstxt_content").val(wp_insert_adstxt_content);
734
-
735
- jQuery("#wp_insert_adstxt_new_entry_domain").val('');
736
- jQuery("#wp_insert_adstxt_new_entry_pid").val('');
737
- jQuery("#wp_insert_adstxt_new_entry_type").val('DIRECT');
738
- jQuery("#wp_insert_adstxt_new_entry_certauthority").val('');
739
-
740
- jQuery("#wp_insert_adstxt_accordion").accordion({active: 0});
741
- jQuery("#wp_insert_adstxt_content").focus();
742
- }
743
- }
744
-
745
- function wp_insert_adstxt_content_download() {
746
- var blob = new Blob([jQuery("#wp_insert_adstxt_content").val()], {type: 'text/csv'});
747
- if(window.navigator.msSaveOrOpenBlob) {
748
- window.navigator.msSaveBlob(blob, 'ads.txt');
749
- }
750
- else{
751
- var elem = window.document.createElement('a');
752
- elem.href = window.URL.createObjectURL(blob);
753
- elem.download = 'ads.txt';
754
- document.body.appendChild(elem);
755
- elem.click();
756
- document.body.removeChild(elem);
757
- }
758
- }
759
-
760
- function wp_insert_vi_signup_handler() {
761
- wp_insert_click_handler(
762
- 'wp_insert_vi_signup',
763
- 'video intelligence: Signup',
764
- '870',
765
- '554',
766
- function() { },
767
- function() { },
768
- function() { }
769
- );
770
- }
771
-
772
- function wp_insert_vi_login_handler() {
773
- wp_insert_click_handler(
774
- 'wp_insert_vi_login',
775
- 'video intelligence: Login',
776
- '540',
777
- '540',
778
- function() {
779
- jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
780
- if((jQuery('#wp_insert_vi_login_username').val() != '') && (jQuery('#wp_insert_vi_login_password').val() != '')) {
781
- jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
782
- jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
783
- jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
784
- var wp_insert_vi_login_username = jQuery('#wp_insert_vi_login_username').val();
785
- var wp_insert_vi_login_password = jQuery('#wp_insert_vi_login_password').val();
786
- jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
787
- jQuery('.wp_insert_ajaxloader').show();
788
- jQuery.post(
789
- jQuery('#wp_insert_admin_ajax').val(), {
790
- 'action': 'wp_insert_vi_login_form_save_action',
791
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
792
- 'wp_insert_vi_login_username': wp_insert_vi_login_username,
793
- 'wp_insert_vi_login_password': wp_insert_vi_login_password,
794
- }, function(response) {
795
- if(response.indexOf('###SUCCESS###') !== -1) {
796
- jQuery.post(
797
- jQuery('#wp_insert_admin_ajax').val(), {
798
- 'action': 'wp_insert_vi_update_adstxt',
799
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
800
- }, function(response) {
801
- if(response.indexOf('###SUCCESS###') !== -1) {
802
- jQuery('.wrap #wp_insert_title').after(response.replace('###SUCCESS###', ''));
803
- } else if(response.indexOf('###FAIL###') !== -1) {
804
- jQuery('.wrap #wp_insert_title').after(response.replace('###FAIL###', ''));
805
- } else {
806
- }
807
- }
808
- );
809
- jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
810
- jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
811
- wp_insert_vi_logout_handler();
812
- wp_insert_vi_customize_adcode();
813
- wp_insert_vi_chart_draw();
814
- jQuery(window).resize();
815
- jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
816
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
817
- } else {
818
- jQuery('.ui-dialog-buttonset').find('button').first().button('enable');
819
- jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
820
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
821
- jQuery('.ui-dialog-content').html(response);
822
- }
823
- }
824
- );
825
- } else {
826
- jQuery('#wp_insert_vi_login_username').css('border-color', '#dddddd');
827
- jQuery('#wp_insert_vi_login_password').css('border-color', '#dddddd');
828
- if(jQuery('#wp_insert_vi_login_username').val() == '') {
829
- jQuery('#wp_insert_vi_login_username').css('border-color', '#ff0000');
830
- }
831
- if(jQuery('#wp_insert_vi_login_password').val() == '') {
832
- jQuery('#wp_insert_vi_login_password').css('border-color', '#ff0000');
833
- }
834
- }
835
- });
836
- },
837
- function() { },
838
- function() { }
839
- );
840
- }
841
-
842
- function wp_insert_vi_customize_adcode() {
843
- wp_insert_click_handler(
844
- 'wp_insert_vi_customize_adcode',
845
- 'video intelligence: Customize vi Code',
846
- jQuery("body").width() * 0.8,
847
- jQuery("body").height() * 0.8,
848
- function() {
849
- jQuery('#wp_insert_vi_code_settings_keywords').attr('maxlength', '200');
850
- jQuery('#wp_insert_vi_code_settings_optional_1').attr('maxlength', '200');
851
- jQuery('#wp_insert_vi_code_settings_optional_2').attr('maxlength', '200');
852
- jQuery('#wp_insert_vi_code_settings_optional_3').attr('maxlength', '200');
853
- jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
854
- var keywordsRegex = /[ ,a-zA-Z0-9-’'‘\u00C6\u00D0\u018E\u018F\u0190\u0194\u0132\u014A\u0152\u1E9E\u00DE\u01F7\u021C\u00E6\u00F0\u01DD\u0259\u025B\u0263\u0133\u014B\u0153\u0138\u017F\u00DF\u00FE\u01BF\u021D\u0104\u0181\u00C7\u0110\u018A\u0118\u0126\u012E\u0198\u0141\u00D8\u01A0\u015E\u0218\u0162\u021A\u0166\u0172\u01AFY\u0328\u01B3\u0105\u0253\u00E7\u0111\u0257\u0119\u0127\u012F\u0199\u0142\u00F8\u01A1\u015F\u0219\u0163\u021B\u0167\u0173\u01B0y\u0328\u01B4\u00C1\u00C0\u00C2\u00C4\u01CD\u0102\u0100\u00C3\u00C5\u01FA\u0104\u00C6\u01FC\u01E2\u0181\u0106\u010A\u0108\u010C\u00C7\u010E\u1E0C\u0110\u018A\u00D0\u00C9\u00C8\u0116\u00CA\u00CB\u011A\u0114\u0112\u0118\u1EB8\u018E\u018F\u0190\u0120\u011C\u01E6\u011E\u0122\u0194\u00E1\u00E0\u00E2\u00E4\u01CE\u0103\u0101\u00E3\u00E5\u01FB\u0105\u00E6\u01FD\u01E3\u0253\u0107\u010B\u0109\u010D\u00E7\u010F\u1E0D\u0111\u0257\u00F0\u00E9\u00E8\u0117\u00EA\u00EB\u011B\u0115\u0113\u0119\u1EB9\u01DD\u0259\u025B\u0121\u011D\u01E7\u011F\u0123\u0263\u0124\u1E24\u0126I\u00CD\u00CC\u0130\u00CE\u00CF\u01CF\u012C\u012A\u0128\u012E\u1ECA\u0132\u0134\u0136\u0198\u0139\u013B\u0141\u013D\u013F\u02BCN\u0143N\u0308\u0147\u00D1\u0145\u014A\u00D3\u00D2\u00D4\u00D6\u01D1\u014E\u014C\u00D5\u0150\u1ECC\u00D8\u01FE\u01A0\u0152\u0125\u1E25\u0127\u0131\u00ED\u00ECi\u00EE\u00EF\u01D0\u012D\u012B\u0129\u012F\u1ECB\u0133\u0135\u0137\u0199\u0138\u013A\u013C\u0142\u013E\u0140\u0149\u0144n\u0308\u0148\u00F1\u0146\u014B\u00F3\u00F2\u00F4\u00F6\u01D2\u014F\u014D\u00F5\u0151\u1ECD\u00F8\u01FF\u01A1\u0153\u0154\u0158\u0156\u015A\u015C\u0160\u015E\u0218\u1E62\u1E9E\u0164\u0162\u1E6C\u0166\u00DE\u00DA\u00D9\u00DB\u00DC\u01D3\u016C\u016A\u0168\u0170\u016E\u0172\u1EE4\u01AF\u1E82\u1E80\u0174\u1E84\u01F7\u00DD\u1EF2\u0176\u0178\u0232\u1EF8\u01B3\u0179\u017B\u017D\u1E92\u0155\u0159\u0157\u017F\u015B\u015D\u0161\u015F\u0219\u1E63\u00DF\u0165\u0163\u1E6D\u0167\u00FE\u00FA\u00F9\u00FB\u00FC\u01D4\u016D\u016B\u0169\u0171\u016F\u0173\u1EE5\u01B0\u1E83\u1E81\u0175\u1E85\u01BF\u00FD\u1EF3\u0177\u00FF\u0233\u1EF9\u01B4\u017A\u017C\u017E\u1E93]/g;
855
- if(
856
- (jQuery('#wp_insert_vi_code_settings_ad_unit_type').val() != 'select') &&
857
- (jQuery('#wp_insert_vi_code_settings_iab_category_child').val() != 'select') &&
858
- (jQuery('#wp_insert_vi_code_settings_language').val() != 'select') &&
859
- ((jQuery('#wp_insert_vi_code_settings_keywords').val() == '') || ((jQuery(jQuery('#wp_insert_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#wp_insert_vi_code_settings_keywords').val().match(keywordsRegex)).get().length == 0) && (jQuery('#wp_insert_vi_code_settings_keywords').val().length < 200)))
860
- ) {
861
- jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
862
- jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
863
- jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
864
- var wp_insert_vi_code_settings_ad_unit_type = jQuery('#wp_insert_vi_code_settings_ad_unit_type').val();
865
- var wp_insert_vi_code_settings_keywords = jQuery('#wp_insert_vi_code_settings_keywords').val();
866
- var wp_insert_vi_code_settings_iab_category_parent = jQuery('#wp_insert_vi_code_settings_iab_category_parent').val();
867
- var wp_insert_vi_code_settings_iab_category_child = jQuery('#wp_insert_vi_code_settings_iab_category_child').val();
868
- var wp_insert_vi_code_settings_language = jQuery('#wp_insert_vi_code_settings_language').val();
869
- var wp_insert_vi_code_settings_native_bg_color = jQuery('#wp_insert_vi_code_settings_native_bg_color').val();
870
- var wp_insert_vi_code_settings_native_text_color = jQuery('#wp_insert_vi_code_settings_native_text_color').val();
871
- var wp_insert_vi_code_settings_font_family = jQuery('#wp_insert_vi_code_settings_font_family').val();
872
- var wp_insert_vi_code_settings_font_size = jQuery('#wp_insert_vi_code_settings_font_size').val();
873
- var wp_insert_vi_code_settings_optional_1 = jQuery('#wp_insert_vi_code_settings_optional_1').val();
874
- var wp_insert_vi_code_settings_optional_2 = jQuery('#wp_insert_vi_code_settings_optional_2').val();
875
- var wp_insert_vi_code_settings_optional_3 = jQuery('#wp_insert_vi_code_settings_optional_3').val();
876
- jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
877
- jQuery('.wp_insert_ajaxloader').show();
878
- jQuery.post(
879
- jQuery('#wp_insert_admin_ajax').val(), {
880
- 'action': 'wp_insert_vi_customize_adcode_form_save_action',
881
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
882
- 'wp_insert_vi_code_settings_ad_unit_type': wp_insert_vi_code_settings_ad_unit_type,
883
- 'wp_insert_vi_code_settings_keywords': wp_insert_vi_code_settings_keywords,
884
- 'wp_insert_vi_code_settings_iab_category_parent': wp_insert_vi_code_settings_iab_category_parent,
885
- 'wp_insert_vi_code_settings_iab_category_child': wp_insert_vi_code_settings_iab_category_child,
886
- 'wp_insert_vi_code_settings_language': wp_insert_vi_code_settings_language,
887
- 'wp_insert_vi_code_settings_native_bg_color': wp_insert_vi_code_settings_native_bg_color,
888
- 'wp_insert_vi_code_settings_native_text_color': wp_insert_vi_code_settings_native_text_color,
889
- 'wp_insert_vi_code_settings_font_family': wp_insert_vi_code_settings_font_family,
890
- 'wp_insert_vi_code_settings_font_size': wp_insert_vi_code_settings_font_size,
891
- 'wp_insert_vi_code_settings_optional_1': wp_insert_vi_code_settings_optional_1,
892
- 'wp_insert_vi_code_settings_optional_2': wp_insert_vi_code_settings_optional_2,
893
- 'wp_insert_vi_code_settings_optional_3': wp_insert_vi_code_settings_optional_3,
894
- }, function(response) {
895
- if(response.indexOf('###SUCCESS###') !== -1) {
896
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
897
- } else {
898
- jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
899
- jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
900
- jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
901
- jQuery('.ui-dialog-content').html(response.replace('###FAIL###', ''));
902
- }
903
- }
904
- );
905
- } else {
906
- jQuery('#wp_insert_vi_customize_adcode_keywords_required_error').hide();
907
- jQuery('#wp_insert_vi_customize_adcode_keywords_error').hide();
908
- jQuery('#wp_insert_vi_customize_adcode_required_error').hide();
909
- jQuery('#wp_insert_vi_code_settings_ad_unit_type').css('border-color', '#dddddd');
910
- jQuery('#wp_insert_vi_code_settings_iab_category_parent').css('border-color', '#dddddd');
911
- jQuery('#wp_insert_vi_code_settings_iab_category_child').css('border-color', '#dddddd');
912
- jQuery('#wp_insert_vi_code_settings_language').css('border-color', '#dddddd');
913
- jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#dddddd');
914
- var wp_insert_vi_customize_adcode_keywords_error = false;
915
- var wp_insert_vi_customize_adcode_required_error = false;
916
- if(jQuery('#wp_insert_vi_code_settings_ad_unit_type').val() == 'select') {
917
- jQuery('#wp_insert_vi_code_settings_ad_unit_type').css('border-color', '#ff0000');
918
- wp_insert_vi_customize_adcode_required_error = true;
919
- }
920
- if(jQuery('#wp_insert_vi_code_settings_iab_category_parent').val() == 'select') {
921
- jQuery('#wp_insert_vi_code_settings_iab_category_parent').css('border-color', '#ff0000');
922
- wp_insert_vi_customize_adcode_required_error = true;
923
- }
924
- if(jQuery('#wp_insert_vi_code_settings_iab_category_child').val() == 'select') {
925
- jQuery('#wp_insert_vi_code_settings_iab_category_child').css('border-color', '#ff0000');
926
- wp_insert_vi_customize_adcode_required_error = true;
927
- }
928
- if(jQuery('#wp_insert_vi_code_settings_language').val() == 'select') {
929
- jQuery('#wp_insert_vi_code_settings_language').css('border-color', '#ff0000');
930
- wp_insert_vi_customize_adcode_required_error = true;
931
- }
932
- if(jQuery('#wp_insert_vi_code_settings_keywords').val() != '') {
933
- if(jQuery('#wp_insert_vi_code_settings_keywords').val().length > 200) {
934
- jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#ff0000');
935
- wp_insert_vi_customize_adcode_keywords_error = true;
936
- }
937
- if(jQuery(jQuery('#wp_insert_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#wp_insert_vi_code_settings_keywords').val().match(keywordsRegex)).get().length != 0) {
938
- jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#ff0000');
939
- wp_insert_vi_customize_adcode_keywords_error = true;
940
- }
941
- }
942
- if(wp_insert_vi_customize_adcode_keywords_error && wp_insert_vi_customize_adcode_required_error) {
943
- jQuery('#wp_insert_vi_customize_adcode_keywords_required_error').show();
944
- } else if(wp_insert_vi_customize_adcode_keywords_error) {
945
- jQuery('#wp_insert_vi_customize_adcode_keywords_error').show();
946
- } else if(wp_insert_vi_customize_adcode_required_error) {
947
- jQuery('#wp_insert_vi_customize_adcode_required_error').show();
948
- } else {}
949
- }
950
- });
951
- },
952
- function() { },
953
- function() { }
954
- );
955
- }
956
-
957
- function wp_insert_vi_code_iab_category_parent_change() {
958
- jQuery('#wp_insert_vi_code_settings_iab_category_parent').change(function() {
959
- var wp_insert_vi_code_iab_category = jQuery(this).val();
960
- jQuery('#wp_insert_vi_code_settings_iab_category_child option').prop('disabled', true).hide();
961
- jQuery('#wp_insert_vi_code_settings_iab_category_child option').each(function() {
962
- if((jQuery(this).attr('data-parent') == wp_insert_vi_code_iab_category) || (jQuery(this).val() == 'select')) {
963
- jQuery(this).prop('disabled', false).show();
964
- }
965
- });
966
- if(jQuery('#wp_insert_vi_code_settings_iab_category_child option:selected').prop('disabled') != false) {
967
- jQuery('#wp_insert_vi_code_settings_iab_category_child').val('select');
968
- }
969
- });
970
- jQuery('#wp_insert_vi_code_settings_iab_category_parent').change();
971
- }
972
-
973
- function wp_insert_vi_logout_handler() {
974
- jQuery('#wp_insert_vi_logout').click(function() {
975
- jQuery.post(
976
- jQuery('#wp_insert_admin_ajax').val(), {
977
- 'action': 'wp_insert_vi_logout_action',
978
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
979
- }, function(response) {
980
- if(response.indexOf('###SUCCESS###') !== -1) {
981
- jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
982
- wp_insert_vi_signup_handler();
983
- wp_insert_vi_login_handler();
984
- jQuery(window).resize();
985
- }
986
- jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
987
- }
988
- );
989
- jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
990
-
991
- });
992
- }
993
-
994
- function wp_insert_vi_chart_draw() {
995
- if(jQuery('#wp_insert_vi_earnings_wrapper').length) {
996
- jQuery.post(
997
- jQuery('#wp_insert_admin_ajax').val(), {
998
- 'action': 'wp_insert_vi_get_chart',
999
- 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
1000
- }, function(response) {
1001
- if(response.indexOf('###SUCCESS###') !== -1) {
1002
- jQuery('#wp_insert_vi_earnings_wrapper').html(response.replace('###SUCCESS###', ''));
1003
- if(jQuery('#wp_insert_vi_chart_data').length) {
1004
- var ctx = document.getElementById("myChart");
1005
- var wp_insert_vi_chart = new Chart(jQuery('#wp_insert_vi_chart'), {
1006
- type: 'line',
1007
- data: {
1008
- datasets: [{
1009
- data: JSON.parse(jQuery('#wp_insert_vi_chart_data').val()),
1010
- backgroundColor: '#EDF5FB',
1011
- borderColor: '#186EAE',/*E8EBEF*/
1012
- borderWidth: 1
1013
- }]
1014
- },
1015
- options: {
1016
- title: {
1017
- display: false,
1018
- backgroundColor: '#EDF5FB'
1019
- },
1020
- legend: {
1021
- display: false,
1022
- },
1023
- scales: {
1024
- xAxes: [{
1025
- type: "time",
1026
- display: true,
1027
- scaleLabel: {
1028
- display: false
1029
- },
1030
- gridLines: {
1031
- display: false,
1032
- drawTicks: false
1033
- },
1034
- ticks: {
1035
- display: false
1036
- }
1037
- }],
1038
- yAxes: [{
1039
- display: true,
1040
- scaleLabel: {
1041
- display: false
1042
- },
1043
- gridLines: {
1044
- display: true,
1045
- drawTicks: false
1046
- },
1047
- ticks: {
1048
- display: false
1049
- }
1050
- }]
1051
- },
1052
- tooltips: {
1053
- displayColors: false,
1054
- callbacks: {
1055
- label: function(tooltipItem, data) {
1056
- return '$ '+parseFloat(tooltipItem.yLabel).toFixed(2);
1057
- },
1058
- title: function(tooltipItem, data) {
1059
- var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
1060
- var dateParts = tooltipItem[0].xLabel.split('/');
1061
- var date = new Date(dateParts[2], dateParts[0]-1, dateParts[1]);
1062
- return monthNames[date.getMonth()]+' '+date.getDate();
1063
- }
1064
- }
1065
- }
1066
- }
1067
- });
1068
- }
1069
- } else {
1070
- jQuery('#wp_insert_vi_earnings_wrapper').parent().html(response);
1071
- }
1072
- jQuery(window).resize();
1073
- }
1074
- );
1075
- }
1076
  }
34
  },
35
  function() { }
36
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  });
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  function wp_insert_click_handler(target, title, width, height, openAction, UpdateAction, closeAction) {
40
  jQuery('#'+target).click(function() {
41
  jQuery('<div id="'+target+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
93
  }
94
  })
95
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
includes/common/abtesting.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_abtesting_plugin_card', 60);
4
  function wp_insert_abtesting_plugin_card() {
5
  echo '<div class="plugin-card">';
6
  echo '<div class="plugin-card-top">';
1
  <?php
2
  /* Begin Add Card in Admin Panel */
3
+ add_action('wp_insert_plugin_card', 'wp_insert_abtesting_plugin_card', 90);
4
  function wp_insert_abtesting_plugin_card() {
5
  echo '<div class="plugin-card">';
6
  echo '<div class="plugin-card-top">';
includes/common/adstxt.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
- function wp_insert_adstxt_file_exists() {
3
- if(file_exists(trailingslashit(get_home_path()).'ads.txt')) {
4
- return true;
5
- }
6
- return false;
7
- }
8
-
9
- function wp_insert_adstxt_get_content() {
10
- if(wp_insert_adstxt_file_exists()) {
11
- return @file_get_contents(trailingslashit(get_home_path()).'ads.txt');
12
- }
13
- return '';
14
- }
15
-
16
- function wp_insert_adstxt_update_content($content) {
17
- if(get_filesystem_method() === 'direct') {
18
- $creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
19
- if(!WP_Filesystem($creds)) {
20
- return false;
21
- }
22
- global $wp_filesystem;
23
- if(!$wp_filesystem->put_contents(trailingslashit(get_home_path()).'ads.txt', $content, FS_CHMOD_FILE)) {
24
- return false;
25
- }
26
- } else {
27
- return false;
28
- }
29
- return true;
30
- }
31
-
32
- function wp_insert_adstxt_updation_failed_message($content) {
33
- $output = '<div class="wp_insert_popup_content_wrapper">';
34
- $output .= '<p>Auto Creation / Updation of ads.txt failed due to access permission restrictions on the server.</p>';
35
- $output .= '<p>You have to manually upload the file using your Host\'s File manager or your favourite FTP program</p>';
36
- $output .= '<p>ads.txt should be located in the root of your server. After manually uploading the file click <a href="'.site_url().'/ads.txt">here</a> to check if its accessible from the correct location</p>';
37
- $output .= '<textarea style="display: none;" id="wp_insert_adstxt_content">'.$content.'</textarea>';
38
- $output .= '<p><a onclick="wp_insert_adstxt_content_download()" class="button button-primary" href="javascript:;">Download ads.txt</a></p>';
39
- $output .= '</div>';
40
- return $output;
41
- }
42
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/common/control-panel.php CHANGED
@@ -17,6 +17,8 @@ function wp_insert_admin_enqueue_scripts($page) {
17
  wp_enqueue_script('wp-insert-js');
18
  wp_register_script('chart-js', WP_INSERT_URL.'includes/assets/js/Chart.bundle.min.js', array('jquery'), WP_INSERT_VERSION);
19
  wp_enqueue_script('chart-js');
 
 
20
  smartlogixControls::enqueue_assets(WP_INSERT_URL.'includes/controls', WP_INSERT_VERSION);
21
  wp_enqueue_script('editor');
22
  wp_enqueue_script('quicktags');
@@ -63,7 +65,8 @@ function wp_insert_admin_notices() {
63
  echo '<div class="notice notice-success wp_insert_notice is-dismissible" style="padding: 15px;">';
64
  echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
65
  echo '<p>Thank you for updating <b>Wp-Insert</b>.</p>';
66
- echo '<p>This update features <b>vi stories</b> from video intelligence. A video player that will supply both video content and video advertising. Install it now to increase time-on-page, and your revenue thanks to high CPMs. Read the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQ</a>.</p>';
 
67
  echo '</div>';
68
  echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
69
  echo '<div class="clear"></div>';
17
  wp_enqueue_script('wp-insert-js');
18
  wp_register_script('chart-js', WP_INSERT_URL.'includes/assets/js/Chart.bundle.min.js', array('jquery'), WP_INSERT_VERSION);
19
  wp_enqueue_script('chart-js');
20
+ do_action('wp_insert_modules_css');
21
+ do_action('wp_insert_modules_js');
22
  smartlogixControls::enqueue_assets(WP_INSERT_URL.'includes/controls', WP_INSERT_VERSION);
23
  wp_enqueue_script('editor');
24
  wp_enqueue_script('quicktags');
65
  echo '<div class="notice notice-success wp_insert_notice is-dismissible" style="padding: 15px;">';
66
  echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
67
  echo '<p>Thank you for updating <b>Wp-Insert</b>.</p>';
68
+ echo '<p>This update features <b>vi stories</b> from <a href="https://www.vi.ai/">video intelligence</a> - a video player that supplies both content and video advertising. Watch a <a href="http://demo.vi.ai/ViewsterBlog_Nintendo.html">demo</a>.</p>';
69
+ echo '<p>Read the <a href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQ</a>.</p>';
70
  echo '</div>';
71
  echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
72
  echo '<div class="clear"></div>';
includes/controls/assets/css/controls.css CHANGED
@@ -10,7 +10,6 @@
10
  font-weight: bold;
11
  position: absolute;
12
  left: 15px;
13
- right: 15px;
14
  top: -10px;
15
  background: #FFFFFF;
16
  color: #111111;
10
  font-weight: bold;
11
  position: absolute;
12
  left: 15px;
 
13
  top: -10px;
14
  background: #FFFFFF;
15
  color: #111111;
includes/controls/controls.php CHANGED
@@ -135,13 +135,13 @@ class smartlogixControls {
135
  $syncedArgs['type'] = $this->type;
136
  }
137
 
138
- if(isset($args['plainHTML']) && ($args['plainHTML'] != '')) {
139
  $syncedArgs['plainHTML'] = $args['plainHTML'];
140
  } else {
141
  $syncedArgs['plainHTML'] = $this->plainHTML;
142
  }
143
 
144
- if(isset($args['useParagraph']) && ($args['useParagraph'] != '')) {
145
  $syncedArgs['useParagraph'] = $args['useParagraph'];
146
  } else {
147
  $syncedArgs['useParagraph'] = $this->useParagraph;
@@ -165,12 +165,6 @@ class smartlogixControls {
165
  $syncedArgs['name'] = $this->name;
166
  }
167
 
168
- if(isset($args['value']) && ($args['value'] != '')) {
169
- $syncedArgs['value'] = $args['value'];
170
- } else {
171
- $syncedArgs['value'] = $this->value;
172
- }
173
-
174
  if(isset($args['label']) && ($args['label'] != '')) {
175
  $syncedArgs['label'] = $args['label'];
176
  } else {
@@ -215,18 +209,24 @@ class smartlogixControls {
215
  $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$this->optionName;
216
  $syncedArgs['name'] = $this->optionIdentifier.'['.$this->optionName.']';
217
  }
218
-
219
- if(isset($args['values']) && is_array($args['values'])) {
220
- if(isset($args['optionName']) && ($args['optionName'] != '')) {
221
- $syncedArgs['value'] = $args['values'][$args['optionName']];
222
- } elseif(isset($this->optionName) && ($this->optionName != '')) {
223
- $syncedArgs['value'] = $args['values'][$this->optionName];
224
- }
225
- } elseif(isset($this->values) && is_array($this->values)) {
226
- if(isset($args['optionName']) && ($args['optionName'] != '')) {
227
- $syncedArgs['value'] = $this->values[$args['optionName']];
228
- } elseif(isset($this->optionName) && ($this->optionName != '')) {
229
- $syncedArgs['value'] = $this->values[$this->optionName];
 
 
 
 
 
 
230
  }
231
  }
232
 
@@ -294,7 +294,7 @@ class smartlogixControls {
294
  case 'select':
295
  if($args['useParagraph']) { $HTML .= '<p>'; }
296
  if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
297
- $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
298
  if(is_array($args['options'])) {
299
  foreach($args['options'] as $option) {
300
  $metadata = '';
@@ -335,7 +335,7 @@ class smartlogixControls {
335
  $index = 1;
336
  foreach($args['options'] as $option) {
337
  $HTML .= '<input type="radio" '.(($args['id'] != '')?'id="'.$args['id'].'_'.$index.'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.checked(((isset($args['value']))?$args['value']:''), ((isset($option['value']))?$option['value']:''), false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' />';
338
- if($option['text'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</label><br />'; }
339
  $index++;
340
  }
341
  }
135
  $syncedArgs['type'] = $this->type;
136
  }
137
 
138
+ if(isset($args['plainHTML']) && is_bool($args['plainHTML'])) {
139
  $syncedArgs['plainHTML'] = $args['plainHTML'];
140
  } else {
141
  $syncedArgs['plainHTML'] = $this->plainHTML;
142
  }
143
 
144
+ if(isset($args['useParagraph']) && is_bool($args['useParagraph'])) {
145
  $syncedArgs['useParagraph'] = $args['useParagraph'];
146
  } else {
147
  $syncedArgs['useParagraph'] = $this->useParagraph;
165
  $syncedArgs['name'] = $this->name;
166
  }
167
 
 
 
 
 
 
 
168
  if(isset($args['label']) && ($args['label'] != '')) {
169
  $syncedArgs['label'] = $args['label'];
170
  } else {
209
  $syncedArgs['id'] = str_replace(array('[', ']'), array('_', ''), $this->optionIdentifier).'_'.$this->optionName;
210
  $syncedArgs['name'] = $this->optionIdentifier.'['.$this->optionName.']';
211
  }
212
+
213
+ if(isset($args['value']) && ($args['value'] != '')) {
214
+ $syncedArgs['value'] = $args['value'];
215
+ } else {
216
+ if(isset($args['values']) && is_array($args['values'])) {
217
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
218
+ $syncedArgs['value'] = $args['values'][$args['optionName']];
219
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
220
+ $syncedArgs['value'] = $args['values'][$this->optionName];
221
+ }
222
+ } elseif(isset($this->values) && is_array($this->values)) {
223
+ if(isset($args['optionName']) && ($args['optionName'] != '')) {
224
+ $syncedArgs['value'] = $this->values[$args['optionName']];
225
+ } elseif(isset($this->optionName) && ($this->optionName != '')) {
226
+ $syncedArgs['value'] = $this->values[$this->optionName];
227
+ }
228
+ } else {
229
+ $syncedArgs['value'] = $this->value;
230
  }
231
  }
232
 
294
  case 'select':
295
  if($args['useParagraph']) { $HTML .= '<p>'; }
296
  if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
297
+ $HTML .= '<select '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').'>';
298
  if(is_array($args['options'])) {
299
  foreach($args['options'] as $option) {
300
  $metadata = '';
335
  $index = 1;
336
  foreach($args['options'] as $option) {
337
  $HTML .= '<input type="radio" '.(($args['id'] != '')?'id="'.$args['id'].'_'.$index.'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($option['value'] != '')?'value="'.$option['value'].'"':'').' '.checked(((isset($args['value']))?$args['value']:''), ((isset($option['value']))?$option['value']:''), false).' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' />';
338
+ if($option['text'] != '') { $HTML .= '&nbsp;<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').'>'.(($option['text'] != '')?$option['text']:'').'</label><br />'; }
339
  $index++;
340
  }
341
  }
includes/inpostads.php DELETED
@@ -1,573 +0,0 @@
1
- <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_inpostads_plugin_card', 10);
4
- function wp_insert_inpostads_plugin_card() {
5
- echo '<div class="plugin-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>In-Post Ads</h4>';
8
- echo '<p>Ads shown within the post content.</p>';
9
- echo '</div>';
10
- echo '<div class="plugin-card-bottom">';
11
- echo '<p><a id="wp_insert_inpostads_above" href="javascript:;">Ad - Above Post Content</a></p>';
12
- echo '<p><a id="wp_insert_inpostads_middle" href="javascript:;">Ad - Middle of Post Content</a></p>';
13
- echo '<p><a id="wp_insert_inpostads_below" href="javascript:;">Ad - Below Post Content</a></p>';
14
- echo '<p><a id="wp_insert_inpostads_left" href="javascript:;">Ad - Left of Post Content</a></p>';
15
- echo '<p><a id="wp_insert_inpostads_right" href="javascript:;">Ad - Right of Post Content</a></p>';
16
- echo '</div>';
17
- echo '</div>';
18
- }
19
- /* End Add Card in Admin Panel */
20
-
21
- /* Begin Ad Above Post Content */
22
- add_action('wp_ajax_wp_insert_inpostads_above_form_get_content', 'wp_insert_inpostads_above_form_get_content');
23
- function wp_insert_inpostads_above_form_get_content() {
24
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
25
- wp_insert_inpostads_form_get_content('above');
26
- die();
27
- }
28
-
29
- add_action('wp_ajax_wp_insert_inpostads_above_form_save_action', 'wp_insert_inpostads_above_form_save_action');
30
- function wp_insert_inpostads_above_form_save_action() {
31
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
32
- wp_insert_inpostads_form_save_action('above');
33
- die();
34
- }
35
- /* End Ad Above Post Content */
36
-
37
- /* Begin Ad Middle Post Content */
38
- add_action('wp_ajax_wp_insert_inpostads_middle_form_get_content', 'wp_insert_inpostads_middle_form_get_content');
39
- function wp_insert_inpostads_middle_form_get_content() {
40
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
41
- wp_insert_inpostads_form_get_content('middle');
42
- die();
43
- }
44
-
45
- add_action('wp_ajax_wp_insert_inpostads_middle_form_save_action', 'wp_insert_inpostads_middle_form_save_action');
46
- function wp_insert_inpostads_middle_form_save_action() {
47
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
48
- wp_insert_inpostads_form_save_action('middle');
49
- die();
50
- }
51
- /* End Ad Middle Post Content */
52
-
53
- /* Begin Ad Below Post Content */
54
- add_action('wp_ajax_wp_insert_inpostads_below_form_get_content', 'wp_insert_inpostads_below_form_get_content');
55
- function wp_insert_inpostads_below_form_get_content() {
56
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
57
- wp_insert_inpostads_form_get_content('below');
58
- die();
59
- }
60
-
61
- add_action('wp_ajax_wp_insert_inpostads_below_form_save_action', 'wp_insert_inpostads_below_form_save_action');
62
- function wp_insert_inpostads_below_form_save_action() {
63
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
64
- wp_insert_inpostads_form_save_action('below');
65
- die();
66
- }
67
- /* End Ad Below Post Content */
68
-
69
- /* Begin Ad Left Post Content */
70
- add_action('wp_ajax_wp_insert_inpostads_left_form_get_content', 'wp_insert_inpostads_left_form_get_content');
71
- function wp_insert_inpostads_left_form_get_content() {
72
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
73
- wp_insert_inpostads_form_get_content('left');
74
- die();
75
- }
76
-
77
- add_action('wp_ajax_wp_insert_inpostads_left_form_save_action', 'wp_insert_inpostads_left_form_save_action');
78
- function wp_insert_inpostads_left_form_save_action() {
79
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
80
- wp_insert_inpostads_form_save_action('left');
81
- die();
82
- }
83
- /* End Ad Left Post Content */
84
-
85
- /* Begin Ad Right Post Content */
86
- add_action('wp_ajax_wp_insert_inpostads_right_form_get_content', 'wp_insert_inpostads_right_form_get_content');
87
- function wp_insert_inpostads_right_form_get_content() {
88
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
89
- wp_insert_inpostads_form_get_content('right');
90
- die();
91
- }
92
-
93
- add_action('wp_ajax_wp_insert_inpostads_right_form_save_action', 'wp_insert_inpostads_right_form_save_action');
94
- function wp_insert_inpostads_right_form_save_action() {
95
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
96
- wp_insert_inpostads_form_save_action('right');
97
- die();
98
- }
99
- /* End Ad Right Post Content */
100
-
101
- /* Begin Shared UI Functions */
102
- function wp_insert_inpostads_form_get_content($position) {
103
- $inpostads = get_option('wp_insert_inpostads');
104
- echo '<div class="wp_insert_popup_content_wrapper">';
105
- $posts_per_page = get_option('posts_per_page');
106
- $instances = array();
107
- for($i = 1; $i <= $posts_per_page; $i++) {
108
- $instances[] = array('text' => 'Hide on '.wp_insert_add_ordinal_number_suffix($i).' Post', 'value' => $i);
109
- }
110
- $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_inpostads['.$position.']', 'values' => $inpostads[$position]));
111
- $control->add_control(array('type' => 'ipCheckbox', 'optionName' => 'status'));
112
- echo '<div id="wp_insert_inpostads_'.$position.'_accordion">';
113
- echo '<h3>Ad Code</h3>';
114
- echo '<div>';
115
- $abtestingMode = get_option('wp_insert_abtesting_mode');
116
-
117
- if($position == 'above' || $position == 'middle') {
118
- $adTypes = array(
119
- array('text' => 'Use Generic / Custom Ad Code', 'value' => 'generic'),
120
- array('text' => 'vi stories', 'value' => 'vicode'),
121
- );
122
- $control->add_control(array('type' => 'select', 'label' => 'Ad Type', 'optionName' => 'primary_ad_code_type', 'options' => $adTypes));
123
- echo $control->HTML;
124
- $control->clear_controls();
125
-
126
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
127
- $control->create_section('<span id="primary_ad_code_type_generic" class="isSelectedIndicator"></span>Generic / Custom Ad Code (Primary Network)');
128
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
129
- echo $control->HTML;
130
- $control->clear_controls();
131
-
132
- $IsVILoggedin = wp_insert_vi_api_is_loggedin();
133
- $isJSTagGenerated = ((wp_insert_vi_api_get_vi_code() === false)?false:true);
134
- $isVIDisabled = false;
135
- $viMessage = '';
136
- if(!$IsVILoggedin && !$isJSTagGenerated) {
137
- $isVIDisabled = true;
138
- $viMessage = '<p>Introducing <b>vi stories</b> – the video content and advertising player.</p>';
139
- $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
140
- } else if($IsVILoggedin && !$isJSTagGenerated) {
141
- $isVIDisabled = true;
142
- $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. In the <i>video intelligence</i> panel, click <i>Configure</i></p>';
143
- //$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
144
- } else if(!$IsVILoggedin && $isJSTagGenerated) {
145
- $isVIDisabled = false;
146
- $viMessage = '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
147
- } else {
148
- $isVIDisabled = false;
149
- $viMessage = wp_insert_vi_customize_adcode_get_settings();
150
- $viMessage .= '<p>To configure <b>vi stories</b>, go to the <i>video intelligence</i> panel, click <i>Configure</i></p>';
151
- //$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
152
- }
153
-
154
- $control->HTML .= $viMessage;
155
- $control->create_section('<span id="primary_ad_code_type_vicode" class="isSelectedIndicator '.(($isVIDisabled)?'disabled':'').'"></span>vi stories (Primary Network)');
156
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
157
- echo $control->HTML;
158
- $control->clear_controls();
159
- } else {
160
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
161
- $control->create_section('Ad Code (Primary Network)');
162
- echo $control->HTML;
163
- $control->clear_controls();
164
- }
165
-
166
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
167
- $control->create_section('Ad Code (Secondary Network)');
168
- if($abtestingMode != '2' && $abtestingMode != '3') {
169
- $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
170
- }
171
- echo $control->HTML;
172
- $control->clear_controls();
173
-
174
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
175
- $control->create_section('Ad Code (Tertiary Network)');
176
- if($abtestingMode != '3') {
177
- $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
178
- }
179
- echo $control->HTML;
180
- $control->clear_controls();
181
- echo '</div>';
182
- echo '<h3>Rules</h3>';
183
- echo '<div>';
184
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
185
- $control->create_section('Logged in Users');
186
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
187
- echo $control->HTML;
188
- $control->clear_controls();
189
-
190
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
191
- $control->create_section('Mobile Devices');
192
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
193
- echo $control->HTML;
194
- $control->clear_controls();
195
-
196
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
197
- $control->create_section('404 Pages');
198
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
199
- echo $control->HTML;
200
- $control->clear_controls();
201
-
202
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
203
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_home_instances', 'options' => $instances));
204
- $control->create_section('Home');
205
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
206
- echo $control->HTML;
207
- $control->clear_controls();
208
-
209
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
210
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_archives_instances', 'options' => $instances));
211
- $control->create_section('Archives');
212
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
213
- echo $control->HTML;
214
- $control->clear_controls();
215
-
216
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
217
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_search_instances', 'options' => $instances));
218
- $control->create_section('Search Results');
219
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
220
- echo $control->HTML;
221
- $control->clear_controls();
222
-
223
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
224
- $control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
225
- $control->create_section('Single Pages');
226
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
227
- echo $control->HTML;
228
- $control->clear_controls();
229
-
230
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
231
- $control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
232
- $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
233
- $control->create_section('Single Posts');
234
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
235
- echo $control->HTML;
236
- $control->clear_controls();
237
-
238
- $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
239
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_categories_instances', 'options' => $instances));
240
- $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
241
- $control->create_section('Category Archives');
242
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
243
- echo $control->HTML;
244
- $control->clear_controls();
245
-
246
- echo '</div>';
247
- echo '<h3>Geo Targeting</h3>';
248
- echo '<div>';
249
- echo '<p>';
250
- echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
251
- echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.<br />';
252
- echo '</p>';
253
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
254
- $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
255
- $control->create_section('Group 1');
256
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
257
- echo $control->HTML;
258
- $control->clear_controls();
259
-
260
- $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
261
- $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
262
- $control->create_section('Group 2');
263
- $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
264
- echo $control->HTML;
265
- $control->clear_controls();
266
- echo '<p>';
267
- echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
268
- echo '</p>';
269
- echo '</div>';
270
- echo '<h3>Styles</h3>';
271
- echo '<div>';
272
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
273
- $control->create_section('Styles');
274
- echo $control->HTML;
275
- $control->clear_controls();
276
- echo '</div>';
277
- echo '<h3>Notes</h3>';
278
- echo '<div>';
279
- $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
280
- $control->create_section('Notes');
281
- echo $control->HTML;
282
- $control->clear_controls();
283
- echo '</div>';
284
- if($position == 'middle') {
285
- echo '<h3>Positioning</h3>';
286
- echo '<div>';
287
- $control->add_control(array('type' => 'text', 'label' => 'Minimum Character Count', 'optionName' => 'minimum_character_count', 'helpText' => 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.'));
288
- $control->add_control(array('type' => 'text', 'label' => 'Paragraph Buffer Count', 'optionName' => 'paragraph_buffer_count', 'helpText' => 'Shows the ad after X number of Paragraphs. If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.'));
289
- $control->create_section('Positioning');
290
- echo $control->HTML;
291
- $control->clear_controls();
292
- echo '</div>';
293
- }
294
- echo '</div>';
295
- echo '<script type="text/javascript">';
296
- echo $control->JS;
297
- echo 'jQuery("#wp_insert_inpostads_'.$position.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
298
- echo 'primary_ad_code_type_change();';
299
- echo 'wp_insert_inpostads_vi_customize_adcode();';
300
- echo '</script>';
301
- echo '</div>';
302
- }
303
-
304
- function wp_insert_inpostads_form_save_action($position) {
305
- $inpostAds = get_option('wp_insert_inpostads');
306
- $inpostAds[$position]['status'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_status']) && ($_POST['wp_insert_inpostads_'.$position.'_status'] == 'true'))?'1':'');
307
-
308
- if($position == 'above' || $position == 'middle') {
309
- $inpostAds[$position]['primary_ad_code_type'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_primary_ad_code_type']))?$_POST['wp_insert_inpostads_'.$position.'_primary_ad_code_type']:'');
310
- }
311
- $inpostAds[$position]['primary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_primary_ad_code']))?$_POST['wp_insert_inpostads_'.$position.'_primary_ad_code']:'');
312
- $inpostAds[$position]['secondary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_secondary_ad_code']))?$_POST['wp_insert_inpostads_'.$position.'_secondary_ad_code']:'');
313
- $inpostAds[$position]['tertiary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_tertiary_ad_code']))?$_POST['wp_insert_inpostads_'.$position.'_tertiary_ad_code']:'');
314
-
315
- $inpostAds[$position]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_loggedin']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_loggedin']:'');
316
- $inpostAds[$position]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_mobile_devices']:'');
317
- $inpostAds[$position]['rules_exclude_404'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_404']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_404']:'');
318
- $inpostAds[$position]['rules_exclude_home'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_home']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_home']:'');
319
- $inpostAds[$position]['rules_home_instances'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_home_instances']))?$_POST['wp_insert_inpostads_'.$position.'_rules_home_instances']:'');
320
- $inpostAds[$position]['rules_exclude_archives'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_archives']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_archives']:'');
321
- $inpostAds[$position]['rules_archives_instances'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_archives_instances']))?$_POST['wp_insert_inpostads_'.$position.'_rules_archives_instances']:'');
322
- $inpostAds[$position]['rules_exclude_search'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_search']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_search']:'');
323
- $inpostAds[$position]['rules_search_instances'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_search_instances']))?$_POST['wp_insert_inpostads_'.$position.'_rules_search_instances']:'');
324
- $inpostAds[$position]['rules_exclude_page'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_page']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_page']:'');
325
- $inpostAds[$position]['rules_page_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_page_exceptions']))?$_POST['wp_insert_inpostads_'.$position.'_rules_page_exceptions']:'');
326
- $inpostAds[$position]['rules_exclude_post'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_post']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_post']:'');
327
- $inpostAds[$position]['rules_post_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_post_exceptions']))?$_POST['wp_insert_inpostads_'.$position.'_rules_post_exceptions']:'');
328
- $inpostAds[$position]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_post_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$position.'_rules_post_categories_exceptions']:'');
329
- $inpostAds[$position]['rules_exclude_categories'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_exclude_categories']))?$_POST['wp_insert_inpostads_'.$position.'_rules_exclude_categories']:'');
330
- $inpostAds[$position]['rules_categories_instances'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_categories_instances']))?$_POST['wp_insert_inpostads_'.$position.'_rules_categories_instances']:'');
331
- $inpostAds[$position]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_rules_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$position.'_rules_categories_exceptions']:'');
332
-
333
- $inpostAds[$position]['geo_group1_countries'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_geo_group1_countries']))?$_POST['wp_insert_inpostads_'.$position.'_geo_group1_countries']:'');
334
- $inpostAds[$position]['geo_group1_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_geo_group1_adcode']))?$_POST['wp_insert_inpostads_'.$position.'_geo_group1_adcode']:'');
335
- $inpostAds[$position]['geo_group2_countries'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_geo_group2_countries']))?$_POST['wp_insert_inpostads_'.$position.'_geo_group2_countries']:'');
336
- $inpostAds[$position]['geo_group2_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_geo_group2_adcode']))?$_POST['wp_insert_inpostads_'.$position.'_geo_group2_adcode']:'');
337
-
338
- $inpostAds[$position]['styles'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_styles']))?$_POST['wp_insert_inpostads_'.$position.'_styles']:'');
339
-
340
- $inpostAds[$position]['notes'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_notes']))?$_POST['wp_insert_inpostads_'.$position.'_notes']:'');
341
-
342
- if($position == 'middle') {
343
- $inpostAds[$position]['minimum_character_count'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_minimum_character_count']))?$_POST['wp_insert_inpostads_'.$position.'_minimum_character_count']:'');
344
- $inpostAds[$position]['paragraph_buffer_count'] = ((isset($_POST['wp_insert_inpostads_'.$position.'_paragraph_buffer_count']))?$_POST['wp_insert_inpostads_'.$position.'_paragraph_buffer_count']:'');
345
- }
346
- update_option('wp_insert_inpostads', $inpostAds);
347
- }
348
- /* End Shared UI Functions */
349
-
350
- /* Begin Database Upgrade */
351
- add_action('wp_insert_upgrade_database', 'wp_insert_inpostads_upgrade_database');
352
- function wp_insert_inpostads_upgrade_database() {
353
- if(!get_option('wp_insert_inpostads')) {
354
- $oldValues = get_option('wp_insert_inpostads_options');
355
- $newValues = array(
356
- 'above' => array (
357
- 'status' => ((isset($oldValues['above']['status']) && $oldValues['above']['status'] == true)?'1':''),
358
- 'primary_ad_code' => ((isset($oldValues['above']['ad_code_1']))?$oldValues['above']['ad_code_1']:''),
359
- 'secondary_ad_code' => ((isset($oldValues['above']['ad_code_2']))?$oldValues['above']['ad_code_2']:''),
360
- 'tertiary_ad_code' => ((isset($oldValues['above']['ad_code_3']))?$oldValues['above']['ad_code_3']:''),
361
- 'rules_exclude_loggedin' => ((isset($oldValues['above']['rules_exclude_loggedin']))?true:false),
362
- 'rules_exclude_mobile_devices' => ((isset($oldValues['above']['rules_exclude_mobile_devices']))?true:false),
363
- 'rules_exclude_home' => ((isset($oldValues['above']['rules_exclude_home']))?true:false),
364
- 'rules_home_instances' => ((isset($options['above']['rules_home_instances']) && ($options['above']['rules_home_instances'] != ''))?explode(',', $options['above']['rules_home_instances']):array()),
365
- 'rules_exclude_archives' => ((isset($oldValues['above']['rules_exclude_archives']))?true:false),
366
- 'rules_archives_instances' => ((isset($options['above']['rules_archives_instances']) && ($options['above']['rules_archives_instances'] != ''))?explode(',', $options['above']['rules_archives_instances']):array()),
367
- 'rules_exclude_search' => ((isset($oldValues['above']['rules_exclude_search']))?true:false),
368
- 'rules_search_instances' => ((isset($options['above']['rules_search_instances']) && ($options['above']['rules_search_instances'] != ''))?explode(',', $options['above']['rules_search_instances']):array()),
369
- 'rules_exclude_page' => ((isset($oldValues['above']['rules_exclude_page']))?true:false),
370
- 'rules_page_exceptions' => ((isset($options['above']['rules_page_exceptions']) && ($options['above']['rules_page_exceptions'] != ''))?explode(',', $options['above']['rules_page_exceptions']):array()),
371
- 'rules_exclude_post' => ((isset($oldValues['above']['rules_exclude_post']))?true:false),
372
- 'rules_post_exceptions' => ((isset($options['above']['rules_post_exceptions']) && ($options['above']['rules_post_exceptions'] != ''))?explode(',', $options['above']['rules_post_exceptions']):array()),
373
- 'rules_post_categories_exceptions' => ((isset($options['above']['rules_post_categories_exceptions']) && ($options['above']['rules_post_categories_exceptions'] != ''))?explode(',', $options['above']['rules_post_categories_exceptions']):array()),
374
- 'rules_exclude_categories' => ((isset($oldValues['above']['rules_exclude_categories']))?true:false),
375
- 'rules_categories_instances' => ((isset($options['above']['rules_categories_instances']) && ($options['above']['rules_categories_instances'] != ''))?explode(',', $options['above']['rules_categories_instances']):array()),
376
- 'rules_categories_exceptions' => ((isset($options['above']['rules_categories_exceptions']) && ($options['above']['rules_categories_exceptions'] != ''))?explode(',', $options['above']['rules_categories_exceptions']):array()),
377
- 'geo_group1_countries' => ((isset($options['above']['country_1']) && ($options['above']['country_1'] != ''))?explode(',', $options['above']['country_1']):array()),
378
- 'geo_group1_adcode' => ((isset($oldValues['above']['country_code_1']))?$oldValues['above']['country_code_1']:''),
379
- 'geo_group2_countries' => array(),
380
- 'geo_group2_adcode' => '',
381
- 'styles' => ((isset($oldValues['above']['styles']))?$oldValues['above']['styles']:'margin: 5px; padding: 0px;'),
382
- 'notes' => ((isset($oldValues['above']['notes']))?$oldValues['above']['notes']:''),
383
- ),
384
- 'middle' => array (
385
- 'status' => ((isset($oldValues['middle']['status']) && $oldValues['middle']['status'] == true)?'1':''),
386
- 'primary_ad_code' => ((isset($oldValues['middle']['ad_code_1']))?$oldValues['middle']['ad_code_1']:''),
387
- 'secondary_ad_code' => ((isset($oldValues['middle']['ad_code_2']))?$oldValues['middle']['ad_code_2']:''),
388
- 'tertiary_ad_code' => ((isset($oldValues['middle']['ad_code_3']))?$oldValues['middle']['ad_code_3']:''),
389
- 'rules_exclude_loggedin' => ((isset($oldValues['middle']['rules_exclude_loggedin']))?true:false),
390
- 'rules_exclude_mobile_devices' => ((isset($oldValues['middle']['rules_exclude_mobile_devices']))?true:false),
391
- 'rules_exclude_home' => ((isset($oldValues['middle']['rules_exclude_home']))?true:false),
392
- 'rules_home_instances' => ((isset($options['middle']['rules_home_instances']) && ($options['middle']['rules_home_instances'] != ''))?explode(',', $options['middle']['rules_home_instances']):array()),
393
- 'rules_exclude_archives' => ((isset($oldValues['middle']['rules_exclude_archives']))?true:false),
394
- 'rules_archives_instances' => ((isset($options['middle']['rules_archives_instances']) && ($options['middle']['rules_archives_instances'] != ''))?explode(',', $options['middle']['rules_archives_instances']):array()),
395
- 'rules_exclude_search' => ((isset($oldValues['middle']['rules_exclude_search']))?true:false),
396
- 'rules_search_instances' => ((isset($options['middle']['rules_search_instances']) && ($options['middle']['rules_search_instances'] != ''))?explode(',', $options['middle']['rules_search_instances']):array()),
397
- 'rules_exclude_page' => ((isset($oldValues['middle']['rules_exclude_page']))?true:false),
398
- 'rules_page_exceptions' => ((isset($options['middle']['rules_page_exceptions']) && ($options['middle']['rules_page_exceptions'] != ''))?explode(',', $options['middle']['rules_page_exceptions']):array()),
399
- 'rules_exclude_post' => ((isset($oldValues['middle']['rules_exclude_post']))?true:false),
400
- 'rules_post_exceptions' => ((isset($options['middle']['rules_post_exceptions']) && ($options['middle']['rules_post_exceptions'] != ''))?explode(',', $options['middle']['rules_post_exceptions']):array()),
401
- 'rules_post_categories_exceptions' => ((isset($options['middle']['rules_post_categories_exceptions']) && ($options['middle']['rules_post_categories_exceptions'] != ''))?explode(',', $options['middle']['rules_post_categories_exceptions']):array()),
402
- 'rules_exclude_categories' => ((isset($oldValues['middle']['rules_exclude_categories']))?true:false),
403
- 'rules_categories_instances' => ((isset($options['middle']['rules_categories_instances']) && ($options['middle']['rules_categories_instances'] != ''))?explode(',', $options['middle']['rules_categories_instances']):array()),
404
- 'rules_categories_exceptions' => ((isset($options['middle']['rules_categories_exceptions']) && ($options['middle']['rules_categories_exceptions'] != ''))?explode(',', $options['middle']['rules_categories_exceptions']):array()),
405
- 'geo_group1_countries' => ((isset($options['middle']['country_1']) && ($options['middle']['country_1'] != ''))?explode(',', $options['middle']['country_1']):array()),
406
- 'geo_group1_adcode' => ((isset($oldValues['middle']['country_code_1']))?$oldValues['middle']['country_code_1']:''),
407
- 'geo_group2_countries' => array(),
408
- 'geo_group2_adcode' => '',
409
- 'styles' => ((isset($oldValues['middle']['styles']))?$oldValues['middle']['styles']:'margin: 5px; padding: 0px;'),
410
- 'notes' => ((isset($oldValues['middle']['notes']))?$oldValues['middle']['notes']:''),
411
- 'minimum_character_count' => ((isset($oldValues['middle']['minimum_character_count']))?$oldValues['middle']['minimum_character_count']:'500'),
412
- 'paragraph_buffer_count' => ((isset($oldValues['middle']['paragraph_buffer_count']))?$oldValues['middle']['paragraph_buffer_count']:''),
413
- ),
414
- 'below' => array (
415
- 'status' => ((isset($oldValues['below']['status']) && $oldValues['below']['status'] == true)?'1':''),
416
- 'primary_ad_code' => ((isset($oldValues['below']['ad_code_1']))?$oldValues['below']['ad_code_1']:''),
417
- 'secondary_ad_code' => ((isset($oldValues['below']['ad_code_2']))?$oldValues['below']['ad_code_2']:''),
418
- 'tertiary_ad_code' => ((isset($oldValues['below']['ad_code_3']))?$oldValues['below']['ad_code_3']:''),
419
- 'rules_exclude_loggedin' => ((isset($oldValues['below']['rules_exclude_loggedin']))?true:false),
420
- 'rules_exclude_mobile_devices' => ((isset($oldValues['below']['rules_exclude_mobile_devices']))?true:false),
421
- 'rules_exclude_home' => ((isset($oldValues['below']['rules_exclude_home']))?true:false),
422
- 'rules_home_instances' => ((isset($options['below']['rules_home_instances']) && ($options['below']['rules_home_instances'] != ''))?explode(',', $options['below']['rules_home_instances']):array()),
423
- 'rules_exclude_archives' => ((isset($oldValues['below']['rules_exclude_archives']))?true:false),
424
- 'rules_archives_instances' => ((isset($options['below']['rules_archives_instances']) && ($options['below']['rules_archives_instances'] != ''))?explode(',', $options['below']['rules_archives_instances']):array()),
425
- 'rules_exclude_search' => ((isset($oldValues['below']['rules_exclude_search']))?true:false),
426
- 'rules_search_instances' => ((isset($options['below']['rules_search_instances']) && ($options['below']['rules_search_instances'] != ''))?explode(',', $options['below']['rules_search_instances']):array()),
427
- 'rules_exclude_page' => ((isset($oldValues['below']['rules_exclude_page']))?true:false),
428
- 'rules_page_exceptions' => ((isset($options['below']['rules_page_exceptions']) && ($options['below']['rules_page_exceptions'] != ''))?explode(',', $options['below']['rules_page_exceptions']):array()),
429
- 'rules_exclude_post' => ((isset($oldValues['below']['rules_exclude_post']))?true:false),
430
- 'rules_post_exceptions' => ((isset($options['below']['rules_post_exceptions']) && ($options['below']['rules_post_exceptions'] != ''))?explode(',', $options['below']['rules_post_exceptions']):array()),
431
- 'rules_post_categories_exceptions' => ((isset($options['below']['rules_post_categories_exceptions']) && ($options['below']['rules_post_categories_exceptions'] != ''))?explode(',', $options['below']['rules_post_categories_exceptions']):array()),
432
- 'rules_exclude_categories' => ((isset($oldValues['below']['rules_exclude_categories']))?true:false),
433
- 'rules_categories_instances' => ((isset($options['below']['rules_categories_instances']) && ($options['below']['rules_categories_instances'] != ''))?explode(',', $options['below']['rules_categories_instances']):array()),
434
- 'rules_categories_exceptions' => ((isset($options['below']['rules_categories_exceptions']) && ($options['below']['rules_categories_exceptions'] != ''))?explode(',', $options['below']['rules_categories_exceptions']):array()),
435
- 'geo_group1_countries' => ((isset($options['below']['country_1']) && ($options['below']['country_1'] != ''))?explode(',', $options['below']['country_1']):array()),
436
- 'geo_group1_adcode' => ((isset($oldValues['below']['country_code_1']))?$oldValues['below']['country_code_1']:''),
437
- 'geo_group2_countries' => array(),
438
- 'geo_group2_adcode' => '',
439
- 'styles' => ((isset($oldValues['below']['styles']))?$oldValues['below']['styles']:'margin: 5px; padding: 0px;'),
440
- 'notes' => ((isset($oldValues['below']['notes']))?$oldValues['below']['notes']:''),
441
- ),
442
- 'left' => array (
443
- 'status' => ((isset($oldValues['left']['status']) && $oldValues['left']['status'] == true)?'1':''),
444
- 'primary_ad_code' => ((isset($oldValues['left']['ad_code_1']))?$oldValues['left']['ad_code_1']:''),
445
- 'secondary_ad_code' => ((isset($oldValues['left']['ad_code_2']))?$oldValues['left']['ad_code_2']:''),
446
- 'tertiary_ad_code' => ((isset($oldValues['left']['ad_code_3']))?$oldValues['left']['ad_code_3']:''),
447
- 'rules_exclude_loggedin' => ((isset($oldValues['left']['rules_exclude_loggedin']))?true:false),
448
- 'rules_exclude_mobile_devices' => ((isset($oldValues['left']['rules_exclude_mobile_devices']))?true:false),
449
- 'rules_exclude_home' => ((isset($oldValues['left']['rules_exclude_home']))?true:false),
450
- 'rules_home_instances' => ((isset($options['left']['rules_home_instances']) && ($options['left']['rules_home_instances'] != ''))?explode(',', $options['left']['rules_home_instances']):array()),
451
- 'rules_exclude_archives' => ((isset($oldValues['left']['rules_exclude_archives']))?true:false),
452
- 'rules_archives_instances' => ((isset($options['left']['rules_archives_instances']) && ($options['left']['rules_archives_instances'] != ''))?explode(',', $options['left']['rules_archives_instances']):array()),
453
- 'rules_exclude_search' => ((isset($oldValues['left']['rules_exclude_search']))?true:false),
454
- 'rules_search_instances' => ((isset($options['left']['rules_search_instances']) && ($options['left']['rules_search_instances'] != ''))?explode(',', $options['left']['rules_search_instances']):array()),
455
- 'rules_exclude_page' => ((isset($oldValues['left']['rules_exclude_page']))?true:false),
456
- 'rules_page_exceptions' => ((isset($options['left']['rules_page_exceptions']) && ($options['left']['rules_page_exceptions'] != ''))?explode(',', $options['left']['rules_page_exceptions']):array()),
457
- 'rules_exclude_post' => ((isset($oldValues['left']['rules_exclude_post']))?true:false),
458
- 'rules_post_exceptions' => ((isset($options['left']['rules_post_exceptions']) && ($options['left']['rules_post_exceptions'] != ''))?explode(',', $options['left']['rules_post_exceptions']):array()),
459
- 'rules_post_categories_exceptions' => ((isset($options['left']['rules_post_categories_exceptions']) && ($options['left']['rules_post_categories_exceptions'] != ''))?explode(',', $options['left']['rules_post_categories_exceptions']):array()),
460
- 'rules_exclude_categories' => ((isset($oldValues['left']['rules_exclude_categories']))?true:false),
461
- 'rules_categories_instances' => ((isset($options['left']['rules_categories_instances']) && ($options['left']['rules_categories_instances'] != ''))?explode(',', $options['left']['rules_categories_instances']):array()),
462
- 'rules_categories_exceptions' => ((isset($options['left']['rules_categories_exceptions']) && ($options['left']['rules_categories_exceptions'] != ''))?explode(',', $options['left']['rules_categories_exceptions']):array()),
463
- 'geo_group1_countries' => ((isset($options['left']['country_1']) && ($options['left']['country_1'] != ''))?explode(',', $options['left']['country_1']):array()),
464
- 'geo_group1_adcode' => ((isset($oldValues['left']['country_code_1']))?$oldValues['left']['country_code_1']:''),
465
- 'geo_group2_countries' => array(),
466
- 'geo_group2_adcode' => '',
467
- 'styles' => ((isset($oldValues['left']['styles']))?$oldValues['left']['styles']:'margin: 5px; padding: 0px;'),
468
- 'notes' => ((isset($oldValues['left']['notes']))?$oldValues['left']['notes']:''),
469
- ),
470
- 'right' => array (
471
- 'status' => ((isset($oldValues['right']['status']) && $oldValues['right']['status'] == true)?'1':''),
472
- 'primary_ad_code' => ((isset($oldValues['right']['ad_code_1']))?$oldValues['right']['ad_code_1']:''),
473
- 'secondary_ad_code' => ((isset($oldValues['right']['ad_code_2']))?$oldValues['right']['ad_code_2']:''),
474
- 'tertiary_ad_code' => ((isset($oldValues['right']['ad_code_3']))?$oldValues['right']['ad_code_3']:''),
475
- 'rules_exclude_loggedin' => ((isset($oldValues['right']['rules_exclude_loggedin']))?true:false),
476
- 'rules_exclude_mobile_devices' => ((isset($oldValues['right']['rules_exclude_mobile_devices']))?true:false),
477
- 'rules_exclude_home' => ((isset($oldValues['right']['rules_exclude_home']))?true:false),
478
- 'rules_home_instances' => ((isset($options['right']['rules_home_instances']) && ($options['right']['rules_home_instances'] != ''))?explode(',', $options['right']['rules_home_instances']):array()),
479
- 'rules_exclude_archives' => ((isset($oldValues['right']['rules_exclude_archives']))?true:false),
480
- 'rules_archives_instances' => ((isset($options['right']['rules_archives_instances']) && ($options['right']['rules_archives_instances'] != ''))?explode(',', $options['right']['rules_archives_instances']):array()),
481
- 'rules_exclude_search' => ((isset($oldValues['right']['rules_exclude_search']))?true:false),
482
- 'rules_search_instances' => ((isset($options['right']['rules_search_instances']) && ($options['right']['rules_search_instances'] != ''))?explode(',', $options['right']['rules_search_instances']):array()),
483
- 'rules_exclude_page' => ((isset($oldValues['right']['rules_exclude_page']))?true:false),
484
- 'rules_page_exceptions' => ((isset($options['right']['rules_page_exceptions']) && ($options['right']['rules_page_exceptions'] != ''))?explode(',', $options['right']['rules_page_exceptions']):array()),
485
- 'rules_exclude_post' => ((isset($oldValues['right']['rules_exclude_post']))?true:false),
486
- 'rules_post_exceptions' => ((isset($options['right']['rules_post_exceptions']) && ($options['right']['rules_post_exceptions'] != ''))?explode(',', $options['right']['rules_post_exceptions']):array()),
487
- 'rules_post_categories_exceptions' => ((isset($options['right']['rules_post_categories_exceptions']) && ($options['right']['rules_post_categories_exceptions'] != ''))?explode(',', $options['right']['rules_post_categories_exceptions']):array()),
488
- 'rules_exclude_categories' => ((isset($oldValues['right']['rules_exclude_categories']))?true:false),
489
- 'rules_categories_instances' => ((isset($options['right']['rules_categories_instances']) && ($options['right']['rules_categories_instances'] != ''))?explode(',', $options['right']['rules_categories_instances']):array()),
490
- 'rules_categories_exceptions' => ((isset($options['right']['rules_categories_exceptions']) && ($options['right']['rules_categories_exceptions'] != ''))?explode(',', $options['right']['rules_categories_exceptions']):array()),
491
- 'geo_group1_countries' => ((isset($options['right']['country_1']) && ($options['right']['country_1'] != ''))?explode(',', $options['right']['country_1']):array()),
492
- 'geo_group1_adcode' => ((isset($oldValues['right']['country_code_1']))?$oldValues['right']['country_code_1']:''),
493
- 'geo_group2_countries' => array(),
494
- 'geo_group2_adcode' => '',
495
- 'styles' => ((isset($oldValues['right']['styles']))?$oldValues['right']['styles']:'margin: 5px; padding: 0px;'),
496
- 'notes' => ((isset($oldValues['right']['notes']))?$oldValues['right']['notes']:''),
497
- )
498
- );
499
- update_option('wp_insert_inpostads', $newValues);
500
- }
501
- }
502
- /* End Database Upgrade */
503
-
504
- /* Begin Ad Insertion */
505
- add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
506
- function wp_insert_inpostads_the_content($content) {
507
- if(!is_feed() && is_main_query()) {
508
- $inpostAds = get_option('wp_insert_inpostads');
509
-
510
- if(wp_insert_get_ad_status($inpostAds['left'])) {
511
- $content = '<div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; '.(($inpostAds['left']['styles'] != '')?$inpostAds['left']['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostAds['left']).'</div>'.$content;
512
- }
513
- if(wp_insert_get_ad_status($inpostAds['right'])) {
514
- $content = '<div class="wpInsert wpInsertInPostAd wpInsertRight" style="float: right; '.(($inpostAds['right']['styles'] != '')?$inpostAds['right']['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostAds['right']).'</div>'.$content;
515
- }
516
- if(wp_insert_get_ad_status($inpostAds['above'])) {
517
- $content = '<div class="wpInsert wpInsertInPostAd wpInsertAbove"'.(($inpostAds['above']['styles'] != '')?' style="'.$inpostAds['above']['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostAds['above']).'</div>'.$content;
518
- }
519
- if(wp_insert_get_ad_status($inpostAds['middle'])) {
520
- $paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
521
- if($paragraphCount > 1) {
522
- if(($inpostAds['middle']['paragraph_buffer_count'] == 0) || ($inpostAds['middle']['paragraph_buffer_count'] == '')) {
523
- $position = wp_insert_inpostads_get_midpoint('/p>', $content, round($paragraphCount / 2));
524
- } else {
525
- $position = wp_insert_inpostads_get_midpoint('/p>', $content, $inpostAds['middle']['paragraph_buffer_count']);
526
- }
527
- if($position) {
528
- if(($inpostAds['middle']['minimum_character_count'] == 0) || ($inpostAds['middle']['minimum_character_count'] == '')) {
529
- $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostAds['middle']['styles'] != '')?' style="'.$inpostAds['middle']['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostAds['middle']).'</div>', $position, 3);
530
- } else {
531
- if(strlen(strip_tags($content)) > $inpostAds['middle']['minimum_character_count']) {
532
- $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostAds['middle']['styles'] != '')?' style="'.$inpostAds['middle']['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostAds['middle']).'</div>', $position, 3);
533
- }
534
- }
535
- }
536
- }
537
- }
538
- if(wp_insert_get_ad_status($inpostAds['below'])) {
539
- $content = $content.'<div class="wpInsert wpInsertInPostAd wpInsertBelow"'.(($inpostAds['below']['styles'] != '')?' style="'.$inpostAds['below']['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostAds['below']).'</div>';
540
- }
541
- }
542
- return $content;
543
- }
544
-
545
- function wp_insert_inpostads_get_paragraph_count($content) {
546
- $paragraphs = explode('/p>', $content);
547
- $paragraphCount = 0;
548
- if(is_array($paragraphs)) {
549
- foreach($paragraphs as $paragraph) {
550
- if(strlen($paragraph) > 1) {
551
- $paragraphCount++;
552
- }
553
- }
554
- }
555
- return $paragraphCount;
556
- }
557
-
558
- function wp_insert_inpostads_get_midpoint($search, $string, $offset) {
559
- $arr = explode($search, $string);
560
- switch($offset) {
561
- case $offset == 0:
562
- return false;
563
- break;
564
- case $offset > max(array_keys($arr)):
565
- return false;
566
- break;
567
- default:
568
- return strlen(implode($search, array_slice($arr, 0, $offset)));
569
- break;
570
- }
571
- }
572
- /* End Ad Insertion */
573
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/modules/adstxt/css/module.css ADDED
File without changes
includes/{adstxt.php → modules/adstxt/functions.php} RENAMED
@@ -1,24 +1,4 @@
1
- <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_adstxt_plugin_card', 70);
4
- function wp_insert_adstxt_plugin_card() {
5
- echo '<div class="plugin-card adstxt-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>Authorized Digital Sellers / ads.txt</h4>';
8
- echo '<p>Authorized Digital Sellers, or ads.txt, is an <a href="https://iabtechlab.com/">IAB</a> initiative to improve transparency in programmatic advertising.</p>';
9
- echo '<p>You can easily manage your ads.txt from within Wp-Insert, providing confidence to brands they are buying authentic publisher inventory, protect you from counterfiet inventory and might even lead to higher monetization for your ad invertory.</p>';
10
- echo '</div>';
11
- echo '<div class="plugin-card-bottom">';
12
- if(wp_insert_adstxt_file_exists()) {
13
- echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Modify ads.txt</a>';
14
- } else {
15
- echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Generate ads.txt</a>';
16
- }
17
- echo '</div>';
18
- echo '</div>';
19
- }
20
- /* End Add Card in Admin Panel */
21
-
22
  /* Begin Create Ads.txt */
23
  add_action('wp_ajax_wp_insert_adstxt_generate_form_get_content', 'wp_insert_adstxt_generate_form_get_content');
24
  function wp_insert_adstxt_generate_form_get_content() {
@@ -52,7 +32,9 @@ function wp_insert_adstxt_generate_form_get_content() {
52
  echo '</div>';
53
  die();
54
  }
 
55
 
 
56
  add_action('wp_ajax_wp_insert_adstxt_generate_form_save_action', 'wp_insert_adstxt_generate_form_save_action');
57
  function wp_insert_adstxt_generate_form_save_action() {
58
  check_ajax_referer('wp-insert', 'wp_insert_nonce');
@@ -69,5 +51,48 @@ function wp_insert_adstxt_generate_form_save_action() {
69
  }
70
  die();
71
  }
72
- /* End Create Ads.txt */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ?>
1
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Begin Create Ads.txt */
3
  add_action('wp_ajax_wp_insert_adstxt_generate_form_get_content', 'wp_insert_adstxt_generate_form_get_content');
4
  function wp_insert_adstxt_generate_form_get_content() {
32
  echo '</div>';
33
  die();
34
  }
35
+ /* End Create Ads.txt */
36
 
37
+ /* Begin Update Ads.txt */
38
  add_action('wp_ajax_wp_insert_adstxt_generate_form_save_action', 'wp_insert_adstxt_generate_form_save_action');
39
  function wp_insert_adstxt_generate_form_save_action() {
40
  check_ajax_referer('wp-insert', 'wp_insert_nonce');
51
  }
52
  die();
53
  }
54
+ /* End Update Ads.txt */
55
+
56
+ /* Begin Common Functions */
57
+ function wp_insert_adstxt_file_exists() {
58
+ if(file_exists(trailingslashit(get_home_path()).'ads.txt')) {
59
+ return true;
60
+ }
61
+ return false;
62
+ }
63
+
64
+ function wp_insert_adstxt_get_content() {
65
+ if(wp_insert_adstxt_file_exists()) {
66
+ return @file_get_contents(trailingslashit(get_home_path()).'ads.txt');
67
+ }
68
+ return '';
69
+ }
70
+
71
+ function wp_insert_adstxt_update_content($content) {
72
+ if(get_filesystem_method() === 'direct') {
73
+ $creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
74
+ if(!WP_Filesystem($creds)) {
75
+ return false;
76
+ }
77
+ global $wp_filesystem;
78
+ if(!$wp_filesystem->put_contents(trailingslashit(get_home_path()).'ads.txt', $content, FS_CHMOD_FILE)) {
79
+ return false;
80
+ }
81
+ } else {
82
+ return false;
83
+ }
84
+ return true;
85
+ }
86
+
87
+ function wp_insert_adstxt_updation_failed_message($content) {
88
+ $output = '<div class="wp_insert_popup_content_wrapper">';
89
+ $output .= '<p>Auto Creation / Updation of ads.txt failed due to access permission restrictions on the server.</p>';
90
+ $output .= '<p>You have to manually upload the file using your Host\'s File manager or your favourite FTP program</p>';
91
+ $output .= '<p>ads.txt should be located in the root of your server. After manually uploading the file click <a href="'.site_url().'/ads.txt">here</a> to check if its accessible from the correct location</p>';
92
+ $output .= '<textarea style="display: none;" id="wp_insert_adstxt_content">'.$content.'</textarea>';
93
+ $output .= '<p><a onclick="wp_insert_adstxt_content_download()" class="button button-primary" href="javascript:;">Download ads.txt</a></p>';
94
+ $output .= '</div>';
95
+ return $output;
96
+ }
97
+ /* End Common Functions */
98
  ?>
includes/modules/adstxt/js/module.js ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_adstxt_generate',
4
+ 'Create / Update ads.txt',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('#wp_insert_adstxt_content').css('height', (jQuery('body').height() * 0.5)+'px');
9
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
10
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
11
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
12
+ var wp_insert_adstxt_content = jQuery('#wp_insert_adstxt_content').val();
13
+ jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
14
+ jQuery('.wp_insert_ajaxloader').show();
15
+ jQuery.post(
16
+ jQuery('#wp_insert_admin_ajax').val(), {
17
+ 'action': 'wp_insert_adstxt_generate_form_save_action',
18
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
19
+ 'wp_insert_adstxt_content': wp_insert_adstxt_content,
20
+ }, function(response) {
21
+ if(response == '###SUCCESS###') {
22
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
23
+ } else {
24
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
25
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
26
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
27
+ jQuery('.ui-dialog-content').html(response);
28
+ }
29
+ }
30
+ );
31
+ });
32
+ },
33
+ function() { },
34
+ function() { }
35
+ );
36
+ });
37
+
38
+ function wp_insert_adstxt_add_entry() {
39
+ var wp_insert_adstxt_new_entry_domain = jQuery("#wp_insert_adstxt_new_entry_domain").val();
40
+ var wp_insert_adstxt_new_entry_pid = jQuery("#wp_insert_adstxt_new_entry_pid").val();
41
+ var wp_insert_adstxt_new_entry_type = jQuery("#wp_insert_adstxt_new_entry_type").val();
42
+ var wp_insert_adstxt_new_entry_certauthority = jQuery("#wp_insert_adstxt_new_entry_certauthority").val();
43
+ var wp_insert_adstxt_content = jQuery("#wp_insert_adstxt_content").val();
44
+ var defaultBorderColor = jQuery("#wp_insert_adstxt_new_entry_domain").css("border-color");
45
+ var defaultLabelColor = jQuery("#wp_insert_adstxt_new_entry_domain").parent().find("small").css("color");
46
+
47
+ var isValidated = true;
48
+ jQuery("#wp_insert_adstxt_new_entry_domain").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
49
+ jQuery("#wp_insert_adstxt_new_entry_pid").css({"border-color": defaultBorderColor}).parent().find("small").css({"color": defaultLabelColor});
50
+
51
+
52
+ if(wp_insert_adstxt_new_entry_domain == '') {
53
+ jQuery("#wp_insert_adstxt_new_entry_domain").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
54
+ isValidated = false;
55
+ }
56
+ if(wp_insert_adstxt_new_entry_pid == '') {
57
+ jQuery("#wp_insert_adstxt_new_entry_pid").css({"border-color": "#B20303"}).parent().find("small").css({"color": "#B20303"});
58
+ isValidated = false;
59
+ }
60
+
61
+ if(isValidated) {
62
+ if((wp_insert_adstxt_content != '') && (jQuery.inArray((wp_insert_adstxt_content[wp_insert_adstxt_content.length -1]), ["\r", "\n"]) == -1)) {
63
+ wp_insert_adstxt_content += '\r\n';
64
+ }
65
+ wp_insert_adstxt_content += wp_insert_adstxt_new_entry_domain + ', ' + wp_insert_adstxt_new_entry_pid + ', ' + wp_insert_adstxt_new_entry_type;
66
+ if(wp_insert_adstxt_new_entry_certauthority != '') {
67
+ wp_insert_adstxt_content += ', ' + wp_insert_adstxt_new_entry_certauthority;
68
+ }
69
+ jQuery("#wp_insert_adstxt_content").val(wp_insert_adstxt_content);
70
+
71
+ jQuery("#wp_insert_adstxt_new_entry_domain").val('');
72
+ jQuery("#wp_insert_adstxt_new_entry_pid").val('');
73
+ jQuery("#wp_insert_adstxt_new_entry_type").val('DIRECT');
74
+ jQuery("#wp_insert_adstxt_new_entry_certauthority").val('');
75
+
76
+ jQuery("#wp_insert_adstxt_accordion").accordion({active: 0});
77
+ jQuery("#wp_insert_adstxt_content").focus();
78
+ }
79
+ }
80
+
81
+ function wp_insert_adstxt_content_download() {
82
+ var blob = new Blob([jQuery("#wp_insert_adstxt_content").val()], {type: 'text/csv'});
83
+ if(window.navigator.msSaveOrOpenBlob) {
84
+ window.navigator.msSaveBlob(blob, 'ads.txt');
85
+ }
86
+ else{
87
+ var elem = window.document.createElement('a');
88
+ elem.href = window.URL.createObjectURL(blob);
89
+ elem.download = 'ads.txt';
90
+ document.body.appendChild(elem);
91
+ elem.click();
92
+ document.body.removeChild(elem);
93
+ }
94
+ }
includes/modules/adstxt/module.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_adstxt_css', 0);
6
+ function wp_insert_module_adstxt_css() {
7
+ wp_register_style('wp-insert-module-adstxt-css', WP_INSERT_URL.'includes/modules/adstxt/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-adstxt-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_adstxt_js', 0);
12
+ function wp_insert_module_adstxt_js() {
13
+ wp_register_script('wp-insert-module-adstxt-js', WP_INSERT_URL.'includes/modules/adstxt/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-adstxt-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_adstxt_plugin_card', 100);
20
+ function wp_insert_adstxt_plugin_card() {
21
+ echo '<div class="plugin-card adstxt-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Authorized Digital Sellers / ads.txt</h4>';
24
+ echo '<p>Authorized Digital Sellers, or ads.txt, is an <a href="https://iabtechlab.com/">IAB</a> initiative to improve transparency in programmatic advertising.</p>';
25
+ echo '<p>You can easily manage your ads.txt from within Wp-Insert, providing confidence to brands they are buying authentic publisher inventory, protect you from counterfiet inventory and might even lead to higher monetization for your ad invertory.</p>';
26
+ echo '</div>';
27
+ echo '<div class="plugin-card-bottom">';
28
+ if(wp_insert_adstxt_file_exists()) {
29
+ echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Modify ads.txt</a>';
30
+ } else {
31
+ echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Generate ads.txt</a>';
32
+ }
33
+ echo '</div>';
34
+ echo '</div>';
35
+ }
36
+ /* End Add Card in Admin Panel */
37
+ ?>
includes/{adwidgets.php → modules/adwidgets/functions.php} RENAMED
@@ -1,28 +1,4 @@
1
  <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_adwidgets_plugin_card', 20);
4
- function wp_insert_adwidgets_plugin_card() {
5
- echo '<div class="plugin-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>Ad Widgets</h4>';
8
- echo '<p>Ads shown inside widget enabled areas.</p>';
9
- echo '</div>';
10
- echo '<div class="plugin-card-bottom">';
11
- $adwidgets = get_option('wp_insert_adwidgets');
12
- if(isset($adwidgets) && is_array($adwidgets)) {
13
- foreach($adwidgets as $key => $value) {
14
- echo '<p>';
15
- echo '<a id="wp_insert_adwidgets_'.$key.'" href="javascript:;" onclick="wp_insert_adwidgets_click_handler(\''.$key.'\', \''.$value['title'].'\')">Ad Widget : '.$value['title'].'</a>';
16
- echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_adwidgets_remove(\''.$key.'\')"></span>';
17
- echo '</p>';
18
- }
19
- }
20
- echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_adwidgets_new" href="#" class="button-secondary">Add New Ad Widget</a></p>';
21
- echo '</div>';
22
- echo '</div>';
23
- }
24
- /* End Add Card in Admin Panel */
25
-
26
  /* Begin Add New Adwidget Content */
27
  add_action('wp_ajax_wp_insert_adwidgets_new_form_get_content', 'wp_insert_adwidgets_new_form_get_content');
28
  function wp_insert_adwidgets_new_form_get_content() {
@@ -215,8 +191,6 @@ function wp_insert_adwidgets_form_save_action($identifier) {
215
  $adwidgets[$identifier]['identifier'] = ((isset($_POST['wp_insert_adwidgets_identifier']))?$_POST['wp_insert_adwidgets_identifier']:'');
216
  $adwidgets[$identifier]['status'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_status']) && ($_POST['wp_insert_adwidgets_'.$identifier.'_status'] == 'true'))?'1':'');
217
 
218
- $adwidgets[$identifier]['title'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_title']))?$_POST['wp_insert_adwidgets_'.$identifier.'_title']:'');
219
-
220
  $adwidgets[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']:'');
221
  $adwidgets[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']:'');
222
  $adwidgets[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']:'');
@@ -242,85 +216,12 @@ function wp_insert_adwidgets_form_save_action($identifier) {
242
 
243
  $adwidgets[$identifier]['styles'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_styles']))?$_POST['wp_insert_adwidgets_'.$identifier.'_styles']:'');
244
 
 
245
  $adwidgets[$identifier]['notes'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_notes']))?$_POST['wp_insert_adwidgets_'.$identifier.'_notes']:'');
246
  update_option('wp_insert_adwidgets', $adwidgets);
247
  }
248
  /* End Shared UI Functions */
249
 
250
- /* Begin Database Upgrade */
251
- add_action('wp_insert_upgrade_database', 'wp_insert_adwidgets_upgrade_database');
252
- function wp_insert_adwidgets_upgrade_database() {
253
- if(!get_option('wp_insert_adwidgets')) {
254
- $newValues = array();
255
-
256
- $oldValues = get_option('wp_insert_adwidgets_options');
257
- for($i = 1; $i <= 10; $i++) {
258
- if(isset($oldValues['adwidgets-'.$i]['ad_code_1']) && ($oldValues['adwidgets-'.$i]['ad_code_1'] != '')) {
259
- $newValues[$i] = array (
260
- 'identifier' => $i,
261
- 'status' => ((isset($oldValues['adwidgets-'.$i]['status']) && $oldValues['adwidgets-'.$i]['status'] == true)?'1':''),
262
- 'title' => 'adwidgets-'.$i,
263
- 'primary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_1']))?$oldValues['adwidgets-'.$i]['ad_code_1']:''),
264
- 'secondary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_2']))?$oldValues['adwidgets-'.$i]['ad_code_2']:''),
265
- 'tertiary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_3']))?$oldValues['adwidgets-'.$i]['ad_code_3']:''),
266
- 'rules_exclude_loggedin' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_loggedin']))?true:false),
267
- 'rules_exclude_mobile_devices' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_mobile_devices']))?true:false),
268
- 'rules_exclude_home' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_home']))?true:false),
269
- 'rules_exclude_archives' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_archives']))?true:false),
270
- 'rules_exclude_search' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_search']))?true:false),
271
- 'rules_exclude_page' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_page']))?true:false),
272
- 'rules_page_exceptions' => ((isset($options['adwidgets-'.$i]['rules_page_exceptions']) && ($options['adwidgets-'.$i]['rules_page_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_page_exceptions']):array()),
273
- 'rules_exclude_post' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_post']))?true:false),
274
- 'rules_post_exceptions' => ((isset($options['adwidgets-'.$i]['rules_post_exceptions']) && ($options['adwidgets-'.$i]['rules_post_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_post_exceptions']):array()),
275
- 'rules_post_categories_exceptions' => ((isset($options['adwidgets-'.$i]['rules_post_categories_exceptions']) && ($options['adwidgets-'.$i]['rules_post_categories_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_post_categories_exceptions']):array()),
276
- 'rules_exclude_categories' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_categories']))?true:false),
277
- 'rules_categories_exceptions' => ((isset($options['adwidgets-'.$i]['rules_categories_exceptions']) && ($options['adwidgets-'.$i]['rules_categories_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_categories_exceptions']):array()),
278
- 'geo_group1_countries' => ((isset($options['adwidgets-'.$i]['country_1']) && ($options['adwidgets-'.$i]['country_1'] != ''))?explode(',', $options['adwidgets-'.$i]['country_1']):array()),
279
- 'geo_group1_adcode' => ((isset($oldValues['adwidgets-'.$i]['country_code_1']))?$oldValues['adwidgets-'.$i]['country_code_1']:''),
280
- 'geo_group2_countries' => array(),
281
- 'geo_group2_adcode' => '',
282
- 'styles' => ((isset($oldValues['adwidgets-'.$i]['styles']))?$oldValues['adwidgets-'.$i]['styles']:'margin: 5px; padding: 0px;'),
283
- 'notes' => ((isset($oldValues['adwidgets-'.$i]['notes']))?$oldValues['adwidgets-'.$i]['notes']:''),
284
- );
285
- }
286
- }
287
-
288
- $oldValues = get_option('wp_insert_more_adwidgets_options');
289
- for($i = 11; $i <= 20; $i++) {
290
- if(isset($oldValues['adwidgets-'.$i]['ad_code_1']) && ($oldValues['adwidgets-'.$i]['ad_code_1'] != '')) {
291
- $newValues[$i] = array (
292
- 'identifier' => $i,
293
- 'status' => ((isset($oldValues['adwidgets-'.$i]['status']) && $oldValues['adwidgets-'.$i]['status'] == true)?'1':''),
294
- 'title' => 'adwidgets-'.$i,
295
- 'primary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_1']))?$oldValues['adwidgets-'.$i]['ad_code_1']:''),
296
- 'secondary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_2']))?$oldValues['adwidgets-'.$i]['ad_code_2']:''),
297
- 'tertiary_ad_code' => ((isset($oldValues['adwidgets-'.$i]['ad_code_3']))?$oldValues['adwidgets-'.$i]['ad_code_3']:''),
298
- 'rules_exclude_loggedin' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_loggedin']))?true:false),
299
- 'rules_exclude_mobile_devices' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_mobile_devices']))?true:false),
300
- 'rules_exclude_home' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_home']))?true:false),
301
- 'rules_exclude_archives' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_archives']))?true:false),
302
- 'rules_exclude_search' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_search']))?true:false),
303
- 'rules_exclude_page' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_page']))?true:false),
304
- 'rules_page_exceptions' => ((isset($options['adwidgets-'.$i]['rules_page_exceptions']) && ($options['adwidgets-'.$i]['rules_page_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_page_exceptions']):array()),
305
- 'rules_exclude_post' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_post']))?true:false),
306
- 'rules_post_exceptions' => ((isset($options['adwidgets-'.$i]['rules_post_exceptions']) && ($options['adwidgets-'.$i]['rules_post_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_post_exceptions']):array()),
307
- 'rules_post_categories_exceptions' => ((isset($options['adwidgets-'.$i]['rules_post_categories_exceptions']) && ($options['adwidgets-'.$i]['rules_post_categories_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_post_categories_exceptions']):array()),
308
- 'rules_exclude_categories' => ((isset($oldValues['adwidgets-'.$i]['rules_exclude_categories']))?true:false),
309
- 'rules_categories_exceptions' => ((isset($options['adwidgets-'.$i]['rules_categories_exceptions']) && ($options['adwidgets-'.$i]['rules_categories_exceptions'] != ''))?explode(',', $options['adwidgets-'.$i]['rules_categories_exceptions']):array()),
310
- 'geo_group1_countries' => ((isset($options['adwidgets-'.$i]['country_1']) && ($options['adwidgets-'.$i]['country_1'] != ''))?explode(',', $options['adwidgets-'.$i]['country_1']):array()),
311
- 'geo_group1_adcode' => ((isset($oldValues['adwidgets-'.$i]['country_code_1']))?$oldValues['adwidgets-'.$i]['country_code_1']:''),
312
- 'geo_group2_countries' => array(),
313
- 'geo_group2_adcode' => '',
314
- 'styles' => ((isset($oldValues['adwidgets-'.$i]['styles']))?$oldValues['adwidgets-'.$i]['styles']:'margin: 5px; padding: 0px;'),
315
- 'notes' => ((isset($oldValues['adwidgets-'.$i]['notes']))?$oldValues['adwidgets-'.$i]['notes']:''),
316
- );
317
- }
318
- }
319
- update_option('wp_insert_adwidgets', $newValues);
320
- }
321
- }
322
- /* End Database Upgrade */
323
-
324
  /* Begin Ad Widget Insertion */
325
  add_action('widgets_init', create_function('', 'register_widget("wpInsertAdWidget");'));
326
  class wpInsertAdWidget extends WP_Widget {
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Begin Add New Adwidget Content */
3
  add_action('wp_ajax_wp_insert_adwidgets_new_form_get_content', 'wp_insert_adwidgets_new_form_get_content');
4
  function wp_insert_adwidgets_new_form_get_content() {
191
  $adwidgets[$identifier]['identifier'] = ((isset($_POST['wp_insert_adwidgets_identifier']))?$_POST['wp_insert_adwidgets_identifier']:'');
192
  $adwidgets[$identifier]['status'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_status']) && ($_POST['wp_insert_adwidgets_'.$identifier.'_status'] == 'true'))?'1':'');
193
 
 
 
194
  $adwidgets[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']:'');
195
  $adwidgets[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']:'');
196
  $adwidgets[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']:'');
216
 
217
  $adwidgets[$identifier]['styles'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_styles']))?$_POST['wp_insert_adwidgets_'.$identifier.'_styles']:'');
218
 
219
+ $adwidgets[$identifier]['title'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_title']))?$_POST['wp_insert_adwidgets_'.$identifier.'_title']:'');
220
  $adwidgets[$identifier]['notes'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_notes']))?$_POST['wp_insert_adwidgets_'.$identifier.'_notes']:'');
221
  update_option('wp_insert_adwidgets', $adwidgets);
222
  }
223
  /* End Shared UI Functions */
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  /* Begin Ad Widget Insertion */
226
  add_action('widgets_init', create_function('', 'register_widget("wpInsertAdWidget");'));
227
  class wpInsertAdWidget extends WP_Widget {
includes/modules/adwidgets/js/module.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_adwidgets_new',
4
+ 'Ad Widget : Add New',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ var identifier = jQuery(".wp_insert_adwidgets_identifier").val();
12
+ var adwidgetLink = jQuery("<a></a>");
13
+ adwidgetLink.attr("id", "wp_insert_adwidgets_"+identifier);
14
+ adwidgetLink.attr("href", "javascript:;");
15
+ adwidgetLink.attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
16
+ adwidgetLink.html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
17
+ var deleteButton = jQuery("<span></span>");
18
+ deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
19
+ deleteButton.attr("onClick", "wp_insert_adwidgets_remove(\'"+identifier+"\')");
20
+ jQuery("#wp_insert_adwidgets_new").parent().before(jQuery("<p></p>").append(adwidgetLink, deleteButton));
21
+ wp_insert_adwidgets_update(identifier);
22
+ },
23
+ function() { }
24
+ );
25
+ });
26
+
27
+ function wp_insert_adwidgets_click_handler(identifier, title) {
28
+ jQuery('<div id="wp_insert_adwidgets_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
29
+ 'modal': true,
30
+ 'resizable': false,
31
+ 'width': jQuery("body").width() * 0.8,
32
+ 'maxWidth': jQuery("body").width() * 0.8,
33
+ 'maxHeight': jQuery("body").height() * 0.9,
34
+ 'title': 'Ad Widget : '+title,
35
+ position: { my: 'center', at: 'center', of: window },
36
+ open: function (event, ui) {
37
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
38
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
39
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
40
+ jQuery.post(
41
+ jQuery('#wp_insert_admin_ajax').val(), {
42
+ 'action': 'wp_insert_adwidgets_existing_form_get_content',
43
+ 'wp_insert_adwidgets_identifier': identifier,
44
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
45
+ }, function(response) {
46
+ jQuery('.wp_insert_ajaxloader').hide();
47
+ jQuery('.ui-dialog-content').html(response);
48
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
49
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
50
+ jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
51
+ jQuery('.ui-dialog').css({'position': 'fixed'});
52
+ jQuery('#wp_insert_adwidgets_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
53
+ }
54
+ );
55
+ },
56
+ buttons: {
57
+ 'Update': function() {
58
+ jQuery("#wp_insert_adwidgets_"+identifier).html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
59
+ jQuery("#wp_insert_adwidgets_"+identifier).attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
60
+ wp_insert_adwidgets_update(identifier);
61
+ jQuery(this).dialog('close');
62
+ },
63
+ Cancel: function() {
64
+ jQuery(this).dialog('close');
65
+ }
66
+ },
67
+ close: function() {
68
+ jQuery(this).dialog('destroy');
69
+ }
70
+ });
71
+ }
72
+
73
+ function wp_insert_adwidgets_update(identifier) {
74
+ args = {};
75
+ args['action'] = 'wp_insert_adwidgets_existing_form_save_action';
76
+ args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
77
+ args['wp_insert_adwidgets_identifier'] = identifier;
78
+ args['wp_insert_adwidgets_'+identifier+'_status'] = jQuery('#wp_insert_adwidgets_'+identifier+'_status').prop('checked');
79
+
80
+ args['wp_insert_adwidgets_'+identifier+'_title'] = jQuery('#wp_insert_adwidgets_'+identifier+'_title').val();
81
+
82
+ args['wp_insert_adwidgets_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_primary_ad_code').val();
83
+ args['wp_insert_adwidgets_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_secondary_ad_code').val();
84
+ args['wp_insert_adwidgets_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_tertiary_ad_code').val();
85
+
86
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin').prop('checked');
87
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
88
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_404').prop('checked');
89
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_home').prop('checked');
90
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_archives').prop('checked');
91
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_search').prop('checked');
92
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_page').prop('checked');
93
+ args['wp_insert_adwidgets_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
94
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_post').prop('checked');
95
+ args['wp_insert_adwidgets_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
96
+ args['wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
97
+ args['wp_insert_adwidgets_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_categories').prop('checked');
98
+ args['wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
99
+
100
+ args['wp_insert_adwidgets_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
101
+ args['wp_insert_adwidgets_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_adcode').val();
102
+ args['wp_insert_adwidgets_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
103
+ args['wp_insert_adwidgets_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_adcode').val();
104
+
105
+ args['wp_insert_adwidgets_'+identifier+'_styles'] = jQuery('#wp_insert_adwidgets_'+identifier+'_styles').val();
106
+
107
+ args['wp_insert_adwidgets_'+identifier+'_notes'] = jQuery('#wp_insert_adwidgets_'+identifier+'_notes').val();
108
+
109
+ jQuery.post(
110
+ jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
111
+ );
112
+ }
113
+
114
+ function wp_insert_adwidgets_remove(identifier) {
115
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
116
+ 'modal': true,
117
+ 'resizable': false,
118
+ 'title': 'Deletion Confirmation',
119
+ position: { my: 'center', at: 'center', of: window },
120
+ open: function (event, ui) {
121
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
122
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
123
+ },
124
+ buttons : {
125
+ 'Confirm': function() {
126
+ jQuery("#wp_insert_adwidgets_"+identifier).parent().remove();
127
+ jQuery.post(
128
+ jQuery('#wp_insert_admin_ajax').val(), {
129
+ 'action': 'wp_insert_adwidgets_remove',
130
+ 'wp_insert_adwidgets_identifier': identifier,
131
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
132
+ }, function(response) {
133
+ }
134
+ );
135
+ jQuery(this).dialog("close");
136
+ },
137
+ 'Cancel': function() {
138
+ jQuery(this).dialog("close");
139
+ }
140
+ },
141
+ close: function() {
142
+ jQuery(this).dialog('destroy');
143
+ }
144
+ });
145
+ }
includes/modules/adwidgets/module.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_adwidgets_css', 0);
6
+ function wp_insert_module_adwidgets_css() {
7
+ wp_register_style('wp-insert-module-adwidgets-css', WP_INSERT_URL.'includes/modules/adwidgets/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-adwidgets-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_adwidgets_js', 0);
12
+ function wp_insert_module_adwidgets_js() {
13
+ wp_register_script('wp-insert-module-adwidgets-js', WP_INSERT_URL.'includes/modules/adwidgets/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-adwidgets-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_adwidgets_plugin_card', 50);
20
+ function wp_insert_adwidgets_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Ad Widgets</h4>';
24
+ echo '<p>Ads shown inside widget enabled areas.</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ $adwidgets = get_option('wp_insert_adwidgets');
28
+ if(isset($adwidgets) && is_array($adwidgets)) {
29
+ foreach($adwidgets as $key => $value) {
30
+ echo '<p>';
31
+ echo '<a id="wp_insert_adwidgets_'.$key.'" href="javascript:;" onclick="wp_insert_adwidgets_click_handler(\''.$key.'\', \''.$value['title'].'\')">Ad Widget : '.$value['title'].'</a>';
32
+ echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_adwidgets_remove(\''.$key.'\')"></span>';
33
+ echo '</p>';
34
+ }
35
+ }
36
+ echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_adwidgets_new" href="#" class="button-secondary">Add New Ad Widget</a></p>';
37
+ echo '</div>';
38
+ echo '</div>';
39
+ }
40
+ /* End Add Card in Admin Panel */
41
+ ?>
includes/modules/inpostads/functions.php ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Add New In-Post Ads Content */
3
+ add_action('wp_ajax_wp_insert_inpostads_new_form_get_content', 'wp_insert_inpostads_new_form_get_content');
4
+ function wp_insert_inpostads_new_form_get_content() {
5
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
6
+ wp_insert_inpostads_form_get_content(uniqid());
7
+ die();
8
+ }
9
+ /* End Add New In-Post Ads Content */
10
+
11
+ /* Begin Edit In-Post Ads Content */
12
+ add_action('wp_ajax_wp_insert_inpostads_existing_form_get_content', 'wp_insert_inpostads_existing_form_get_content');
13
+ function wp_insert_inpostads_existing_form_get_content() {
14
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
15
+ if(isset($_POST['wp_insert_inpostads_identifier'])) {
16
+ wp_insert_inpostads_form_get_content($_POST['wp_insert_inpostads_identifier']);
17
+ }
18
+ die();
19
+ }
20
+
21
+ add_action('wp_ajax_wp_insert_inpostads_existing_form_save_action', 'wp_insert_inpostads_existing_form_save_action');
22
+ function wp_insert_inpostads_existing_form_save_action() {
23
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
24
+ if(isset($_POST['wp_insert_inpostads_identifier'])) {
25
+ wp_insert_inpostads_form_save_action($_POST['wp_insert_inpostads_identifier']);
26
+ }
27
+ die();
28
+ }
29
+ /* End Edit In-Post Ads Content */
30
+
31
+ /* Begin Delete In-Post Ads Content */
32
+ add_action('wp_ajax_wp_insert_inpostads_remove', 'wp_insert_inpostads_remove');
33
+ function wp_insert_inpostads_remove() {
34
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
35
+ if(isset($_POST['wp_insert_inpostads_identifier'])) {
36
+ $inpostads = get_option('wp_insert_inpostads');
37
+ unset($inpostads[$_POST['wp_insert_inpostads_identifier']]);
38
+ update_option('wp_insert_inpostads', $inpostads);
39
+ }
40
+ die();
41
+ }
42
+ /* End Delete In-Post Ads Content */
43
+
44
+ /* Begin Shared UI Functions */
45
+ function wp_insert_inpostads_form_get_content($identifier) {
46
+ $inpostads = get_option('wp_insert_inpostads');
47
+ echo '<div class="wp_insert_popup_content_wrapper">';
48
+ $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_inpostads['.$identifier.']', 'values' => $inpostads[$identifier]));
49
+ $control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_inpostads_status', 'optionName' => 'status'));
50
+ $control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_inpostads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
51
+ echo $control->HTML;
52
+ $control->clear_controls();
53
+ echo '<div id="wp_insert_inpostads_'.$identifier.'_accordion">';
54
+ echo '<h3>Location</h3>';
55
+ echo '<div>';
56
+ $paragraphPositioningOptions = array(
57
+ array('text' => '1st', 'value' => '1'),
58
+ array('text' => '2nd', 'value' => '2'),
59
+ array('text' => '3rd', 'value' => '3'),
60
+ array('text' => '4th', 'value' => '4'),
61
+ array('text' => '5th', 'value' => '5'),
62
+ array('text' => '6th', 'value' => '6'),
63
+ array('text' => '7th', 'value' => '7'),
64
+ array('text' => '8th', 'value' => '8'),
65
+ array('text' => '9th', 'value' => '9'),
66
+ array('text' => '10th', 'value' => '10'),
67
+ );
68
+ $control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphtopposition', 'options' => $paragraphPositioningOptions));
69
+ $nthParagraphTopControl = $control->HTML;
70
+ $control->clear_controls();
71
+ $control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphbottomposition', 'options' => $paragraphPositioningOptions));
72
+ $nthParagraphBottomControl = $control->HTML;
73
+ $control->clear_controls();
74
+
75
+ if(!isset($inpostads[$identifier]['location'])) {
76
+ switch($identifier) {
77
+ case 'above':
78
+ $inpostads[$identifier]['location'] = 'above';
79
+ break;
80
+ case 'middle':
81
+ $inpostads[$identifier]['location'] = 'middle';
82
+ break;
83
+ case 'below':
84
+ $inpostads[$identifier]['location'] = 'below';
85
+ break;
86
+ case 'left':
87
+ $inpostads[$identifier]['location'] = 'left';
88
+ break;
89
+ case 'right':
90
+ $inpostads[$identifier]['location'] = 'right';
91
+ break;
92
+ default:
93
+ $inpostads[$identifier]['location'] = 'above';
94
+ break;
95
+ }
96
+ }
97
+ $locations = array(
98
+ array('text' => 'Above Post Content', 'value' => 'above'),
99
+ array('text' => 'Middle of Post Content', 'value' => 'middle'),
100
+ array('text' => 'Below Post Content', 'value' => 'below'),
101
+ array('text' => 'To the Left of Post Content', 'value' => 'left'),
102
+ array('text' => 'To the Right of Post Content', 'value' => 'right'),
103
+ array('text' => 'After '.$nthParagraphTopControl.' Paragraph in Post Content (From the Top)', 'value' => 'paragraphtop'),
104
+ array('text' => 'After '.$nthParagraphBottomControl.' Paragraph in Post Content (From the Bottom)', 'value' => 'paragraphbottom'),
105
+ );
106
+ $control->add_control(array('type' => 'radio-group', 'style' => 'line-height: 40px; margin-top: 3px;', 'optionName' => 'location', 'options' => $locations, 'value' => $inpostads[$identifier]['location']));
107
+ $control->create_section('Location');
108
+ echo $control->HTML;
109
+ $control->clear_controls();
110
+ echo '</div>';
111
+ echo '<h3>Ad Code</h3>';
112
+ echo '<div>';
113
+ $abtestingMode = get_option('wp_insert_abtesting_mode');
114
+ $adTypes = array(
115
+ array('text' => 'Use Generic / Custom Ad Code', 'value' => 'generic'),
116
+ array('text' => 'vi stories', 'value' => 'vicode'),
117
+ );
118
+ $control->add_control(array('type' => 'select', 'label' => 'Ad Type', 'optionName' => 'primary_ad_code_type', 'options' => $adTypes));
119
+ echo $control->HTML;
120
+ $control->clear_controls();
121
+
122
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
123
+ $control->create_section('<span id="primary_ad_code_type_generic" class="isSelectedIndicator"></span><span class="isSelectedIndicatorText">Generic / Custom Ad Code (Primary Network)</span>');
124
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
125
+ echo $control->HTML;
126
+ $control->clear_controls();
127
+
128
+ $IsVILoggedin = wp_insert_vi_api_is_loggedin();
129
+ $isJSTagGenerated = ((wp_insert_vi_api_get_vi_code() === false)?false:true);
130
+ $isVIDisabled = false;
131
+ $viMessage = '';
132
+ if(!$IsVILoggedin && !$isJSTagGenerated) {
133
+ $isVIDisabled = true;
134
+ $viMessage = '<p>Introducing <b>vi stories</b> – the video content and advertising player.</p>';
135
+ $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
136
+ } else if($IsVILoggedin && !$isJSTagGenerated) {
137
+ $isVIDisabled = true;
138
+ $viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. In the <i>video intelligence</i> panel, click <i>Configure</i></p>';
139
+ //$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
140
+ } else if(!$IsVILoggedin && $isJSTagGenerated) {
141
+ $isVIDisabled = false;
142
+ $viMessage = '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
143
+ } else {
144
+ $isVIDisabled = false;
145
+ $viMessage = wp_insert_vi_customize_adcode_get_settings();
146
+ $viMessage .= '<p>To configure <b>vi stories</b>, go to the <i>video intelligence</i> panel, click <i>Configure</i></p>';
147
+ //$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
148
+ }
149
+
150
+ $control->HTML .= $viMessage;
151
+ $control->create_section('<span id="primary_ad_code_type_vicode" class="isSelectedIndicator '.(($isVIDisabled)?'disabled':'').'"></span><span class="isSelectedIndicatorText">vi stories (Primary Network)</span>');
152
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
153
+ echo $control->HTML;
154
+ $control->clear_controls();
155
+
156
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
157
+ $control->create_section('Ad Code (Secondary Network)');
158
+ if($abtestingMode != '2' && $abtestingMode != '3') {
159
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
160
+ }
161
+ echo $control->HTML;
162
+ $control->clear_controls();
163
+
164
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
165
+ $control->create_section('Ad Code (Tertiary Network)');
166
+ if($abtestingMode != '3') {
167
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
168
+ }
169
+ echo $control->HTML;
170
+ $control->clear_controls();
171
+ echo '</div>';
172
+ echo '<h3>Rules</h3>';
173
+ echo '<div>';
174
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
175
+ $control->create_section('Logged in Users');
176
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
177
+ echo $control->HTML;
178
+ $control->clear_controls();
179
+
180
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
181
+ $control->create_section('Mobile Devices');
182
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
183
+ echo $control->HTML;
184
+ $control->clear_controls();
185
+
186
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
187
+ $control->create_section('404 Pages');
188
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
189
+ echo $control->HTML;
190
+ $control->clear_controls();
191
+
192
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
193
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_home_instances', 'options' => $instances));
194
+ $control->create_section('Home');
195
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
196
+ echo $control->HTML;
197
+ $control->clear_controls();
198
+
199
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
200
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_archives_instances', 'options' => $instances));
201
+ $control->create_section('Archives');
202
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
203
+ echo $control->HTML;
204
+ $control->clear_controls();
205
+
206
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
207
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_search_instances', 'options' => $instances));
208
+ $control->create_section('Search Results');
209
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
210
+ echo $control->HTML;
211
+ $control->clear_controls();
212
+
213
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
214
+ $control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
215
+ $control->create_section('Single Pages');
216
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
217
+ echo $control->HTML;
218
+ $control->clear_controls();
219
+
220
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
221
+ $control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
222
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
223
+ $control->create_section('Single Posts');
224
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
225
+ echo $control->HTML;
226
+ $control->clear_controls();
227
+
228
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
229
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_categories_instances', 'options' => $instances));
230
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
231
+ $control->create_section('Category Archives');
232
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
233
+ echo $control->HTML;
234
+ $control->clear_controls();
235
+ echo '</div>';
236
+ echo '<h3>Geo Targeting</h3>';
237
+ echo '<div>';
238
+ echo '<p>';
239
+ echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
240
+ echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
241
+ echo '</p>';
242
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
243
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
244
+ $control->create_section('Group 1');
245
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
246
+ echo $control->HTML;
247
+ $control->clear_controls();
248
+
249
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
250
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
251
+ $control->create_section('Group 2');
252
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
253
+ echo $control->HTML;
254
+ $control->clear_controls();
255
+ echo '<p>';
256
+ echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
257
+ echo '</p>';
258
+ echo '</div>';
259
+ echo '<h3>Styles</h3>';
260
+ echo '<div>';
261
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
262
+ $control->create_section('Styles');
263
+ echo $control->HTML;
264
+ $control->clear_controls();
265
+ echo '</div>';
266
+ echo '<h3>Notes</h3>';
267
+ echo '<div>';
268
+ if(!isset($inpostads[$identifier]['title']) || ($inpostads[$identifier]['title'] == '')) {
269
+ switch($identifier) {
270
+ case 'above':
271
+ $inpostads[$identifier]['title'] = 'Above Post Content';
272
+ break;
273
+ case 'middle':
274
+ $inpostads[$identifier]['title'] = 'Middle of Post Content';
275
+ break;
276
+ case 'below':
277
+ $inpostads[$identifier]['title'] = 'Below Post Content';
278
+ break;
279
+ case 'left':
280
+ $inpostads[$identifier]['title'] = 'To the Left of Post Content';
281
+ break;
282
+ case 'right':
283
+ $inpostads[$identifier]['title'] = 'To the Right of Post Content';
284
+ break;
285
+ default:
286
+ $inpostads[$identifier]['title'] = $identifier;
287
+ break;
288
+ }
289
+ }
290
+ $control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => $inpostads[$identifier]['title']));
291
+ $control->create_section('Title');
292
+ echo $control->HTML;
293
+ $control->clear_controls();
294
+
295
+ $control->add_control(array('type' => 'textarea', 'optionName' => 'notes', 'style' => 'height: 220px;'));
296
+ $control->create_section('Notes');
297
+ echo $control->HTML;
298
+ $control->clear_controls();
299
+ echo '</div>';
300
+ echo '<h3 class="wp_insert_inpostads_location_middle_panel">Positioning</h3>';
301
+ echo '<div>';
302
+ $control->add_control(array('type' => 'text', 'label' => 'Minimum Character Count', 'optionName' => 'minimum_character_count', 'helpText' => 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.'));
303
+ $control->add_control(array('type' => 'text', 'label' => 'Paragraph Buffer Count', 'optionName' => 'paragraph_buffer_count', 'helpText' => 'Shows the ad after X number of Paragraphs. If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.'));
304
+ $control->create_section('Positioning');
305
+ echo $control->HTML;
306
+ $control->clear_controls();
307
+ echo '</div>';
308
+ echo '</div>';
309
+ echo '<script type="text/javascript">';
310
+ echo $control->JS;
311
+ echo 'jQuery("#wp_insert_inpostads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
312
+ echo 'wp_insert_inpostads_primary_ad_code_type_change("'.$identifier.'");';
313
+ echo 'wp_insert_inpostads_primary_ad_code_location_change_action("'.$identifier.'");';
314
+ echo 'wp_insert_inpostads_vi_customize_adcode();';
315
+ echo '</script>';
316
+ echo '</div>';
317
+ }
318
+
319
+ function wp_insert_inpostads_form_save_action($identifier) {
320
+ $inpostads = get_option('wp_insert_inpostads');
321
+ $inpostads[$identifier]['identifier'] = ((isset($_POST['wp_insert_inpostads_identifier']))?$_POST['wp_insert_inpostads_identifier']:'');
322
+ $inpostads[$identifier]['status'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_status']) && ($_POST['wp_insert_inpostads_'.$identifier.'_status'] == 'true'))?'1':'');
323
+
324
+ $inpostads[$identifier]['location'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_location']))?$_POST['wp_insert_inpostads_'.$identifier.'_location']:'');
325
+ $inpostads[$identifier]['paragraphtopposition'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraphtopposition']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraphtopposition']:'');
326
+ $inpostads[$identifier]['paragraphbottomposition'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraphbottomposition']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraphbottomposition']:'');
327
+
328
+ $inpostads[$identifier]['primary_ad_code_type'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code_type']))?$_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code_type']:'');
329
+ $inpostads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code']:'');
330
+ $inpostads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_secondary_ad_code']:'');
331
+ $inpostads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_tertiary_ad_code']:'');
332
+
333
+ $inpostads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_loggedin']:'');
334
+ $inpostads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_mobile_devices']:'');
335
+ $inpostads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_404']:'');
336
+ $inpostads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_home']:'');
337
+ $inpostads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_archives']:'');
338
+ $inpostads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_search']:'');
339
+ $inpostads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_page']:'');
340
+ $inpostads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_page_exceptions']:'');
341
+ $inpostads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_post']:'');
342
+ $inpostads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_post_exceptions']:'');
343
+ $inpostads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_post_categories_exceptions']:'');
344
+ $inpostads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_categories']:'');
345
+ $inpostads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_categories_exceptions']:'');
346
+
347
+ $inpostads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_countries']:'');
348
+ $inpostads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_adcode']:'');
349
+ $inpostads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_countries']:'');
350
+ $inpostads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_adcode']:'');
351
+
352
+ $inpostads[$identifier]['styles'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_styles']))?$_POST['wp_insert_inpostads_'.$identifier.'_styles']:'');
353
+
354
+ $inpostads[$identifier]['title'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_title']))?$_POST['wp_insert_inpostads_'.$identifier.'_title']:'');
355
+ $inpostads[$identifier]['notes'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_notes']))?$_POST['wp_insert_inpostads_'.$identifier.'_notes']:'');
356
+
357
+ $inpostads[$identifier]['minimum_character_count'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_minimum_character_count']))?$_POST['wp_insert_inpostads_'.$identifier.'_minimum_character_count']:'');
358
+ $inpostads[$identifier]['paragraph_buffer_count'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraph_buffer_count']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraph_buffer_count']:'');
359
+
360
+ update_option('wp_insert_inpostads', $inpostads);
361
+ }
362
+ /* End Shared UI Functions */
363
+
364
+ /* Begin In-Post Ads Ad Insertion */
365
+ add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
366
+ function wp_insert_inpostads_the_content($content) {
367
+ if(function_exists('is_amp_endpoint') && is_amp_endpoint()) {
368
+ return $content;
369
+ } else if(!is_feed() && is_main_query()) {
370
+ $inpostads = get_option('wp_insert_inpostads');
371
+ if(isset($inpostads) && is_array($inpostads)) {
372
+ $paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
373
+ foreach($inpostads as $key => $inpostad) {
374
+ if(!isset($inpostad['location'])) { //Get the location value from the key for old users who doesnt have a location saved.
375
+ switch($key) {
376
+ case 'above':
377
+ $inpostad['location'] = 'above';
378
+ break;
379
+ case 'middle':
380
+ $inpostad['location'] = 'middle';
381
+ break;
382
+ case 'below':
383
+ $inpostad['location'] = 'below';
384
+ break;
385
+ case 'left':
386
+ $inpostad['location'] = 'left';
387
+ break;
388
+ case 'right':
389
+ $inpostad['location'] = 'right';
390
+ break;
391
+ default:
392
+ $inpostad['location'] = 'above';
393
+ break;
394
+ }
395
+ }
396
+
397
+ if(wp_insert_get_ad_status($inpostad)) {
398
+ switch($inpostad['location']) {
399
+ case 'above':
400
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertAbove"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
401
+ break;
402
+ case 'middle':
403
+ if($paragraphCount > 1) {
404
+ if(($inpostad['paragraph_buffer_count'] == 0) || ($inpostad['paragraph_buffer_count'] == '')) {
405
+ $position = wp_insert_inpostads_get_insertion_position('/p>', $content, round($paragraphCount / 2));
406
+ } else {
407
+ $position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraph_buffer_count']);
408
+ }
409
+ if($position) {
410
+ if(($inpostad['minimum_character_count'] == 0) || ($inpostad['minimum_character_count'] == '')) {
411
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
412
+ } else {
413
+ if(strlen(strip_tags($content)) > $inpostad['minimum_character_count']) {
414
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
415
+ }
416
+ }
417
+ }
418
+ }
419
+ break;
420
+ case 'below':
421
+ $content = $content.'<div class="wpInsert wpInsertInPostAd wpInsertBelow"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>';
422
+ break;
423
+ case 'left':
424
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; '.(($inpostad['styles'] != '')?$inpostad['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
425
+ break;
426
+ case 'right':
427
+ $content = '<div class="wpInsert wpInsertInPostAd wpInsertRight" style="float: right; '.(($inpostad['styles'] != '')?$inpostad['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
428
+ break;
429
+ case 'paragraphtop':
430
+ if($paragraphCount > 1) {
431
+ $position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraphtopposition']);
432
+ if($position) {
433
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
434
+ }
435
+ }
436
+ break;
437
+ case 'paragraphbottom':
438
+ if($paragraphCount > 1) {
439
+ $paragraphbottomposition = ($paragraphCount - (int)$inpostad['paragraphbottomposition']);
440
+ if(($paragraphbottomposition > 0) && ($paragraphbottomposition < $paragraphCount)) {
441
+ $position = wp_insert_inpostads_get_insertion_position('/p>', $content, $paragraphbottomposition);
442
+ if($position) {
443
+ $content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
444
+ }
445
+ }
446
+ }
447
+ break;
448
+ }
449
+ }
450
+ }
451
+ }
452
+ }
453
+ return $content;
454
+ }
455
+
456
+ function wp_insert_inpostads_get_paragraph_count($content) {
457
+ $paragraphs = explode('/p>', $content);
458
+ $paragraphCount = 0;
459
+ if(is_array($paragraphs)) {
460
+ foreach($paragraphs as $paragraph) {
461
+ if(strlen($paragraph) > 1) {
462
+ $paragraphCount++;
463
+ }
464
+ }
465
+ }
466
+ return $paragraphCount;
467
+ }
468
+
469
+ function wp_insert_inpostads_get_insertion_position($search, $string, $offset) {
470
+ $arr = explode($search, $string);
471
+ switch($offset) {
472
+ case $offset == 0:
473
+ return false;
474
+ break;
475
+ case $offset > max(array_keys($arr)):
476
+ return false;
477
+ break;
478
+ default:
479
+ return strlen(implode($search, array_slice($arr, 0, $offset)));
480
+ break;
481
+ }
482
+ }
483
+ /* End In-Post Ads Ad Insertion */
484
+ ?>
includes/modules/inpostads/js/module.js ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_inpostads_new',
4
+ 'In-Post Ad : Add New',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('.wp_insert_inpostads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ var identifier = jQuery(".wp_insert_inpostads_identifier").val();
12
+ var inpostadLink = jQuery("<a></a>");
13
+ inpostadLink.attr("id", "wp_insert_inpostads_"+identifier);
14
+ inpostadLink.attr("href", "javascript:;");
15
+ inpostadLink.attr("onClick", "wp_insert_inpostads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inpostads_"+identifier+"_title").val()+"\')");
16
+ inpostadLink.html("In-Post Ad : "+jQuery("#wp_insert_inpostads_"+identifier+"_title").val());
17
+ var deleteButton = jQuery("<span></span>");
18
+ deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
19
+ deleteButton.attr("onClick", "wp_insert_inpostads_remove(\'"+identifier+"\')");
20
+ jQuery("#wp_insert_inpostads_new").parent().before(jQuery("<p></p>").append(inpostadLink, deleteButton));
21
+ wp_insert_inpostads_update(identifier);
22
+ },
23
+ function() { }
24
+ );
25
+ });
26
+
27
+ function wp_insert_inpostads_click_handler(identifier, title) {
28
+ jQuery('<div id="wp_insert_inpostads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
29
+ 'modal': true,
30
+ 'resizable': false,
31
+ 'width': jQuery("body").width() * 0.8,
32
+ 'maxWidth': jQuery("body").width() * 0.8,
33
+ 'maxHeight': jQuery("body").height() * 0.9,
34
+ 'title': 'In-Post Ad : '+title,
35
+ position: { my: 'center', at: 'center', of: window },
36
+ open: function (event, ui) {
37
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
38
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
39
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
40
+ jQuery.post(
41
+ jQuery('#wp_insert_admin_ajax').val(), {
42
+ 'action': 'wp_insert_inpostads_existing_form_get_content',
43
+ 'wp_insert_inpostads_identifier': identifier,
44
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
45
+ }, function(response) {
46
+ jQuery('.wp_insert_ajaxloader').hide();
47
+ jQuery('.ui-dialog-content').html(response);
48
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
49
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
50
+ jQuery('.wp_insert_inpostads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
51
+ jQuery('.ui-dialog').css({'position': 'fixed'});
52
+ jQuery('#wp_insert_inpostads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
53
+ }
54
+ );
55
+ },
56
+ buttons: {
57
+ 'Update': function() {
58
+ jQuery("#wp_insert_inpostads_"+identifier).html("In-Post Ad : "+jQuery("#wp_insert_inpostads_"+identifier+"_title").val());
59
+ jQuery("#wp_insert_inpostads_"+identifier).attr("onClick", "wp_insert_inpostads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inpostads_"+identifier+"_title").val()+"\')");
60
+ wp_insert_inpostads_update(identifier);
61
+ jQuery(this).dialog('close');
62
+ },
63
+ Cancel: function() {
64
+ jQuery(this).dialog('close');
65
+ }
66
+ },
67
+ close: function() {
68
+ jQuery(this).dialog('destroy');
69
+ }
70
+ });
71
+ }
72
+
73
+ function wp_insert_inpostads_update(identifier) {
74
+ args = {};
75
+ args['action'] = 'wp_insert_inpostads_existing_form_save_action';
76
+ args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
77
+ args['wp_insert_inpostads_identifier'] = identifier;
78
+ args['wp_insert_inpostads_'+identifier+'_status'] = jQuery('#wp_insert_inpostads_'+identifier+'_status').prop('checked');
79
+
80
+ args['wp_insert_inpostads_'+identifier+'_location'] = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
81
+ args['wp_insert_inpostads_'+identifier+'_paragraphtopposition'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraphtopposition').val();
82
+ args['wp_insert_inpostads_'+identifier+'_paragraphbottomposition'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraphbottomposition').val();
83
+
84
+ args['wp_insert_inpostads_'+identifier+'_primary_ad_code_type'] = jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val();
85
+ args['wp_insert_inpostads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code').val();
86
+ args['wp_insert_inpostads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_secondary_ad_code').val();
87
+ args['wp_insert_inpostads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_tertiary_ad_code').val();
88
+
89
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_loggedin').prop('checked');
90
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
91
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_404').prop('checked');
92
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_home').prop('checked');
93
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_archives').prop('checked');
94
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_search').prop('checked');
95
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_page').prop('checked');
96
+ args['wp_insert_inpostads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
97
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_post').prop('checked');
98
+ args['wp_insert_inpostads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
99
+ args['wp_insert_inpostads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
100
+ args['wp_insert_inpostads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_categories').prop('checked');
101
+ args['wp_insert_inpostads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
102
+
103
+ args['wp_insert_inpostads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
104
+ args['wp_insert_inpostads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_inpostads_'+identifier+'_geo_group1_adcode').val();
105
+ args['wp_insert_inpostads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
106
+ args['wp_insert_inpostads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_inpostads_'+identifier+'_geo_group2_adcode').val();
107
+
108
+ args['wp_insert_inpostads_'+identifier+'_title'] = jQuery('#wp_insert_inpostads_'+identifier+'_title').val();
109
+ args['wp_insert_inpostads_'+identifier+'_styles'] = jQuery('#wp_insert_inpostads_'+identifier+'_styles').val();
110
+
111
+ args['wp_insert_inpostads_'+identifier+'_notes'] = jQuery('#wp_insert_inpostads_'+identifier+'_notes').val();
112
+
113
+ args['wp_insert_inpostads_'+identifier+'_minimum_character_count'] = jQuery('#wp_insert_inpostads_'+identifier+'_minimum_character_count').val();
114
+ args['wp_insert_inpostads_'+identifier+'_paragraph_buffer_count'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraph_buffer_count').val();
115
+
116
+ jQuery.post(
117
+ jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
118
+ );
119
+ }
120
+
121
+ function wp_insert_inpostads_remove(identifier) {
122
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
123
+ 'modal': true,
124
+ 'resizable': false,
125
+ 'title': 'Deletion Confirmation',
126
+ position: { my: 'center', at: 'center', of: window },
127
+ open: function (event, ui) {
128
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
129
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
130
+ },
131
+ buttons : {
132
+ 'Confirm': function() {
133
+ jQuery("#wp_insert_inpostads_"+identifier).parent().remove();
134
+ jQuery.post(
135
+ jQuery('#wp_insert_admin_ajax').val(), {
136
+ 'action': 'wp_insert_inpostads_remove',
137
+ 'wp_insert_inpostads_identifier': identifier,
138
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
139
+ }, function(response) {
140
+ }
141
+ );
142
+ jQuery(this).dialog("close");
143
+ },
144
+ 'Cancel': function() {
145
+ jQuery(this).dialog("close");
146
+ }
147
+ },
148
+ close: function() {
149
+ jQuery(this).dialog('destroy');
150
+ }
151
+ });
152
+ }
153
+
154
+ function wp_insert_inpostads_primary_ad_code_location_change_action(identifier) {
155
+ jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]').click(function() {
156
+ var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
157
+ if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
158
+ jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
159
+ jQuery('#primary_ad_code_type_generic').show();
160
+ jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
161
+ jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
162
+ //jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
163
+ } else {
164
+ jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
165
+ jQuery('#primary_ad_code_type_generic').hide();
166
+ jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
167
+ jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
168
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
169
+ }
170
+
171
+ if(location == 'middle') {
172
+ jQuery('.wp_insert_inpostads_location_middle_panel').show();
173
+ } else {
174
+ jQuery('.wp_insert_inpostads_location_middle_panel').hide();
175
+ }
176
+ });
177
+ var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
178
+ if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
179
+ jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
180
+ jQuery('#primary_ad_code_type_generic').show();
181
+ jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
182
+ jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
183
+ //jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
184
+ } else {
185
+ jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
186
+ jQuery('#primary_ad_code_type_generic').hide();
187
+ jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
188
+ jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
189
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
190
+ }
191
+
192
+ if(location == 'middle') {
193
+ jQuery('.wp_insert_inpostads_location_middle_panel').show();
194
+ } else {
195
+ jQuery('.wp_insert_inpostads_location_middle_panel').hide();
196
+ }
197
+ }
198
+
199
+ function wp_insert_inpostads_primary_ad_code_type_change(identifier) {
200
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').parent().hide();
201
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change(function() {
202
+ jQuery('.isSelectedIndicator').removeClass('active');
203
+ jQuery('#primary_ad_code_type_'+jQuery(this).val()).addClass('active');
204
+ });
205
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
206
+
207
+ jQuery('#primary_ad_code_type_generic').click(function() {
208
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
209
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
210
+ });
211
+ jQuery('#primary_ad_code_type_generic').parent().click(function() {
212
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
213
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
214
+ });
215
+
216
+ jQuery('#primary_ad_code_type_vicode').click(function() {
217
+ if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
218
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
219
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
220
+ }
221
+ });
222
+ jQuery('#primary_ad_code_type_vicode').parent().click(function() {
223
+ if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
224
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
225
+ jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
226
+ }
227
+ });
228
+ }
229
+
230
+ function wp_insert_inpostads_vi_customize_adcode() {
231
+ jQuery('#wp_insert_inpostads_vi_customize_adcode').click(function() {
232
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
233
+ jQuery('#wp_insert_vi_customize_adcode').click();
234
+ });
235
+ }
includes/modules/inpostads/module.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_inpostads_css', 0);
6
+ function wp_insert_module_inpostads_css() {
7
+ wp_register_style('wp-insert-module-inpostads-css', WP_INSERT_URL.'includes/modules/inpostads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-inpostads-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_inpostads_js', 0);
12
+ function wp_insert_module_inpostads_js() {
13
+ wp_register_script('wp-insert-module-inpostads-js', WP_INSERT_URL.'includes/modules/inpostads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-inpostads-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_inpostads_plugin_card', 20);
20
+ function wp_insert_inpostads_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>In-Post Ads</h4>';
24
+ echo '<p>Ads shown within the post content.<br />You can choose different locations to insert ads from Above / Below / Inside / Middle Of / To the Left / To the Right of post content</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ $inpostads = get_option('wp_insert_inpostads');
28
+ if(isset($inpostads) && is_array($inpostads)) {
29
+ foreach($inpostads as $key => $value) {
30
+ echo '<p>';
31
+ if(!isset($value['title']) || ($value['title'] == '')) {
32
+ switch($key) {
33
+ case 'above':
34
+ $value['title'] = 'Above Post Content';
35
+ break;
36
+ case 'middle':
37
+ $value['title'] = 'Middle of Post Content';
38
+ break;
39
+ case 'below':
40
+ $value['title'] = 'Below Post Content';
41
+ break;
42
+ case 'left':
43
+ $value['title'] = 'To the Left of Post Content';
44
+ break;
45
+ case 'right':
46
+ $value['title'] = 'To the Right of Post Content';
47
+ break;
48
+ }
49
+ }
50
+ echo '<a id="wp_insert_inpostads_'.$key.'" href="javascript:;" onclick="wp_insert_inpostads_click_handler(\''.$key.'\', \''.$value['title'].'\')">In-Post Ad : '.$value['title'].'</a>';
51
+ echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_inpostads_remove(\''.$key.'\')"></span>';
52
+ echo '</p>';
53
+ }
54
+ }
55
+ echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_inpostads_new" href="#" class="button-secondary">Add New In-Post Ad</a></p>';
56
+ echo '</div>';
57
+ echo '</div>';
58
+ }
59
+ /* End Add Card in Admin Panel */
60
+ ?>
includes/{inthemeads.php → modules/inthemeads/functions.php} RENAMED
@@ -1,28 +1,4 @@
1
  <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_inthemeads_plugin_card', 30);
4
- function wp_insert_inthemeads_plugin_card() {
5
- echo '<div class="plugin-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>In-Theme Ads</h4>';
8
- echo '<p>Ads embedded directly inside theme files (Advanced Users Only).</p>';
9
- echo '</div>';
10
- echo '<div class="plugin-card-bottom">';
11
- $inthemeads = get_option('wp_insert_inthemeads');
12
- if(isset($inthemeads) && is_array($inthemeads)) {
13
- foreach($inthemeads as $key => $value) {
14
- echo '<p>';
15
- echo '<a id="wp_insert_inthemeads_'.$key.'" href="javascript:;" onclick="wp_insert_inthemeads_click_handler(\''.$key.'\', \''.$value['title'].'\')">In-Theme Ad : '.$value['title'].'</a>';
16
- echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_inthemeads_remove(\''.$key.'\')"></span>';
17
- echo '</p>';
18
- }
19
- }
20
- echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_inthemeads_new" href="#" class="button-secondary">Add New In-Theme Ad</a></p>';
21
- echo '</div>';
22
- echo '</div>';
23
- }
24
- /* End Add Card in Admin Panel */
25
-
26
  /* Begin Add New In-Theme Content */
27
  add_action('wp_ajax_wp_insert_inthemeads_new_form_get_content', 'wp_insert_inthemeads_new_form_get_content');
28
  function wp_insert_inthemeads_new_form_get_content() {
@@ -250,89 +226,10 @@ function wp_insert_inthemeads_form_save_action($identifier) {
250
  $inthemeads[$identifier]['styles'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_styles']))?$_POST['wp_insert_inthemeads_'.$identifier.'_styles']:'');
251
 
252
  $inthemeads[$identifier]['notes'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_notes']))?$_POST['wp_insert_inthemeads_'.$identifier.'_notes']:'');
253
-
254
- if($identifier == 'middle') {
255
- $inthemeads[$identifier]['minimum_character_count'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_minimum_character_count']))?$_POST['wp_insert_inthemeads_'.$identifier.'_minimum_character_count']:'');
256
- $inthemeads[$identifier]['paragraph_buffer_count'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_paragraph_buffer_count']))?$_POST['wp_insert_inthemeads_'.$identifier.'_paragraph_buffer_count']:'');
257
- }
258
  update_option('wp_insert_inthemeads', $inthemeads);
259
  }
260
  /* End Shared UI Functions */
261
 
262
- /* Begin Database Upgrade */
263
- add_action('wp_insert_upgrade_database', 'wp_insert_inthemeads_upgrade_database');
264
- function wp_insert_inthemeads_upgrade_database() {
265
- if(!get_option('wp_insert_inthemeads')) {
266
- $newValues = array();
267
-
268
- $oldValues = get_option('wp_insert_templateads_options');
269
- for($i = 1; $i <= 10; $i++) {
270
- if(isset($oldValues['templateads-'.$i]['ad_code_1']) && ($oldValues['templateads-'.$i]['ad_code_1'] != '')) {
271
- $newValues['templateads-'.$i] = array (
272
- 'identifier' => 'templateads-'.$i,
273
- 'status' => ((isset($oldValues['templateads-'.$i]['status']) && $oldValues['templateads-'.$i]['status'] == true)?'1':''),
274
- 'title' => 'templateads-'.$i,
275
- 'primary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_1']))?$oldValues['templateads-'.$i]['ad_code_1']:''),
276
- 'secondary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_2']))?$oldValues['templateads-'.$i]['ad_code_2']:''),
277
- 'tertiary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_3']))?$oldValues['templateads-'.$i]['ad_code_3']:''),
278
- 'rules_exclude_loggedin' => ((isset($oldValues['templateads-'.$i]['rules_exclude_loggedin']))?true:false),
279
- 'rules_exclude_mobile_devices' => ((isset($oldValues['templateads-'.$i]['rules_exclude_mobile_devices']))?true:false),
280
- 'rules_exclude_home' => ((isset($oldValues['templateads-'.$i]['rules_exclude_home']))?true:false),
281
- 'rules_exclude_archives' => ((isset($oldValues['templateads-'.$i]['rules_exclude_archives']))?true:false),
282
- 'rules_exclude_search' => ((isset($oldValues['templateads-'.$i]['rules_exclude_search']))?true:false),
283
- 'rules_exclude_page' => ((isset($oldValues['templateads-'.$i]['rules_exclude_page']))?true:false),
284
- 'rules_page_exceptions' => ((isset($options['templateads-'.$i]['rules_page_exceptions']) && ($options['templateads-'.$i]['rules_page_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_page_exceptions']):array()),
285
- 'rules_exclude_post' => ((isset($oldValues['templateads-'.$i]['rules_exclude_post']))?true:false),
286
- 'rules_post_exceptions' => ((isset($options['templateads-'.$i]['rules_post_exceptions']) && ($options['templateads-'.$i]['rules_post_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_post_exceptions']):array()),
287
- 'rules_post_categories_exceptions' => ((isset($options['templateads-'.$i]['rules_post_categories_exceptions']) && ($options['templateads-'.$i]['rules_post_categories_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_post_categories_exceptions']):array()),
288
- 'rules_exclude_categories' => ((isset($oldValues['templateads-'.$i]['rules_exclude_categories']))?true:false),
289
- 'rules_categories_exceptions' => ((isset($options['templateads-'.$i]['rules_categories_exceptions']) && ($options['templateads-'.$i]['rules_categories_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_categories_exceptions']):array()),
290
- 'geo_group1_countries' => ((isset($options['templateads-'.$i]['country_1']) && ($options['templateads-'.$i]['country_1'] != ''))?explode(',', $options['templateads-'.$i]['country_1']):array()),
291
- 'geo_group1_adcode' => ((isset($oldValues['templateads-'.$i]['country_code_1']))?$oldValues['templateads-'.$i]['country_code_1']:''),
292
- 'geo_group2_countries' => array(),
293
- 'geo_group2_adcode' => '',
294
- 'styles' => ((isset($oldValues['templateads-'.$i]['styles']))?$oldValues['templateads-'.$i]['styles']:'margin: 5px; padding: 0px;'),
295
- 'notes' => ((isset($oldValues['templateads-'.$i]['notes']))?$oldValues['templateads-'.$i]['notes']:''),
296
- );
297
- }
298
- }
299
-
300
- $oldValues = get_option('wp_insert_more_templateads_options');
301
- for($i = 11; $i <= 20; $i++) {
302
- if(isset($oldValues['templateads-'.$i]['ad_code_1']) && ($oldValues['templateads-'.$i]['ad_code_1'] != '')) {
303
- $newValues['templateads-'.$i] = array (
304
- 'identifier' => 'templateads-'.$i,
305
- 'status' => ((isset($oldValues['templateads-'.$i]['status']) && $oldValues['templateads-'.$i]['status'] == true)?'1':''),
306
- 'title' => 'templateads-'.$i,
307
- 'primary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_1']))?$oldValues['templateads-'.$i]['ad_code_1']:''),
308
- 'secondary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_2']))?$oldValues['templateads-'.$i]['ad_code_2']:''),
309
- 'tertiary_ad_code' => ((isset($oldValues['templateads-'.$i]['ad_code_3']))?$oldValues['templateads-'.$i]['ad_code_3']:''),
310
- 'rules_exclude_loggedin' => ((isset($oldValues['templateads-'.$i]['rules_exclude_loggedin']))?true:false),
311
- 'rules_exclude_mobile_devices' => ((isset($oldValues['templateads-'.$i]['rules_exclude_mobile_devices']))?true:false),
312
- 'rules_exclude_home' => ((isset($oldValues['templateads-'.$i]['rules_exclude_home']))?true:false),
313
- 'rules_exclude_archives' => ((isset($oldValues['templateads-'.$i]['rules_exclude_archives']))?true:false),
314
- 'rules_exclude_search' => ((isset($oldValues['templateads-'.$i]['rules_exclude_search']))?true:false),
315
- 'rules_exclude_page' => ((isset($oldValues['templateads-'.$i]['rules_exclude_page']))?true:false),
316
- 'rules_page_exceptions' => ((isset($options['templateads-'.$i]['rules_page_exceptions']) && ($options['templateads-'.$i]['rules_page_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_page_exceptions']):array()),
317
- 'rules_exclude_post' => ((isset($oldValues['templateads-'.$i]['rules_exclude_post']))?true:false),
318
- 'rules_post_exceptions' => ((isset($options['templateads-'.$i]['rules_post_exceptions']) && ($options['templateads-'.$i]['rules_post_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_post_exceptions']):array()),
319
- 'rules_post_categories_exceptions' => ((isset($options['templateads-'.$i]['rules_post_categories_exceptions']) && ($options['templateads-'.$i]['rules_post_categories_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_post_categories_exceptions']):array()),
320
- 'rules_exclude_categories' => ((isset($oldValues['templateads-'.$i]['rules_exclude_categories']))?true:false),
321
- 'rules_categories_exceptions' => ((isset($options['templateads-'.$i]['rules_categories_exceptions']) && ($options['templateads-'.$i]['rules_categories_exceptions'] != ''))?explode(',', $options['templateads-'.$i]['rules_categories_exceptions']):array()),
322
- 'geo_group1_countries' => ((isset($options['templateads-'.$i]['country_1']) && ($options['templateads-'.$i]['country_1'] != ''))?explode(',', $options['templateads-'.$i]['country_1']):array()),
323
- 'geo_group1_adcode' => ((isset($oldValues['templateads-'.$i]['country_code_1']))?$oldValues['templateads-'.$i]['country_code_1']:''),
324
- 'geo_group2_countries' => array(),
325
- 'geo_group2_adcode' => '',
326
- 'styles' => ((isset($oldValues['templateads-'.$i]['styles']))?$oldValues['templateads-'.$i]['styles']:'margin: 5px; padding: 0px;'),
327
- 'notes' => ((isset($oldValues['templateads-'.$i]['notes']))?$oldValues['templateads-'.$i]['notes']:''),
328
- );
329
- }
330
- }
331
- update_option('wp_insert_inthemeads', $newValues);
332
- }
333
- }
334
- /* End Database Upgrade */
335
-
336
  /* Begin In-Theme Ad Insertion */
337
  function wp_template_ad($identifier) { wp_intheme_ad('templateads-'.$identifier); }
338
  function wp_intheme_ad($identifier) {
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Begin Add New In-Theme Content */
3
  add_action('wp_ajax_wp_insert_inthemeads_new_form_get_content', 'wp_insert_inthemeads_new_form_get_content');
4
  function wp_insert_inthemeads_new_form_get_content() {
226
  $inthemeads[$identifier]['styles'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_styles']))?$_POST['wp_insert_inthemeads_'.$identifier.'_styles']:'');
227
 
228
  $inthemeads[$identifier]['notes'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_notes']))?$_POST['wp_insert_inthemeads_'.$identifier.'_notes']:'');
 
 
 
 
 
229
  update_option('wp_insert_inthemeads', $inthemeads);
230
  }
231
  /* End Shared UI Functions */
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  /* Begin In-Theme Ad Insertion */
234
  function wp_template_ad($identifier) { wp_intheme_ad('templateads-'.$identifier); }
235
  function wp_intheme_ad($identifier) {
includes/modules/inthemeads/js/module.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_inthemeads_new',
4
+ 'In-Theme Ad : Add New',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ var identifier = jQuery(".wp_insert_inthemeads_identifier").val();
12
+ var inthemeadLink = jQuery("<a></a>");
13
+ inthemeadLink.attr("id", "wp_insert_inthemeads_"+identifier);
14
+ inthemeadLink.attr("href", "javascript:;");
15
+ inthemeadLink.attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
16
+ inthemeadLink.html("In-Theme Ad : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
17
+ var deleteButton = jQuery("<span></span>");
18
+ deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
19
+ deleteButton.attr("onClick", "wp_insert_inthemeads_remove(\'"+identifier+"\')");
20
+ jQuery("#wp_insert_inthemeads_new").parent().before(jQuery("<p></p>").append(inthemeadLink, deleteButton));
21
+ wp_insert_inthemeads_update(identifier);
22
+ },
23
+ function() { }
24
+ );
25
+ });
26
+
27
+ function wp_insert_inthemeads_click_handler(identifier, title) {
28
+ jQuery('<div id="wp_insert_inthemeads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
29
+ 'modal': true,
30
+ 'resizable': false,
31
+ 'width': jQuery("body").width() * 0.8,
32
+ 'maxWidth': jQuery("body").width() * 0.8,
33
+ 'maxHeight': jQuery("body").height() * 0.9,
34
+ 'title': 'In-Theme Ad : '+title,
35
+ position: { my: 'center', at: 'center', of: window },
36
+ open: function (event, ui) {
37
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
38
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
39
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
40
+ jQuery.post(
41
+ jQuery('#wp_insert_admin_ajax').val(), {
42
+ 'action': 'wp_insert_inthemeads_existing_form_get_content',
43
+ 'wp_insert_inthemeads_identifier': identifier,
44
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
45
+ }, function(response) {
46
+ jQuery('.wp_insert_ajaxloader').hide();
47
+ jQuery('.ui-dialog-content').html(response);
48
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
49
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
50
+ jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
51
+ jQuery('.ui-dialog').css({'position': 'fixed'});
52
+ jQuery('#wp_insert_inthemeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
53
+ }
54
+ );
55
+ },
56
+ buttons: {
57
+ 'Update': function() {
58
+ jQuery("#wp_insert_inthemeads_"+identifier).html("In-Theme Ad : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
59
+ jQuery("#wp_insert_inthemeads_"+identifier).attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
60
+ wp_insert_inthemeads_update(identifier);
61
+ jQuery(this).dialog('close');
62
+ },
63
+ Cancel: function() {
64
+ jQuery(this).dialog('close');
65
+ }
66
+ },
67
+ close: function() {
68
+ jQuery(this).dialog('destroy');
69
+ }
70
+ });
71
+ }
72
+
73
+ function wp_insert_inthemeads_update(identifier) {
74
+ args = {};
75
+ args['action'] = 'wp_insert_inthemeads_existing_form_save_action';
76
+ args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
77
+ args['wp_insert_inthemeads_identifier'] = identifier;
78
+ args['wp_insert_inthemeads_'+identifier+'_status'] = jQuery('#wp_insert_inthemeads_'+identifier+'_status').prop('checked');
79
+
80
+ args['wp_insert_inthemeads_'+identifier+'_title'] = jQuery('#wp_insert_inthemeads_'+identifier+'_title').val();
81
+
82
+ args['wp_insert_inthemeads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_primary_ad_code').val();
83
+ args['wp_insert_inthemeads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_secondary_ad_code').val();
84
+ args['wp_insert_inthemeads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_tertiary_ad_code').val();
85
+
86
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
87
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
88
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_404').prop('checked');
89
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_home').prop('checked');
90
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_archives').prop('checked');
91
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_search').prop('checked');
92
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_page').prop('checked');
93
+ args['wp_insert_inthemeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
94
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_post').prop('checked');
95
+ args['wp_insert_inthemeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
96
+ args['wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
97
+ args['wp_insert_inthemeads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_categories').prop('checked');
98
+ args['wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
99
+
100
+ args['wp_insert_inthemeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
101
+ args['wp_insert_inthemeads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_adcode').val();
102
+ args['wp_insert_inthemeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
103
+ args['wp_insert_inthemeads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_adcode').val();
104
+
105
+ args['wp_insert_inthemeads_'+identifier+'_styles'] = jQuery('#wp_insert_inthemeads_'+identifier+'_styles').val();
106
+
107
+ args['wp_insert_inthemeads_'+identifier+'_notes'] = jQuery('#wp_insert_inthemeads_'+identifier+'_notes').val();
108
+
109
+ jQuery.post(
110
+ jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
111
+ );
112
+ }
113
+
114
+ function wp_insert_inthemeads_remove(identifier) {
115
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
116
+ 'modal': true,
117
+ 'resizable': false,
118
+ 'title': 'Deletion Confirmation',
119
+ position: { my: 'center', at: 'center', of: window },
120
+ open: function (event, ui) {
121
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
122
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
123
+ },
124
+ buttons : {
125
+ 'Confirm': function() {
126
+ jQuery("#wp_insert_inthemeads_"+identifier).parent().remove();
127
+ jQuery.post(
128
+ jQuery('#wp_insert_admin_ajax').val(), {
129
+ 'action': 'wp_insert_inthemeads_remove',
130
+ 'wp_insert_inthemeads_identifier': identifier,
131
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
132
+ }, function(response) {
133
+ }
134
+ );
135
+ jQuery(this).dialog("close");
136
+ },
137
+ 'Cancel': function() {
138
+ jQuery(this).dialog("close");
139
+ }
140
+ },
141
+ close: function() {
142
+ jQuery(this).dialog('destroy');
143
+ }
144
+ });
145
+ }
includes/modules/inthemeads/module.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_inthemeads_css', 0);
6
+ function wp_insert_module_inthemeads_css() {
7
+ wp_register_style('wp-insert-module-inthemeads-css', WP_INSERT_URL.'includes/modules/inthemeads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-inthemeads-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_inthemeads_js', 0);
12
+ function wp_insert_module_inthemeads_js() {
13
+ wp_register_script('wp-insert-module-inthemeads-js', WP_INSERT_URL.'includes/modules/inthemeads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-inthemeads-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_inthemeads_plugin_card', 60);
20
+ function wp_insert_inthemeads_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>In-Theme Ads</h4>';
24
+ echo '<p>Ads embedded directly inside theme files (Advanced Users Only).</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ $inthemeads = get_option('wp_insert_inthemeads');
28
+ if(isset($inthemeads) && is_array($inthemeads)) {
29
+ foreach($inthemeads as $key => $value) {
30
+ echo '<p>';
31
+ echo '<a id="wp_insert_inthemeads_'.$key.'" href="javascript:;" onclick="wp_insert_inthemeads_click_handler(\''.$key.'\', \''.$value['title'].'\')">In-Theme Ad : '.$value['title'].'</a>';
32
+ echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_inthemeads_remove(\''.$key.'\')"></span>';
33
+ echo '</p>';
34
+ }
35
+ }
36
+ echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_inthemeads_new" href="#" class="button-secondary">Add New In-Theme Ad</a></p>';
37
+ echo '</div>';
38
+ echo '</div>';
39
+ }
40
+ /* End Add Card in Admin Panel */
41
+ ?>
includes/{legal-pages.php → modules/legalpages/functions.php} RENAMED
@@ -1,23 +1,4 @@
1
  <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_legalpages_plugin_card', 40);
4
- function wp_insert_legalpages_plugin_card() {
5
- echo '<div class="plugin-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>Legal Pages</h4>';
8
- echo '<p>Legal Page Templates to kick start your Legal Notices.</p>';
9
- echo '</div>';
10
- echo '<div class="plugin-card-bottom">';
11
- echo '<p><a id="wp_insert_legalpages_privacy_policy" href="javascript:;">Privacy Policy</a></p>';
12
- echo '<p><a id="wp_insert_legalpages_terms_conditions" href="javascript:;">Terms and Conditions</a></p>';
13
- echo '<p><a id="wp_insert_legalpages_disclaimer" href="javascript:;">Disclaimer</a></p>';
14
- echo '<p><a id="wp_insert_legalpages_copyright" href="javascript:;">Copyright Notice</a></p>';
15
- echo '<!--<p><a href="#">EU Cookie Compliance</a></p>-->';
16
- echo '</div>';
17
- echo '</div>';
18
- }
19
- /* End Add Card in Admin Panel */
20
-
21
  /* Begin Privacy Policy */
22
  add_action('wp_ajax_wp_insert_legalpages_privacy_policy_form_get_content', 'wp_insert_legalpages_privacy_policy_form_get_content');
23
  function wp_insert_legalpages_privacy_policy_form_get_content() {
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Begin Privacy Policy */
3
  add_action('wp_ajax_wp_insert_legalpages_privacy_policy_form_get_content', 'wp_insert_legalpages_privacy_policy_form_get_content');
4
  function wp_insert_legalpages_privacy_policy_form_get_content() {
includes/modules/legalpages/js/module.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_legalpages_privacy_policy',
4
+ 'Legal Pages : Privacy Policy',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() { },
8
+ function() {
9
+ jQuery.post(
10
+ jQuery('#wp_insert_admin_ajax').val(), {
11
+ 'action': 'wp_insert_legalpages_privacy_policy_form_save_action',
12
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
13
+ 'wp_insert_legalpages_privacy_policy_content': jQuery('#wp_insert_legalpages_privacy_policy_content').val(),
14
+ 'wp_insert_legalpages_privacy_policy_assigned_page': jQuery('#wp_insert_legalpages_privacy_policy_assigned_page').val(),
15
+ }, function(response) { }
16
+ );
17
+ },
18
+ function() { }
19
+ );
20
+
21
+ wp_insert_click_handler(
22
+ 'wp_insert_legalpages_terms_conditions',
23
+ 'Legal Pages : Terms and Conditions',
24
+ jQuery("body").width() * 0.8,
25
+ jQuery("body").height() * 0.8,
26
+ function() { },
27
+ function() {
28
+ jQuery.post(
29
+ jQuery('#wp_insert_admin_ajax').val(), {
30
+ 'action': 'wp_insert_legalpages_terms_conditions_form_save_action',
31
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
32
+ 'wp_insert_legalpages_terms_conditions_content': jQuery('#wp_insert_legalpages_terms_conditions_content').val(),
33
+ 'wp_insert_legalpages_terms_conditions_assigned_page': jQuery('#wp_insert_legalpages_terms_conditions_assigned_page').val(),
34
+ }, function(response) { }
35
+ );
36
+ },
37
+ function() { }
38
+ );
39
+
40
+ wp_insert_click_handler(
41
+ 'wp_insert_legalpages_disclaimer',
42
+ 'Legal Pages : Disclaimer',
43
+ jQuery("body").width() * 0.8,
44
+ jQuery("body").height() * 0.8,
45
+ function() { },
46
+ function() {
47
+ jQuery.post(
48
+ jQuery('#wp_insert_admin_ajax').val(), {
49
+ 'action': 'wp_insert_legalpages_disclaimer_form_save_action',
50
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
51
+ 'wp_insert_legalpages_disclaimer_content': jQuery('#wp_insert_legalpages_disclaimer_content').val(),
52
+ 'wp_insert_legalpages_disclaimer_assigned_page': jQuery('#wp_insert_legalpages_disclaimer_assigned_page').val(),
53
+ }, function(response) { }
54
+ );
55
+ },
56
+ function() { }
57
+ );
58
+
59
+ wp_insert_click_handler(
60
+ 'wp_insert_legalpages_copyright',
61
+ 'Legal Pages : Copyright Notice',
62
+ jQuery("body").width() * 0.8,
63
+ jQuery("body").height() * 0.8,
64
+ function() { },
65
+ function() {
66
+ jQuery.post(
67
+ jQuery('#wp_insert_admin_ajax').val(), {
68
+ 'action': 'wp_insert_legalpages_copyright_form_save_action',
69
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
70
+ 'wp_insert_legalpages_copyright_content': jQuery('#wp_insert_legalpages_copyright_content').val(),
71
+ 'wp_insert_legalpages_copyright_assigned_page': jQuery('#wp_insert_legalpages_copyright_assigned_page').val(),
72
+ }, function(response) { }
73
+ );
74
+ },
75
+ function() { }
76
+ );
77
+ });
78
+
79
+ function wp_insert_legalpages_generate_page(target, title) {
80
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
81
+ jQuery('#'+target+'_generate_page').hide();
82
+ jQuery('#'+target+'_accordion .wp_insert_ajaxloader_flat').show();
83
+ jQuery.post(
84
+ jQuery('#wp_insert_admin_ajax').val(), {
85
+ 'action': target+'_form_generate_page_action',
86
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
87
+ }, function(response) {
88
+ if(response != '0') {
89
+ jQuery('#'+target+'_assigned_page').append(jQuery('<option>', {value: response, text: title})).val(response);
90
+ }
91
+ jQuery('#'+target+'_generate_page').show();
92
+ jQuery('#'+target+'_accordion .wp_insert_ajaxloader_flat').hide();
93
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
94
+ }
95
+ );
96
+ }
includes/modules/legalpages/module.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_legalpages_css', 0);
6
+ function wp_insert_module_legalpages_css() {
7
+ wp_register_style('wp-insert-module-legalpages-css', WP_INSERT_URL.'includes/modules/legalpages/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-legalpages-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_legalpages_js', 0);
12
+ function wp_insert_module_legalpages_js() {
13
+ wp_register_script('wp-insert-module-legalpages-js', WP_INSERT_URL.'includes/modules/legalpages/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-legalpages-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_legalpages_plugin_card', 70);
20
+ function wp_insert_legalpages_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Legal Pages</h4>';
24
+ echo '<p>Legal Page Templates to kick start your Legal Notices.</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ echo '<p><a id="wp_insert_legalpages_privacy_policy" href="javascript:;">Privacy Policy</a></p>';
28
+ echo '<p><a id="wp_insert_legalpages_terms_conditions" href="javascript:;">Terms and Conditions</a></p>';
29
+ echo '<p><a id="wp_insert_legalpages_disclaimer" href="javascript:;">Disclaimer</a></p>';
30
+ echo '<p><a id="wp_insert_legalpages_copyright" href="javascript:;">Copyright Notice</a></p>';
31
+ echo '<!--<p><a href="#">EU Cookie Compliance</a></p>-->';
32
+ echo '</div>';
33
+ echo '</div>';
34
+ }
35
+ /* End Add Card in Admin Panel */
36
+ ?>
includes/modules/modules.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/adstxt/module.php');
3
+ require_once(dirname(__FILE__).'/inpostads/module.php');
4
+ require_once(dirname(__FILE__).'/adwidgets/module.php');
5
+ require_once(dirname(__FILE__).'/shortcodeads/module.php');
6
+ require_once(dirname(__FILE__).'/inthemeads/module.php');
7
+ require_once(dirname(__FILE__).'/pagelevelads/module.php');
8
+ require_once(dirname(__FILE__).'/trackingcodes/module.php');
9
+ require_once(dirname(__FILE__).'/legalpages/module.php');
10
+ require_once(dirname(__FILE__).'/videointelligence/module.php');
11
+ ?>
includes/modules/pagelevelads/functions.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Add New Page-Level Content */
3
+ add_action('wp_ajax_wp_insert_pagelevelads_new_form_get_content', 'wp_insert_pagelevelads_new_form_get_content');
4
+ function wp_insert_pagelevelads_new_form_get_content() {
5
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
6
+ wp_insert_pagelevelads_form_get_content(uniqid());
7
+ die();
8
+ }
9
+ /* End Add New Page-Level Content */
10
+
11
+ /* Begin Edit Page-Level Content */
12
+ add_action('wp_ajax_wp_insert_pagelevelads_existing_form_get_content', 'wp_insert_pagelevelads_existing_form_get_content');
13
+ function wp_insert_pagelevelads_existing_form_get_content() {
14
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
15
+ if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
16
+ wp_insert_pagelevelads_form_get_content($_POST['wp_insert_pagelevelads_identifier']);
17
+ }
18
+ die();
19
+ }
20
+
21
+ add_action('wp_ajax_wp_insert_pagelevelads_existing_form_save_action', 'wp_insert_pagelevelads_existing_form_save_action');
22
+ function wp_insert_pagelevelads_existing_form_save_action() {
23
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
24
+ if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
25
+ wp_insert_pagelevelads_form_save_action($_POST['wp_insert_pagelevelads_identifier']);
26
+ }
27
+ die();
28
+ }
29
+ /* End Edit Page-Level Content */
30
+
31
+ /* Begin Delete Page-Level Content */
32
+ add_action('wp_ajax_wp_insert_pagelevelads_remove', 'wp_insert_pagelevelads_remove');
33
+ function wp_insert_pagelevelads_remove() {
34
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
35
+ if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
36
+ $pagelevelads = get_option('wp_insert_pagelevelads');
37
+ unset($pagelevelads[$_POST['wp_insert_pagelevelads_identifier']]);
38
+ update_option('wp_insert_pagelevelads', $pagelevelads);
39
+ }
40
+ die();
41
+ }
42
+ /* End Delete Page-Level Content */
43
+
44
+ /* Begin Shared UI Functions */
45
+ function wp_insert_pagelevelads_form_get_content($identifier) {
46
+ $pagelevelads = get_option('wp_insert_pagelevelads');
47
+ echo '<div class="wp_insert_popup_content_wrapper">';
48
+ $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_pagelevelads['.$identifier.']', 'values' => $pagelevelads[$identifier]));
49
+ $control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_pagelevelads_status', 'optionName' => 'status'));
50
+ $control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_pagelevelads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
51
+ echo $control->HTML;
52
+ $control->clear_controls();
53
+ echo '<div id="wp_insert_pagelevelads_'.$identifier.'_accordion">';
54
+ echo '<h3>Ad Code</h3>';
55
+ echo '<div>';
56
+ $abtestingMode = get_option('wp_insert_abtesting_mode');
57
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
58
+ $control->create_section('Ad Code (Primary Network)');
59
+ echo $control->HTML;
60
+ $control->clear_controls();
61
+
62
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
63
+ $control->create_section('Ad Code (Secondary Network)');
64
+ if($abtestingMode != '2' && $abtestingMode != '3') {
65
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
66
+ }
67
+ echo $control->HTML;
68
+ $control->clear_controls();
69
+
70
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
71
+ $control->create_section('Ad Code (Tertiary Network)');
72
+ if($abtestingMode != '3') {
73
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
74
+ }
75
+ echo $control->HTML;
76
+ $control->clear_controls();
77
+ echo '</div>';
78
+ echo '<h3>Rules</h3>';
79
+ echo '<div>';
80
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
81
+ $control->create_section('Logged in Users');
82
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
83
+ echo $control->HTML;
84
+ $control->clear_controls();
85
+
86
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
87
+ $control->create_section('Mobile Devices');
88
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
89
+ echo $control->HTML;
90
+ $control->clear_controls();
91
+
92
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
93
+ $control->create_section('404 Pages');
94
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
95
+ echo $control->HTML;
96
+ $control->clear_controls();
97
+
98
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
99
+ $control->create_section('Home');
100
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
101
+ echo $control->HTML;
102
+ $control->clear_controls();
103
+
104
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
105
+ $control->create_section('Archives');
106
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
107
+ echo $control->HTML;
108
+ $control->clear_controls();
109
+
110
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
111
+ $control->create_section('Search Results');
112
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
113
+ echo $control->HTML;
114
+ $control->clear_controls();
115
+
116
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
117
+ $control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
118
+ $control->create_section('Single Pages');
119
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
120
+ echo $control->HTML;
121
+ $control->clear_controls();
122
+
123
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
124
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
125
+ $control->create_section('Category Archives');
126
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
127
+ echo $control->HTML;
128
+ $control->clear_controls();
129
+
130
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
131
+ $control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
132
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
133
+ $control->create_section('Single Posts');
134
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
135
+ echo $control->HTML;
136
+ $control->clear_controls();
137
+
138
+ echo '</div>';
139
+ echo '<h3>Geo Targeting</h3>';
140
+ echo '<div>';
141
+ echo '<p>';
142
+ echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
143
+ echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
144
+ echo '</p>';
145
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
146
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
147
+ $control->create_section('Group 1');
148
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
149
+ echo $control->HTML;
150
+ $control->clear_controls();
151
+
152
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
153
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
154
+ $control->create_section('Group 2');
155
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
156
+ echo $control->HTML;
157
+ $control->clear_controls();
158
+ echo '<p>';
159
+ echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
160
+ echo '</p>';
161
+ echo '</div>';
162
+ echo '<h3>Styles</h3>';
163
+ echo '<div>';
164
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
165
+ $control->create_section('Styles');
166
+ echo $control->HTML;
167
+ $control->clear_controls();
168
+ echo '</div>';
169
+ echo '<h3>Notes</h3>';
170
+ echo '<div>';
171
+ $control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($pagelevelads[$identifier]['title']))?$pagelevelads[$identifier]['title']:$identifier)));
172
+ $control->create_section('Title');
173
+ echo $control->HTML;
174
+ $control->clear_controls();
175
+
176
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
177
+ $control->create_section('Notes');
178
+ echo $control->HTML;
179
+ $control->clear_controls();
180
+ echo '</div>';
181
+ echo '</div>';
182
+ echo '<script type="text/javascript">';
183
+ echo $control->JS;
184
+ echo 'jQuery("#wp_insert_pagelevelads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
185
+ echo '</script>';
186
+ echo '</div>';
187
+ }
188
+
189
+ function wp_insert_pagelevelads_form_save_action($identifier) {
190
+ $pagelevelads = get_option('wp_insert_pagelevelads');
191
+ $pagelevelads[$identifier]['identifier'] = ((isset($_POST['wp_insert_pagelevelads_identifier']))?$_POST['wp_insert_pagelevelads_identifier']:'');
192
+ $pagelevelads[$identifier]['status'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_status']) && ($_POST['wp_insert_pagelevelads_'.$identifier.'_status'] == 'true'))?'1':'');
193
+
194
+ $pagelevelads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_primary_ad_code']:'');
195
+ $pagelevelads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_secondary_ad_code']:'');
196
+ $pagelevelads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_tertiary_ad_code']:'');
197
+
198
+ $pagelevelads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_loggedin']:'');
199
+ $pagelevelads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_mobile_devices']:'');
200
+ $pagelevelads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_404']:'');
201
+ $pagelevelads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_home']:'');
202
+ $pagelevelads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_archives']:'');
203
+ $pagelevelads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_search']:'');
204
+ $pagelevelads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_page']:'');
205
+ $pagelevelads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_page_exceptions']:'');
206
+ $pagelevelads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_post']:'');
207
+ $pagelevelads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_exceptions']:'');
208
+ $pagelevelads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_categories_exceptions']:'');
209
+ $pagelevelads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_categories']:'');
210
+ $pagelevelads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_categories_exceptions']:'');
211
+
212
+ $pagelevelads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_countries']:'');
213
+ $pagelevelads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_adcode']:'');
214
+ $pagelevelads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_countries']:'');
215
+ $pagelevelads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_adcode']:'');
216
+
217
+ $pagelevelads[$identifier]['styles'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_styles']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_styles']:'');
218
+
219
+ $pagelevelads[$identifier]['title'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_title']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_title']:'');
220
+ $pagelevelads[$identifier]['notes'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_notes']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_notes']:'');
221
+
222
+ update_option('wp_insert_pagelevelads', $pagelevelads);
223
+ }
224
+ /* End Shared UI Functions */
225
+
226
+ /* Begin Page-Level Ad Insertion */
227
+ add_action('wp_head', 'wp_insert_pagelevelads_wp_head');
228
+ function wp_insert_pagelevelads_wp_head() {
229
+ $pagelevelads = get_option('wp_insert_pagelevelads');
230
+ if(isset($pagelevelads) && is_array($pagelevelads)) {
231
+ foreach($pagelevelads as $pagelevelad) {
232
+ if(isset($pagelevelad) && is_array($pagelevelad) && wp_insert_get_ad_status($pagelevelad)) {
233
+ echo '<div class="wpInsert wpInsertTemplateTag"'.(($pagelevelad['styles'] != '')?' style="'.$pagelevelad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($pagelevelad).'</div>';
234
+ }
235
+ }
236
+ }
237
+ }
238
+ /* End Page-Level Ad Insertion */
239
+ ?>
includes/modules/pagelevelads/js/module.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_pagelevelads_new',
4
+ 'Page-Level Ad : Add New',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('.wp_insert_pagelevelads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ var identifier = jQuery(".wp_insert_pagelevelads_identifier").val();
12
+ var pageleveladLink = jQuery("<a></a>");
13
+ pageleveladLink.attr("id", "wp_insert_pagelevelads_"+identifier);
14
+ pageleveladLink.attr("href", "javascript:;");
15
+ pageleveladLink.attr("onClick", "wp_insert_pagelevelads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val()+"\')");
16
+ pageleveladLink.html("Page-Level Ad : "+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val());
17
+ var deleteButton = jQuery("<span></span>");
18
+ deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
19
+ deleteButton.attr("onClick", "wp_insert_pagelevelads_remove(\'"+identifier+"\')");
20
+ jQuery("#wp_insert_pagelevelads_new").parent().before(jQuery("<p></p>").append(pageleveladLink, deleteButton));
21
+ wp_insert_pagelevelads_update(identifier);
22
+ },
23
+ function() { }
24
+ );
25
+ });
26
+
27
+ function wp_insert_pagelevelads_click_handler(identifier, title) {
28
+ jQuery('<div id="wp_insert_pagelevelads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
29
+ 'modal': true,
30
+ 'resizable': false,
31
+ 'width': jQuery("body").width() * 0.8,
32
+ 'maxWidth': jQuery("body").width() * 0.8,
33
+ 'maxHeight': jQuery("body").height() * 0.9,
34
+ 'title': 'Page-Level Ad : '+title,
35
+ position: { my: 'center', at: 'center', of: window },
36
+ open: function (event, ui) {
37
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
38
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
39
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
40
+ jQuery.post(
41
+ jQuery('#wp_insert_admin_ajax').val(), {
42
+ 'action': 'wp_insert_pagelevelads_existing_form_get_content',
43
+ 'wp_insert_pagelevelads_identifier': identifier,
44
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
45
+ }, function(response) {
46
+ jQuery('.wp_insert_ajaxloader').hide();
47
+ jQuery('.ui-dialog-content').html(response);
48
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
49
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
50
+ jQuery('.wp_insert_pagelevelads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
51
+ jQuery('.ui-dialog').css({'position': 'fixed'});
52
+ jQuery('#wp_insert_pagelevelads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
53
+ }
54
+ );
55
+ },
56
+ buttons: {
57
+ 'Update': function() {
58
+ jQuery("#wp_insert_pagelevelads_"+identifier).html("Page-Level Ad : "+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val());
59
+ jQuery("#wp_insert_pagelevelads_"+identifier).attr("onClick", "wp_insert_pagelevelads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val()+"\')");
60
+ wp_insert_pagelevelads_update(identifier);
61
+ jQuery(this).dialog('close');
62
+ },
63
+ Cancel: function() {
64
+ jQuery(this).dialog('close');
65
+ }
66
+ },
67
+ close: function() {
68
+ jQuery(this).dialog('destroy');
69
+ }
70
+ });
71
+ }
72
+
73
+ function wp_insert_pagelevelads_update(identifier) {
74
+ args = {};
75
+ args['action'] = 'wp_insert_pagelevelads_existing_form_save_action';
76
+ args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
77
+ args['wp_insert_pagelevelads_identifier'] = identifier;
78
+ args['wp_insert_pagelevelads_'+identifier+'_status'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_status').prop('checked');
79
+
80
+ args['wp_insert_pagelevelads_'+identifier+'_title'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_title').val();
81
+
82
+ args['wp_insert_pagelevelads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_primary_ad_code').val();
83
+ args['wp_insert_pagelevelads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_secondary_ad_code').val();
84
+ args['wp_insert_pagelevelads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_tertiary_ad_code').val();
85
+
86
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_loggedin').prop('checked');
87
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
88
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_404').prop('checked');
89
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_home').prop('checked');
90
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_archives').prop('checked');
91
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_search').prop('checked');
92
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_page').prop('checked');
93
+ args['wp_insert_pagelevelads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
94
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_post').prop('checked');
95
+ args['wp_insert_pagelevelads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
96
+ args['wp_insert_pagelevelads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
97
+ args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_categories').prop('checked');
98
+ args['wp_insert_pagelevelads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
99
+
100
+ args['wp_insert_pagelevelads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
101
+ args['wp_insert_pagelevelads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group1_adcode').val();
102
+ args['wp_insert_pagelevelads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
103
+ args['wp_insert_pagelevelads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group2_adcode').val();
104
+
105
+ args['wp_insert_pagelevelads_'+identifier+'_styles'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_styles').val();
106
+
107
+ args['wp_insert_pagelevelads_'+identifier+'_notes'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_notes').val();
108
+
109
+ jQuery.post(
110
+ jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
111
+ );
112
+ }
113
+
114
+ function wp_insert_pagelevelads_remove(identifier) {
115
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
116
+ 'modal': true,
117
+ 'resizable': false,
118
+ 'title': 'Deletion Confirmation',
119
+ position: { my: 'center', at: 'center', of: window },
120
+ open: function (event, ui) {
121
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
122
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
123
+ },
124
+ buttons : {
125
+ 'Confirm': function() {
126
+ jQuery("#wp_insert_pagelevelads_"+identifier).parent().remove();
127
+ jQuery.post(
128
+ jQuery('#wp_insert_admin_ajax').val(), {
129
+ 'action': 'wp_insert_pagelevelads_remove',
130
+ 'wp_insert_pagelevelads_identifier': identifier,
131
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
132
+ }, function(response) {
133
+ }
134
+ );
135
+ jQuery(this).dialog("close");
136
+ },
137
+ 'Cancel': function() {
138
+ jQuery(this).dialog("close");
139
+ }
140
+ },
141
+ close: function() {
142
+ jQuery(this).dialog('destroy');
143
+ }
144
+ });
145
+ }
includes/modules/pagelevelads/module.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_pagelevelads_css', 0);
6
+ function wp_insert_module_pagelevelads_css() {
7
+ wp_register_style('wp-insert-module-pagelevelads-css', WP_INSERT_URL.'includes/modules/pagelevelads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-pagelevelads-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_pagelevelads_js', 0);
12
+ function wp_insert_module_pagelevelads_js() {
13
+ wp_register_script('wp-insert-module-pagelevelads-js', WP_INSERT_URL.'includes/modules/pagelevelads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-pagelevelads-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_pagelevelads_plugin_card', 20);
20
+ function wp_insert_pagelevelads_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Page-level Ads</h4>';
24
+ echo '<p>Adsense Page-level ads are shown on your site only at optimal times.<br />Google Provides a testing tool in adsense portal for webadmins to test your Adsense Page-Level Ads.</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ $pagelevelads = get_option('wp_insert_pagelevelads');
28
+ if(isset($pagelevelads) && is_array($pagelevelads)) {
29
+ foreach($pagelevelads as $key => $value) {
30
+ echo '<p>';
31
+ echo '<a id="wp_insert_pagelevelads_'.$key.'" href="javascript:;" onclick="wp_insert_pagelevelads_click_handler(\''.$key.'\', \''.$value['title'].'\')">Page-Level Ad : '.$value['title'].'</a>';
32
+ echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_pagelevelads_remove(\''.$key.'\')"></span>';
33
+ echo '</p>';
34
+ }
35
+ }
36
+ echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_pagelevelads_new" href="#" class="button-secondary">Add New Page-Level Ad</a></p>';
37
+ echo '</div>';
38
+ echo '</div>';
39
+ }
40
+ /* End Add Card in Admin Panel */
41
+ ?>
includes/modules/shortcodeads/functions.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Add New Shortcode Content */
3
+ add_action('wp_ajax_wp_insert_shortcodeads_new_form_get_content', 'wp_insert_shortcodeads_new_form_get_content');
4
+ function wp_insert_shortcodeads_new_form_get_content() {
5
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
6
+ wp_insert_shortcodeads_form_get_content(uniqid());
7
+ die();
8
+ }
9
+ /* End Add New Shortcode Content */
10
+
11
+ /* Begin Edit Shortcode Content */
12
+ add_action('wp_ajax_wp_insert_shortcodeads_existing_form_get_content', 'wp_insert_shortcodeads_existing_form_get_content');
13
+ function wp_insert_shortcodeads_existing_form_get_content() {
14
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
15
+ if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
16
+ wp_insert_shortcodeads_form_get_content($_POST['wp_insert_shortcodeads_identifier']);
17
+ }
18
+ die();
19
+ }
20
+
21
+ add_action('wp_ajax_wp_insert_shortcodeads_existing_form_save_action', 'wp_insert_shortcodeads_existing_form_save_action');
22
+ function wp_insert_shortcodeads_existing_form_save_action() {
23
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
24
+ if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
25
+ wp_insert_shortcodeads_form_save_action($_POST['wp_insert_shortcodeads_identifier']);
26
+ }
27
+ die();
28
+ }
29
+ /* End Edit Shortcode Content */
30
+
31
+ /* Begin Delete Shortcode Content */
32
+ add_action('wp_ajax_wp_insert_shortcodeads_remove', 'wp_insert_shortcodeads_remove');
33
+ function wp_insert_shortcodeads_remove() {
34
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
35
+ if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
36
+ $shortcodeads = get_option('wp_insert_shortcodeads');
37
+ unset($shortcodeads[$_POST['wp_insert_shortcodeads_identifier']]);
38
+ update_option('wp_insert_shortcodeads', $shortcodeads);
39
+ }
40
+ die();
41
+ }
42
+ /* End Delete Shortcode Content */
43
+
44
+ /* Begin Shared UI Functions */
45
+ function wp_insert_shortcodeads_form_get_content($identifier) {
46
+ $shortcodeads = get_option('wp_insert_shortcodeads');
47
+ echo '<div class="wp_insert_popup_content_wrapper">';
48
+ $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_shortcodeads['.$identifier.']', 'values' => $shortcodeads[$identifier]));
49
+ $control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_shortcodeads_status', 'optionName' => 'status'));
50
+ $control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_shortcodeads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
51
+ echo $control->HTML;
52
+ $control->clear_controls();
53
+ echo '<div id="wp_insert_shortcodeads_'.$identifier.'_accordion">';
54
+ echo '<h3>Shortcode</h3>';
55
+ echo '<div>';
56
+ $control->set_HTML('<p class="codeSnippet"><code>[wpshortcodead id="'.$identifier.'"]</code></p>');
57
+ $control->create_section('Code to add to your post/page content');
58
+ echo $control->HTML;
59
+ $control->clear_controls();
60
+ echo '</div>';
61
+ echo '<h3>Ad Code</h3>';
62
+ echo '<div>';
63
+ $abtestingMode = get_option('wp_insert_abtesting_mode');
64
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
65
+ $control->create_section('Ad Code (Primary Network)');
66
+ echo $control->HTML;
67
+ $control->clear_controls();
68
+
69
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
70
+ $control->create_section('Ad Code (Secondary Network)');
71
+ if($abtestingMode != '2' && $abtestingMode != '3') {
72
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
73
+ }
74
+ echo $control->HTML;
75
+ $control->clear_controls();
76
+
77
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
78
+ $control->create_section('Ad Code (Tertiary Network)');
79
+ if($abtestingMode != '3') {
80
+ $control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
81
+ }
82
+ echo $control->HTML;
83
+ $control->clear_controls();
84
+ echo '</div>';
85
+ echo '<h3>Rules</h3>';
86
+ echo '<div>';
87
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
88
+ $control->create_section('Logged in Users');
89
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
90
+ echo $control->HTML;
91
+ $control->clear_controls();
92
+
93
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
94
+ $control->create_section('Mobile Devices');
95
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
96
+ echo $control->HTML;
97
+ $control->clear_controls();
98
+
99
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
100
+ $control->create_section('404 Pages');
101
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
102
+ echo $control->HTML;
103
+ $control->clear_controls();
104
+
105
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
106
+ $control->create_section('Home');
107
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
108
+ echo $control->HTML;
109
+ $control->clear_controls();
110
+
111
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
112
+ $control->create_section('Archives');
113
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
114
+ echo $control->HTML;
115
+ $control->clear_controls();
116
+
117
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
118
+ $control->create_section('Search Results');
119
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
120
+ echo $control->HTML;
121
+ $control->clear_controls();
122
+
123
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
124
+ $control->create_section('Single Pages');
125
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
126
+ echo $control->HTML;
127
+ $control->clear_controls();
128
+
129
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
130
+ $control->create_section('Single Posts');
131
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
132
+ echo $control->HTML;
133
+ $control->clear_controls();
134
+
135
+ $control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
136
+ $control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
137
+ $control->create_section('Category Archives');
138
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
139
+ echo $control->HTML;
140
+ $control->clear_controls();
141
+
142
+ echo '</div>';
143
+ echo '<h3>Geo Targeting</h3>';
144
+ echo '<div>';
145
+ echo '<p>';
146
+ echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
147
+ echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
148
+ echo '</p>';
149
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
150
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
151
+ $control->create_section('Group 1');
152
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
153
+ echo $control->HTML;
154
+ $control->clear_controls();
155
+
156
+ $control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
157
+ $control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
158
+ $control->create_section('Group 2');
159
+ $control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
160
+ echo $control->HTML;
161
+ $control->clear_controls();
162
+ echo '<p>';
163
+ echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
164
+ echo '</p>';
165
+ echo '</div>';
166
+ echo '<h3>Styles</h3>';
167
+ echo '<div>';
168
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
169
+ $control->create_section('Styles');
170
+ echo $control->HTML;
171
+ $control->clear_controls();
172
+ echo '</div>';
173
+ echo '<h3>Notes</h3>';
174
+ echo '<div>';
175
+ $control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($shortcodeads[$identifier]['title']))?$shortcodeads[$identifier]['title']:$identifier)));
176
+ $control->create_section('Title');
177
+ echo $control->HTML;
178
+ $control->clear_controls();
179
+
180
+ $control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
181
+ $control->create_section('Notes');
182
+ echo $control->HTML;
183
+ $control->clear_controls();
184
+ echo '</div>';
185
+ echo '</div>';
186
+ echo '<script type="text/javascript">';
187
+ echo $control->JS;
188
+ echo 'jQuery("#wp_insert_shortcodeads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
189
+ echo '</script>';
190
+ echo '</div>';
191
+ }
192
+
193
+ function wp_insert_shortcodeads_form_save_action($identifier) {
194
+ $shortcodeads = get_option('wp_insert_shortcodeads');
195
+ $shortcodeads[$identifier]['identifier'] = ((isset($_POST['wp_insert_shortcodeads_identifier']))?$_POST['wp_insert_shortcodeads_identifier']:'');
196
+ $shortcodeads[$identifier]['status'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_status']) && ($_POST['wp_insert_shortcodeads_'.$identifier.'_status'] == 'true'))?'1':'');
197
+
198
+ $shortcodeads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_primary_ad_code']:'');
199
+ $shortcodeads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_secondary_ad_code']:'');
200
+ $shortcodeads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_tertiary_ad_code']:'');
201
+
202
+ $shortcodeads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_loggedin']:'');
203
+ $shortcodeads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_mobile_devices']:'');
204
+ $shortcodeads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_404']:'');
205
+ $shortcodeads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_home']:'');
206
+ $shortcodeads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_archives']:'');
207
+ $shortcodeads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_search']:'');
208
+ $shortcodeads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_page']:'');
209
+ $shortcodeads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_page_exceptions']:'');
210
+ $shortcodeads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_post']:'');
211
+ $shortcodeads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_exceptions']:'');
212
+ $shortcodeads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_categories_exceptions']:'');
213
+ $shortcodeads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_categories']:'');
214
+ $shortcodeads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_categories_exceptions']:'');
215
+
216
+ $shortcodeads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_countries']:'');
217
+ $shortcodeads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_adcode']:'');
218
+ $shortcodeads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_countries']:'');
219
+ $shortcodeads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_adcode']:'');
220
+
221
+ $shortcodeads[$identifier]['styles'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_styles']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_styles']:'');
222
+
223
+ $shortcodeads[$identifier]['title'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_title']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_title']:'');
224
+ $shortcodeads[$identifier]['notes'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_notes']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_notes']:'');
225
+
226
+ update_option('wp_insert_shortcodeads', $shortcodeads);
227
+ }
228
+ /* End Shared UI Functions */
229
+
230
+ /* Begin Shortcode Ad Insertion */
231
+ add_shortcode('wpshortcodead', 'wp_insert_shortcodeads_shortcode');
232
+ function wp_insert_shortcodeads_shortcode($atts) {
233
+ $atts = shortcode_atts(array('id' => ''), $atts, 'wpshortcodead');
234
+ if(isset($atts['id']) && ($atts['id'] != '')) {
235
+ $shortcodeads = get_option('wp_insert_shortcodeads');
236
+ if(isset($shortcodeads[$atts['id']]) && is_array($shortcodeads[$atts['id']]) && wp_insert_get_ad_status($shortcodeads[$atts['id']])) {
237
+ return '<div class="wpInsert wpInsertShortcodeAd"'.(($shortcodeads[$atts['id']]['styles'] != '')?' style="'.$shortcodeads[$atts['id']]['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($shortcodeads[$atts['id']]).'</div>';
238
+ }
239
+ }
240
+ }
241
+ /* End Shortcode Ad Insertion */
242
+ ?>
includes/modules/shortcodeads/js/module.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_shortcodeads_new',
4
+ 'Shortcode Ad : Add New',
5
+ jQuery("body").width() * 0.8,
6
+ jQuery("body").height() * 0.8,
7
+ function() {
8
+ jQuery('.wp_insert_shortcodeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ var identifier = jQuery(".wp_insert_shortcodeads_identifier").val();
12
+ var shortcodeadLink = jQuery("<a></a>");
13
+ shortcodeadLink.attr("id", "wp_insert_shortcodeads_"+identifier);
14
+ shortcodeadLink.attr("href", "javascript:;");
15
+ shortcodeadLink.attr("onClick", "wp_insert_shortcodeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val()+"\')");
16
+ shortcodeadLink.html("Shortcode Ad : "+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val());
17
+ var deleteButton = jQuery("<span></span>");
18
+ deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
19
+ deleteButton.attr("onClick", "wp_insert_shortcodeads_remove(\'"+identifier+"\')");
20
+ jQuery("#wp_insert_shortcodeads_new").parent().before(jQuery("<p></p>").append(shortcodeadLink, deleteButton));
21
+ wp_insert_shortcodeads_update(identifier);
22
+ },
23
+ function() { }
24
+ );
25
+ });
26
+
27
+ function wp_insert_shortcodeads_click_handler(identifier, title) {
28
+ jQuery('<div id="wp_insert_shortcodeads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
29
+ 'modal': true,
30
+ 'resizable': false,
31
+ 'width': jQuery("body").width() * 0.8,
32
+ 'maxWidth': jQuery("body").width() * 0.8,
33
+ 'maxHeight': jQuery("body").height() * 0.9,
34
+ 'title': 'Shortcode Ad : '+title,
35
+ position: { my: 'center', at: 'center', of: window },
36
+ open: function (event, ui) {
37
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
38
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
39
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
40
+ jQuery.post(
41
+ jQuery('#wp_insert_admin_ajax').val(), {
42
+ 'action': 'wp_insert_shortcodeads_existing_form_get_content',
43
+ 'wp_insert_shortcodeads_identifier': identifier,
44
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
45
+ }, function(response) {
46
+ jQuery('.wp_insert_ajaxloader').hide();
47
+ jQuery('.ui-dialog-content').html(response);
48
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
49
+ jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
50
+ jQuery('.wp_insert_shortcodeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
51
+ jQuery('.ui-dialog').css({'position': 'fixed'});
52
+ jQuery('#wp_insert_shortcodeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
53
+ }
54
+ );
55
+ },
56
+ buttons: {
57
+ 'Update': function() {
58
+ jQuery("#wp_insert_shortcodeads_"+identifier).html("Shortcode Ad : "+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val());
59
+ jQuery("#wp_insert_shortcodeads_"+identifier).attr("onClick", "wp_insert_shortcodeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val()+"\')");
60
+ wp_insert_shortcodeads_update(identifier);
61
+ jQuery(this).dialog('close');
62
+ },
63
+ Cancel: function() {
64
+ jQuery(this).dialog('close');
65
+ }
66
+ },
67
+ close: function() {
68
+ jQuery(this).dialog('destroy');
69
+ }
70
+ });
71
+ }
72
+
73
+ function wp_insert_shortcodeads_update(identifier) {
74
+ args = {};
75
+ args['action'] = 'wp_insert_shortcodeads_existing_form_save_action';
76
+ args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
77
+ args['wp_insert_shortcodeads_identifier'] = identifier;
78
+ args['wp_insert_shortcodeads_'+identifier+'_status'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_status').prop('checked');
79
+
80
+ args['wp_insert_shortcodeads_'+identifier+'_title'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_title').val();
81
+
82
+ args['wp_insert_shortcodeads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_primary_ad_code').val();
83
+ args['wp_insert_shortcodeads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_secondary_ad_code').val();
84
+ args['wp_insert_shortcodeads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_tertiary_ad_code').val();
85
+
86
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
87
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
88
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_404').prop('checked');
89
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_home').prop('checked');
90
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_archives').prop('checked');
91
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_search').prop('checked');
92
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_page').prop('checked');
93
+ args['wp_insert_shortcodeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
94
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_post').prop('checked');
95
+ args['wp_insert_shortcodeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
96
+ args['wp_insert_shortcodeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
97
+ args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_categories').prop('checked');
98
+ args['wp_insert_shortcodeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
99
+
100
+ args['wp_insert_shortcodeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
101
+ args['wp_insert_shortcodeads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group1_adcode').val();
102
+ args['wp_insert_shortcodeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
103
+ args['wp_insert_shortcodeads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group2_adcode').val();
104
+
105
+ args['wp_insert_shortcodeads_'+identifier+'_styles'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_styles').val();
106
+
107
+ args['wp_insert_shortcodeads_'+identifier+'_notes'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_notes').val();
108
+
109
+ jQuery.post(
110
+ jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
111
+ );
112
+ }
113
+
114
+ function wp_insert_shortcodeads_remove(identifier) {
115
+ jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
116
+ 'modal': true,
117
+ 'resizable': false,
118
+ 'title': 'Deletion Confirmation',
119
+ position: { my: 'center', at: 'center', of: window },
120
+ open: function (event, ui) {
121
+ jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
122
+ jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
123
+ },
124
+ buttons : {
125
+ 'Confirm': function() {
126
+ jQuery("#wp_insert_shortcodeads_"+identifier).parent().remove();
127
+ jQuery.post(
128
+ jQuery('#wp_insert_admin_ajax').val(), {
129
+ 'action': 'wp_insert_shortcodeads_remove',
130
+ 'wp_insert_shortcodeads_identifier': identifier,
131
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
132
+ }, function(response) {
133
+ }
134
+ );
135
+ jQuery(this).dialog("close");
136
+ },
137
+ 'Cancel': function() {
138
+ jQuery(this).dialog("close");
139
+ }
140
+ },
141
+ close: function() {
142
+ jQuery(this).dialog('destroy');
143
+ }
144
+ });
145
+ }
includes/modules/shortcodeads/module.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_shortcodeads_css', 0);
6
+ function wp_insert_module_shortcodeads_css() {
7
+ wp_register_style('wp-insert-module-shortcodeads-css', WP_INSERT_URL.'includes/modules/shortcodeads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-shortcodeads-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_shortcodeads_js', 0);
12
+ function wp_insert_module_shortcodeads_js() {
13
+ wp_register_script('wp-insert-module-shortcodeads-js', WP_INSERT_URL.'includes/modules/shortcodeads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-shortcodeads-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_shortcodeads_plugin_card', 40);
20
+ function wp_insert_shortcodeads_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Shortcode Ads</h4>';
24
+ echo '<p>Ads embedded directly inside post / page content via shortcodes.</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ $shortcodeads = get_option('wp_insert_shortcodeads');
28
+ if(isset($shortcodeads) && is_array($shortcodeads)) {
29
+ foreach($shortcodeads as $key => $value) {
30
+ echo '<p>';
31
+ echo '<a id="wp_insert_shortcodeads_'.$key.'" href="javascript:;" onclick="wp_insert_shortcodeads_click_handler(\''.$key.'\', \''.$value['title'].'\')">Shortcode Ad : '.$value['title'].'</a>';
32
+ echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_shortcodeads_remove(\''.$key.'\')"></span>';
33
+ echo '</p>';
34
+ }
35
+ }
36
+ echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_shortcodeads_new" href="#" class="button-secondary">Add New Shortcode Ad</a></p>';
37
+ echo '</div>';
38
+ echo '</div>';
39
+ }
40
+ /* End Add Card in Admin Panel */
41
+ ?>
includes/{tracking-codes.php → modules/trackingcodes/functions.php} RENAMED
@@ -1,21 +1,4 @@
1
  <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_trackingcodes_plugin_card', 50);
4
- function wp_insert_trackingcodes_plugin_card() {
5
- echo '<div class="plugin-card">';
6
- echo '<div class="plugin-card-top">';
7
- echo '<h4>Tracking Codes</h4>';
8
- echo '<p>Google Analytics and other embeddable codes directly inserted into the site.</p>';
9
- echo '</div>';
10
- echo '<div class="plugin-card-bottom">';
11
- echo '<p><a id="wp_insert_trackingcodes_google_analytics" href="javascript:;">Google Analytics</a></p>';
12
- echo '<p><a id="wp_insert_trackingcodes_header" href="javascript:;">Embed Code in Header</a></p>';
13
- echo '<p><a id="wp_insert_trackingcodes_footer" href="javascript:;">Embed Code in Footer</a></p>';
14
- echo '</div>';
15
- echo '</div>';
16
- }
17
- /* End Add Card in Admin Panel */
18
-
19
  /* Begin Analytics Embed */
20
  add_action('wp_ajax_wp_insert_trackingcodes_google_analytics_form_get_content', 'wp_insert_trackingcodes_google_analytics_form_get_content');
21
  function wp_insert_trackingcodes_google_analytics_form_get_content() {
@@ -137,28 +120,4 @@ function wp_insert_trackingcodes_footer_wp_footer() {
137
  }
138
  }
139
  /* End Footer Code Embed */
140
-
141
- /* Begin Database Upgrade */
142
- add_action('wp_insert_upgrade_database', 'wp_insert_trackingcodes_upgrade_database');
143
- function wp_insert_trackingcodes_upgrade_database() {
144
- if(!get_option('wp_insert_trackingcodes')) {
145
- $oldValues = get_option('wp_insert_tracking_codes_options');
146
- $newValues = array(
147
- 'analytics' => array(
148
- 'status' => ((isset($oldValues['analytics']['status']) && $oldValues['analytics']['status'] == true)?'1':''),
149
- 'code' => ((isset($oldValues['analytics']['code']))?$oldValues['analytics']['code']:''),
150
- ),
151
- 'header' => array(
152
- 'status' => ((isset($oldValues['header']['status']) && $oldValues['header']['status'] == true)?'1':''),
153
- 'code' => ((isset($oldValues['header']['code']))?$oldValues['header']['code']:''),
154
- ),
155
- 'footer' => array(
156
- 'status' => ((isset($oldValues['footer']['status']) && $oldValues['footer']['status'] == true)?'1':''),
157
- 'code' => ((isset($oldValues['footer']['code']))?$oldValues['footer']['code']:''),
158
- ),
159
- );
160
- update_option('wp_insert_trackingcodes', $newValues);
161
- }
162
- }
163
- /* End Database Upgrade */
164
  ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* Begin Analytics Embed */
3
  add_action('wp_ajax_wp_insert_trackingcodes_google_analytics_form_get_content', 'wp_insert_trackingcodes_google_analytics_form_get_content');
4
  function wp_insert_trackingcodes_google_analytics_form_get_content() {
120
  }
121
  }
122
  /* End Footer Code Embed */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  ?>
includes/modules/trackingcodes/js/module.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_click_handler(
3
+ 'wp_insert_trackingcodes_google_analytics',
4
+ 'Tracking Codes : Google Analytics',
5
+ '480',
6
+ '480',
7
+ function() {
8
+ jQuery('#wp_insert_trackingcodes_analytics_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
9
+ },
10
+ function() {
11
+ jQuery.post(
12
+ jQuery('#wp_insert_admin_ajax').val(), {
13
+ 'action': 'wp_insert_trackingcodes_google_analytics_form_save_action',
14
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
15
+ 'wp_insert_trackingcodes_analytics_status': jQuery('#wp_insert_trackingcodes_analytics_status').prop('checked'),
16
+ 'wp_insert_trackingcodes_analytics_code': jQuery('#wp_insert_trackingcodes_analytics_code').val(),
17
+ }, function(response) { }
18
+ );
19
+ },
20
+ function() { }
21
+ );
22
+
23
+ wp_insert_click_handler(
24
+ 'wp_insert_trackingcodes_header',
25
+ 'Tracking Codes : Header',
26
+ jQuery("body").width() * 0.8,
27
+ jQuery("body").height() * 0.8,
28
+ function() {
29
+ jQuery('#wp_insert_trackingcodes_header_code').css('height', (jQuery("body").height() * 0.5)+'px');
30
+ jQuery('#wp_insert_trackingcodes_header_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
31
+ },
32
+ function() {
33
+ jQuery.post(
34
+ jQuery('#wp_insert_admin_ajax').val(), {
35
+ 'action': 'wp_insert_trackingcodes_header_form_save_action',
36
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
37
+ 'wp_insert_trackingcodes_header_status': jQuery('#wp_insert_trackingcodes_header_status').prop('checked'),
38
+ 'wp_insert_trackingcodes_header_code': jQuery('#wp_insert_trackingcodes_header_code').val(),
39
+ }, function(response) { }
40
+ );
41
+ },
42
+ function() { }
43
+ );
44
+
45
+ wp_insert_click_handler(
46
+ 'wp_insert_trackingcodes_footer',
47
+ 'Tracking Codes : Footer',
48
+ jQuery("body").width() * 0.8,
49
+ jQuery("body").height() * 0.8,
50
+ function() {
51
+ jQuery('#wp_insert_trackingcodes_footer_code').css('height', (jQuery("body").height() * 0.5)+'px');
52
+ jQuery('#wp_insert_trackingcodes_footer_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
53
+ },
54
+ function() {
55
+ jQuery.post(
56
+ jQuery('#wp_insert_admin_ajax').val(), {
57
+ 'action': 'wp_insert_trackingcodes_footer_form_save_action',
58
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
59
+ 'wp_insert_trackingcodes_footer_status': jQuery('#wp_insert_trackingcodes_footer_status').prop('checked'),
60
+ 'wp_insert_trackingcodes_footer_code': jQuery('#wp_insert_trackingcodes_footer_code').val(),
61
+ }, function(response) { }
62
+ );
63
+ },
64
+ function() { }
65
+ );
66
+ });
includes/modules/trackingcodes/module.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+
4
+ /* Begin Add Assets */
5
+ /*add_action('wp_insert_modules_css', 'wp_insert_module_trackingcodes_css', 0);
6
+ function wp_insert_module_trackingcodes_css() {
7
+ wp_register_style('wp-insert-module-trackingcodes-css', WP_INSERT_URL.'includes/modules/trackingcodes/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
8
+ wp_enqueue_style('wp-insert-module-trackingcodes-css');
9
+ }*/
10
+
11
+ add_action('wp_insert_modules_js', 'wp_insert_module_trackingcodes_js', 0);
12
+ function wp_insert_module_trackingcodes_js() {
13
+ wp_register_script('wp-insert-module-trackingcodes-js', WP_INSERT_URL.'includes/modules/trackingcodes/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
14
+ wp_enqueue_script('wp-insert-module-trackingcodes-js');
15
+ }
16
+ /* End Add Assets */
17
+
18
+ /* Begin Add Card in Admin Panel */
19
+ add_action('wp_insert_plugin_card', 'wp_insert_trackingcodes_plugin_card', 80);
20
+ function wp_insert_trackingcodes_plugin_card() {
21
+ echo '<div class="plugin-card">';
22
+ echo '<div class="plugin-card-top">';
23
+ echo '<h4>Tracking Codes</h4>';
24
+ echo '<p>Google Analytics and other embeddable codes directly inserted into the site.</p>';
25
+ echo '</div>';
26
+ echo '<div class="plugin-card-bottom">';
27
+ echo '<p><a id="wp_insert_trackingcodes_google_analytics" href="javascript:;">Google Analytics</a></p>';
28
+ echo '<p><a id="wp_insert_trackingcodes_header" href="javascript:;">Embed Code in Header</a></p>';
29
+ echo '<p><a id="wp_insert_trackingcodes_footer" href="javascript:;">Embed Code in Footer</a></p>';
30
+ echo '</div>';
31
+ echo '</div>';
32
+ }
33
+ /* End Add Card in Admin Panel */
34
+ ?>
includes/{apis/vi/api.php → modules/videointelligence/api/vi.php} RENAMED
File without changes
includes/modules/videointelligence/css/module.css ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wp-insert .plugin-card.vi-card {
2
+ position: relative;
3
+ }
4
+
5
+ .wp-insert .plugin-card.vi-card .plugin-card-top {
6
+ padding-bottom: 100px;
7
+ }
8
+
9
+ .wp-insert .vi-card .plugin-card-bottom {
10
+ bottom: 0;
11
+ left: 0;
12
+ right: 0;
13
+ position: absolute;
14
+ }
15
+
16
+ .vi-card .plugin-card-top {
17
+ padding: 0;
18
+ }
19
+
20
+ .vi-card .plugin-card-top h4 {
21
+ color: #000;
22
+ font-size: 14px;
23
+ font-weight: 600;
24
+ line-height: 18px;
25
+ margin: 0;
26
+ }
27
+
28
+ .vi-card .plugin-card-top .plugin-card-top-header {
29
+ border-bottom: 1px solid #eee;
30
+ padding: 5px 10px;
31
+ }
32
+
33
+ .vi-card .plugin-card-top .plugin-card-top-content {
34
+ padding: 0 10px 5px;
35
+ font-family: arial;
36
+ font-size: 13px;
37
+ line-height: 18px;
38
+ color: #444444;
39
+ }
40
+
41
+ .vi-card .plugin-card-top .plugin-card-top-content p {
42
+ font-family: arial;
43
+ font-size: 13px;
44
+ line-height: 18px;
45
+ color: #444444;
46
+ }
47
+
48
+
49
+ .vi-card .plugin-card-top .plugin-card-top-content p.strong {
50
+ color: #000;
51
+ font-size: 15px;
52
+ }
53
+
54
+ .vi-card .plugin-card-top .plugin-card-top-content ul {
55
+ margin: 10px 0 10px 15px;
56
+ padding: 0 0 0 15px;
57
+ }
58
+
59
+ .vi-card .plugin-card-top .plugin-card-top-content ul li {
60
+ list-style-type: disc;
61
+ margin: 0;
62
+ padding: 0 0 0 7px;
63
+ list-style-position: outside;
64
+ }
65
+
66
+ .vi-card .plugin-card-bottom {
67
+ text-align: right;
68
+ padding: 24px 20px;
69
+ }
70
+
71
+ .vi-card .plugin-card-bottom .button {
72
+ height: 32px;
73
+ line-height: 28px;
74
+ padding: 0 15px;
75
+ margin: 5px 0;
76
+ }
77
+
78
+ .vi-card .plugin-card-bottom .button#wp_insert_vi_signup {
79
+ margin: 5px 0 5px 15px;
80
+ }
81
+
82
+ .vi-card .plugin-card-bottom span {
83
+ display: inline;
84
+ float: left;
85
+ font-size: 13px;
86
+ text-align: left;
87
+ width: calc(100% - 200px);
88
+ font-family: arial;
89
+ line-height: 18px;
90
+ }
91
+
92
+ p.viError {
93
+ font-weight: bold;
94
+ color: #fd5740;
95
+ }
96
+
97
+ .vi-card #wp_insert_vi_earnings_wrapper {
98
+ margin-top: 50px;
99
+ }
100
+
101
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings {
102
+ float: left;
103
+ width: calc(100% - 348px);
104
+ margin-top: 38px;
105
+ min-width: 150px;
106
+ margin-bottom: 15px;
107
+ }
108
+
109
+ @media only screen and (max-width: 1256px) {
110
+ .vi-card #wp_insert_vi_earnings_wrapper {
111
+ margin-top: 0;
112
+ }
113
+
114
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings {
115
+ margin-top: 0;
116
+ }
117
+ }
118
+
119
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings #wp_insert_vi_earnings_label {
120
+ color: rgb(35, 40, 45);
121
+ display: block;
122
+ font-size: 14px;
123
+ line-height: 18px;
124
+ font-family: Arial;
125
+ }
126
+
127
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_earnings #wp_insert_vi_earnings_value {
128
+ color: rgb(35, 40, 45);
129
+ display: block;
130
+ font-size: 32px;
131
+ font-weight: bold;
132
+ line-height: 44px;
133
+ font-family: Arial;
134
+ }
135
+
136
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_chart_wrapper {
137
+ float: right;
138
+ height: 139px;
139
+ width: 348px;
140
+ max-width: 100%;
141
+ }
142
+
143
+ .vi-card #wp_insert_vi_earnings_wrapper #wp_insert_vi_chart_wrapper canvas {
144
+ border: 1px solid #ddd
145
+ }
146
+
147
+ .wp_insert_vi_login_error {
148
+ color: #ff0000;
149
+ font-size: 10px;
150
+ margin: -10px 0 0;
151
+ }
152
+
153
+ #wp_insert_vi_customize_adcode {
154
+ margin-left: 10px;
155
+ }
156
+
157
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_right_column {
158
+ width: calc(50% - 30px);
159
+ float: right;
160
+ margin-top: 10px;
161
+ }
162
+
163
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column {
164
+ width: calc(50% - 30px);
165
+ float: left;
166
+ margin-top: 10px;
167
+ font-family: Arial;
168
+ font-size: 13px;
169
+ line-height: 18px;
170
+ }
171
+
172
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p {
173
+ position: relative;
174
+ }
175
+
176
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p label {
177
+ float: left;
178
+ display: inline-block;
179
+ width: 180px;
180
+ }
181
+
182
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p br {
183
+ display: none;
184
+ }
185
+
186
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p input,
187
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p select,
188
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p textarea {
189
+ float: right;
190
+ width: calc(100% - 210px);
191
+ display: inline-block;
192
+ clear: none;
193
+ margin-right: 20px;
194
+ }
195
+
196
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper {
197
+ position: absolute;
198
+ display: inline-block;
199
+ background: #bababa;
200
+ width: 13px;
201
+ height: 13px;
202
+ border-radius: 7px;
203
+ right: 0;
204
+ top: 5px;
205
+ cursor: pointer;
206
+ }
207
+
208
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:after {
209
+ content: "i";
210
+ font-size: 10px;
211
+ font-weight: 600;
212
+ color: #fff;
213
+ line-height: 13px;
214
+ position: relative;
215
+ left: 0;
216
+ right: 0;
217
+ margin: 0 auto 0;
218
+ width: 13px;
219
+ height: 13px;
220
+ display: block;
221
+ text-align: center;
222
+ }
223
+
224
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:hover {
225
+ background: #000000;
226
+ }
227
+
228
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip {
229
+ visibility: hidden;
230
+ width: 142px;
231
+ background-color: #363636;
232
+ color: #fff;
233
+ text-align: left;
234
+ padding: 5px;
235
+ border-radius: 4px;
236
+ position: absolute;
237
+ top: -10px;
238
+ left: 20px;
239
+ z-index: 1;
240
+ font-size: 9px;
241
+ }
242
+
243
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip br {
244
+ display: block;
245
+ }
246
+
247
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper:hover span.tooltip {
248
+ visibility: visible;
249
+ }
250
+
251
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p span.tooltipWrapper span.tooltip::after {
252
+ /*content: " ";
253
+ position: absolute;
254
+ top: 50%;
255
+ right: 100%;
256
+ margin-top: -5px;
257
+ border-width: 5px;
258
+ border-style: solid;
259
+ border-color: transparent black transparent transparent;*/
260
+ }
261
+
262
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column .minicolors {
263
+ width: calc(100% - 190px);
264
+ float: right;
265
+ }
266
+
267
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column .minicolors input {
268
+ width: calc(100% - 20px);
269
+ height: 30px;
270
+ }
271
+
272
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p small {
273
+ clear: both;
274
+ height: 1px;
275
+ width: 100%;
276
+ display: block;
277
+ }
278
+
279
+ .wp_insert_popup_content_wrapper .wp_insert_vi_popup_left_column p a.textTip {
280
+ position: absolute;
281
+ right: -92px;
282
+ top: 5px;
283
+ font-size: 11px;
284
+ display: block;
285
+ font-style: italic;
286
+ }
287
+
288
+ .wp_insert_popup_content_wrapper .wp_insert_vi_delay_notice {
289
+ float: right;
290
+ width: calc(100% - 190px);
291
+ display: inline-block;
292
+ clear: both;
293
+ margin: 0 20px 0 0;
294
+ color: #5f5f5f;
295
+ font-size: 13px;
296
+ font-style: italic;
297
+ }
298
+
299
+ .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper {
300
+ line-height: 24px;
301
+ margin: 18px 0 20px;
302
+ }
303
+
304
+ .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper label {
305
+ width: 144px;
306
+ display: block;
307
+ font-size: 12px;
308
+ font-family: Arial;
309
+ position: absolute;
310
+ color: #444444;
311
+ }
312
+
313
+ .wp_insert_popup_content_wrapper .wp_insert_vi_code_data_wrapper b {
314
+ margin-left: 164px;
315
+ display: block;
316
+ font-size: 13px;
317
+ font-family: Arial;
318
+ color: #444444;
319
+ }
includes/modules/videointelligence/functions.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Begin Signup Form */
3
+ add_action('wp_ajax_wp_insert_vi_signup_form_get_content', 'wp_insert_vi_signup_form_get_content');
4
+ function wp_insert_vi_signup_form_get_content() {
5
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
6
+ $signupURL = wp_insert_vi_api_get_signupurl();
7
+ if(($signupURL != false) && ($signupURL != '')) {
8
+ echo '<div class="wp_insert_popup_content_wrapper">';
9
+ echo '<iframe src="'.$signupURL.'?email='.get_bloginfo('admin_email').'&domain='.wp_insert_get_domain_name_from_url(get_bloginfo('url')).'&aid=WP_insert" style="width: 100%; max-width: 870px; min-height: 554px;"></iframe>';
10
+ echo '<script type="text/javascript">';
11
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().remove();';
12
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Close</span>");';
13
+ echo '</script>';
14
+ echo '</div>';
15
+ } else {
16
+ echo '<div class="wp_insert_popup_content_wrapper">';
17
+ echo '<p> There was an error processing your request. Please try again later. </p>';
18
+ echo '</div>';
19
+ }
20
+ die();
21
+ }
22
+ /* End Signup Form */
23
+
24
+ /* Begin Login Form */
25
+ add_action('wp_ajax_wp_insert_vi_login_form_get_content', 'wp_insert_vi_login_form_get_content');
26
+ function wp_insert_vi_login_form_get_content() {
27
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
28
+ echo '<div class="wp_insert_popup_content_wrapper">';
29
+ echo '<div class="wp_insert_vi_loginform_wrapper">';
30
+ wp_insert_vi_login_form_get_controls();
31
+ echo '</div>';
32
+ echo '<script type="text/javascript">';
33
+ echo $control->JS;
34
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Login</span>");';
35
+ echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(1)").attr("class", "ui-button-icon-primary ui-icon ui-icon-key");';
36
+ echo '</script>';
37
+ echo '</div>';
38
+ die();
39
+ }
40
+
41
+ add_action('wp_ajax_wp_insert_vi_login_form_save_action', 'wp_insert_vi_login_form_save_action');
42
+ function wp_insert_vi_login_form_save_action() {
43
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
44
+ if(isset($_POST['wp_insert_vi_login_username']) && ($_POST['wp_insert_vi_login_username'] != '') && isset($_POST['wp_insert_vi_login_password']) && ($_POST['wp_insert_vi_login_password'] != '')) {
45
+ $token = wp_insert_vi_api_login($_POST['wp_insert_vi_login_username'], $_POST['wp_insert_vi_login_password']);
46
+ if(is_array($token) && (isset($token['status'])) && ($token['status'] == 'error')) {
47
+ wp_insert_vi_login_form_get_controls();
48
+ if($token['errorCode'] == 'WIVI008') {
49
+ echo '<p class="wp_insert_vi_login_error">'.$token['message'].'</p>';
50
+ } else {
51
+ echo '<p class="wp_insert_vi_login_error">Error Code: '.$token['errorCode'].'<br />Please contact support or try again later!'.'</p>';
52
+ }
53
+ } else {
54
+ echo '###SUCCESS###';
55
+ wp_insert_vi_plugin_card_content(true, true);
56
+ }
57
+ }
58
+ die();
59
+ }
60
+
61
+ function wp_insert_vi_login_form_get_controls() {
62
+ $control = new smartlogixControls();
63
+ $control->HTML .= '<p>Please log in with the received credentials to complete the integration:</p>';
64
+ $control->add_control(array('type' => 'text', 'id' => 'wp_insert_vi_login_username', 'name' => 'wp_insert_vi_login_username', 'label' => 'Email', 'value' => ''));
65
+ $control->add_control(array('type' => 'password', 'id' => 'wp_insert_vi_login_password', 'name' => 'wp_insert_vi_login_password', 'label' => 'Password', 'value' => ''));
66
+ $control->create_section('Login');
67
+ echo $control->HTML;
68
+ }
69
+
70
+ add_action('wp_ajax_wp_insert_vi_update_adstxt', 'wp_insert_vi_update_adstxt');
71
+ function wp_insert_vi_update_adstxt() {
72
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
73
+
74
+ $adstxtContent = wp_insert_adstxt_get_content();
75
+ $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
76
+ $viEntry = wp_insert_vi_api_get_adstxt_content();
77
+ if(strpos(str_replace(array("\r", "\n", " "), '', $adstxtContent), str_replace(array("\r", "\n", " "), '', $viEntry)) !== false) {
78
+ die();
79
+ } else {
80
+ $updatedAdstxtContent = '';
81
+ if(strpos($adstxtContent, '# 41b5eef6') !== false) {
82
+ foreach($adstxtContentData as $line) {
83
+ if(strpos($line, '# 41b5eef6') !== false) {
84
+
85
+ } else {
86
+ $updatedAdstxtContent .= str_replace(array("\r", "\n", " "), '', $line)."\r\n";
87
+ }
88
+ }
89
+ $updatedAdstxtContent .= $viEntry;
90
+ } else {
91
+ $updatedAdstxtContent .= $adstxtContent."\r\n".$viEntry;
92
+ }
93
+
94
+ if(wp_insert_adstxt_update_content($updatedAdstxtContent)) {
95
+ echo '###SUCCESS###';
96
+ echo '<div class="notice notice-warning wp_insert_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
97
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
98
+ echo '<p><b>ADS.TXT has been added</b></p>';
99
+ echo '<p>Wp-Insert has updated your ads.txt file with lines that declare video intelligence as a legitimate seller of your inventory and enables you to make more money through video intelligence. Read the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQ</a>.</p>';
100
+ echo '</div>';
101
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
102
+ echo '<div class="clear"></div>';
103
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
104
+ echo '</div>';
105
+ } else {
106
+ echo '###FAIL###';
107
+ echo '<div class="notice notice-error wp_insert_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
108
+ echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
109
+ echo '<p><b>ADS.TXT couldn’t be added</b></p>';
110
+ echo '<p>Important note: Wp-Insert hasn’t been able to update your ads.txt file. Please make sure that you enter the following lines manually:</p>';
111
+ echo '<p><code style="display: block;">'.trim(str_replace(array("\r\n", "\r", "\n"), "<br />", $viEntry)).'</code><br />Only by doing so, you\'ll be able to make more money through video intelligence (vi.ai).</p>';
112
+ echo '</div>';
113
+ echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
114
+ echo '<div class="clear"></div>';
115
+ echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
116
+ echo '</div>';
117
+ }
118
+ }
119
+ die();
120
+ }
121
+ /* End Login Form */
122
+
123
+ /* Begin Logout */
124
+ add_action('wp_ajax_wp_insert_vi_logout_action', 'wp_insert_vi_logout_action');
125
+ function wp_insert_vi_logout_action() {
126
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
127
+ wp_insert_vi_api_logout();
128
+ echo '###SUCCESS###';
129
+ wp_insert_vi_plugin_card_content(false, true);
130
+ die();
131
+ }
132
+ /* End Logout */
133
+
134
+ /* Begin Configure vi Code */
135
+ add_action('wp_ajax_wp_insert_vi_customize_adcode_form_get_content', 'wp_insert_vi_customize_adcode_form_get_content');
136
+ function wp_insert_vi_customize_adcode_form_get_content() {
137
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
138
+ $vicodeSettings = get_option('wp_insert_vi_code_settings');
139
+ $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_vi_code_settings', 'values' => $vicodeSettings));
140
+ $control->HTML = '<div class="wp_insert_popup_content_wrapper">';
141
+ $control->HTML .= '<p>Use this form to customize the look of the video unit. Use the same parameters as your WordPress theme for a natural look on your site.<br />You can use <b>vi stories</b> for <i>In-Post Ads: Ad - Above Post Content</i> and <i>In-Post Ads: Ad - Middle of Post Content</i></p>';
142
+ $control->HTML .= '<div class="wp_insert_vi_popup_right_column">';
143
+ $control->HTML .= '<img style="margin: 0 auto; display: block;" src="'.WP_INSERT_URL.'includes/assets/images/advertisement-preview.png?'.WP_INSERT_VERSION.'" />';
144
+ $control->HTML .= '</div>';
145
+ $control->HTML .= '<div class="wp_insert_vi_popup_left_column">';
146
+ $control->HTML .= '<p id="wp_insert_vi_customize_adcode_keywords_required_error" style="display: none;" class="viError">Keywords contains invalid characters, Some required fields are missing</p>';
147
+ $control->HTML .= '<p id="wp_insert_vi_customize_adcode_keywords_error" style="display: none;" class="viError">Keywords contains invalid characters</p>';
148
+ $control->HTML .= '<p id="wp_insert_vi_customize_adcode_required_error" style="display: none;" class="viError">Some required fields are missing</p>';
149
+ $adUnitOptions = array(
150
+ /*array('text' => 'Select Ad Unit', 'value' => 'select'),*/
151
+ array('text' => 'vi stories', 'value' => 'NATIVE_VIDEO_UNIT'),
152
+ /*array('text' => 'Outstream', 'value' => 'FLOATING_OUTSTREAM')*/
153
+ );
154
+ $control->add_control(array('type' => 'select', 'label' => ' Ad Unit*', 'optionName' => 'ad_unit_type', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">- vi stories (video advertising + video content)</span></span><small>', 'options' => $adUnitOptions));/*<br />- out-stream (video advertising)*/
155
+ $control->add_control(array('type' => 'textarea', 'label' => 'Keywords', 'optionName' => 'keywords', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">Comma separated values describing the content of the page e.g. \'cooking, grilling, pulled pork\'</span></span><small>'));
156
+ $IABParentCategories = wp_insert_vi_get_constant_iab_parent_categories();
157
+ $control->add_control(array('type' => 'select', 'label' => 'IAB Category*', 'optionName' => 'iab_category_parent', 'helpText' => '</small><a class="textTip" target="_blank" href="'.wp_insert_vi_api_get_iabCategoriesURL().'">See Complete List</a><small>', 'options' => $IABParentCategories));
158
+ $IABChildCategories = wp_insert_vi_get_constant_iab_child_categories();
159
+ $control->add_control(array('type' => 'select', 'label' => '&nbsp;', 'optionName' => 'iab_category_child', 'helpText' => '&nbsp;', 'options' => $IABChildCategories));
160
+ $languages = wp_insert_vi_api_get_languages();
161
+ $languageOptions = array(
162
+ array('text' => 'Select language', 'value' => 'select'),
163
+ );
164
+ if($languages != false) {
165
+ foreach($languages as $key => $value) {
166
+ $languageOptions[] = array('text' => $value, 'value' => $key);
167
+ }
168
+ }
169
+ $control->add_control(array('type' => 'select', 'label' => 'Language*', 'optionName' => 'language', 'helpText' => '&nbsp;', 'options' => $languageOptions));
170
+ $control->add_control(array('type' => 'minicolors', 'label' => 'Native Background color', 'optionName' => 'native_bg_color', 'helpText' => '&nbsp;'));
171
+ $control->add_control(array('type' => 'minicolors', 'label' => 'Native Text color', 'optionName' => 'native_text_color', 'helpText' => '&nbsp;'));
172
+ $control->add_control(array('type' => 'select', 'label' => ' Native Text Font Family', 'optionName' => 'font_family', 'helpText' => '&nbsp;', 'options' => wp_insert_vi_get_constant_fonts()));
173
+ $control->add_control(array('type' => 'select', 'label' => 'Native Text Font Size', 'optionName' => 'font_size', 'helpText' => '&nbsp;', 'options' => wp_insert_vi_get_constant_font_sizes()));
174
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 1', 'optionName' => 'optional_1', 'helpText' => '&nbsp;'));
175
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 2', 'optionName' => 'optional_2', 'helpText' => '&nbsp;'));
176
+ $control->add_control(array('type' => 'textarea', 'label' => 'Optional 3', 'optionName' => 'optional_3', 'helpText' => '&nbsp;'));
177
+ $control->HTML .= '<p class="wp_insert_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
178
+ $control->HTML .= '</div>';
179
+ $control->HTML .= '<div class="clear"></div>';
180
+ $control->HTML .= '</div>';
181
+ $control->create_section(' vi stories: customize your video player ');
182
+ echo $control->HTML;
183
+ echo '<script type="text/javascript">';
184
+ echo $control->JS;
185
+ echo 'wp_insert_vi_code_iab_category_parent_change();';
186
+ echo '</script>';
187
+ die();
188
+ }
189
+
190
+ add_action('wp_ajax_wp_insert_vi_customize_adcode_form_save_action', 'wp_insert_vi_customize_adcode_form_save_action');
191
+ function wp_insert_vi_customize_adcode_form_save_action() {
192
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
193
+ $vicodeSettings = array();
194
+ $vicodeSettings['ad_unit_type'] = ((isset($_POST['wp_insert_vi_code_settings_ad_unit_type']))?$_POST['wp_insert_vi_code_settings_ad_unit_type']:'');
195
+ $vicodeSettings['keywords'] = ((isset($_POST['wp_insert_vi_code_settings_keywords']))?$_POST['wp_insert_vi_code_settings_keywords']:'');
196
+ $vicodeSettings['iab_category_parent'] = ((isset($_POST['wp_insert_vi_code_settings_iab_category_parent']))?$_POST['wp_insert_vi_code_settings_iab_category_parent']:'');
197
+ $vicodeSettings['iab_category_child'] = ((isset($_POST['wp_insert_vi_code_settings_iab_category_child']))?$_POST['wp_insert_vi_code_settings_iab_category_child']:'');
198
+ $vicodeSettings['language'] = ((isset($_POST['wp_insert_vi_code_settings_language']))?$_POST['wp_insert_vi_code_settings_language']:'');
199
+ $vicodeSettings['native_bg_color'] = ((isset($_POST['wp_insert_vi_code_settings_native_bg_color']))?$_POST['wp_insert_vi_code_settings_native_bg_color']:'');
200
+ $vicodeSettings['native_text_color'] = ((isset($_POST['wp_insert_vi_code_settings_native_text_color']))?$_POST['wp_insert_vi_code_settings_native_text_color']:'');
201
+ $vicodeSettings['font_family'] = ((isset($_POST['wp_insert_vi_code_settings_font_family']))?$_POST['wp_insert_vi_code_settings_font_family']:'');
202
+ $vicodeSettings['font_size'] = ((isset($_POST['wp_insert_vi_code_settings_font_size']))?$_POST['wp_insert_vi_code_settings_font_size']:'');
203
+ $vicodeSettings['optional_1'] = ((isset($_POST['wp_insert_vi_code_settings_optional_1']))?$_POST['wp_insert_vi_code_settings_optional_1']:'');
204
+ $vicodeSettings['optional_2'] = ((isset($_POST['wp_insert_vi_code_settings_optional_2']))?$_POST['wp_insert_vi_code_settings_optional_2']:'');
205
+ $vicodeSettings['optional_3'] = ((isset($_POST['wp_insert_vi_code_settings_optional_3']))?$_POST['wp_insert_vi_code_settings_optional_3']:'');
206
+ update_option('wp_insert_vi_code_settings', $vicodeSettings);
207
+ $viCodeStatus = wp_insert_vi_api_set_vi_code($vicodeSettings);
208
+ if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
209
+ if($viCodeStatus['errorCode'] == 'WIVI108') {
210
+ echo '###FAIL###';
211
+ echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
212
+ } else {
213
+ echo '###FAIL###';
214
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
215
+ }
216
+ } else {
217
+ echo '###SUCCESS###';
218
+ }
219
+ die();
220
+ }
221
+
222
+ function wp_insert_vi_customize_adcode_get_settings() {
223
+ $vicodeSettings = get_option('wp_insert_vi_code_settings');
224
+
225
+ $output = '';
226
+ if(isset($vicodeSettings) && is_array($vicodeSettings)) {
227
+ $output .= '<p class="wp_insert_vi_code_data_wrapper">';
228
+ if(isset($vicodeSettings['ad_unit_type']) && ($vicodeSettings['ad_unit_type'] != '') && ($vicodeSettings['ad_unit_type'] != 'select')) {
229
+ $output .= '<label>Ad Unit:</label><b>vi stories</b>';
230
+ }
231
+
232
+ if(isset($vicodeSettings['keywords']) && ($vicodeSettings['keywords'] != '')) {
233
+ $output .= '<label>Keywords:</label><b>'.$vicodeSettings['keywords'].'</b>';
234
+ }
235
+
236
+ if(isset($vicodeSettings['iab_category_child']) && ($vicodeSettings['iab_category_child'] != '') && ($vicodeSettings['iab_category_child'] != 'select')) {
237
+ $IABChildCategories = wp_insert_vi_get_constant_iab_child_categories();
238
+ foreach($IABChildCategories as $IABChildCategoryItem) {
239
+ if($vicodeSettings['iab_category_child'] == $IABChildCategoryItem['value']) {
240
+ $output .= '<label>IAB Category:</label><b>'.$IABChildCategoryItem['text'].'</b>';
241
+ }
242
+ }
243
+ }
244
+
245
+ $languages = wp_insert_vi_api_get_languages();
246
+ if(isset($vicodeSettings['language']) && ($vicodeSettings['language'] != '') && ($vicodeSettings['language'] != 'select')) {
247
+ if($languages != false) {
248
+ foreach($languages as $key => $value) {
249
+ if($vicodeSettings['language'] == $key) {
250
+ $output .= '<label>Language:</label><b>'.$value.'</b>';
251
+ }
252
+ }
253
+ }
254
+ }
255
+
256
+ if(isset($vicodeSettings['native_bg_color']) && ($vicodeSettings['native_bg_color'] != '')) {
257
+ $output .= '<label>Native Background color:</label><b>'.$vicodeSettings['native_bg_color'].'</b>';
258
+ }
259
+
260
+ if(isset($vicodeSettings['native_text_color']) && ($vicodeSettings['native_text_color'] != '')) {
261
+ $output .= '<label>Native Text color:</label><b>'.$vicodeSettings['native_text_color'].'</b>';
262
+ }
263
+
264
+ if(isset($vicodeSettings['font_family']) && ($vicodeSettings['font_family'] != '') && ($vicodeSettings['font_family'] != 'select')) {
265
+ $fontFamily = wp_insert_vi_get_constant_fonts();
266
+ foreach($fontFamily as $fontFamilyItem) {
267
+ if($vicodeSettings['font_family'] == $fontFamilyItem['value']) {
268
+ $output .= '<label>Native Text Font Family:</label><b>'.$fontFamilyItem['text'].'</b>';
269
+ }
270
+ }
271
+ }
272
+
273
+ if(isset($vicodeSettings['font_size']) && ($vicodeSettings['font_size'] != '') && ($vicodeSettings['font_size'] != 'select')) {
274
+ $fontSize = wp_insert_vi_get_constant_font_sizes();
275
+ foreach($fontSize as $fontSizeItem) {
276
+ if($vicodeSettings['font_size'] == $fontSizeItem['value']) {
277
+ $output .= '<label>Native Text Font Size:</label><b>'.$fontSizeItem['text'].'</b>';
278
+ }
279
+ }
280
+ }
281
+
282
+ if(isset($vicodeSettings['optional_1']) && ($vicodeSettings['optional_1'] != '')) {
283
+ $output .= '<label>Optional 1:</label><b>'.$vicodeSettings['optional_1'].'</b>';
284
+ }
285
+ if(isset($vicodeSettings['optional_2']) && ($vicodeSettings['optional_2'] != '')) {
286
+ $output .= '<label>Optional 2:</label><b>'.$vicodeSettings['optional_1'].'</b>';
287
+ }
288
+ if(isset($vicodeSettings['optional_3']) && ($vicodeSettings['optional_3'] != '')) {
289
+ $output .= '<label>Optional 3:</label><b>'.$vicodeSettings['optional_1'].'</b>';
290
+ }
291
+ $output .= '</p>';
292
+ }
293
+ return $output;
294
+ }
295
+ /* End Configure vi Code */
296
+ ?>
includes/modules/videointelligence/js/module.js ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ wp_insert_vi_signup_handler();
3
+ wp_insert_vi_login_handler();
4
+ wp_insert_vi_logout_handler();
5
+ wp_insert_vi_customize_adcode();
6
+ wp_insert_vi_chart_draw()
7
+ });
8
+
9
+ function wp_insert_vi_signup_handler() {
10
+ wp_insert_click_handler(
11
+ 'wp_insert_vi_signup',
12
+ 'video intelligence: Signup',
13
+ '870',
14
+ '554',
15
+ function() { },
16
+ function() { },
17
+ function() { }
18
+ );
19
+ }
20
+
21
+ function wp_insert_vi_login_handler() {
22
+ wp_insert_click_handler(
23
+ 'wp_insert_vi_login',
24
+ 'video intelligence: Login',
25
+ '540',
26
+ '540',
27
+ function() {
28
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
29
+ if((jQuery('#wp_insert_vi_login_username').val() != '') && (jQuery('#wp_insert_vi_login_password').val() != '')) {
30
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
31
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
32
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
33
+ var wp_insert_vi_login_username = jQuery('#wp_insert_vi_login_username').val();
34
+ var wp_insert_vi_login_password = jQuery('#wp_insert_vi_login_password').val();
35
+ jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
36
+ jQuery('.wp_insert_ajaxloader').show();
37
+ jQuery.post(
38
+ jQuery('#wp_insert_admin_ajax').val(), {
39
+ 'action': 'wp_insert_vi_login_form_save_action',
40
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
41
+ 'wp_insert_vi_login_username': wp_insert_vi_login_username,
42
+ 'wp_insert_vi_login_password': wp_insert_vi_login_password,
43
+ }, function(response) {
44
+ if(response.indexOf('###SUCCESS###') !== -1) {
45
+ jQuery.post(
46
+ jQuery('#wp_insert_admin_ajax').val(), {
47
+ 'action': 'wp_insert_vi_update_adstxt',
48
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
49
+ }, function(response) {
50
+ if(response.indexOf('###SUCCESS###') !== -1) {
51
+ jQuery('.wrap #wp_insert_title').after(response.replace('###SUCCESS###', ''));
52
+ } else if(response.indexOf('###FAIL###') !== -1) {
53
+ jQuery('.wrap #wp_insert_title').after(response.replace('###FAIL###', ''));
54
+ } else {
55
+ }
56
+ }
57
+ );
58
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
59
+ jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
60
+ wp_insert_vi_logout_handler();
61
+ wp_insert_vi_customize_adcode();
62
+ wp_insert_vi_chart_draw();
63
+ jQuery(window).resize();
64
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
65
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
66
+ } else {
67
+ jQuery('.ui-dialog-buttonset').find('button').first().button('enable');
68
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
69
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
70
+ jQuery('.ui-dialog-content').html(response);
71
+ }
72
+ }
73
+ );
74
+ } else {
75
+ jQuery('#wp_insert_vi_login_username').css('border-color', '#dddddd');
76
+ jQuery('#wp_insert_vi_login_password').css('border-color', '#dddddd');
77
+ if(jQuery('#wp_insert_vi_login_username').val() == '') {
78
+ jQuery('#wp_insert_vi_login_username').css('border-color', '#ff0000');
79
+ }
80
+ if(jQuery('#wp_insert_vi_login_password').val() == '') {
81
+ jQuery('#wp_insert_vi_login_password').css('border-color', '#ff0000');
82
+ }
83
+ }
84
+ });
85
+ },
86
+ function() { },
87
+ function() { }
88
+ );
89
+ }
90
+
91
+ function wp_insert_vi_logout_handler() {
92
+ jQuery('#wp_insert_vi_logout').click(function() {
93
+ jQuery.post(
94
+ jQuery('#wp_insert_admin_ajax').val(), {
95
+ 'action': 'wp_insert_vi_logout_action',
96
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
97
+ }, function(response) {
98
+ if(response.indexOf('###SUCCESS###') !== -1) {
99
+ jQuery('.vi-card').html(response.replace('###SUCCESS###', ''));
100
+ wp_insert_vi_signup_handler();
101
+ wp_insert_vi_login_handler();
102
+ jQuery(window).resize();
103
+ }
104
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 1}, 1000);
105
+ }
106
+ );
107
+ jQuery('.vi-card .plugin-card-bottom, .vi-card .plugin-card-top-content').animate({'opacity': 0}, 1000);
108
+
109
+ });
110
+ }
111
+
112
+ function wp_insert_vi_customize_adcode() {
113
+ wp_insert_click_handler(
114
+ 'wp_insert_vi_customize_adcode',
115
+ 'video intelligence: Customize vi Code',
116
+ jQuery("body").width() * 0.8,
117
+ jQuery("body").height() * 0.8,
118
+ function() {
119
+ jQuery('#wp_insert_vi_code_settings_keywords').attr('maxlength', '200');
120
+ jQuery('#wp_insert_vi_code_settings_optional_1').attr('maxlength', '200');
121
+ jQuery('#wp_insert_vi_code_settings_optional_2').attr('maxlength', '200');
122
+ jQuery('#wp_insert_vi_code_settings_optional_3').attr('maxlength', '200');
123
+ jQuery('.ui-dialog-buttonset').find('button').first().unbind('click').click(function() {
124
+ var keywordsRegex = /[ ,a-zA-Z0-9-’'‘\u00C6\u00D0\u018E\u018F\u0190\u0194\u0132\u014A\u0152\u1E9E\u00DE\u01F7\u021C\u00E6\u00F0\u01DD\u0259\u025B\u0263\u0133\u014B\u0153\u0138\u017F\u00DF\u00FE\u01BF\u021D\u0104\u0181\u00C7\u0110\u018A\u0118\u0126\u012E\u0198\u0141\u00D8\u01A0\u015E\u0218\u0162\u021A\u0166\u0172\u01AFY\u0328\u01B3\u0105\u0253\u00E7\u0111\u0257\u0119\u0127\u012F\u0199\u0142\u00F8\u01A1\u015F\u0219\u0163\u021B\u0167\u0173\u01B0y\u0328\u01B4\u00C1\u00C0\u00C2\u00C4\u01CD\u0102\u0100\u00C3\u00C5\u01FA\u0104\u00C6\u01FC\u01E2\u0181\u0106\u010A\u0108\u010C\u00C7\u010E\u1E0C\u0110\u018A\u00D0\u00C9\u00C8\u0116\u00CA\u00CB\u011A\u0114\u0112\u0118\u1EB8\u018E\u018F\u0190\u0120\u011C\u01E6\u011E\u0122\u0194\u00E1\u00E0\u00E2\u00E4\u01CE\u0103\u0101\u00E3\u00E5\u01FB\u0105\u00E6\u01FD\u01E3\u0253\u0107\u010B\u0109\u010D\u00E7\u010F\u1E0D\u0111\u0257\u00F0\u00E9\u00E8\u0117\u00EA\u00EB\u011B\u0115\u0113\u0119\u1EB9\u01DD\u0259\u025B\u0121\u011D\u01E7\u011F\u0123\u0263\u0124\u1E24\u0126I\u00CD\u00CC\u0130\u00CE\u00CF\u01CF\u012C\u012A\u0128\u012E\u1ECA\u0132\u0134\u0136\u0198\u0139\u013B\u0141\u013D\u013F\u02BCN\u0143N\u0308\u0147\u00D1\u0145\u014A\u00D3\u00D2\u00D4\u00D6\u01D1\u014E\u014C\u00D5\u0150\u1ECC\u00D8\u01FE\u01A0\u0152\u0125\u1E25\u0127\u0131\u00ED\u00ECi\u00EE\u00EF\u01D0\u012D\u012B\u0129\u012F\u1ECB\u0133\u0135\u0137\u0199\u0138\u013A\u013C\u0142\u013E\u0140\u0149\u0144n\u0308\u0148\u00F1\u0146\u014B\u00F3\u00F2\u00F4\u00F6\u01D2\u014F\u014D\u00F5\u0151\u1ECD\u00F8\u01FF\u01A1\u0153\u0154\u0158\u0156\u015A\u015C\u0160\u015E\u0218\u1E62\u1E9E\u0164\u0162\u1E6C\u0166\u00DE\u00DA\u00D9\u00DB\u00DC\u01D3\u016C\u016A\u0168\u0170\u016E\u0172\u1EE4\u01AF\u1E82\u1E80\u0174\u1E84\u01F7\u00DD\u1EF2\u0176\u0178\u0232\u1EF8\u01B3\u0179\u017B\u017D\u1E92\u0155\u0159\u0157\u017F\u015B\u015D\u0161\u015F\u0219\u1E63\u00DF\u0165\u0163\u1E6D\u0167\u00FE\u00FA\u00F9\u00FB\u00FC\u01D4\u016D\u016B\u0169\u0171\u016F\u0173\u1EE5\u01B0\u1E83\u1E81\u0175\u1E85\u01BF\u00FD\u1EF3\u0177\u00FF\u0233\u1EF9\u01B4\u017A\u017C\u017E\u1E93]/g;
125
+ if(
126
+ (jQuery('#wp_insert_vi_code_settings_ad_unit_type').val() != 'select') &&
127
+ (jQuery('#wp_insert_vi_code_settings_iab_category_child').val() != 'select') &&
128
+ (jQuery('#wp_insert_vi_code_settings_language').val() != 'select') &&
129
+ ((jQuery('#wp_insert_vi_code_settings_keywords').val() == '') || ((jQuery(jQuery('#wp_insert_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#wp_insert_vi_code_settings_keywords').val().match(keywordsRegex)).get().length == 0) && (jQuery('#wp_insert_vi_code_settings_keywords').val().length < 200)))
130
+ ) {
131
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
132
+ jQuery('.ui-dialog-buttonset').find('button').last().button('disable');
133
+ jQuery('.ui-dialog-titlebar').find('button').last().button('disable');
134
+ var wp_insert_vi_code_settings_ad_unit_type = jQuery('#wp_insert_vi_code_settings_ad_unit_type').val();
135
+ var wp_insert_vi_code_settings_keywords = jQuery('#wp_insert_vi_code_settings_keywords').val();
136
+ var wp_insert_vi_code_settings_iab_category_parent = jQuery('#wp_insert_vi_code_settings_iab_category_parent').val();
137
+ var wp_insert_vi_code_settings_iab_category_child = jQuery('#wp_insert_vi_code_settings_iab_category_child').val();
138
+ var wp_insert_vi_code_settings_language = jQuery('#wp_insert_vi_code_settings_language').val();
139
+ var wp_insert_vi_code_settings_native_bg_color = jQuery('#wp_insert_vi_code_settings_native_bg_color').val();
140
+ var wp_insert_vi_code_settings_native_text_color = jQuery('#wp_insert_vi_code_settings_native_text_color').val();
141
+ var wp_insert_vi_code_settings_font_family = jQuery('#wp_insert_vi_code_settings_font_family').val();
142
+ var wp_insert_vi_code_settings_font_size = jQuery('#wp_insert_vi_code_settings_font_size').val();
143
+ var wp_insert_vi_code_settings_optional_1 = jQuery('#wp_insert_vi_code_settings_optional_1').val();
144
+ var wp_insert_vi_code_settings_optional_2 = jQuery('#wp_insert_vi_code_settings_optional_2').val();
145
+ var wp_insert_vi_code_settings_optional_3 = jQuery('#wp_insert_vi_code_settings_optional_3').val();
146
+ jQuery('.ui-dialog-content').html('<div class="wp_insert_ajaxloader"></div>');
147
+ jQuery('.wp_insert_ajaxloader').show();
148
+ jQuery.post(
149
+ jQuery('#wp_insert_admin_ajax').val(), {
150
+ 'action': 'wp_insert_vi_customize_adcode_form_save_action',
151
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
152
+ 'wp_insert_vi_code_settings_ad_unit_type': wp_insert_vi_code_settings_ad_unit_type,
153
+ 'wp_insert_vi_code_settings_keywords': wp_insert_vi_code_settings_keywords,
154
+ 'wp_insert_vi_code_settings_iab_category_parent': wp_insert_vi_code_settings_iab_category_parent,
155
+ 'wp_insert_vi_code_settings_iab_category_child': wp_insert_vi_code_settings_iab_category_child,
156
+ 'wp_insert_vi_code_settings_language': wp_insert_vi_code_settings_language,
157
+ 'wp_insert_vi_code_settings_native_bg_color': wp_insert_vi_code_settings_native_bg_color,
158
+ 'wp_insert_vi_code_settings_native_text_color': wp_insert_vi_code_settings_native_text_color,
159
+ 'wp_insert_vi_code_settings_font_family': wp_insert_vi_code_settings_font_family,
160
+ 'wp_insert_vi_code_settings_font_size': wp_insert_vi_code_settings_font_size,
161
+ 'wp_insert_vi_code_settings_optional_1': wp_insert_vi_code_settings_optional_1,
162
+ 'wp_insert_vi_code_settings_optional_2': wp_insert_vi_code_settings_optional_2,
163
+ 'wp_insert_vi_code_settings_optional_3': wp_insert_vi_code_settings_optional_3,
164
+ }, function(response) {
165
+ if(response.indexOf('###SUCCESS###') !== -1) {
166
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
167
+ } else {
168
+ jQuery('.ui-dialog-buttonset').find('button').first().button('disable');
169
+ jQuery('.ui-dialog-buttonset').find('button').last().button('enable');
170
+ jQuery('.ui-dialog-titlebar').find('button').last().button('enable');
171
+ jQuery('.ui-dialog-content').html(response.replace('###FAIL###', ''));
172
+ }
173
+ }
174
+ );
175
+ } else {
176
+ jQuery('#wp_insert_vi_customize_adcode_keywords_required_error').hide();
177
+ jQuery('#wp_insert_vi_customize_adcode_keywords_error').hide();
178
+ jQuery('#wp_insert_vi_customize_adcode_required_error').hide();
179
+ jQuery('#wp_insert_vi_code_settings_ad_unit_type').css('border-color', '#dddddd');
180
+ jQuery('#wp_insert_vi_code_settings_iab_category_parent').css('border-color', '#dddddd');
181
+ jQuery('#wp_insert_vi_code_settings_iab_category_child').css('border-color', '#dddddd');
182
+ jQuery('#wp_insert_vi_code_settings_language').css('border-color', '#dddddd');
183
+ jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#dddddd');
184
+ var wp_insert_vi_customize_adcode_keywords_error = false;
185
+ var wp_insert_vi_customize_adcode_required_error = false;
186
+ if(jQuery('#wp_insert_vi_code_settings_ad_unit_type').val() == 'select') {
187
+ jQuery('#wp_insert_vi_code_settings_ad_unit_type').css('border-color', '#ff0000');
188
+ wp_insert_vi_customize_adcode_required_error = true;
189
+ }
190
+ if(jQuery('#wp_insert_vi_code_settings_iab_category_parent').val() == 'select') {
191
+ jQuery('#wp_insert_vi_code_settings_iab_category_parent').css('border-color', '#ff0000');
192
+ wp_insert_vi_customize_adcode_required_error = true;
193
+ }
194
+ if(jQuery('#wp_insert_vi_code_settings_iab_category_child').val() == 'select') {
195
+ jQuery('#wp_insert_vi_code_settings_iab_category_child').css('border-color', '#ff0000');
196
+ wp_insert_vi_customize_adcode_required_error = true;
197
+ }
198
+ if(jQuery('#wp_insert_vi_code_settings_language').val() == 'select') {
199
+ jQuery('#wp_insert_vi_code_settings_language').css('border-color', '#ff0000');
200
+ wp_insert_vi_customize_adcode_required_error = true;
201
+ }
202
+ if(jQuery('#wp_insert_vi_code_settings_keywords').val() != '') {
203
+ if(jQuery('#wp_insert_vi_code_settings_keywords').val().length > 200) {
204
+ jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#ff0000');
205
+ wp_insert_vi_customize_adcode_keywords_error = true;
206
+ }
207
+ if(jQuery(jQuery('#wp_insert_vi_code_settings_keywords').val().match(/./g)).not(jQuery('#wp_insert_vi_code_settings_keywords').val().match(keywordsRegex)).get().length != 0) {
208
+ jQuery('#wp_insert_vi_code_settings_keywords').css('border-color', '#ff0000');
209
+ wp_insert_vi_customize_adcode_keywords_error = true;
210
+ }
211
+ }
212
+ if(wp_insert_vi_customize_adcode_keywords_error && wp_insert_vi_customize_adcode_required_error) {
213
+ jQuery('#wp_insert_vi_customize_adcode_keywords_required_error').show();
214
+ } else if(wp_insert_vi_customize_adcode_keywords_error) {
215
+ jQuery('#wp_insert_vi_customize_adcode_keywords_error').show();
216
+ } else if(wp_insert_vi_customize_adcode_required_error) {
217
+ jQuery('#wp_insert_vi_customize_adcode_required_error').show();
218
+ } else {}
219
+ }
220
+ });
221
+ },
222
+ function() { },
223
+ function() { }
224
+ );
225
+ }
226
+
227
+ function wp_insert_vi_code_iab_category_parent_change() {
228
+ jQuery('#wp_insert_vi_code_settings_iab_category_parent').change(function() {
229
+ var wp_insert_vi_code_iab_category = jQuery(this).val();
230
+ jQuery('#wp_insert_vi_code_settings_iab_category_child option').prop('disabled', true).hide();
231
+ jQuery('#wp_insert_vi_code_settings_iab_category_child option').each(function() {
232
+ if((jQuery(this).attr('data-parent') == wp_insert_vi_code_iab_category) || (jQuery(this).val() == 'select')) {
233
+ jQuery(this).prop('disabled', false).show();
234
+ }
235
+ });
236
+ if(jQuery('#wp_insert_vi_code_settings_iab_category_child option:selected').prop('disabled') != false) {
237
+ jQuery('#wp_insert_vi_code_settings_iab_category_child').val('select');
238
+ }
239
+ });
240
+ jQuery('#wp_insert_vi_code_settings_iab_category_parent').change();
241
+ }
242
+
243
+ function wp_insert_vi_chart_draw() {
244
+ if(jQuery('#wp_insert_vi_earnings_wrapper').length) {
245
+ jQuery.post(
246
+ jQuery('#wp_insert_admin_ajax').val(), {
247
+ 'action': 'wp_insert_vi_get_chart',
248
+ 'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
249
+ }, function(response) {
250
+ if(response.indexOf('###SUCCESS###') !== -1) {
251
+ jQuery('#wp_insert_vi_earnings_wrapper').html(response.replace('###SUCCESS###', ''));
252
+ if(jQuery('#wp_insert_vi_chart_data').length) {
253
+ var ctx = document.getElementById("myChart");
254
+ var wp_insert_vi_chart = new Chart(jQuery('#wp_insert_vi_chart'), {
255
+ type: 'line',
256
+ data: {
257
+ datasets: [{
258
+ data: JSON.parse(jQuery('#wp_insert_vi_chart_data').val()),
259
+ backgroundColor: '#EDF5FB',
260
+ borderColor: '#186EAE',/*E8EBEF*/
261
+ borderWidth: 1
262
+ }]
263
+ },
264
+ options: {
265
+ title: {
266
+ display: false,
267
+ backgroundColor: '#EDF5FB'
268
+ },
269
+ legend: {
270
+ display: false,
271
+ },
272
+ scales: {
273
+ xAxes: [{
274
+ type: "time",
275
+ display: true,
276
+ scaleLabel: {
277
+ display: false
278
+ },
279
+ gridLines: {
280
+ display: false,
281
+ drawTicks: false
282
+ },
283
+ ticks: {
284
+ display: false
285
+ }
286
+ }],
287
+ yAxes: [{
288
+ display: true,
289
+ scaleLabel: {
290
+ display: false
291
+ },
292
+ gridLines: {
293
+ display: true,
294
+ drawTicks: false
295
+ },
296
+ ticks: {
297
+ display: false
298
+ }
299
+ }]
300
+ },
301
+ tooltips: {
302
+ displayColors: false,
303
+ callbacks: {
304
+ label: function(tooltipItem, data) {
305
+ return '$ '+parseFloat(tooltipItem.yLabel).toFixed(2);
306
+ },
307
+ title: function(tooltipItem, data) {
308
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
309
+ var dateParts = tooltipItem[0].xLabel.split('/');
310
+ var date = new Date(dateParts[2], dateParts[0]-1, dateParts[1]);
311
+ return monthNames[date.getMonth()]+' '+date.getDate();
312
+ }
313
+ }
314
+ }
315
+ }
316
+ });
317
+ }
318
+ } else {
319
+ jQuery('#wp_insert_vi_earnings_wrapper').parent().html(response);
320
+ }
321
+ jQuery(window).resize();
322
+ }
323
+ );
324
+ }
325
+ }
includes/modules/videointelligence/module.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/functions.php');
3
+ require_once(dirname(__FILE__).'/api/vi.php');
4
+ require_once(dirname(__FILE__).'/vi-constants.php');
5
+
6
+ /* Begin Add Assets */
7
+ add_action('wp_insert_modules_css', 'wp_insert_module_vi_css', 0);
8
+ function wp_insert_module_vi_css() {
9
+ wp_register_style('wp-insert-module-vi-css', WP_INSERT_URL.'includes/modules/videointelligence/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
10
+ wp_enqueue_style('wp-insert-module-vi-css');
11
+ }
12
+
13
+ add_action('wp_insert_modules_js', 'wp_insert_module_vi_js', 0);
14
+ function wp_insert_module_vi_js() {
15
+ wp_register_script('wp-insert-module-vi-js', WP_INSERT_URL.'includes/modules/videointelligence/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
16
+ wp_enqueue_script('wp-insert-module-vi-js');
17
+ }
18
+ /* End Add Assets */
19
+
20
+ /* Begin Add Card in Admin Panel */
21
+ add_action('wp_insert_plugin_card', 'wp_insert_vi_plugin_card', 10);
22
+ function wp_insert_vi_plugin_card() {
23
+ echo '<div class="plugin-card vi-card">';
24
+ if(wp_insert_vi_api_is_loggedin()) {
25
+ wp_insert_vi_plugin_card_content(true);
26
+ } else {
27
+ wp_insert_vi_plugin_card_content(false);
28
+ }
29
+ echo '</div>';
30
+ }
31
+
32
+ function wp_insert_vi_plugin_card_content($isLoggedin = false, $isAjaxRequest = false) {
33
+ if(!$isLoggedin) {
34
+ echo '<div class="plugin-card-top">';
35
+ echo '<div class="plugin-card-top-header">';
36
+ echo '<h4>Video content and video advertising – powered by video intelligence</h4>';
37
+ echo '</div>';
38
+ echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
39
+ echo '<p>Advertisers pay more for video advertising when it’s matched with video content. This new video player will insert both on your page. It increases time on site, and commands a higher CPM than display advertising.</p>';
40
+ echo '<ul>';
41
+ echo '<li>The set up takes only a few minutes</li>';
42
+ echo '<li>Up to 10x higher CPM than traditional display advertising</li>';
43
+ echo '<li>Users spend longer on your site thanks to professional video content</li>';
44
+ echo '<li>The video player is customizable to match your site</li>';
45
+ echo '</ul>';
46
+ echo '<p>You\'ll see video content that is matched to your sites keywords straight away. A few days after activation you’ll begin to receive revenue from advertising served before this video content.</p>';
47
+ //echo '<p>Watch a <a href="http://demo.vi.ai/ViewsterBlog_Nintendo.html" target="_blank">demo</a> of how <b>vi stories</b> works.</p>';
48
+ echo '</div>';
49
+ echo '</div>';
50
+ echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
51
+ echo '<span>By clicking Sign Up button you agree to send current domain, email and affiliate ID to video intelligence.</span>';
52
+ echo '<a id="wp_insert_vi_login" href="javascript:;" class="button button-secondary">Log In</a>';
53
+ echo '<a id="wp_insert_vi_signup" href="javascript:;" class="button button-primary">Sign Up</a>';
54
+ echo '</div>';
55
+ } else {
56
+ $dashboardURL = wp_insert_vi_api_get_dashboardurl();
57
+ echo '<div class="plugin-card-top">';
58
+ echo '<div class="plugin-card-top-header">';
59
+ echo '<h4>Video content and video advertising – powered by video intelligence</h4>';
60
+ echo '</div>';
61
+ echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
62
+ echo '<p>Below you can see your current revenues.<br />Don’t see anything? Consult the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQs</a>.</p>';
63
+ echo '<div id="wp_insert_vi_earnings_wrapper">';
64
+ echo '<div class="wp_insert_ajaxloader"></div>';
65
+ echo '</div>';
66
+ echo '</div>';
67
+ echo '</div>';
68
+ echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
69
+ echo '<a id="wp_insert_vi_dashboard" href="'.$dashboardURL.'" target="_blank" class="button button-primary alignleft">Publisher Dashboard</a>';
70
+ echo '<a id="wp_insert_vi_customize_adcode" href="javascript:;" class="button button-primary alignleft">Configure vi Code</a>';
71
+ echo '<a id="wp_insert_vi_logout" href="javascript:;" class="button button-secondary">Log Out</a>';
72
+ echo '</div>';
73
+ }
74
+ }
75
+
76
+ add_action('wp_ajax_wp_insert_vi_get_chart', 'wp_insert_vi_get_chart');
77
+ function wp_insert_vi_get_chart() {
78
+ check_ajax_referer('wp-insert', 'wp_insert_nonce');
79
+ $revenueData = wp_insert_vi_api_get_revenue_data();
80
+ if(isset($revenueData) && is_array($revenueData)) {
81
+ echo '###SUCCESS###';
82
+ echo '<div id="wp_insert_vi_earnings">';
83
+ echo '<span id="wp_insert_vi_earnings_label">Total Earnings</span>';
84
+ echo '<span id="wp_insert_vi_earnings_value">$'.$revenueData['netRevenue'].'</span>';
85
+ echo '</div>';
86
+ echo '<div id="wp_insert_vi_chart_wrapper">';
87
+ echo '<canvas id="wp_insert_vi_chart" width="348" height="139"></canvas>';
88
+ echo '<textarea id="wp_insert_vi_chart_data" style="display: none;">[';
89
+ if(isset($revenueData['mtdReport']) && is_array($revenueData['mtdReport']) & (count($revenueData['mtdReport']) > 0)) {
90
+ $isFirstItem = true;
91
+ foreach($revenueData['mtdReport'] as $reportData) {
92
+ if(!$isFirstItem) {
93
+ echo ',';
94
+ }
95
+ $date = DateTime::createFromFormat('d-m-Y', $reportData['date']);
96
+ echo '{"x": "'.$date->format('m/d/Y').'", "y": "'.$reportData['revenue'].'"}';
97
+ $isFirstItem = false;;
98
+ }
99
+ } else {
100
+ echo '{"x": "'.date('m/d/Y').'", "y": "0.00"}';
101
+ }
102
+ echo ']</textarea>';
103
+ echo '</div>';
104
+ echo '<div class="clear"></div>';
105
+ } else {
106
+ echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
107
+ echo '<div id="wp_insert_vi_earnings_wrapper">';
108
+ echo '<div id="wp_insert_vi_earnings">';
109
+ echo '<span id="wp_insert_vi_earnings_label">Total Earnings</span>';
110
+ echo '<span id="wp_insert_vi_earnings_value"><img src="'.WP_INSERT_URL.'includes/assets/images/vi-no-data.jpg?'.WP_INSERT_VERSION.'"></span>';
111
+ echo '</div>';
112
+ echo '<div id="wp_insert_vi_chart_wrapper">';
113
+ echo '<img width="348" height="139" src="'.WP_INSERT_URL.'includes/assets/images/vi-empty-graph.jpg?'.WP_INSERT_VERSION.'">';
114
+ echo '</div>';
115
+ echo '<div class="clear"></div>';
116
+ echo '</div>';
117
+ }
118
+ die();
119
+ }
120
+ /* End Add Card in Admin Panel */
121
+ ?>
includes/modules/videointelligence/vi-constants.php ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wp_insert_vi_get_constant_fonts() {
3
+ return array(
4
+ array('text' => 'Select font family', 'value' => 'select'),
5
+ array('text' => 'Georgia', 'value' => 'Georgia'),
6
+ array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
7
+ array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
8
+ array('text' => 'Arial', 'value' => 'Arial'),
9
+ array('text' => 'Arial Black', 'value' => 'Arial Black'),
10
+ array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
11
+ array('text' => 'Impact', 'value' => 'Impact'),
12
+ array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
13
+ array('text' => 'Tahoma', 'value' => 'Tahoma'),
14
+ array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
15
+ array('text' => 'Verdana', 'value' => 'Verdana'),
16
+ array('text' => 'Courier New', 'value' => 'Courier New'),
17
+ array('text' => 'Lucida Console', 'value' => 'Lucida Console')
18
+ );
19
+ }
20
+
21
+ function wp_insert_vi_get_constant_font_sizes() {
22
+ return array(
23
+ array('text' => 'Select', 'value' => 'select'),
24
+ array('text' => '8px', 'value' => '8'),
25
+ array('text' => '9px', 'value' => '9'),
26
+ array('text' => '10px', 'value' => '10'),
27
+ array('text' => '11px', 'value' => '11'),
28
+ array('text' => '12px', 'value' => '12'),
29
+ array('text' => '14px', 'value' => '14'),
30
+ array('text' => '16px', 'value' => '16'),
31
+ array('text' => '18px', 'value' => '18'),
32
+ array('text' => '20px', 'value' => '20'),
33
+ array('text' => '22px', 'value' => '22'),
34
+ array('text' => '24px', 'value' => '24'),
35
+ array('text' => '26px', 'value' => '26'),
36
+ array('text' => '28px', 'value' => '28'),
37
+ array('text' => '36px', 'value' => '36')
38
+ );
39
+ }
40
+
41
+ function wp_insert_vi_get_constant_iab_parent_categories() {
42
+ return array(
43
+ array('text' => 'Select tier 1 category', 'value' => 'select'),
44
+ array('text' => 'Arts & Entertainment', 'value' => 'IAB1'),
45
+ array('text' => 'Automotive', 'value' => 'IAB2'),
46
+ array('text' => 'Business', 'value' => 'IAB3'),
47
+ array('text' => 'Careers', 'value' => 'IAB4'),
48
+ array('text' => 'Education', 'value' => 'IAB5'),
49
+ array('text' => 'Family & Parenting', 'value' => 'IAB6'),
50
+ array('text' => 'Health & Fitness', 'value' => 'IAB7'),
51
+ array('text' => 'Food & Drink', 'value' => 'IAB8'),
52
+ array('text' => 'Hobbies & Interests', 'value' => 'IAB9'),
53
+ array('text' => 'Home & Garden', 'value' => 'IAB10'),
54
+ array('text' => 'Law, Gov’t & Politics', 'value' => 'IAB11'),
55
+ array('text' => 'News', 'value' => 'IAB12'),
56
+ array('text' => 'Personal Finance', 'value' => 'IAB13'),
57
+ array('text' => 'Society', 'value' => 'IAB14'),
58
+ array('text' => 'Science', 'value' => 'IAB15'),
59
+ array('text' => 'Pets', 'value' => 'IAB16'),
60
+ array('text' => 'Sports', 'value' => 'IAB17'),
61
+ array('text' => 'Style & Fashion', 'value' => 'IAB18'),
62
+ array('text' => 'Technology & Computing', 'value' => 'IAB19'),
63
+ array('text' => 'Travel', 'value' => 'IAB20'),
64
+ array('text' => 'Real Estate', 'value' => 'IAB21'),
65
+ array('text' => 'Shopping', 'value' => 'IAB22'),
66
+ array('text' => 'Religion & Spirituality', 'value' => 'IAB23'),
67
+ array('text' => 'Uncategorized', 'value' => 'IAB24'),
68
+ array('text' => 'Non-Standard Content', 'value' => 'IAB25'),
69
+ array('text' => 'Illegal Content', 'value' => 'IAB26')
70
+ );
71
+ }
72
+
73
+ function wp_insert_vi_get_constant_iab_child_categories() {
74
+ return array(
75
+ array('text' => 'Select tier 2 category', 'value' => 'select'),
76
+ array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
77
+ array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
78
+ array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
79
+ array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
80
+ array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
81
+ array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
82
+ array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
83
+ array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
84
+ array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
85
+ array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
86
+ array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
87
+ array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
88
+ array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
89
+ array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
90
+ array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
91
+ array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
92
+ array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
93
+ array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
94
+ array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
95
+ array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
96
+ array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
97
+ array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
98
+ array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
99
+ array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
100
+ array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
101
+ array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
102
+ array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
103
+ array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
104
+ array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
105
+ array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
106
+ array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
107
+ array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
108
+ array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
109
+ array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
110
+ array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
111
+ array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
112
+ array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
113
+ array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
114
+ array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
115
+ array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
116
+ array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
117
+ array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
118
+ array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
119
+ array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
120
+ array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
121
+ array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
122
+ array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
123
+ array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
124
+ array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
125
+ array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
126
+ array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
127
+ array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
128
+ array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
129
+ array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
130
+ array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
131
+ array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
132
+ array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
133
+ array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
134
+ array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
135
+ array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
136
+ array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
137
+ array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
138
+ array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
139
+ array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
140
+ array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
141
+ array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
142
+ array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
143
+ array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
144
+ array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
145
+ array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
146
+ array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
147
+ array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
148
+ array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
149
+ array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
150
+ array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
151
+ array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
152
+ array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
153
+ array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
154
+ array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
155
+ array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
156
+ array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
157
+ array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
158
+ array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
159
+ array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
160
+ array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
161
+ array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
162
+ array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
163
+ array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
164
+ array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
165
+ array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
166
+ array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
167
+ array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
168
+ array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
169
+ array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
170
+ array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
171
+ array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
172
+ array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
173
+ array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
174
+ array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
175
+ array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
176
+ array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
177
+ array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
178
+ array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
179
+ array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
180
+ array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
181
+ array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
182
+ array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
183
+ array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
184
+ array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
185
+ array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
186
+ array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
187
+ array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
188
+ array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
189
+ array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
190
+ array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
191
+ array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
192
+ array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
193
+ array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
194
+ array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
195
+ array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
196
+ array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
197
+ array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
198
+ array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
199
+ array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
200
+ array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
201
+ array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
202
+ array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
203
+ array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
204
+ array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
205
+ array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
206
+ array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
207
+ array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
208
+ array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
209
+ array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
210
+ array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
211
+ array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
212
+ array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
213
+ array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
214
+ array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
215
+ array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
216
+ array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
217
+ array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
218
+ array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
219
+ array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
220
+ array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
221
+ array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
222
+ array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
223
+ array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
224
+ array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
225
+ array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
226
+ array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
227
+ array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
228
+ array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
229
+ array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
230
+ array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
231
+ array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
232
+ array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
233
+ array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
234
+ array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
235
+ array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
236
+ array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
237
+ array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
238
+ array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
239
+ array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
240
+ array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
241
+ array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
242
+ array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
243
+ array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
244
+ array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
245
+ array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
246
+ array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
247
+ array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
248
+ array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
249
+ array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
250
+ array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
251
+ array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
252
+ array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
253
+ array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
254
+ array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
255
+ array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
256
+ array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
257
+ array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
258
+ array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
259
+ array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
260
+ array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
261
+ array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
262
+ array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
263
+ array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
264
+ array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
265
+ array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
266
+ array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
267
+ array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
268
+ array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
269
+ array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
270
+ array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
271
+ array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
272
+ array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
273
+ array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
274
+ array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
275
+ array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
276
+ array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
277
+ array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
278
+ array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
279
+ array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
280
+ array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
281
+ array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
282
+ array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
283
+ array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
284
+ array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
285
+ array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
286
+ array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
287
+ array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
288
+ array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
289
+ array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
290
+ array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
291
+ array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
292
+ array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
293
+ array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
294
+ array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
295
+ array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
296
+ array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
297
+ array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
298
+ array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
299
+ array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
300
+ array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
301
+ array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
302
+ array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
303
+ array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
304
+ array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
305
+ array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
306
+ array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
307
+ array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
308
+ array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
309
+ array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
310
+ array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
311
+ array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
312
+ array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
313
+ array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
314
+ array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
315
+ array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
316
+ array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
317
+ array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
318
+ array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
319
+ array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
320
+ array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
321
+ array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
322
+ array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
323
+ array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
324
+ array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
325
+ array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
326
+ array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
327
+ array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
328
+ array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
329
+ array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
330
+ array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
331
+ array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
332
+ array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
333
+ array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
334
+ array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
335
+ array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
336
+ array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
337
+ array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
338
+ array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
339
+ array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
340
+ array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
341
+ array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
342
+ array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
343
+ array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
344
+ array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
345
+ array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
346
+ array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
347
+ array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
348
+ array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
349
+ array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
350
+ array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
351
+ array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
352
+ array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
353
+ array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
354
+ array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
355
+ array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
356
+ array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
357
+ array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
358
+ array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
359
+ array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
360
+ array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
361
+ array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
362
+ array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
363
+ array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
364
+ array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
365
+ array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
366
+ array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
367
+ array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
368
+ array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
369
+ array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
370
+ array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
371
+ array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
372
+ array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
373
+ array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
374
+ array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
375
+ array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
376
+ array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
377
+ array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
378
+ array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
379
+ array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
380
+ array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
381
+ array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
382
+ array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
383
+ array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
384
+ array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
385
+ array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
386
+ array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
387
+ array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
388
+ array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
389
+ array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
390
+ array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
391
+ array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
392
+ array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
393
+ array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
394
+ array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
395
+ array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
396
+ array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
397
+ array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
398
+ array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
399
+ array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
400
+ array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
401
+ array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
402
+ array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
403
+ array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
404
+ array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
405
+ array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
406
+ array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
407
+ array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
408
+ array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
409
+ array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
410
+ array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
411
+ array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
412
+ array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
413
+ array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
414
+ array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
415
+ array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
416
+ array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
417
+ array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
418
+ array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
419
+ array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
420
+ array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
421
+ array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
422
+ array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
423
+ array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
424
+ array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
425
+ array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
426
+ array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
427
+ array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
428
+ array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
429
+ array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
430
+ array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
431
+ array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
432
+ array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
433
+ array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
434
+ array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
435
+ array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
436
+ array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
437
+ array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
438
+ array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
439
+ array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
440
+ array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
441
+ array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
442
+ );
443
+ }
444
+ ?>
includes/vi-integration.php DELETED
@@ -1,1227 +0,0 @@
1
- <?php
2
- /* Begin Add Card in Admin Panel */
3
- add_action('wp_insert_plugin_card', 'wp_insert_vi_plugin_card', 5);
4
- function wp_insert_vi_plugin_card() {
5
- echo '<div class="plugin-card vi-card">';
6
- if(wp_insert_vi_api_is_loggedin()) {
7
- wp_insert_vi_plugin_card_content(true);
8
- } else {
9
- wp_insert_vi_plugin_card_content(false);
10
- }
11
- echo '</div>';
12
- }
13
-
14
- function wp_insert_vi_plugin_card_content($isLoggedin = false, $isAjaxRequest = false) {
15
- if(!$isLoggedin) {
16
- echo '<div class="plugin-card-top">';
17
- echo '<div class="plugin-card-top-header">';
18
- echo '<h4>Video content and video advertising – powered by video intelligence</h4>';
19
- echo '</div>';
20
- echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
21
- echo '<p>Video content and video advertising – powered by video intelligence.</p>';
22
- echo '<p>Advertisers pay more for video advertising when it’s matched with video content. This new video player will insert both on your page. It increases time on site, and commands a higher CPM than display advertising.</p>';
23
- echo '<p>You’ll see video content that is matched to your sites keywords straight away. A few days after activation you’ll begin to receive revenue from advertising served before this video content.</p>';
24
- echo '<ul>';
25
- echo '<li>The set up takes only a few minutes</li>';
26
- echo '<li>Up to 10x higher CPM than traditional display advertising</li>';
27
- echo '<li>Users spend longer on your site thanks to professional video content</li>';
28
- echo '<li>The video player is customizable to match your site</li>';
29
- echo '</ul>';
30
- echo '<p>Watch a <a href="http://demo.vi.ai/ViewsterBlog_Nintendo.html" target="_blank">demo</a> of how <b>vi stories</b> works.</p>';
31
- echo '</div>';
32
- echo '</div>';
33
- echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
34
- echo '<span>By clicking Sign Up button you agree to send current domain, email and affiliate ID to video intelligence.</span>';
35
- echo '<a id="wp_insert_vi_login" href="javascript:;" class="button button-secondary">Log In</a>';
36
- echo '<a id="wp_insert_vi_signup" href="javascript:;" class="button button-primary">Sign Up</a>';
37
- echo '</div>';
38
- } else {
39
- $dashboardURL = wp_insert_vi_api_get_dashboardurl();
40
- echo '<div class="plugin-card-top">';
41
- echo '<div class="plugin-card-top-header">';
42
- echo '<h4>Video content and video advertising – powered by video intelligence</h4>';
43
- echo '</div>';
44
- echo '<div class="plugin-card-top-content" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
45
- echo '<p>Below you can see your current revenues.<br />Don’t see anything? Consult the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQs</a>.</p>';
46
- echo '<div id="wp_insert_vi_earnings_wrapper">';
47
- echo '<div class="wp_insert_ajaxloader"></div>';
48
- echo '</div>';
49
- echo '</div>';
50
- echo '</div>';
51
- echo '<div class="plugin-card-bottom" '.(($isAjaxRequest)?'style="opacity: 0;"':'').'>';
52
- echo '<a id="wp_insert_vi_dashboard" href="'.$dashboardURL.'" target="_blank" class="button button-primary alignleft">Publisher Dashboard</a>';
53
- echo '<a id="wp_insert_vi_customize_adcode" href="javascript:;" class="button button-primary alignleft">Configure vi Code</a>';
54
- echo '<a id="wp_insert_vi_logout" href="javascript:;" class="button button-secondary">Log Out</a>';
55
- echo '</div>';
56
- }
57
- }
58
-
59
- add_action('wp_ajax_wp_insert_vi_get_chart', 'wp_insert_vi_get_chart');
60
- function wp_insert_vi_get_chart() {
61
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
62
- $revenueData = wp_insert_vi_api_get_revenue_data();
63
- if(isset($revenueData) && is_array($revenueData)) {
64
- echo '###SUCCESS###';
65
- echo '<div id="wp_insert_vi_earnings">';
66
- echo '<span id="wp_insert_vi_earnings_label">Total Earnings</span>';
67
- echo '<span id="wp_insert_vi_earnings_value">$'.$revenueData['netRevenue'].'</span>';
68
- echo '</div>';
69
- echo '<div id="wp_insert_vi_chart_wrapper">';
70
- echo '<canvas id="wp_insert_vi_chart" width="348" height="139"></canvas>';
71
- echo '<textarea id="wp_insert_vi_chart_data" style="display: none;">[';
72
- if(isset($revenueData['mtdReport']) && is_array($revenueData['mtdReport']) & (count($revenueData['mtdReport']) > 0)) {
73
- $isFirstItem = true;
74
- foreach($revenueData['mtdReport'] as $reportData) {
75
- if(!$isFirstItem) {
76
- echo ',';
77
- }
78
- $date = DateTime::createFromFormat('d-m-Y', $reportData['date']);
79
- echo '{"x": "'.$date->format('m/d/Y').'", "y": "'.$reportData['revenue'].'"}';
80
- $isFirstItem = false;;
81
- }
82
- } else {
83
- echo '{"x": "'.date('m/d/Y').'", "y": "0.00"}';
84
- }
85
- echo ']</textarea>';
86
- echo '</div>';
87
- echo '<div class="clear"></div>';
88
- } else {
89
- echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
90
- echo '<div id="wp_insert_vi_earnings_wrapper">';
91
- echo '<div id="wp_insert_vi_earnings">';
92
- echo '<span id="wp_insert_vi_earnings_label">Total Earnings</span>';
93
- echo '<span id="wp_insert_vi_earnings_value"><img src="'.WP_INSERT_URL.'includes/assets/images/vi-no-data.jpg?'.WP_INSERT_VERSION.'"></span>';
94
- echo '</div>';
95
- echo '<div id="wp_insert_vi_chart_wrapper">';
96
- echo '<img width="348" height="139" src="'.WP_INSERT_URL.'includes/assets/images/vi-empty-graph.jpg?'.WP_INSERT_VERSION.'">';
97
- echo '</div>';
98
- echo '<div class="clear"></div>';
99
- echo '</div>';
100
- }
101
- die();
102
- }
103
- /* End Add Card in Admin Panel */
104
-
105
- /* Begin Signup Form */
106
- add_action('wp_ajax_wp_insert_vi_signup_form_get_content', 'wp_insert_vi_signup_form_get_content');
107
- function wp_insert_vi_signup_form_get_content() {
108
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
109
- $signupURL = wp_insert_vi_api_get_signupurl();
110
- if(($signupURL != false) && ($signupURL != '')) {
111
- echo '<div class="wp_insert_popup_content_wrapper">';
112
- echo '<iframe src="'.$signupURL.'?email='.get_bloginfo('admin_email').'&domain='.wp_insert_get_domain_name_from_url(get_bloginfo('url')).'&aid=WP_insert" style="width: 100%; max-width: 870px; min-height: 554px;"></iframe>';
113
- echo '<script type="text/javascript">';
114
- echo 'jQuery(".ui-dialog-buttonset").find("button").first().remove();';
115
- echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Close</span>");';
116
- echo '</script>';
117
- echo '</div>';
118
- } else {
119
- echo '<div class="wp_insert_popup_content_wrapper">';
120
- echo '<p> There was an error processing your request. Please try again later. </p>';
121
- echo '</div>';
122
- }
123
- die();
124
- }
125
- /* End Signup Form */
126
-
127
- /* Begin Login Form */
128
- add_action('wp_ajax_wp_insert_vi_login_form_get_content', 'wp_insert_vi_login_form_get_content');
129
- function wp_insert_vi_login_form_get_content() {
130
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
131
- echo '<div class="wp_insert_popup_content_wrapper">';
132
- echo '<div class="wp_insert_vi_loginform_wrapper">';
133
- wp_insert_vi_login_form_get_controls();
134
- echo '</div>';
135
- echo '<script type="text/javascript">';
136
- echo $control->JS;
137
- echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(2)").hide().after("<span class=\'ui-button-text\'>Login</span>");';
138
- echo 'jQuery(".ui-dialog-buttonset").find("button").first().find("span:nth-child(1)").attr("class", "ui-button-icon-primary ui-icon ui-icon-key");';
139
- echo '</script>';
140
- echo '</div>';
141
- die();
142
- }
143
-
144
- add_action('wp_ajax_wp_insert_vi_login_form_save_action', 'wp_insert_vi_login_form_save_action');
145
- function wp_insert_vi_login_form_save_action() {
146
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
147
- if(isset($_POST['wp_insert_vi_login_username']) && ($_POST['wp_insert_vi_login_username'] != '') && isset($_POST['wp_insert_vi_login_password']) && ($_POST['wp_insert_vi_login_password'] != '')) {
148
- $token = wp_insert_vi_api_login($_POST['wp_insert_vi_login_username'], $_POST['wp_insert_vi_login_password']);
149
- if(is_array($token) && (isset($token['status'])) && ($token['status'] == 'error')) {
150
- wp_insert_vi_login_form_get_controls();
151
- if($token['errorCode'] == 'WIVI008') {
152
- echo '<p class="wp_insert_vi_login_error">'.$token['message'].'</p>';
153
- } else {
154
- echo '<p class="wp_insert_vi_login_error">Error Code: '.$token['errorCode'].'<br />Please contact support or try again later!'.'</p>';
155
- }
156
- } else {
157
- echo '###SUCCESS###';
158
- wp_insert_vi_plugin_card_content(true, true);
159
- }
160
- }
161
- die();
162
- }
163
-
164
- function wp_insert_vi_login_form_get_controls() {
165
- $control = new smartlogixControls();
166
- $control->HTML .= '<p>Please log in with the received credentials to complete the integration:</p>';
167
- $control->add_control(array('type' => 'text', 'id' => 'wp_insert_vi_login_username', 'name' => 'wp_insert_vi_login_username', 'label' => 'Email', 'value' => ''));
168
- $control->add_control(array('type' => 'password', 'id' => 'wp_insert_vi_login_password', 'name' => 'wp_insert_vi_login_password', 'label' => 'Password', 'value' => ''));
169
- $control->create_section('Login');
170
- echo $control->HTML;
171
- }
172
-
173
- add_action('wp_ajax_wp_insert_vi_update_adstxt', 'wp_insert_vi_update_adstxt');
174
- function wp_insert_vi_update_adstxt() {
175
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
176
-
177
- $adstxtContent = wp_insert_adstxt_get_content();
178
- $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
179
- $viEntry = wp_insert_vi_api_get_adstxt_content();
180
- if(strpos(str_replace(array("\r", "\n", " "), '', $adstxtContent), str_replace(array("\r", "\n", " "), '', $viEntry)) !== false) {
181
- die();
182
- } else {
183
- $updatedAdstxtContent = '';
184
- if(strpos($adstxtContent, '# 41b5eef6') !== false) {
185
- foreach($adstxtContentData as $line) {
186
- if(strpos($line, '# 41b5eef6') !== false) {
187
-
188
- } else {
189
- $updatedAdstxtContent .= str_replace(array("\r", "\n", " "), '', $line)."\r\n";
190
- }
191
- }
192
- $updatedAdstxtContent .= $viEntry;
193
- } else {
194
- $updatedAdstxtContent .= $adstxtContent."\r\n".$viEntry;
195
- }
196
-
197
- if(wp_insert_adstxt_update_content($updatedAdstxtContent)) {
198
- echo '###SUCCESS###';
199
- echo '<div class="notice notice-warning wp_insert_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
200
- echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
201
- echo '<p><b>ADS.TXT has been added</b></p>';
202
- echo '<p>Wp-Insert has updated your ads.txt file with lines that declare video intelligence as a legitimate seller of your inventory and enables you to make more money through video intelligence. Read the <a target="_blank" href="https://www.vi.ai/frequently-asked-questions-vi-stories-for-wordpress/?utm_source=WordPress&utm_medium=Plugin%20FAQ&utm_campaign=WP%20Insert">FAQ</a>.</p>';
203
- echo '</div>';
204
- echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
205
- echo '<div class="clear"></div>';
206
- echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
207
- echo '</div>';
208
- } else {
209
- echo '###FAIL###';
210
- echo '<div class="notice notice-error wp_insert_adsstxt_notice is-dismissible" style="padding: 5px 15px;">';
211
- echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
212
- echo '<p><b>ADS.TXT couldn’t be added</b></p>';
213
- echo '<p>Important note: Wp-Insert hasn’t been able to update your ads.txt file. Please make sure that you enter the following lines manually:</p>';
214
- echo '<p><code style="display: block;">'.trim(str_replace(array("\r\n", "\r", "\n"), "<br />", $viEntry)).'</code><br />Only by doing so, you\'ll be able to make more money through video intelligence (vi.ai).</p>';
215
- echo '</div>';
216
- echo '<img style="float: right; margin-right: 20px; margin-top: 13px;" src="'.WP_INSERT_URL.'includes/assets/images/vi-big-logo.png?'.WP_INSERT_VERSION.'" />';
217
- echo '<div class="clear"></div>';
218
- echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
219
- echo '</div>';
220
- }
221
- }
222
- die();
223
- }
224
- /* End Login Form */
225
-
226
- /* Begin Logout */
227
- add_action('wp_ajax_wp_insert_vi_logout_action', 'wp_insert_vi_logout_action');
228
- function wp_insert_vi_logout_action() {
229
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
230
- wp_insert_vi_api_logout();
231
- echo '###SUCCESS###';
232
- wp_insert_vi_plugin_card_content(false, true);
233
- die();
234
- }
235
- /* End Logout */
236
-
237
- /* Begin Configure vi Code */
238
- add_action('wp_ajax_wp_insert_vi_customize_adcode_form_get_content', 'wp_insert_vi_customize_adcode_form_get_content');
239
- function wp_insert_vi_customize_adcode_form_get_content() {
240
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
241
- $vicodeSettings = get_option('wp_insert_vi_code_settings');
242
- $control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_vi_code_settings', 'values' => $vicodeSettings));
243
- $control->HTML = '<div class="wp_insert_popup_content_wrapper">';
244
- $control->HTML .= '<p>Use this form to customize the look of the video unit. Use the same parameters as your WordPress theme for a natural look on your site.<br />You can use <b>vi stories</b> for <i>In-Post Ads: Ad - Above Post Content</i> and <i>In-Post Ads: Ad - Middle of Post Content</i></p>';
245
- $control->HTML .= '<div class="wp_insert_vi_popup_right_column">';
246
- $control->HTML .= '<img style="margin: 0 auto; display: block;" src="'.WP_INSERT_URL.'includes/assets/images/advertisement-preview.png?'.WP_INSERT_VERSION.'" />';
247
- $control->HTML .= '</div>';
248
- $control->HTML .= '<div class="wp_insert_vi_popup_left_column">';
249
- $control->HTML .= '<p id="wp_insert_vi_customize_adcode_keywords_required_error" style="display: none;" class="viError">Keywords contains invalid characters, Some required fields are missing</p>';
250
- $control->HTML .= '<p id="wp_insert_vi_customize_adcode_keywords_error" style="display: none;" class="viError">Keywords contains invalid characters</p>';
251
- $control->HTML .= '<p id="wp_insert_vi_customize_adcode_required_error" style="display: none;" class="viError">Some required fields are missing</p>';
252
- $adUnitOptions = array(
253
- /*array('text' => 'Select Ad Unit', 'value' => 'select'),*/
254
- array('text' => 'vi stories', 'value' => 'NATIVE_VIDEO_UNIT'),
255
- /*array('text' => 'Outstream', 'value' => 'FLOATING_OUTSTREAM')*/
256
- );
257
- $control->add_control(array('type' => 'select', 'label' => ' Ad Unit*', 'optionName' => 'ad_unit_type', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">- vi stories (video advertising + video content)</span></span><small>', 'options' => $adUnitOptions));/*<br />- out-stream (video advertising)*/
258
- $control->add_control(array('type' => 'textarea', 'label' => 'Keywords', 'optionName' => 'keywords', 'helpText' => '</small><span class="tooltipWrapper"><span class="tooltip">Comma separated values describing the content of the page e.g. \'cooking, grilling, pulled pork\'</span></span><small>'));
259
- $IABParentCategories = array(
260
- array('text' => 'Select tier 1 category', 'value' => 'select'),
261
- array('text' => 'Arts & Entertainment', 'value' => 'IAB1'),
262
- array('text' => 'Automotive', 'value' => 'IAB2'),
263
- array('text' => 'Business', 'value' => 'IAB3'),
264
- array('text' => 'Careers', 'value' => 'IAB4'),
265
- array('text' => 'Education', 'value' => 'IAB5'),
266
- array('text' => 'Family & Parenting', 'value' => 'IAB6'),
267
- array('text' => 'Health & Fitness', 'value' => 'IAB7'),
268
- array('text' => 'Food & Drink', 'value' => 'IAB8'),
269
- array('text' => 'Hobbies & Interests', 'value' => 'IAB9'),
270
- array('text' => 'Home & Garden', 'value' => 'IAB10'),
271
- array('text' => 'Law, Gov’t & Politics', 'value' => 'IAB11'),
272
- array('text' => 'News', 'value' => 'IAB12'),
273
- array('text' => 'Personal Finance', 'value' => 'IAB13'),
274
- array('text' => 'Society', 'value' => 'IAB14'),
275
- array('text' => 'Science', 'value' => 'IAB15'),
276
- array('text' => 'Pets', 'value' => 'IAB16'),
277
- array('text' => 'Sports', 'value' => 'IAB17'),
278
- array('text' => 'Style & Fashion', 'value' => 'IAB18'),
279
- array('text' => 'Technology & Computing', 'value' => 'IAB19'),
280
- array('text' => 'Travel', 'value' => 'IAB20'),
281
- array('text' => 'Real Estate', 'value' => 'IAB21'),
282
- array('text' => 'Shopping', 'value' => 'IAB22'),
283
- array('text' => 'Religion & Spirituality', 'value' => 'IAB23'),
284
- array('text' => 'Uncategorized', 'value' => 'IAB24'),
285
- array('text' => 'Non-Standard Content', 'value' => 'IAB25'),
286
- array('text' => 'Illegal Content', 'value' => 'IAB26')
287
- );
288
- $control->add_control(array('type' => 'select', 'label' => 'IAB Category*', 'optionName' => 'iab_category_parent', 'helpText' => '</small><a class="textTip" target="_blank" href="'.wp_insert_vi_api_get_iabCategoriesURL().'">See Complete List</a><small>', 'options' => $IABParentCategories));
289
- $IABChildCategories = array(
290
- array('text' => 'Select tier 2 category', 'value' => 'select'),
291
- array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
292
- array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
293
- array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
294
- array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
295
- array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
296
- array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
297
- array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
298
- array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
299
- array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
300
- array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
301
- array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
302
- array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
303
- array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
304
- array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
305
- array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
306
- array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
307
- array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
308
- array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
309
- array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
310
- array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
311
- array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
312
- array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
313
- array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
314
- array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
315
- array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
316
- array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
317
- array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
318
- array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
319
- array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
320
- array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
321
- array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
322
- array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
323
- array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
324
- array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
325
- array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
326
- array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
327
- array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
328
- array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
329
- array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
330
- array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
331
- array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
332
- array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
333
- array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
334
- array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
335
- array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
336
- array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
337
- array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
338
- array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
339
- array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
340
- array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
341
- array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
342
- array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
343
- array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
344
- array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
345
- array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
346
- array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
347
- array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
348
- array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
349
- array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
350
- array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
351
- array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
352
- array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
353
- array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
354
- array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
355
- array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
356
- array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
357
- array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
358
- array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
359
- array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
360
- array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
361
- array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
362
- array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
363
- array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
364
- array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
365
- array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
366
- array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
367
- array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
368
- array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
369
- array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
370
- array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
371
- array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
372
- array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
373
- array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
374
- array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
375
- array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
376
- array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
377
- array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
378
- array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
379
- array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
380
- array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
381
- array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
382
- array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
383
- array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
384
- array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
385
- array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
386
- array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
387
- array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
388
- array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
389
- array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
390
- array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
391
- array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
392
- array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
393
- array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
394
- array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
395
- array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
396
- array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
397
- array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
398
- array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
399
- array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
400
- array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
401
- array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
402
- array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
403
- array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
404
- array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
405
- array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
406
- array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
407
- array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
408
- array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
409
- array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
410
- array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
411
- array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
412
- array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
413
- array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
414
- array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
415
- array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
416
- array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
417
- array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
418
- array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
419
- array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
420
- array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
421
- array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
422
- array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
423
- array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
424
- array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
425
- array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
426
- array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
427
- array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
428
- array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
429
- array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
430
- array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
431
- array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
432
- array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
433
- array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
434
- array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
435
- array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
436
- array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
437
- array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
438
- array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
439
- array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
440
- array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
441
- array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
442
- array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
443
- array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
444
- array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
445
- array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
446
- array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
447
- array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
448
- array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
449
- array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
450
- array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
451
- array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
452
- array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
453
- array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
454
- array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
455
- array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
456
- array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
457
- array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
458
- array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
459
- array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
460
- array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
461
- array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
462
- array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
463
- array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
464
- array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
465
- array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
466
- array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
467
- array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
468
- array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
469
- array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
470
- array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
471
- array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
472
- array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
473
- array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
474
- array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
475
- array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
476
- array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
477
- array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
478
- array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
479
- array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
480
- array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
481
- array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
482
- array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
483
- array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
484
- array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
485
- array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
486
- array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
487
- array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
488
- array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
489
- array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
490
- array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
491
- array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
492
- array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
493
- array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
494
- array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
495
- array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
496
- array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
497
- array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
498
- array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
499
- array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
500
- array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
501
- array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
502
- array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
503
- array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
504
- array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
505
- array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
506
- array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
507
- array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
508
- array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
509
- array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
510
- array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
511
- array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
512
- array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
513
- array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
514
- array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
515
- array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
516
- array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
517
- array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
518
- array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
519
- array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
520
- array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
521
- array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
522
- array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
523
- array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
524
- array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
525
- array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
526
- array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
527
- array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
528
- array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
529
- array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
530
- array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
531
- array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
532
- array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
533
- array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
534
- array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
535
- array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
536
- array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
537
- array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
538
- array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
539
- array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
540
- array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
541
- array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
542
- array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
543
- array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
544
- array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
545
- array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
546
- array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
547
- array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
548
- array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
549
- array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
550
- array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
551
- array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
552
- array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
553
- array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
554
- array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
555
- array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
556
- array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
557
- array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
558
- array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
559
- array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
560
- array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
561
- array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
562
- array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
563
- array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
564
- array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
565
- array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
566
- array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
567
- array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
568
- array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
569
- array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
570
- array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
571
- array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
572
- array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
573
- array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
574
- array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
575
- array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
576
- array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
577
- array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
578
- array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
579
- array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
580
- array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
581
- array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
582
- array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
583
- array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
584
- array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
585
- array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
586
- array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
587
- array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
588
- array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
589
- array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
590
- array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
591
- array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
592
- array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
593
- array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
594
- array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
595
- array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
596
- array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
597
- array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
598
- array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
599
- array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
600
- array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
601
- array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
602
- array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
603
- array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
604
- array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
605
- array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
606
- array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
607
- array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
608
- array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
609
- array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
610
- array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
611
- array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
612
- array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
613
- array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
614
- array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
615
- array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
616
- array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
617
- array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
618
- array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
619
- array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
620
- array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
621
- array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
622
- array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
623
- array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
624
- array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
625
- array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
626
- array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
627
- array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
628
- array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
629
- array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
630
- array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
631
- array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
632
- array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
633
- array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
634
- array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
635
- array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
636
- array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
637
- array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
638
- array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
639
- array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
640
- array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
641
- array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
642
- array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
643
- array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
644
- array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
645
- array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
646
- array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
647
- array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
648
- array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
649
- array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
650
- array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
651
- array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
652
- array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
653
- array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
654
- array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
655
- array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
656
- array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
657
- );
658
- $control->add_control(array('type' => 'select', 'label' => '&nbsp;', 'optionName' => 'iab_category_child', 'helpText' => '&nbsp;', 'options' => $IABChildCategories));
659
- $languages = wp_insert_vi_api_get_languages();
660
- $languageOptions = array(
661
- array('text' => 'Select language', 'value' => 'select'),
662
- );
663
- if($languages != false) {
664
- foreach($languages as $key => $value) {
665
- $languageOptions[] = array('text' => $value, 'value' => $key);
666
- }
667
- }
668
- $control->add_control(array('type' => 'select', 'label' => 'Language*', 'optionName' => 'language', 'helpText' => '&nbsp;', 'options' => $languageOptions));
669
- $control->add_control(array('type' => 'minicolors', 'label' => 'Native Background color', 'optionName' => 'native_bg_color', 'helpText' => '&nbsp;'));
670
- $control->add_control(array('type' => 'minicolors', 'label' => 'Native Text color', 'optionName' => 'native_text_color', 'helpText' => '&nbsp;'));
671
- $fontFamily =array(
672
- array('text' => 'Select font family', 'value' => 'select'),
673
- array('text' => 'Georgia', 'value' => 'Georgia'),
674
- array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
675
- array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
676
- array('text' => 'Arial', 'value' => 'Arial'),
677
- array('text' => 'Arial Black', 'value' => 'Arial Black'),
678
- array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
679
- array('text' => 'Impact', 'value' => 'Impact'),
680
- array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
681
- array('text' => 'Tahoma', 'value' => 'Tahoma'),
682
- array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
683
- array('text' => 'Verdana', 'value' => 'Verdana'),
684
- array('text' => 'Courier New', 'value' => 'Courier New'),
685
- array('text' => 'Lucida Console', 'value' => 'Lucida Console')
686
- );
687
- $control->add_control(array('type' => 'select', 'label' => ' Native Text Font Family', 'optionName' => 'font_family', 'helpText' => '&nbsp;', 'options' => $fontFamily));
688
- $fontSize =array(
689
- array('text' => 'Select font size', 'value' => 'select'),
690
- array('text' => '8px', 'value' => '8'),
691
- array('text' => '9px', 'value' => '9'),
692
- array('text' => '10px', 'value' => '10'),
693
- array('text' => '11px', 'value' => '11'),
694
- array('text' => '12px', 'value' => '12'),
695
- array('text' => '14px', 'value' => '14'),
696
- array('text' => '16px', 'value' => '16'),
697
- array('text' => '18px', 'value' => '18'),
698
- array('text' => '20px', 'value' => '20'),
699
- array('text' => '22px', 'value' => '22'),
700
- array('text' => '24px', 'value' => '24'),
701
- array('text' => '26px', 'value' => '26'),
702
- array('text' => '28px', 'value' => '28'),
703
- array('text' => '36px', 'value' => '36')
704
- );
705
- $control->add_control(array('type' => 'select', 'label' => 'Native Text Font Size', 'optionName' => 'font_size', 'helpText' => '&nbsp;', 'options' => $fontSize));
706
- $control->add_control(array('type' => 'textarea', 'label' => 'Optional 1', 'optionName' => 'optional_1', 'helpText' => '&nbsp;'));
707
- $control->add_control(array('type' => 'textarea', 'label' => 'Optional 2', 'optionName' => 'optional_2', 'helpText' => '&nbsp;'));
708
- $control->add_control(array('type' => 'textarea', 'label' => 'Optional 3', 'optionName' => 'optional_3', 'helpText' => '&nbsp;'));
709
- $control->HTML .= '<p class="wp_insert_vi_delay_notice">vi Ad Changes might take some time to take into effect</p>';
710
- $control->HTML .= '</div>';
711
- $control->HTML .= '<div class="clear"></div>';
712
- $control->HTML .= '</div>';
713
- $control->create_section(' vi stories: customize your video player ');
714
- echo $control->HTML;
715
- echo '<script type="text/javascript">';
716
- echo $control->JS;
717
- echo 'wp_insert_vi_code_iab_category_parent_change();';
718
- echo '</script>';
719
- die();
720
- }
721
-
722
- add_action('wp_ajax_wp_insert_vi_customize_adcode_form_save_action', 'wp_insert_vi_customize_adcode_form_save_action');
723
- function wp_insert_vi_customize_adcode_form_save_action() {
724
- check_ajax_referer('wp-insert', 'wp_insert_nonce');
725
- $vicodeSettings = array();
726
- $vicodeSettings['ad_unit_type'] = ((isset($_POST['wp_insert_vi_code_settings_ad_unit_type']))?$_POST['wp_insert_vi_code_settings_ad_unit_type']:'');
727
- $vicodeSettings['keywords'] = ((isset($_POST['wp_insert_vi_code_settings_keywords']))?$_POST['wp_insert_vi_code_settings_keywords']:'');
728
- $vicodeSettings['iab_category_parent'] = ((isset($_POST['wp_insert_vi_code_settings_iab_category_parent']))?$_POST['wp_insert_vi_code_settings_iab_category_parent']:'');
729
- $vicodeSettings['iab_category_child'] = ((isset($_POST['wp_insert_vi_code_settings_iab_category_child']))?$_POST['wp_insert_vi_code_settings_iab_category_child']:'');
730
- $vicodeSettings['language'] = ((isset($_POST['wp_insert_vi_code_settings_language']))?$_POST['wp_insert_vi_code_settings_language']:'');
731
- $vicodeSettings['native_bg_color'] = ((isset($_POST['wp_insert_vi_code_settings_native_bg_color']))?$_POST['wp_insert_vi_code_settings_native_bg_color']:'');
732
- $vicodeSettings['native_text_color'] = ((isset($_POST['wp_insert_vi_code_settings_native_text_color']))?$_POST['wp_insert_vi_code_settings_native_text_color']:'');
733
- $vicodeSettings['font_family'] = ((isset($_POST['wp_insert_vi_code_settings_font_family']))?$_POST['wp_insert_vi_code_settings_font_family']:'');
734
- $vicodeSettings['font_size'] = ((isset($_POST['wp_insert_vi_code_settings_font_size']))?$_POST['wp_insert_vi_code_settings_font_size']:'');
735
- $vicodeSettings['optional_1'] = ((isset($_POST['wp_insert_vi_code_settings_optional_1']))?$_POST['wp_insert_vi_code_settings_optional_1']:'');
736
- $vicodeSettings['optional_2'] = ((isset($_POST['wp_insert_vi_code_settings_optional_2']))?$_POST['wp_insert_vi_code_settings_optional_2']:'');
737
- $vicodeSettings['optional_3'] = ((isset($_POST['wp_insert_vi_code_settings_optional_3']))?$_POST['wp_insert_vi_code_settings_optional_3']:'');
738
- update_option('wp_insert_vi_code_settings', $vicodeSettings);
739
- $viCodeStatus = wp_insert_vi_api_set_vi_code($vicodeSettings);
740
- if(is_array($viCodeStatus) && (isset($viCodeStatus['status'])) && ($viCodeStatus['status'] == 'error')) {
741
- if($viCodeStatus['errorCode'] == 'WIVI108') {
742
- echo '###FAIL###';
743
- echo '<p class="viError">'.$viCodeStatus['message'].'</p>';
744
- } else {
745
- echo '###FAIL###';
746
- echo '<p class="viError">There was an error processing your request, our team was notified.<br />Please try again later.</p>';
747
- }
748
- } else {
749
- echo '###SUCCESS###';
750
- }
751
- die();
752
- }
753
-
754
- function wp_insert_vi_customize_adcode_get_settings() {
755
- $vicodeSettings = get_option('wp_insert_vi_code_settings');
756
-
757
- $output = '';
758
- if(isset($vicodeSettings) && is_array($vicodeSettings)) {
759
- $output .= '<p class="wp_insert_vi_code_data_wrapper">';
760
- if(isset($vicodeSettings['ad_unit_type']) && ($vicodeSettings['ad_unit_type'] != '') && ($vicodeSettings['ad_unit_type'] != 'select')) {
761
- $output .= '<label>Ad Unit:</label><b>vi stories</b>';
762
- }
763
-
764
- if(isset($vicodeSettings['keywords']) && ($vicodeSettings['keywords'] != '')) {
765
- $output .= '<label>Keywords:</label><b>'.$vicodeSettings['keywords'].'</b>';
766
- }
767
-
768
- if(isset($vicodeSettings['iab_category_child']) && ($vicodeSettings['iab_category_child'] != '') && ($vicodeSettings['iab_category_child'] != 'select')) {
769
- $IABChildCategories = array(
770
- array('text' => 'Select', 'value' => 'select'),
771
- array('text' => 'Books & Literature', 'value' => 'IAB1-1', 'metadata' => array('parent' => 'IAB1')),
772
- array('text' => 'Celebrity Fan/Gossip', 'value' => 'IAB1-2', 'metadata' => array('parent' => 'IAB1')),
773
- array('text' => 'Fine Art', 'value' => 'IAB1-3', 'metadata' => array('parent' => 'IAB1')),
774
- array('text' => 'Humor', 'value' => 'IAB1-4', 'metadata' => array('parent' => 'IAB1')),
775
- array('text' => 'Movies', 'value' => 'IAB1-5', 'metadata' => array('parent' => 'IAB1')),
776
- array('text' => 'Music', 'value' => 'IAB1-6', 'metadata' => array('parent' => 'IAB1')),
777
- array('text' => 'Television', 'value' => 'IAB1-7', 'metadata' => array('parent' => 'IAB1')),
778
- array('text' => 'Auto Parts', 'value' => 'IAB2-1', 'metadata' => array('parent' => 'IAB2')),
779
- array('text' => 'Auto Repair', 'value' => 'IAB2-2', 'metadata' => array('parent' => 'IAB2')),
780
- array('text' => 'Buying/Selling Cars', 'value' => 'IAB2-3', 'metadata' => array('parent' => 'IAB2')),
781
- array('text' => 'Car Culture', 'value' => 'IAB2-4', 'metadata' => array('parent' => 'IAB2')),
782
- array('text' => 'Certified Pre-Owned', 'value' => 'IAB2-5', 'metadata' => array('parent' => 'IAB2')),
783
- array('text' => 'Convertible', 'value' => 'IAB2-6', 'metadata' => array('parent' => 'IAB2')),
784
- array('text' => 'Coupe', 'value' => 'IAB2-7', 'metadata' => array('parent' => 'IAB2')),
785
- array('text' => 'Crossover', 'value' => 'IAB2-8', 'metadata' => array('parent' => 'IAB2')),
786
- array('text' => 'Diesel', 'value' => 'IAB2-9', 'metadata' => array('parent' => 'IAB2')),
787
- array('text' => 'Electric Vehicle', 'value' => 'IAB2-10', 'metadata' => array('parent' => 'IAB2')),
788
- array('text' => 'Hatchback', 'value' => 'IAB2-11', 'metadata' => array('parent' => 'IAB2')),
789
- array('text' => 'Hybrid', 'value' => 'IAB2-12', 'metadata' => array('parent' => 'IAB2')),
790
- array('text' => 'Luxury', 'value' => 'IAB2-13', 'metadata' => array('parent' => 'IAB2')),
791
- array('text' => 'MiniVan', 'value' => 'IAB2-14', 'metadata' => array('parent' => 'IAB2')),
792
- array('text' => 'Mororcycles', 'value' => 'IAB2-15', 'metadata' => array('parent' => 'IAB2')),
793
- array('text' => 'Off-Road Vehicles', 'value' => 'IAB2-16', 'metadata' => array('parent' => 'IAB2')),
794
- array('text' => 'Performance Vehicles', 'value' => 'IAB2-17', 'metadata' => array('parent' => 'IAB2')),
795
- array('text' => 'Pickup', 'value' => 'IAB2-18', 'metadata' => array('parent' => 'IAB2')),
796
- array('text' => 'Road-Side Assistance', 'value' => 'IAB2-19', 'metadata' => array('parent' => 'IAB2')),
797
- array('text' => 'Sedan', 'value' => 'IAB2-20', 'metadata' => array('parent' => 'IAB2')),
798
- array('text' => 'Trucks & Accessories', 'value' => 'IAB2-21', 'metadata' => array('parent' => 'IAB2')),
799
- array('text' => 'Vintage Cars', 'value' => 'IAB2-22', 'metadata' => array('parent' => 'IAB2')),
800
- array('text' => 'Wagon', 'value' => 'IAB2-23', 'metadata' => array('parent' => 'IAB2')),
801
- array('text' => 'Advertising', 'value' => 'IAB3-1', 'metadata' => array('parent' => 'IAB3')),
802
- array('text' => 'Agriculture', 'value' => 'IAB3-2', 'metadata' => array('parent' => 'IAB3')),
803
- array('text' => 'Biotech/Biomedical', 'value' => 'IAB3-3', 'metadata' => array('parent' => 'IAB3')),
804
- array('text' => 'Business Software', 'value' => 'IAB3-4', 'metadata' => array('parent' => 'IAB3')),
805
- array('text' => 'Construction', 'value' => 'IAB3-5', 'metadata' => array('parent' => 'IAB3')),
806
- array('text' => 'Forestry', 'value' => 'IAB3-6', 'metadata' => array('parent' => 'IAB3')),
807
- array('text' => 'Government', 'value' => 'IAB3-7', 'metadata' => array('parent' => 'IAB3')),
808
- array('text' => 'Green Solutions', 'value' => 'IAB3-8', 'metadata' => array('parent' => 'IAB3')),
809
- array('text' => 'Human Resources', 'value' => 'IAB3-9', 'metadata' => array('parent' => 'IAB3')),
810
- array('text' => 'Logistics', 'value' => 'IAB3-10', 'metadata' => array('parent' => 'IAB3')),
811
- array('text' => 'Marketing', 'value' => 'IAB3-11', 'metadata' => array('parent' => 'IAB3')),
812
- array('text' => 'Metals', 'value' => 'IAB3-12', 'metadata' => array('parent' => 'IAB3')),
813
- array('text' => 'Career Planning', 'value' => 'IAB4-1', 'metadata' => array('parent' => 'IAB4')),
814
- array('text' => 'College', 'value' => 'IAB4-2', 'metadata' => array('parent' => 'IAB4')),
815
- array('text' => 'Financial Aid', 'value' => 'IAB4-3', 'metadata' => array('parent' => 'IAB4')),
816
- array('text' => 'Job Fairs', 'value' => 'IAB4-4', 'metadata' => array('parent' => 'IAB4')),
817
- array('text' => 'Job Search', 'value' => 'IAB4-5', 'metadata' => array('parent' => 'IAB4')),
818
- array('text' => 'Resume Writing/Advice', 'value' => 'IAB4-6', 'metadata' => array('parent' => 'IAB4')),
819
- array('text' => 'Nursing', 'value' => 'IAB4-7', 'metadata' => array('parent' => 'IAB4')),
820
- array('text' => 'Scholarships', 'value' => 'IAB4-8', 'metadata' => array('parent' => 'IAB4')),
821
- array('text' => 'Telecommuting', 'value' => 'IAB4-9', 'metadata' => array('parent' => 'IAB4')),
822
- array('text' => 'U.S. Military', 'value' => 'IAB4-10', 'metadata' => array('parent' => 'IAB4')),
823
- array('text' => 'Career Advice', 'value' => 'IAB4-11', 'metadata' => array('parent' => 'IAB4')),
824
- array('text' => '7-12 Education', 'value' => 'IAB5-1', 'metadata' => array('parent' => 'IAB5')),
825
- array('text' => 'Adult Education', 'value' => 'IAB5-2', 'metadata' => array('parent' => 'IAB5')),
826
- array('text' => 'Art History', 'value' => 'IAB5-3', 'metadata' => array('parent' => 'IAB5')),
827
- array('text' => 'Colledge Administration', 'value' => 'IAB5-4', 'metadata' => array('parent' => 'IAB5')),
828
- array('text' => 'College Life', 'value' => 'IAB5-5', 'metadata' => array('parent' => 'IAB5')),
829
- array('text' => 'Distance Learning', 'value' => 'IAB5-6', 'metadata' => array('parent' => 'IAB5')),
830
- array('text' => 'English as a 2nd Language', 'value' => 'IAB5-7', 'metadata' => array('parent' => 'IAB5')),
831
- array('text' => 'Language Learning', 'value' => 'IAB5-8', 'metadata' => array('parent' => 'IAB5')),
832
- array('text' => 'Graduate School', 'value' => 'IAB5-9', 'metadata' => array('parent' => 'IAB5')),
833
- array('text' => 'Homeschooling', 'value' => 'IAB5-10', 'metadata' => array('parent' => 'IAB5')),
834
- array('text' => 'Homework/Study Tips', 'value' => 'IAB5-11', 'metadata' => array('parent' => 'IAB5')),
835
- array('text' => 'K-6 Educators', 'value' => 'IAB5-12', 'metadata' => array('parent' => 'IAB5')),
836
- array('text' => 'Private School', 'value' => 'IAB5-13', 'metadata' => array('parent' => 'IAB5')),
837
- array('text' => 'Special Education', 'value' => 'IAB5-14', 'metadata' => array('parent' => 'IAB5')),
838
- array('text' => 'Studying Business', 'value' => 'IAB5-15', 'metadata' => array('parent' => 'IAB5')),
839
- array('text' => 'Adoption', 'value' => 'IAB6-1', 'metadata' => array('parent' => 'IAB6')),
840
- array('text' => 'Babies & Toddlers', 'value' => 'IAB6-2', 'metadata' => array('parent' => 'IAB6')),
841
- array('text' => 'Daycare/Pre School', 'value' => 'IAB6-3', 'metadata' => array('parent' => 'IAB6')),
842
- array('text' => 'Family Internet', 'value' => 'IAB6-4', 'metadata' => array('parent' => 'IAB6')),
843
- array('text' => 'Parenting – K-6 Kids', 'value' => 'IAB6-5', 'metadata' => array('parent' => 'IAB6')),
844
- array('text' => 'Parenting teens', 'value' => 'IAB6-6', 'metadata' => array('parent' => 'IAB6')),
845
- array('text' => 'Pregnancy', 'value' => 'IAB6-7', 'metadata' => array('parent' => 'IAB6')),
846
- array('text' => 'Special Needs Kids', 'value' => 'IAB6-8', 'metadata' => array('parent' => 'IAB6')),
847
- array('text' => 'Eldercare', 'value' => 'IAB6-9', 'metadata' => array('parent' => 'IAB6')),
848
- array('text' => 'Exercise', 'value' => 'IAB7-1', 'metadata' => array('parent' => 'IAB7')),
849
- array('text' => 'A.D.D.', 'value' => 'IAB7-2', 'metadata' => array('parent' => 'IAB7')),
850
- array('text' => 'AIDS/HIV', 'value' => 'IAB7-3', 'metadata' => array('parent' => 'IAB7')),
851
- array('text' => 'Allergies', 'value' => 'IAB7-4', 'metadata' => array('parent' => 'IAB7')),
852
- array('text' => 'Alternative Medicine', 'value' => 'IAB7-5', 'metadata' => array('parent' => 'IAB7')),
853
- array('text' => 'Arthritis', 'value' => 'IAB7-6', 'metadata' => array('parent' => 'IAB7')),
854
- array('text' => 'Asthma', 'value' => 'IAB7-7', 'metadata' => array('parent' => 'IAB7')),
855
- array('text' => 'Autism/PDD', 'value' => 'IAB7-8', 'metadata' => array('parent' => 'IAB7')),
856
- array('text' => 'Bipolar Disorder', 'value' => 'IAB7-9', 'metadata' => array('parent' => 'IAB7')),
857
- array('text' => 'Brain Tumor', 'value' => 'IAB7-10', 'metadata' => array('parent' => 'IAB7')),
858
- array('text' => 'Cancer', 'value' => 'IAB7-11', 'metadata' => array('parent' => 'IAB7')),
859
- array('text' => 'Cholesterol', 'value' => 'IAB7-12', 'metadata' => array('parent' => 'IAB7')),
860
- array('text' => 'Chronic Fatigue Syndrome', 'value' => 'IAB7-13', 'metadata' => array('parent' => 'IAB7')),
861
- array('text' => 'Chronic Pain', 'value' => 'IAB7-14', 'metadata' => array('parent' => 'IAB7')),
862
- array('text' => 'Cold & Flu', 'value' => 'IAB7-15', 'metadata' => array('parent' => 'IAB7')),
863
- array('text' => 'Deafness', 'value' => 'IAB7-16', 'metadata' => array('parent' => 'IAB7')),
864
- array('text' => 'Dental Care', 'value' => 'IAB7-17', 'metadata' => array('parent' => 'IAB7')),
865
- array('text' => 'Depression', 'value' => 'IAB7-18', 'metadata' => array('parent' => 'IAB7')),
866
- array('text' => 'Dermatology', 'value' => 'IAB7-19', 'metadata' => array('parent' => 'IAB7')),
867
- array('text' => 'Diabetes', 'value' => 'IAB7-20', 'metadata' => array('parent' => 'IAB7')),
868
- array('text' => 'Epilepsy', 'value' => 'IAB7-21', 'metadata' => array('parent' => 'IAB7')),
869
- array('text' => 'GERD/Acid Reflux', 'value' => 'IAB7-22', 'metadata' => array('parent' => 'IAB7')),
870
- array('text' => 'Headaches/Migraines', 'value' => 'IAB7-23', 'metadata' => array('parent' => 'IAB7')),
871
- array('text' => 'Heart Disease', 'value' => 'IAB7-24', 'metadata' => array('parent' => 'IAB7')),
872
- array('text' => 'Herbs for Health', 'value' => 'IAB7-25', 'metadata' => array('parent' => 'IAB7')),
873
- array('text' => 'Holistic Healing', 'value' => 'IAB7-26', 'metadata' => array('parent' => 'IAB7')),
874
- array('text' => 'IBS/Crohn’s Disease', 'value' => 'IAB7-27', 'metadata' => array('parent' => 'IAB7')),
875
- array('text' => 'Incest/Abuse Support', 'value' => 'IAB7-28', 'metadata' => array('parent' => 'IAB7')),
876
- array('text' => 'Incontinence', 'value' => 'IAB7-29', 'metadata' => array('parent' => 'IAB7')),
877
- array('text' => 'Infertility', 'value' => 'IAB7-30', 'metadata' => array('parent' => 'IAB7')),
878
- array('text' => 'Men’s Health', 'value' => 'IAB7-31', 'metadata' => array('parent' => 'IAB7')),
879
- array('text' => 'Nutrition', 'value' => 'IAB7-32', 'metadata' => array('parent' => 'IAB7')),
880
- array('text' => 'Orthopedics', 'value' => 'IAB7-33', 'metadata' => array('parent' => 'IAB7')),
881
- array('text' => 'Panic/Anxiety Disorders', 'value' => 'IAB7-34', 'metadata' => array('parent' => 'IAB7')),
882
- array('text' => 'Pediatrics', 'value' => 'IAB7-35', 'metadata' => array('parent' => 'IAB7')),
883
- array('text' => 'Physical Therapy', 'value' => 'IAB7-36', 'metadata' => array('parent' => 'IAB7')),
884
- array('text' => 'Psychology/Psychiatry', 'value' => 'IAB7-37', 'metadata' => array('parent' => 'IAB7')),
885
- array('text' => 'Senor Health', 'value' => 'IAB7-38', 'metadata' => array('parent' => 'IAB7')),
886
- array('text' => 'Sexuality', 'value' => 'IAB7-39', 'metadata' => array('parent' => 'IAB7')),
887
- array('text' => 'Sleep Disorders', 'value' => 'IAB7-40', 'metadata' => array('parent' => 'IAB7')),
888
- array('text' => 'Smoking Cessation', 'value' => 'IAB7-41', 'metadata' => array('parent' => 'IAB7')),
889
- array('text' => 'Substance Abuse', 'value' => 'IAB7-42', 'metadata' => array('parent' => 'IAB7')),
890
- array('text' => 'Thyroid Disease', 'value' => 'IAB7-43', 'metadata' => array('parent' => 'IAB7')),
891
- array('text' => 'Weight Loss', 'value' => 'IAB7-44', 'metadata' => array('parent' => 'IAB7')),
892
- array('text' => 'Women’s Health', 'value' => 'IAB7-45', 'metadata' => array('parent' => 'IAB7')),
893
- array('text' => 'American Cuisine', 'value' => 'IAB8-1', 'metadata' => array('parent' => 'IAB8')),
894
- array('text' => 'Barbecues & Grilling', 'value' => 'IAB8-2', 'metadata' => array('parent' => 'IAB8')),
895
- array('text' => 'Cajun/Creole', 'value' => 'IAB8-3', 'metadata' => array('parent' => 'IAB8')),
896
- array('text' => 'Chinese Cuisine', 'value' => 'IAB8-4', 'metadata' => array('parent' => 'IAB8')),
897
- array('text' => 'Cocktails/Beer', 'value' => 'IAB8-5', 'metadata' => array('parent' => 'IAB8')),
898
- array('text' => 'Coffee/Tea', 'value' => 'IAB8-6', 'metadata' => array('parent' => 'IAB8')),
899
- array('text' => 'Cuisine-Specific', 'value' => 'IAB8-7', 'metadata' => array('parent' => 'IAB8')),
900
- array('text' => 'Desserts & Baking', 'value' => 'IAB8-8', 'metadata' => array('parent' => 'IAB8')),
901
- array('text' => 'Dining Out', 'value' => 'IAB8-9', 'metadata' => array('parent' => 'IAB8')),
902
- array('text' => 'Food Allergies', 'value' => 'IAB8-10', 'metadata' => array('parent' => 'IAB8')),
903
- array('text' => 'French Cuisine', 'value' => 'IAB8-11', 'metadata' => array('parent' => 'IAB8')),
904
- array('text' => 'Health/Lowfat Cooking', 'value' => 'IAB8-12', 'metadata' => array('parent' => 'IAB8')),
905
- array('text' => 'Italian Cuisine', 'value' => 'IAB8-13', 'metadata' => array('parent' => 'IAB8')),
906
- array('text' => 'Japanese Cuisine', 'value' => 'IAB8-14', 'metadata' => array('parent' => 'IAB8')),
907
- array('text' => 'Mexican Cuisine', 'value' => 'IAB8-15', 'metadata' => array('parent' => 'IAB8')),
908
- array('text' => 'Vegan', 'value' => 'IAB8-16', 'metadata' => array('parent' => 'IAB8')),
909
- array('text' => 'Vegetarian', 'value' => 'IAB8-17', 'metadata' => array('parent' => 'IAB8')),
910
- array('text' => 'Wine', 'value' => 'IAB8-18', 'metadata' => array('parent' => 'IAB8')),
911
- array('text' => 'Art/Technology', 'value' => 'IAB9-1', 'metadata' => array('parent' => 'IAB9')),
912
- array('text' => 'Arts & Crafts', 'value' => 'IAB9-2', 'metadata' => array('parent' => 'IAB9')),
913
- array('text' => 'Beadwork', 'value' => 'IAB9-3', 'metadata' => array('parent' => 'IAB9')),
914
- array('text' => 'Birdwatching', 'value' => 'IAB9-4', 'metadata' => array('parent' => 'IAB9')),
915
- array('text' => 'Board Games/Puzzles', 'value' => 'IAB9-5', 'metadata' => array('parent' => 'IAB9')),
916
- array('text' => 'Candle & Soap Making', 'value' => 'IAB9-6', 'metadata' => array('parent' => 'IAB9')),
917
- array('text' => 'Card Games', 'value' => 'IAB9-7', 'metadata' => array('parent' => 'IAB9')),
918
- array('text' => 'Chess', 'value' => 'IAB9-8', 'metadata' => array('parent' => 'IAB9')),
919
- array('text' => 'Cigars', 'value' => 'IAB9-9', 'metadata' => array('parent' => 'IAB9')),
920
- array('text' => 'Collecting', 'value' => 'IAB9-10', 'metadata' => array('parent' => 'IAB9')),
921
- array('text' => 'Comic Books', 'value' => 'IAB9-11', 'metadata' => array('parent' => 'IAB9')),
922
- array('text' => 'Drawing/Sketching', 'value' => 'IAB9-12', 'metadata' => array('parent' => 'IAB9')),
923
- array('text' => 'Freelance Writing', 'value' => 'IAB9-13', 'metadata' => array('parent' => 'IAB9')),
924
- array('text' => 'Genealogy', 'value' => 'IAB9-14', 'metadata' => array('parent' => 'IAB9')),
925
- array('text' => 'Getting Published', 'value' => 'IAB9-15', 'metadata' => array('parent' => 'IAB9')),
926
- array('text' => 'Guitar', 'value' => 'IAB9-16', 'metadata' => array('parent' => 'IAB9')),
927
- array('text' => 'Home Recording', 'value' => 'IAB9-17', 'metadata' => array('parent' => 'IAB9')),
928
- array('text' => 'Investors & Patents', 'value' => 'IAB9-18', 'metadata' => array('parent' => 'IAB9')),
929
- array('text' => 'Jewelry Making', 'value' => 'IAB9-19', 'metadata' => array('parent' => 'IAB9')),
930
- array('text' => 'Magic & Illusion', 'value' => 'IAB9-20', 'metadata' => array('parent' => 'IAB9')),
931
- array('text' => 'Needlework', 'value' => 'IAB9-21', 'metadata' => array('parent' => 'IAB9')),
932
- array('text' => 'Painting', 'value' => 'IAB9-22', 'metadata' => array('parent' => 'IAB9')),
933
- array('text' => 'Photography', 'value' => 'IAB9-23', 'metadata' => array('parent' => 'IAB9')),
934
- array('text' => 'Radio', 'value' => 'IAB9-24', 'metadata' => array('parent' => 'IAB9')),
935
- array('text' => 'Roleplaying Games', 'value' => 'IAB9-25', 'metadata' => array('parent' => 'IAB9')),
936
- array('text' => 'Sci-Fi & Fantasy', 'value' => 'IAB9-26', 'metadata' => array('parent' => 'IAB9')),
937
- array('text' => 'Scrapbooking', 'value' => 'IAB9-27', 'metadata' => array('parent' => 'IAB9')),
938
- array('text' => 'Screenwriting', 'value' => 'IAB9-28', 'metadata' => array('parent' => 'IAB9')),
939
- array('text' => 'Stamps & Coins', 'value' => 'IAB9-29', 'metadata' => array('parent' => 'IAB9')),
940
- array('text' => 'Video & Computer Games', 'value' => 'IAB9-30', 'metadata' => array('parent' => 'IAB9')),
941
- array('text' => 'Woodworking', 'value' => 'IAB9-31', 'metadata' => array('parent' => 'IAB9')),
942
- array('text' => 'Appliances', 'value' => 'IAB10-1', 'metadata' => array('parent' => 'IAB10')),
943
- array('text' => 'Entertaining', 'value' => 'IAB10-2', 'metadata' => array('parent' => 'IAB10')),
944
- array('text' => 'Environmental Safety', 'value' => 'IAB10-3', 'metadata' => array('parent' => 'IAB10')),
945
- array('text' => 'Gardening', 'value' => 'IAB10-4', 'metadata' => array('parent' => 'IAB10')),
946
- array('text' => 'Home Repair', 'value' => 'IAB10-5', 'metadata' => array('parent' => 'IAB10')),
947
- array('text' => 'Home Theater', 'value' => 'IAB10-6', 'metadata' => array('parent' => 'IAB10')),
948
- array('text' => 'Interior Decorating', 'value' => 'IAB10-7', 'metadata' => array('parent' => 'IAB10')),
949
- array('text' => 'Landscaping', 'value' => 'IAB10-8', 'metadata' => array('parent' => 'IAB10')),
950
- array('text' => 'Remodeling & Construction', 'value' => 'IAB10-9', 'metadata' => array('parent' => 'IAB10')),
951
- array('text' => 'Immigration', 'value' => 'IAB11-1', 'metadata' => array('parent' => 'IAB11')),
952
- array('text' => 'Legal Issues', 'value' => 'IAB11-2', 'metadata' => array('parent' => 'IAB11')),
953
- array('text' => 'U.S. Government Resources', 'value' => 'IAB11-3', 'metadata' => array('parent' => 'IAB11')),
954
- array('text' => 'Politics', 'value' => 'IAB11-4', 'metadata' => array('parent' => 'IAB11')),
955
- array('text' => 'Commentary', 'value' => 'IAB11-5', 'metadata' => array('parent' => 'IAB11')),
956
- array('text' => 'International News', 'value' => 'IAB12-1', 'metadata' => array('parent' => 'IAB12')),
957
- array('text' => 'National News', 'value' => 'IAB12-2', 'metadata' => array('parent' => 'IAB12')),
958
- array('text' => 'Local News', 'value' => 'IAB12-3', 'metadata' => array('parent' => 'IAB12')),
959
- array('text' => 'Beginning Investing', 'value' => 'IAB13-1', 'metadata' => array('parent' => 'IAB13')),
960
- array('text' => 'Credit/Debt & Loans', 'value' => 'IAB13-2', 'metadata' => array('parent' => 'IAB13')),
961
- array('text' => 'Financial News', 'value' => 'IAB13-3', 'metadata' => array('parent' => 'IAB13')),
962
- array('text' => 'Financial Planning', 'value' => 'IAB13-4', 'metadata' => array('parent' => 'IAB13')),
963
- array('text' => 'Hedge Fund', 'value' => 'IAB13-5', 'metadata' => array('parent' => 'IAB13')),
964
- array('text' => 'Insurance', 'value' => 'IAB13-6', 'metadata' => array('parent' => 'IAB13')),
965
- array('text' => 'Investing', 'value' => 'IAB13-7', 'metadata' => array('parent' => 'IAB13')),
966
- array('text' => 'Mutual Funds', 'value' => 'IAB13-8', 'metadata' => array('parent' => 'IAB13')),
967
- array('text' => 'Options', 'value' => 'IAB13-9', 'metadata' => array('parent' => 'IAB13')),
968
- array('text' => 'Retirement Planning', 'value' => 'IAB13-10', 'metadata' => array('parent' => 'IAB13')),
969
- array('text' => 'Stocks', 'value' => 'IAB13-11', 'metadata' => array('parent' => 'IAB13')),
970
- array('text' => 'Tax Planning', 'value' => 'IAB13-12', 'metadata' => array('parent' => 'IAB13')),
971
- array('text' => 'Dating', 'value' => 'IAB14-1', 'metadata' => array('parent' => 'IAB14')),
972
- array('text' => 'Divorce Support', 'value' => 'IAB14-2', 'metadata' => array('parent' => 'IAB14')),
973
- array('text' => 'Gay Life', 'value' => 'IAB14-3', 'metadata' => array('parent' => 'IAB14')),
974
- array('text' => 'Marriage', 'value' => 'IAB14-4', 'metadata' => array('parent' => 'IAB14')),
975
- array('text' => 'Senior Living', 'value' => 'IAB14-5', 'metadata' => array('parent' => 'IAB14')),
976
- array('text' => 'Teens', 'value' => 'IAB14-6', 'metadata' => array('parent' => 'IAB14')),
977
- array('text' => 'Weddings', 'value' => 'IAB14-7', 'metadata' => array('parent' => 'IAB14')),
978
- array('text' => 'Ethnic Specific', 'value' => 'IAB14-8', 'metadata' => array('parent' => 'IAB14')),
979
- array('text' => 'Astrology', 'value' => 'IAB15-1', 'metadata' => array('parent' => 'IAB15')),
980
- array('text' => 'Biology', 'value' => 'IAB15-2', 'metadata' => array('parent' => 'IAB15')),
981
- array('text' => 'Chemistry', 'value' => 'IAB15-3', 'metadata' => array('parent' => 'IAB15')),
982
- array('text' => 'Geology', 'value' => 'IAB15-4', 'metadata' => array('parent' => 'IAB15')),
983
- array('text' => 'Paranormal Phenomena', 'value' => 'IAB15-5', 'metadata' => array('parent' => 'IAB15')),
984
- array('text' => 'Physics', 'value' => 'IAB15-6', 'metadata' => array('parent' => 'IAB15')),
985
- array('text' => 'Space/Astronomy', 'value' => 'IAB15-7', 'metadata' => array('parent' => 'IAB15')),
986
- array('text' => 'Geography', 'value' => 'IAB15-8', 'metadata' => array('parent' => 'IAB15')),
987
- array('text' => 'Botany', 'value' => 'IAB15-9', 'metadata' => array('parent' => 'IAB15')),
988
- array('text' => 'Weather', 'value' => 'IAB15-10', 'metadata' => array('parent' => 'IAB15')),
989
- array('text' => 'Aquariums', 'value' => 'IAB16-1', 'metadata' => array('parent' => 'IAB16')),
990
- array('text' => 'Birds', 'value' => 'IAB16-2', 'metadata' => array('parent' => 'IAB16')),
991
- array('text' => 'Cats', 'value' => 'IAB16-3', 'metadata' => array('parent' => 'IAB16')),
992
- array('text' => 'Dogs', 'value' => 'IAB16-4', 'metadata' => array('parent' => 'IAB16')),
993
- array('text' => 'Large Animals', 'value' => 'IAB16-5', 'metadata' => array('parent' => 'IAB16')),
994
- array('text' => 'Reptiles', 'value' => 'IAB16-6', 'metadata' => array('parent' => 'IAB16')),
995
- array('text' => 'Veterinary Medicine', 'value' => 'IAB16-7', 'metadata' => array('parent' => 'IAB16')),
996
- array('text' => 'Auto Racing', 'value' => 'IAB17-1', 'metadata' => array('parent' => 'IAB17')),
997
- array('text' => 'Baseball', 'value' => 'IAB17-2', 'metadata' => array('parent' => 'IAB17')),
998
- array('text' => 'Bicycling', 'value' => 'IAB17-3', 'metadata' => array('parent' => 'IAB17')),
999
- array('text' => 'Bodybuilding', 'value' => 'IAB17-4', 'metadata' => array('parent' => 'IAB17')),
1000
- array('text' => 'Boxing', 'value' => 'IAB17-5', 'metadata' => array('parent' => 'IAB17')),
1001
- array('text' => 'Canoeing/Kayaking', 'value' => 'IAB17-6', 'metadata' => array('parent' => 'IAB17')),
1002
- array('text' => 'Cheerleading', 'value' => 'IAB17-7', 'metadata' => array('parent' => 'IAB17')),
1003
- array('text' => 'Climbing', 'value' => 'IAB17-8', 'metadata' => array('parent' => 'IAB17')),
1004
- array('text' => 'Cricket', 'value' => 'IAB17-9', 'metadata' => array('parent' => 'IAB17')),
1005
- array('text' => 'Figure Skating', 'value' => 'IAB17-10', 'metadata' => array('parent' => 'IAB17')),
1006
- array('text' => 'Fly Fishing', 'value' => 'IAB17-11', 'metadata' => array('parent' => 'IAB17')),
1007
- array('text' => 'Football', 'value' => 'IAB17-12', 'metadata' => array('parent' => 'IAB17')),
1008
- array('text' => 'Freshwater Fishing', 'value' => 'IAB17-13', 'metadata' => array('parent' => 'IAB17')),
1009
- array('text' => 'Game & Fish', 'value' => 'IAB17-14', 'metadata' => array('parent' => 'IAB17')),
1010
- array('text' => 'Golf', 'value' => 'IAB17-15', 'metadata' => array('parent' => 'IAB17')),
1011
- array('text' => 'Horse Racing', 'value' => 'IAB17-16', 'metadata' => array('parent' => 'IAB17')),
1012
- array('text' => 'Horses', 'value' => 'IAB17-17', 'metadata' => array('parent' => 'IAB17')),
1013
- array('text' => 'Hunting/Shooting', 'value' => 'IAB17-18', 'metadata' => array('parent' => 'IAB17')),
1014
- array('text' => 'Inline Skating', 'value' => 'IAB17-19', 'metadata' => array('parent' => 'IAB17')),
1015
- array('text' => 'Martial Arts', 'value' => 'IAB17-20', 'metadata' => array('parent' => 'IAB17')),
1016
- array('text' => 'Mountain Biking', 'value' => 'IAB17-21', 'metadata' => array('parent' => 'IAB17')),
1017
- array('text' => 'NASCAR Racing', 'value' => 'IAB17-22', 'metadata' => array('parent' => 'IAB17')),
1018
- array('text' => 'Olympics', 'value' => 'IAB17-23', 'metadata' => array('parent' => 'IAB17')),
1019
- array('text' => 'Paintball', 'value' => 'IAB17-24', 'metadata' => array('parent' => 'IAB17')),
1020
- array('text' => 'Power & Motorcycles', 'value' => 'IAB17-25', 'metadata' => array('parent' => 'IAB17')),
1021
- array('text' => 'Pro Basketball', 'value' => 'IAB17-26', 'metadata' => array('parent' => 'IAB17')),
1022
- array('text' => 'Pro Ice Hockey', 'value' => 'IAB17-27', 'metadata' => array('parent' => 'IAB17')),
1023
- array('text' => 'Rodeo', 'value' => 'IAB17-28', 'metadata' => array('parent' => 'IAB17')),
1024
- array('text' => 'Rugby', 'value' => 'IAB17-29', 'metadata' => array('parent' => 'IAB17')),
1025
- array('text' => 'Running/Jogging', 'value' => 'IAB17-30', 'metadata' => array('parent' => 'IAB17')),
1026
- array('text' => 'Sailing', 'value' => 'IAB17-31', 'metadata' => array('parent' => 'IAB17')),
1027
- array('text' => 'Saltwater Fishing', 'value' => 'IAB17-32', 'metadata' => array('parent' => 'IAB17')),
1028
- array('text' => 'Scuba Diving', 'value' => 'IAB17-33', 'metadata' => array('parent' => 'IAB17')),
1029
- array('text' => 'Skateboarding', 'value' => 'IAB17-34', 'metadata' => array('parent' => 'IAB17')),
1030
- array('text' => 'Skiing', 'value' => 'IAB17-35', 'metadata' => array('parent' => 'IAB17')),
1031
- array('text' => 'Snowboarding', 'value' => 'IAB17-36', 'metadata' => array('parent' => 'IAB17')),
1032
- array('text' => 'Surfing/Bodyboarding', 'value' => 'IAB17-37', 'metadata' => array('parent' => 'IAB17')),
1033
- array('text' => 'Swimming', 'value' => 'IAB17-38', 'metadata' => array('parent' => 'IAB17')),
1034
- array('text' => 'Table Tennis/Ping-Pong', 'value' => 'IAB17-39', 'metadata' => array('parent' => 'IAB17')),
1035
- array('text' => 'Tennis', 'value' => 'IAB17-40', 'metadata' => array('parent' => 'IAB17')),
1036
- array('text' => 'Volleyball', 'value' => 'IAB17-41', 'metadata' => array('parent' => 'IAB17')),
1037
- array('text' => 'Walking', 'value' => 'IAB17-42', 'metadata' => array('parent' => 'IAB17')),
1038
- array('text' => 'Waterski/Wakeboard', 'value' => 'IAB17-43', 'metadata' => array('parent' => 'IAB17')),
1039
- array('text' => 'World Soccer', 'value' => 'IAB17-44', 'metadata' => array('parent' => 'IAB17')),
1040
- array('text' => 'Beauty', 'value' => 'IAB18-1', 'metadata' => array('parent' => 'IAB18')),
1041
- array('text' => 'Body Art', 'value' => 'IAB18-2', 'metadata' => array('parent' => 'IAB18')),
1042
- array('text' => 'Fashion', 'value' => 'IAB18-3', 'metadata' => array('parent' => 'IAB18')),
1043
- array('text' => 'Jewelry', 'value' => 'IAB18-4', 'metadata' => array('parent' => 'IAB18')),
1044
- array('text' => 'Clothing', 'value' => 'IAB18-5', 'metadata' => array('parent' => 'IAB18')),
1045
- array('text' => 'Accessories', 'value' => 'IAB18-6', 'metadata' => array('parent' => 'IAB18')),
1046
- array('text' => '3-D Graphics', 'value' => 'IAB19-1', 'metadata' => array('parent' => 'IAB19')),
1047
- array('text' => 'Animation', 'value' => 'IAB19-2', 'metadata' => array('parent' => 'IAB19')),
1048
- array('text' => 'Antivirus Software', 'value' => 'IAB19-3', 'metadata' => array('parent' => 'IAB19')),
1049
- array('text' => 'C/C++', 'value' => 'IAB19-4', 'metadata' => array('parent' => 'IAB19')),
1050
- array('text' => 'Cameras & Camcorders', 'value' => 'IAB19-5', 'metadata' => array('parent' => 'IAB19')),
1051
- array('text' => 'Cell Phones', 'value' => 'IAB19-6', 'metadata' => array('parent' => 'IAB19')),
1052
- array('text' => 'Computer Certification', 'value' => 'IAB19-7', 'metadata' => array('parent' => 'IAB19')),
1053
- array('text' => 'Computer Networking', 'value' => 'IAB19-8', 'metadata' => array('parent' => 'IAB19')),
1054
- array('text' => 'Computer Peripherals', 'value' => 'IAB19-9', 'metadata' => array('parent' => 'IAB19')),
1055
- array('text' => 'Computer Reviews', 'value' => 'IAB19-10', 'metadata' => array('parent' => 'IAB19')),
1056
- array('text' => 'Data Centers', 'value' => 'IAB19-11', 'metadata' => array('parent' => 'IAB19')),
1057
- array('text' => 'Databases', 'value' => 'IAB19-12', 'metadata' => array('parent' => 'IAB19')),
1058
- array('text' => 'Desktop Publishing', 'value' => 'IAB19-13', 'metadata' => array('parent' => 'IAB19')),
1059
- array('text' => 'Desktop Video', 'value' => 'IAB19-14', 'metadata' => array('parent' => 'IAB19')),
1060
- array('text' => 'Email', 'value' => 'IAB19-15', 'metadata' => array('parent' => 'IAB19')),
1061
- array('text' => 'Graphics Software', 'value' => 'IAB19-16', 'metadata' => array('parent' => 'IAB19')),
1062
- array('text' => 'Home Video/DVD', 'value' => 'IAB19-17', 'metadata' => array('parent' => 'IAB19')),
1063
- array('text' => 'Internet Technology', 'value' => 'IAB19-18', 'metadata' => array('parent' => 'IAB19')),
1064
- array('text' => 'Java', 'value' => 'IAB19-19', 'metadata' => array('parent' => 'IAB19')),
1065
- array('text' => 'JavaScript', 'value' => 'IAB19-20', 'metadata' => array('parent' => 'IAB19')),
1066
- array('text' => 'Mac Support', 'value' => 'IAB19-21', 'metadata' => array('parent' => 'IAB19')),
1067
- array('text' => 'MP3/MIDI', 'value' => 'IAB19-22', 'metadata' => array('parent' => 'IAB19')),
1068
- array('text' => 'Net Conferencing', 'value' => 'IAB19-23', 'metadata' => array('parent' => 'IAB19')),
1069
- array('text' => 'Net for Beginners', 'value' => 'IAB19-24', 'metadata' => array('parent' => 'IAB19')),
1070
- array('text' => 'Network Security', 'value' => 'IAB19-25', 'metadata' => array('parent' => 'IAB19')),
1071
- array('text' => 'Palmtops/PDAs', 'value' => 'IAB19-26', 'metadata' => array('parent' => 'IAB19')),
1072
- array('text' => 'PC Support', 'value' => 'IAB19-27', 'metadata' => array('parent' => 'IAB19')),
1073
- array('text' => 'Portable', 'value' => 'IAB19-28', 'metadata' => array('parent' => 'IAB19')),
1074
- array('text' => 'Entertainment', 'value' => 'IAB19-29', 'metadata' => array('parent' => 'IAB19')),
1075
- array('text' => 'Shareware/Freeware', 'value' => 'IAB19-30', 'metadata' => array('parent' => 'IAB19')),
1076
- array('text' => 'Unix', 'value' => 'IAB19-31', 'metadata' => array('parent' => 'IAB19')),
1077
- array('text' => 'Visual Basic', 'value' => 'IAB19-32', 'metadata' => array('parent' => 'IAB19')),
1078
- array('text' => 'Web Clip Art', 'value' => 'IAB19-33', 'metadata' => array('parent' => 'IAB19')),
1079
- array('text' => 'Web Design/HTML', 'value' => 'IAB19-34', 'metadata' => array('parent' => 'IAB19')),
1080
- array('text' => 'Web Search', 'value' => 'IAB19-35', 'metadata' => array('parent' => 'IAB19')),
1081
- array('text' => 'Windows', 'value' => 'IAB19-36', 'metadata' => array('parent' => 'IAB19')),
1082
- array('text' => 'Adventure Travel', 'value' => 'IAB20-1', 'metadata' => array('parent' => 'IAB20')),
1083
- array('text' => 'Africa', 'value' => 'IAB20-2', 'metadata' => array('parent' => 'IAB20')),
1084
- array('text' => 'Air Travel', 'value' => 'IAB20-3', 'metadata' => array('parent' => 'IAB20')),
1085
- array('text' => 'Australia & New Zealand', 'value' => 'IAB20-4', 'metadata' => array('parent' => 'IAB20')),
1086
- array('text' => 'Bed & Breakfasts', 'value' => 'IAB20-5', 'metadata' => array('parent' => 'IAB20')),
1087
- array('text' => 'Budget Travel', 'value' => 'IAB20-6', 'metadata' => array('parent' => 'IAB20')),
1088
- array('text' => 'Business Travel', 'value' => 'IAB20-7', 'metadata' => array('parent' => 'IAB20')),
1089
- array('text' => 'By US Locale', 'value' => 'IAB20-8', 'metadata' => array('parent' => 'IAB20')),
1090
- array('text' => 'Camping', 'value' => 'IAB20-9', 'metadata' => array('parent' => 'IAB20')),
1091
- array('text' => 'Canada', 'value' => 'IAB20-10', 'metadata' => array('parent' => 'IAB20')),
1092
- array('text' => 'Caribbean', 'value' => 'IAB20-11', 'metadata' => array('parent' => 'IAB20')),
1093
- array('text' => 'Cruises', 'value' => 'IAB20-12', 'metadata' => array('parent' => 'IAB20')),
1094
- array('text' => 'Eastern Europe', 'value' => 'IAB20-13', 'metadata' => array('parent' => 'IAB20')),
1095
- array('text' => 'Europe', 'value' => 'IAB20-14', 'metadata' => array('parent' => 'IAB20')),
1096
- array('text' => 'France', 'value' => 'IAB20-15', 'metadata' => array('parent' => 'IAB20')),
1097
- array('text' => 'Greece', 'value' => 'IAB20-16', 'metadata' => array('parent' => 'IAB20')),
1098
- array('text' => 'Honeymoons/Getaways', 'value' => 'IAB20-17', 'metadata' => array('parent' => 'IAB20')),
1099
- array('text' => 'Hotels', 'value' => 'IAB20-18', 'metadata' => array('parent' => 'IAB20')),
1100
- array('text' => 'Italy', 'value' => 'IAB20-19', 'metadata' => array('parent' => 'IAB20')),
1101
- array('text' => 'Japan', 'value' => 'IAB20-20', 'metadata' => array('parent' => 'IAB20')),
1102
- array('text' => 'Mexico & Central America', 'value' => 'IAB20-21', 'metadata' => array('parent' => 'IAB20')),
1103
- array('text' => 'National Parks', 'value' => 'IAB20-22', 'metadata' => array('parent' => 'IAB20')),
1104
- array('text' => 'South America', 'value' => 'IAB20-23', 'metadata' => array('parent' => 'IAB20')),
1105
- array('text' => 'Spas', 'value' => 'IAB20-24', 'metadata' => array('parent' => 'IAB20')),
1106
- array('text' => 'Theme Parks', 'value' => 'IAB20-25', 'metadata' => array('parent' => 'IAB20')),
1107
- array('text' => 'Traveling with Kids', 'value' => 'IAB20-26', 'metadata' => array('parent' => 'IAB20')),
1108
- array('text' => 'United Kingdom', 'value' => 'IAB20-27', 'metadata' => array('parent' => 'IAB20')),
1109
- array('text' => 'Apartments', 'value' => 'IAB21-1', 'metadata' => array('parent' => 'IAB21')),
1110
- array('text' => 'Architects', 'value' => 'IAB21-2', 'metadata' => array('parent' => 'IAB21')),
1111
- array('text' => 'Buying/Selling Homes', 'value' => 'IAB21-3', 'metadata' => array('parent' => 'IAB21')),
1112
- array('text' => 'Contests & Freebies', 'value' => 'IAB22-1', 'metadata' => array('parent' => 'IAB22')),
1113
- array('text' => 'Couponing', 'value' => 'IAB22-2', 'metadata' => array('parent' => 'IAB22')),
1114
- array('text' => 'Comparison', 'value' => 'IAB22-3', 'metadata' => array('parent' => 'IAB22')),
1115
- array('text' => 'Engines', 'value' => 'IAB22-4', 'metadata' => array('parent' => 'IAB22')),
1116
- array('text' => 'Alternative Religions', 'value' => 'IAB23-1', 'metadata' => array('parent' => 'IAB23')),
1117
- array('text' => 'Atheism/Agnosticism', 'value' => 'IAB23-2', 'metadata' => array('parent' => 'IAB23')),
1118
- array('text' => 'Buddhism', 'value' => 'IAB23-3', 'metadata' => array('parent' => 'IAB23')),
1119
- array('text' => 'Catholicism', 'value' => 'IAB23-4', 'metadata' => array('parent' => 'IAB23')),
1120
- array('text' => 'Christianity', 'value' => 'IAB23-5', 'metadata' => array('parent' => 'IAB23')),
1121
- array('text' => 'Hinduism', 'value' => 'IAB23-6', 'metadata' => array('parent' => 'IAB23')),
1122
- array('text' => 'Islam', 'value' => 'IAB23-7', 'metadata' => array('parent' => 'IAB23')),
1123
- array('text' => 'Judaism', 'value' => 'IAB23-8', 'metadata' => array('parent' => 'IAB23')),
1124
- array('text' => 'Latter-Day Saints', 'value' => 'IAB23-9', 'metadata' => array('parent' => 'IAB23')),
1125
- array('text' => 'Pagan/Wiccan', 'value' => 'IAB23-10', 'metadata' => array('parent' => 'IAB23')),
1126
- array('text' => 'Unmoderated UGC', 'value' => 'IAB25-1', 'metadata' => array('parent' => 'IAB25')),
1127
- array('text' => 'Extreme Graphic/Explicit Violence', 'value' => 'IAB25-2', 'metadata' => array('parent' => 'IAB25')),
1128
- array('text' => 'Pornography', 'value' => 'IAB25-3', 'metadata' => array('parent' => 'IAB25')),
1129
- array('text' => 'Profane Content', 'value' => 'IAB25-4', 'metadata' => array('parent' => 'IAB25')),
1130
- array('text' => 'Hate Content', 'value' => 'IAB25-5', 'metadata' => array('parent' => 'IAB25')),
1131
- array('text' => 'Under Construction', 'value' => 'IAB25-6', 'metadata' => array('parent' => 'IAB25')),
1132
- array('text' => 'Incentivized', 'value' => 'IAB25-7', 'metadata' => array('parent' => 'IAB25')),
1133
- array('text' => 'Illegal Content', 'value' => 'IAB26-1', 'metadata' => array('parent' => 'IAB26')),
1134
- array('text' => 'Warez', 'value' => 'IAB26-2', 'metadata' => array('parent' => 'IAB26')),
1135
- array('text' => 'Spyware/Malware', 'value' => 'IAB26-3', 'metadata' => array('parent' => 'IAB26')),
1136
- array('text' => 'Copyright Infringement', 'value' => 'IAB26-4', 'metadata' => array('parent' => 'IAB26'))
1137
- );
1138
- foreach($IABChildCategories as $IABChildCategoryItem) {
1139
- if($vicodeSettings['iab_category_child'] == $IABChildCategoryItem['value']) {
1140
- $output .= '<label>IAB Category:</label><b>'.$IABChildCategoryItem['text'].'</b>';
1141
- }
1142
- }
1143
- }
1144
-
1145
- $languages = wp_insert_vi_api_get_languages();
1146
- if(isset($vicodeSettings['language']) && ($vicodeSettings['language'] != '') && ($vicodeSettings['language'] != 'select')) {
1147
- if($languages != false) {
1148
- foreach($languages as $key => $value) {
1149
- if($vicodeSettings['language'] == $key) {
1150
- $output .= '<label>Language:</label><b>'.$value.'</b>';
1151
- }
1152
- }
1153
- }
1154
- }
1155
-
1156
- if(isset($vicodeSettings['native_bg_color']) && ($vicodeSettings['native_bg_color'] != '')) {
1157
- $output .= '<label>Native Background color:</label><b>'.$vicodeSettings['native_bg_color'].'</b>';
1158
- }
1159
-
1160
- if(isset($vicodeSettings['native_text_color']) && ($vicodeSettings['native_text_color'] != '')) {
1161
- $output .= '<label>Native Text color:</label><b>'.$vicodeSettings['native_text_color'].'</b>';
1162
- }
1163
-
1164
- if(isset($vicodeSettings['font_family']) && ($vicodeSettings['font_family'] != '') && ($vicodeSettings['font_family'] != 'select')) {
1165
- $fontFamily =array(
1166
- array('text' => 'Select', 'value' => 'select'),
1167
- array('text' => 'Georgia', 'value' => 'Georgia'),
1168
- array('text' => 'Palatino Linotype', 'value' => 'Palatino Linotype'),
1169
- array('text' => 'Times New Roman', 'value' => 'Times New Roman'),
1170
- array('text' => 'Arial', 'value' => 'Arial'),
1171
- array('text' => 'Arial Black', 'value' => 'Arial Black'),
1172
- array('text' => 'Comic Sans MS', 'value' => 'Comic Sans MS'),
1173
- array('text' => 'Impact', 'value' => 'Impact'),
1174
- array('text' => 'Lucida Sans Unicode', 'value' => 'Lucida Sans Unicode'),
1175
- array('text' => 'Tahoma', 'value' => 'Tahoma'),
1176
- array('text' => 'Trebuchet MS', 'value' => 'Trebuchet MS'),
1177
- array('text' => 'Verdana', 'value' => 'Verdana'),
1178
- array('text' => 'Courier New', 'value' => 'Courier New'),
1179
- array('text' => 'Lucida Console', 'value' => 'Lucida Console')
1180
- );
1181
- foreach($fontFamily as $fontFamilyItem) {
1182
- if($vicodeSettings['font_family'] == $fontFamilyItem['value']) {
1183
- $output .= '<label>Native Text Font Family:</label><b>'.$fontFamilyItem['text'].'</b>';
1184
- }
1185
- }
1186
- }
1187
-
1188
- if(isset($vicodeSettings['font_size']) && ($vicodeSettings['font_size'] != '') && ($vicodeSettings['font_size'] != 'select')) {
1189
- $fontSize =array(
1190
- array('text' => 'Select', 'value' => 'select'),
1191
- array('text' => '8px', 'value' => '8'),
1192
- array('text' => '9px', 'value' => '9'),
1193
- array('text' => '10px', 'value' => '10'),
1194
- array('text' => '11px', 'value' => '11'),
1195
- array('text' => '12px', 'value' => '12'),
1196
- array('text' => '14px', 'value' => '14'),
1197
- array('text' => '16px', 'value' => '16'),
1198
- array('text' => '18px', 'value' => '18'),
1199
- array('text' => '20px', 'value' => '20'),
1200
- array('text' => '22px', 'value' => '22'),
1201
- array('text' => '24px', 'value' => '24'),
1202
- array('text' => '26px', 'value' => '26'),
1203
- array('text' => '28px', 'value' => '28'),
1204
- array('text' => '36px', 'value' => '36')
1205
- );
1206
- foreach($fontSize as $fontSizeItem) {
1207
- if($vicodeSettings['font_size'] == $fontSizeItem['value']) {
1208
- $output .= '<label>Native Text Font Size:</label><b>'.$fontSizeItem['text'].'</b>';
1209
- }
1210
- }
1211
- }
1212
-
1213
- if(isset($vicodeSettings['optional_1']) && ($vicodeSettings['optional_1'] != '')) {
1214
- $output .= '<label>Optional 1:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1215
- }
1216
- if(isset($vicodeSettings['optional_2']) && ($vicodeSettings['optional_2'] != '')) {
1217
- $output .= '<label>Optional 2:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1218
- }
1219
- if(isset($vicodeSettings['optional_3']) && ($vicodeSettings['optional_3'] != '')) {
1220
- $output .= '<label>Optional 3:</label><b>'.$vicodeSettings['optional_1'].'</b>';
1221
- }
1222
- $output .= '</p>';
1223
- }
1224
- return $output;
1225
- }
1226
- /* End Configure vi Code */
1227
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Wp-Insert ===
2
  Contributors: Namith Jawahar
3
  Tags: google adsense, adsense, google ads, google analytics, privacy policy, best adsense plugin, ad management, ad rotation, tracking codes
4
  Donate link: http://wpinsert.smartlogix.co.in/support/
5
  Requires at least: 4.1.0
6
  Tested up to: 4.9
7
- Stable tag: 2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,14 +18,18 @@ Wp-Insert is the most powerful yet easiest to use wordpress ad management / ad i
18
  = Features =
19
 
20
  * Adsense Optimized
 
21
  * Unlimited Adblocks (No restrictions placed on you)
22
  * Insert Ad Above, Below, To the Left and Right of Page or Post Content
23
  * Insert Ad in the Middle of Page/Post Content with intelligent midpoint detection algorithms
24
- * Insert Ads into the Sidebars using Ad WIdgets
 
 
25
  * GUI Driven Rules based System to control when and where to display Ads
26
  * Use the GUI to easily exclude ads from any specific post, pages, archives etc
27
  * Hide ads for Loggedin users
28
  * Hide ads for Mobile users
 
29
  * Hide ads on specific pages
30
  * Insert Ads directly into the theme files with control over when and where to display Ads
31
  * Insert Google Analytics, Facebook trackng pixel or any other tracking Code easily
@@ -38,19 +42,28 @@ Wp-Insert is the most powerful yet easiest to use wordpress ad management / ad i
38
  * A/B Testing Facility for Ads (Comply with Adsense Policies while serving other Ad Networks)
39
  * Ad roation via A/B testing feature (You can even use different networks with conflicting terms such that only ads from one network appears at any time)
40
  * Geo-targeted Country Specific Ad Placement with builtin caching for improved performace.
 
41
  * Backed by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a>, The Unparalleled WordPress Specialist
42
 
43
  == Screenshots ==
44
 
45
  1. The New Unified plugin admin page.
46
- 2. Elaborate Rules system to control WHEN and WHERE to show your Ads
47
- 3. Geotarget Different Ads just for audence from specific Countries
48
- 4. Easy to use preprepared Legal Page Templates to serve as a starting point to your legal pages.
49
- 5. Easily insert Ads directly into your theme for Advanced Ad Placement and still support the Rules system.
50
- 6. Multiple Ad Networks / Ab testing.
51
- 7. Google Analytics integrated.
 
 
 
 
 
 
 
 
52
  8. Easily embed codes in the Header / Footer.
53
- 9. Ad Widgets which support the Rules System.
54
 
55
  == Installation ==
56
  = In WordPress =
1
+ === Wp-Insert - Adsense / Ad Management Plugin ===
2
  Contributors: Namith Jawahar
3
  Tags: google adsense, adsense, google ads, google analytics, privacy policy, best adsense plugin, ad management, ad rotation, tracking codes
4
  Donate link: http://wpinsert.smartlogix.co.in/support/
5
  Requires at least: 4.1.0
6
  Tested up to: 4.9
7
+ Stable tag: 2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
18
  = Features =
19
 
20
  * Adsense Optimized
21
+ * Builtin support for Google Page-Level Ads
22
  * Unlimited Adblocks (No restrictions placed on you)
23
  * Insert Ad Above, Below, To the Left and Right of Page or Post Content
24
  * Insert Ad in the Middle of Page/Post Content with intelligent midpoint detection algorithms
25
+ * Insert ads after set number of Paragraphs counting from top or bottom
26
+ * Insert Ads into the Sidebars using Ad Widgets
27
+ * Insert Ads into post content using shortcodes is required
28
  * GUI Driven Rules based System to control when and where to display Ads
29
  * Use the GUI to easily exclude ads from any specific post, pages, archives etc
30
  * Hide ads for Loggedin users
31
  * Hide ads for Mobile users
32
+ * Builtin support for AMP plugin by Automattic
33
  * Hide ads on specific pages
34
  * Insert Ads directly into the theme files with control over when and where to display Ads
35
  * Insert Google Analytics, Facebook trackng pixel or any other tracking Code easily
42
  * A/B Testing Facility for Ads (Comply with Adsense Policies while serving other Ad Networks)
43
  * Ad roation via A/B testing feature (You can even use different networks with conflicting terms such that only ads from one network appears at any time)
44
  * Geo-targeted Country Specific Ad Placement with builtin caching for improved performace.
45
+ * Supports Authorized Digital Sellers, or ads.txt, an IAB initiative to improve transparency in programmatic advertising.
46
  * Backed by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a>, The Unparalleled WordPress Specialist
47
 
48
  == Screenshots ==
49
 
50
  1. The New Unified plugin admin page.
51
+ 2. Different positioning options for Inpost Ads.
52
+ 3. All Ad units support Multiple Ad Networks / Ab testing feature when enabled.
53
+ 4. Elaborate Rules system to control WHEN and WHERE to show your Ads
54
+ 5. Ad Widgets which support the Rules System.
55
+ 6. Shortcode ads to insert ads precisly into post content, multitude of other use cases (Google Maps Insertion, Contact Forms, Embedded Widgets etc etc)
56
+ 7. Google Analytics integrated with additional options for inserting custom code into header / footer of the site.
57
+ 8. Multiple Ad Networks / Ab testing.
58
+ 9. Geotarget Different Ads just for audence from specific Countries
59
+ 10. Easily insert Ads directly into your theme for Advanced Ad Placement and still support the Rules system.
60
+ 11. Easy to use preprepared Legal Page Templates to serve as a starting point to your legal pages.
61
+ 12. Easily create new legal pages or assign legal content to existing pages without leaving the unified admin page.
62
+ 13. Easily edit your ads.txt (Authorized Digital Sellers) right from inside wordpress.
63
+ 14. Handholds you to format your ads.txt entry correctly.
64
+
65
  8. Easily embed codes in the Header / Footer.
66
+
67
 
68
  == Installation ==
69
  = In WordPress =
wp-insert.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Wp-Insert
4
  Plugin URI: http://www.wp-insert.smartlogix.co.in/
5
  Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
6
- Version: 2.2
7
  Author: Namith Jawahar
8
  Author URI: http://www.smartlogix.co.in/
9
  WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
@@ -31,7 +31,9 @@ if(!defined('WP_INSERT_URL'))
31
  if(!defined('WP_INSERT_DIR'))
32
  define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
33
  if(!defined('WP_INSERT_VERSION'))
34
- define('WP_INSERT_VERSION', '2.2');
 
 
35
  /*Includes*/
36
  require_once(dirname(__FILE__).'/includes/common/common.php');
37
  require_once(dirname(__FILE__).'/includes/controls/controls.php');
@@ -39,14 +41,6 @@ require_once(dirname(__FILE__).'/includes/common/control-panel.php');
39
  require_once(dirname(__FILE__).'/includes/common/abtesting.php');
40
  require_once(dirname(__FILE__).'/includes/common/rules.php');
41
  require_once(dirname(__FILE__).'/includes/common/geotargeting.php');
42
- require_once(dirname(__FILE__).'/includes/common/adstxt.php');
43
- require_once(dirname(__FILE__).'/includes/inpostads.php');
44
- require_once(dirname(__FILE__).'/includes/adwidgets.php');
45
- require_once(dirname(__FILE__).'/includes/inthemeads.php');
46
- require_once(dirname(__FILE__).'/includes/tracking-codes.php');
47
- require_once(dirname(__FILE__).'/includes/legal-pages.php');
48
- require_once(dirname(__FILE__).'/includes/adstxt.php');
49
 
50
- require_once(dirname(__FILE__).'/includes/vi-integration.php');
51
- require_once(dirname(__FILE__).'/includes/apis/vi/api.php');
52
  ?>
3
  Plugin Name: Wp-Insert
4
  Plugin URI: http://www.wp-insert.smartlogix.co.in/
5
  Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
6
+ Version: 2.3
7
  Author: Namith Jawahar
8
  Author URI: http://www.smartlogix.co.in/
9
  WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
31
  if(!defined('WP_INSERT_DIR'))
32
  define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
33
  if(!defined('WP_INSERT_VERSION'))
34
+ define('WP_INSERT_VERSION', '2.3');
35
+ if(!defined('WP_INSERT_DEBUG'))
36
+ define('WP_INSERT_DEBUG', false);
37
  /*Includes*/
38
  require_once(dirname(__FILE__).'/includes/common/common.php');
39
  require_once(dirname(__FILE__).'/includes/controls/controls.php');
41
  require_once(dirname(__FILE__).'/includes/common/abtesting.php');
42
  require_once(dirname(__FILE__).'/includes/common/rules.php');
43
  require_once(dirname(__FILE__).'/includes/common/geotargeting.php');
 
 
 
 
 
 
 
44
 
45
+ require_once(dirname(__FILE__).'/includes/modules/modules.php');
 
46
  ?>