This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
admin.php
1643 lines (1535 loc) · 83.8 KB
/
admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
add_action("admin_init", array("dsSearchAgent_Admin", "Initialize"));
add_Action("admin_enqueue_scripts", array("dsSearchAgent_Admin", "Enqueue"));
add_action("admin_menu", array("dsSearchAgent_Admin", "AddMenu"), 40);
add_action("admin_notices", array("dsSearchAgent_Admin", "DisplayAdminNotices"));
add_action("wp_ajax_dsidxpress-dismiss-notification", array("dsSearchAgent_Admin", "DismissNotification"));
add_filter("manage_nav-menus_columns", array("dsSearchAgent_Admin", "CreateLinkBuilderMenuWidget"), 9);
add_action("admin_print_scripts", array("dsSearchAgent_Admin", "SetPluginUri"));
if (defined('ZPRESS_API') && ZPRESS_API != '') {
add_filter('nav_menu_items_zpress-page', array('dsSearchAgent_Admin', 'NavMenus'));
}
class dsSearchAgent_Admin {
static $HeaderLoaded = null;
static $capabilities = array();
static function AddMenu() {
$options = get_option(DSIDXPRESS_OPTION_NAME);
dsSearchAgent_Admin::GenerateAdminMenus(DSIDXPRESS_PLUGIN_URL . 'assets/idxpress_LOGOicon.png');
dsSearchAgent_Admin::GenerateAdminSubMenus();
add_filter("mce_external_plugins", array("dsSearchAgent_Admin", "AddTinyMcePlugin"));
add_filter("mce_buttons", array("dsSearchAgent_Admin", "RegisterTinyMceButton"));
// won't work until this <http://core.trac.wordpress.org/ticket/12207> is fixed
//add_filter("tiny_mce_before_init", array("dsSearchAgent_Admin", "ModifyTinyMceSettings"));
}
static function GenerateAdminMenus($icon_url){
add_menu_page('IDX', 'IDX', "manage_options", "dsidxpress", "", $icon_url);
$activationPage = add_submenu_page("dsidxpress", "IDX Activation", "Activation", "manage_options", "dsidxpress", array("dsSearchAgent_Admin", "Activation"));
add_action("admin_print_scripts-{$activationPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
static function GenerateAdminSubMenus() {
$options = get_option(DSIDXPRESS_OPTION_NAME);
if (isset($options["Activated"])) {
$optionsPage = add_submenu_page("dsidxpress", "IDX Options", "General", "manage_options", "dsidxpress-options", array("dsSearchAgent_Admin", "EditOptions"));
add_action("admin_print_scripts-{$optionsPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
if (isset($options["Activated"])) {
$filtersPage = add_submenu_page("dsidxpress", "IDX Filters", "Filters", "manage_options", "dsidxpress-filters", array("dsSearchAgent_Admin", "FilterOptions"));
add_action("admin_print_scripts-{$filtersPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
if (isset($options["Activated"])) {
$seoSettingsPage = add_submenu_page("dsidxpress", "IDX SEO Settings", "SEO Settings", "manage_options", "dsidxpress-seo-settings", array("dsSearchAgent_Admin", "SEOSettings"));
add_action("admin_print_scripts-{$seoSettingsPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
if (isset($options["Activated"])) {
$xmlSitemapsPage = add_submenu_page("dsidxpress", "IDX XML Sitemaps", "XML Sitemaps", "manage_options", "dsidxpress-xml-sitemaps", array("dsSearchAgent_Admin", "XMLSitemaps"));
add_action("admin_print_scripts-{$xmlSitemapsPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
if (isset($options["Activated"])) {
$detailsPage = add_submenu_page("dsidxpress", "IDX Details", "More Options", "manage_options", "dsidxpress-details", array("dsSearchAgent_Admin", "DetailsOptions"));
add_action("admin_print_scripts-{$detailsPage}", array("dsSearchAgent_Admin", "LoadHeader"));
}
}
static function AddTinyMcePlugin($plugins) {
$plugins["idxlisting"] = DSIDXPRESS_PLUGIN_URL . "tinymce/single_listing/editor_plugin.js";
$plugins["idxlistings"] = DSIDXPRESS_PLUGIN_URL . "tinymce/multi_listings/editor_plugin.js";
$plugins["idxlinkbuilder"] = DSIDXPRESS_PLUGIN_URL . "tinymce/link_builder/editor_plugin.js";
$plugins["idxquicksearch"] = DSIDXPRESS_PLUGIN_URL . "tinymce/idx_quick_search/editor_plugin.js";
return $plugins;
}
static function RegisterTinyMceButton($buttons) {
array_push($buttons, "separator", "idxlisting", "idxlistings", "idxlinkbuilder", "idxquicksearch");
return $buttons;
}
static function ModifyTinyMceSettings($settings) {
$settings["wordpress_adv_hidden"] = 0;
return $settings;
}
static function Initialize() {
register_setting("dsidxpress_activation", DSIDXPRESS_OPTION_NAME, array("dsSearchAgent_Admin", "SanitizeOptions"));
register_setting("dsidxpress_options", DSIDXPRESS_OPTION_NAME, array("dsSearchAgent_Admin", "SanitizeOptions"));
register_setting("dsidxpress_options", DSIDXPRESS_API_OPTIONS_NAME, array("dsSearchAgent_Admin", "SanitizeApiOptions"));
register_setting("dsidxpress_api_options", DSIDXPRESS_API_OPTIONS_NAME, array("dsSearchAgent_Admin", "SanitizeApiOptions"));
register_setting("dsidxpress_api_options", DSIDXPRESS_OPTION_NAME, array("dsSearchAgent_Admin", "SanitizeOptions"));
register_setting("dsidxpress_xml_sitemap", DSIDXPRESS_OPTION_NAME, array("dsSearchAgent_Admin", "SanitizeOptions"));
$capabilities = dsSearchAgent_ApiRequest::FetchData('MlsCapabilities');
if (isset($capabilities['body'])) {
self::$capabilities = json_decode($capabilities['body'], true);
}
}
static function Enqueue($hook) {
//every admin should have admin-options.js cept dsidx_footer-util
if(!isset($_GET['page'])){
wp_enqueue_script('dsidxpress_admin_options', DSIDXPRESS_PLUGIN_URL . 'js/admin-options.js', array(), DSIDXPRESS_PLUGIN_VERSION, true);
}
if (isset($_GET['page']) && ($_GET['page'] == 'dsidxpress-details' || $_GET['page'] == 'dsidxpress-seo-settings' || $_GET['page'] == 'dsidxpress-options' || $_GET['page'] == 'dsidxpress-xml-sitemaps')) {
wp_enqueue_script('dsidxpress_admin_options', DSIDXPRESS_PLUGIN_URL . 'js/admin-options.js', array(), DSIDXPRESS_PLUGIN_VERSION, true);
}
//We need the options script loaded in the header for this page
if (isset($_GET['page']) && $_GET['page'] == 'dsidxpress-xml-sitemaps') {
wp_enqueue_script('dsidxpress_admin_options', DSIDXPRESS_PLUGIN_URL . 'js/admin-options.js', array(), DSIDXPRESS_PLUGIN_VERSION);
}
if (isset($_GET['page']) && $_GET['page'] == 'dsidxpress-filters') {
wp_enqueue_script('dsidxpress_admin_filters', DSIDXPRESS_PLUGIN_URL . 'js/admin-filters.js', array(), DSIDXPRESS_PLUGIN_VERSION);
}
if ($hook == 'nav-menus.php' || $hook == 'post.php' || $hook == 'post-new.php') {
wp_enqueue_script('dsidxpress_google_maps_geocode_api', '//maps.googleapis.com/maps/api/js?sensor=false&libraries=drawing,geometry');
wp_enqueue_script('dsidxpress_admin_utilities', DSIDXPRESS_PLUGIN_URL . 'js/admin-utilities.js', array(), DSIDXPRESS_PLUGIN_VERSION, true);
wp_localize_script('dsidxpress_admin_utilities', 'mlsCapabilities', self::$capabilities);
wp_enqueue_style('dsidxpress_admin_options_style', DSIDXPRESS_PLUGIN_URL . 'css/admin-options.css', array(), DSIDXPRESS_PLUGIN_VERSION);
wp_enqueue_script( 'jquery-ui-autocomplete', '', array( 'jquery-ui-widget', 'jquery-ui-position' ), '1.10.4' );
}
if (($hook == 'post.php' && $_GET['action'] == 'edit') || $hook == 'post-new.php' && $_GET['post_type'] == 'ds-idx-listings-page') {
wp_enqueue_style('dsidxpress_admin_options_style', DSIDXPRESS_PLUGIN_URL . 'css/admin-options.css', array(), DSIDXPRESS_PLUGIN_VERSION);
}
}
static function SetPluginUri(){
$pluginUrl = DSIDXPRESS_PLUGIN_URL;
echo <<<HTML
<script type="text/javascript">
var dsIdxPluginUri = "$pluginUrl";
</script>
HTML;
}
static function LoadHeader() {
if (self::$HeaderLoaded)
return;
$pluginUrl = DSIDXPRESS_PLUGIN_URL;
echo <<<HTML
<link rel="stylesheet" href="{$pluginUrl}css/admin-options.css" type="text/css" />
HTML;
self::$HeaderLoaded = true;
}
static function DisplayAdminNotices() {
if (!current_user_can("manage_options") || (defined('ZPRESS_API') && ZPRESS_API != ''))
return;
$options = get_option(DSIDXPRESS_OPTION_NAME);
if (!isset($options["PrivateApiKey"])) {
echo <<<HTML
<div class="error">
<p style="line-height: 1.6;">
In order to use the dsIDXpress plugin, you need to add your
<a href="http://www.dsidxpress.com/tryit/" target="_blank">activation key</a> to the
<a href="admin.php?page=dsidxpress">dsIDXpress activation area</a>.
</p>
</div>
HTML;
} else if (isset($options["PrivateApiKey"]) && empty($options["Activated"])) {
echo <<<HTML
<div class="error">
<p style="line-height: 1.6;">
It looks like there may be a problem with the dsIDXpress that's installed on this blog.
Please take a look at the <a href="admin.php?page=dsidxpress">dsIDXpress diagnostics area</a>
to find out more about any potential issues
</p>
</div>
HTML;
} else if (isset($options["Activated"]) && empty($options["HideIntroNotification"])) {
wp_nonce_field("dsidxpress-dismiss-notification", "dsidxpress-dismiss-notification", false);
echo <<<HTML
<script>
function dsidxpressDismiss() {
jQuery.post(ajaxurl, {
action: 'dsidxpress-dismiss-notification',
_ajax_nonce: jQuery('#dsidxpress-dismiss-notification').val()
});
jQuery('#dsidxpress-intro-notification').slideUp();
}
</script>
<div id="dsidxpress-intro-notification" class="updated">
<p style="line-height: 1.6;">Now that you have the <strong>dsIDXpress plugin</strong>
activated, you'll probably want to start adding <strong>live MLS content</strong>
to your site right away. The easiest way to get started is to use the three new IDX widgets that have
been added to your <a href="widgets.php">widgets page</a> and the two new IDX icons
(they look like property markers) that have been added to the visual editor for
all of your <a href="post-new.php?post_type=page">pages</a> and <a href="post-new.php">posts</a>.
You'll probably also want to check out our <a href="http://wiki.diversesolutions.com/wiki:link-structure"
target="_blank">dsIDXpress virtual page link structure guide</a> so that you
can start linking to the property listings and property details pages throughout
your blog. Finally, you may also want to hop over to our
<a href="http://helpdesk.diversesolutions.com/category/ds-idxpress/" target="_blank">help desk</a> or our
<a href="http://forum.diversesolutions.com/" target="_blank">forum</a>.
</p>
<p style="line-height: 1.6; text-align: center; font-weight: bold;">Take a look at the
<a href="http://wiki.diversesolutions.com/wiki:getting-started" target="_blank">dsIDXpress getting
started guide</a> for more info.
</p>
<p style="text-align: right;">(<a href="javascript:void(0)" onclick="dsidxpressDismiss()">dismiss this message</a>)</p>
</div>
HTML;
}
}
static function DismissNotification() {
$action = $_POST["action"];
check_ajax_referer($action);
$options = get_option(DSIDXPRESS_OPTION_NAME);
$options["HideIntroNotification"] = true;
update_option(DSIDXPRESS_OPTION_NAME, $options);
die();
}
static function EditOptions() {
$options = get_option(DSIDXPRESS_OPTION_NAME);
$apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false, 0);
if (!empty($apiHttpResponse["errors"]) || $apiHttpResponse["response"]["code"] != "200")
wp_die("We're sorry, but we ran into a temporary problem while trying to load the account data. Please check back soon.", "Account data load error");
else
$account_options = json_decode($apiHttpResponse["body"]);
$urlBase = get_home_url();
if (substr($urlBase, strlen($urlBase), 1) != "/") $urlBase .= "/";
$urlBase .= dsSearchAgent_Rewrite::GetUrlSlug();
?>
<div class="wrap metabox-holder">
<h1>General Options</h1>
<?php if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') : ?>
<div class="updated"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
<?php endif; ?>
<form method="post" action="options.php" onsubmit="return dsIDXpressOptions.FilterViews();">
<?php settings_fields("dsidxpress_options"); ?>
<h2>Display Settings</h2>
<table class="form-table">
<?php if(!defined('ZPRESS_API') || ZPRESS_API == '') : ?>
<tr>
<th>
<label for="dsidxpress-DetailsTemplate">Template for details pages:</label>
</th>
<td>
<select id="dsidxpress-DetailsTemplate" name="<?php echo DSIDXPRESS_OPTION_NAME ; ?>[DetailsTemplate]">
<option value="">- Default -</option>
<?php
$details_template = (isset($options["DetailsTemplate"])) ? $options["DetailsTemplate"] : '';
page_template_dropdown($details_template);
?>
</select><br />
<span class="description">Some themes have custom templates that can change how a particular page is displayed. If your theme does have multiple templates, you'll be able to select which one you want to use in the drop-down above.</span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-ResultsTemplate">Template for results pages:</label>
</th>
<td>
<select id="dsidxpress-ResultsTemplate" name="<?php echo DSIDXPRESS_OPTION_NAME ; ?>[ResultsTemplate]">
<option value="">- Default -</option>
<?php
$results_template = (isset($options["ResultsTemplate"])) ? $options["ResultsTemplate"] : '';
page_template_dropdown($results_template);
?>
</select><br />
<span class="description">See above.</span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-AdvancedTemplate">Template for dsSearchAgent:</label>
</th>
<td>
<select id="dsidxpress-AdvancedTemplate" name="<?php echo DSIDXPRESS_OPTION_NAME ; ?>[AdvancedTemplate]">
<option value="">- Default -</option>
<?php
$advanced_template = (isset($options["AdvancedTemplate"])) ? $options["AdvancedTemplate"] : '';
page_template_dropdown($advanced_template);
?>
</select><br />
<span class="description">See above.</span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-IDXTemplate">Template for IDX pages:</label>
</th>
<td>
<select id="dsidxpress-IDXTemplate" name="<?php echo DSIDXPRESS_OPTION_NAME ; ?>[IDXTemplate]">
<option value="">- Default -</option>
<?php
$idx_template = (isset($options["IDXTemplate"])) ? $options["IDXTemplate"] : '';
page_template_dropdown($idx_template);
?>
</select><br />
<span class="description">See above.</span>
</td>
</tr>
<?php endif; ?>
<tr>
<th>
<label for="dsidxpress-CustomTitleText">Title for results pages:</label>
</th>
<td>
<input type="text" id="dsidxpress-CustomTitleText" maxlength="49" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[CustomTitleText]" value="<?php echo $account_options->CustomTitleText; ?>" /><br />
<span class="description">By default, the titles are auto-generated based on the type of area searched. You can override this above; use <code>%title%</code> to designate where you want the location title. For example, you could use <code>Real estate in the %title%</code>.</span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-ResultsMapDefaultState">Default view for Results pages:</label>
</th>
<td>
<input type="radio" id="dsidxpress-ResultsDefaultState-List" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[ResultsDefaultState]" value="list" <?php echo @$options["ResultsDefaultState"] == "list" || !isset($options["ResultsDefaultState"]) ? "checked=\"checked\"" : "" ?>/> <label for="dsidxpress-ResultsDefaultState-List">List</label><br />
<input type="radio" id="dsidxpress-ResultsDefaultState-ListMap" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[ResultsDefaultState]" value="listmap" <?php echo @$options["ResultsDefaultState"] == "listmap" ? "checked=\"checked\"" : "" ?> /> <label for="dsidxpress-ResultsDefaultState-ListMap">List + Map</label>
<?php if (defined('ZPRESS_API') || isset($options["dsIDXPressPackage"]) && $options["dsIDXPressPackage"] == "pro"): ?>
<br /><input type="radio" id="dsidxpress-ResultsDefaultState-Grid" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[ResultsDefaultState]" value="grid" <?php echo @$options["ResultsDefaultState"] == "grid" ? "checked=\"checked\"" : "" ?>/> <label for="dsidxpress-ResultsDefaultState-Grid">Grid</label>
<?php endif ?>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-ResultsMapDefaultState">Property Details Image Display:</label>
</th>
<td>
<input type="radio" id="dsidxpress-ImageDisplay-Slideshow" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[ImageDisplay]" value="slideshow" <?php echo @$options["ImageDisplay"] == "slideshow" || !isset($options["ImageDisplay"]) ? "checked=\"checked\"" : "" ?>/> <label for="dsidxpress-ImageDisplay-Slideshow">Rotating Slideshow</label><br />
<input type="radio" id="dsidxpress-ImageDisplay-Thumbnail" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[ImageDisplay]" value="thumbnail" <?php echo @$options["ImageDisplay"] == "thumbnail" ? "checked=\"checked\"" : "" ?> /> <label for="dsidxpress-ImageDisplay-Thumbnail">Thumbnail Display</label>
</td>
</tr>
</table>
<?php if (defined('ZPRESS_API') || isset($options["dsIDXPressPackage"]) && $options["dsIDXPressPackage"] == "pro"): ?>
<h2>Registration Options</h2>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-RequiredPhone-check">Require phone numbers for visitor registration and contact forms</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequiredPhone" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequiredPhone]" value="<?php echo $account_options->{'RequiredPhone'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequiredPhone-check" <?php checked('true', strtolower($account_options->{'RequiredPhone'})); ?> />
</td>
</tr>
</table>
<h2>Forced Registration Settings</h2>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-NumofDetailsViews">Number of detail views before required registration</label>
</th>
<td>
<input type="text" id="dsidxpress-NumOfDetailsViews" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[AllowedDetailViewsBeforeRegistration]" value="<?php echo $account_options->AllowedDetailViewsBeforeRegistration; ?>" />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-NumofResultsViews">Number of result views before required registration</label>
</th>
<td>
<input type="text" id="dsidxpress-NumOfResultViews" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME;?>[AllowedSearchesBeforeRegistration]" value="<?php echo $account_options->AllowedSearchesBeforeRegistration; ?>" />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Details-Description-check">Require login to view description</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Details-Description" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Details-Description]" value="<?php echo $account_options->{'RequireAuth-Details-Description'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Details-Description-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Details-Description'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Property-Community">Require login to view the community</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Property-Community" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Property-Community]" value="<?php echo $account_options->{'RequireAuth-Property-Community'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Property-Community-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Property-Community'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Property-Tract-check">Require login to view the tract</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Property-Tract" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Property-Tract]" value="<?php echo $account_options->{'RequireAuth-Property-Tract'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Property-Tract-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Property-Tract'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Details-Schools-check">Require login to view schools</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Details-Schools" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Details-Schools]" value="<?php echo $account_options->{'RequireAuth-Details-Schools'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Details-Schools-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Details-Schools'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Details-AdditionalInfo-check">Require login to view additional info</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Details-AdditionalInfo" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Details-AdditionalInfo]" value="<?php echo $account_options->{'RequireAuth-Details-AdditionalInfo'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Details-AdditionalInfo-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Details-AdditionalInfo'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Details-PriceChanges-check">Require login to view price changes</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Details-PriceChanges" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Details-PriceChanges]" value="<?php echo $account_options->{'RequireAuth-Details-PriceChanges'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Details-PriceChanges-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Details-PriceChanges'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Details-Features-check">Require login to view features</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Details-Features" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Details-Features]" value="<?php echo $account_options->{'RequireAuth-Details-Features'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Details-Features-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Details-Features'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Property-DaysOnMarket-check">Require login to view days on market</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Property-DaysOnMarket" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Property-DaysOnMarket]" value="<?php echo $account_options->{'RequireAuth-Property-DaysOnMarket'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Property-DaysOnMarket-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Property-DaysOnMarket'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Property-LastUpdated-check">Require login to view last update date</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Property-LastUpdated" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Property-LastUpdated]" value="<?php echo $account_options->{'RequireAuth-Property-LastUpdated'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Property-LastUpdated-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Property-LastUpdated'})); ?> />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-RequireAuth-Property-YearBuilt-check">Require login to view year built</label>
</th>
<td>
<input type="hidden" id="dsidxpress-RequireAuth-Property-YearBuilt" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RequireAuth-Property-YearBuilt]" value="<?php echo $account_options->{'RequireAuth-Property-YearBuilt'}; ?>" />
<input type="checkbox" class="dsidxpress-api-checkbox" id="dsidxpress-RequireAuth-Property-YearBuilt-check" <?php checked('true', strtolower($account_options->{'RequireAuth-Property-YearBuilt'})); ?> />
</td>
</tr>
</table>
<?php endif ?>
<?php if(!defined('ZPRESS_API') || ZPRESS_API == '') : ?>
<h2>Contact Information</h2>
<span class="description">This information is used in identifying you to the website visitor. For example: Listing PDF Printouts, Contact Forms, and Dwellicious</span>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-FirstName">First Name:</label>
</th>
<td>
<input type="text" id="dsidxpress-FirstName" maxlength="49" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[FirstName]" value="<?php echo $account_options->FirstName; ?>" /><br />
<span class="description"></span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-LastName">Last Name:</label>
</th>
<td>
<input type="text" id="dsidxpress-LastName" maxlength="49" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[LastName]" value="<?php echo $account_options->LastName; ?>" /><br />
<span class="description"></span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-Email">Email:</label>
</th>
<td>
<input type="text" id="dsidxpress-Email" maxlength="49" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[Email]" value="<?php echo $account_options->Email; ?>" /><br />
<span class="description"></span>
</td>
</tr>
</table>
<h2>Copyright Settings</h2>
<span class="description">This setting allows you to remove links to <a href="http://www.diversesolutions.com">Diverse Solutions</a> that are included in the IDX disclaimer.</span>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-RemoveDsDisclaimerLinks">Remove Diverse Solutions links</label>
</th>
<td>
<input type="checkbox" id="dsidxpress-RemoveDsDisclaimerLinks" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[RemoveDsDisclaimerLinks]" value="Y"<?php if (isset($options['RemoveDsDisclaimerLinks']) && $options['RemoveDsDisclaimerLinks'] == 'Y'): ?> checked="checked"<?php endif ?> />
</td>
</tr>
</table>
<?php endif; ?>
<h2>Mobile Settings</h2>
<span class="description">To set up a custom mobile domain you must configure your DNS to point a domain, or subdomain, at app.dsmobileidx.com. Then enter the custom domain's full url here. Example: http://mobile.myrealestatesite.com</span>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-MobileSiteUrl">Custom Mobile Domain:</label>
</th>
<td>
<input type="text" id="dsidxpress-MobileSiteUrl" maxlength="100" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[MobileSiteUrl]" value="<?php echo $account_options->MobileSiteUrl; ?>" />
</td>
</tr>
</table>
<h2>My Listings</h2>
<span class="description">When filled in, these settings will make pages for "My Listings" and "My Office Listings" available in your navigation menus page list.</span>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-AgentID">Agent ID:</label>
</th>
<td>
<input type="text" id="dsidxpress-AgentID" maxlength="35" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[AgentID]" value="<?php echo (!empty($options['AgentID']) ? $options['AgentID'] : $account_options->AgentID); ?>" /><br />
<span class="description">This is the Agent ID as assigned to you by the MLS you are using to provide data to this site.</span>
<input type="hidden" id="dsidxpress-API-AgentID" maxlength="35" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[AgentID]" value="<?php echo (!empty($options['AgentID']) ? $options['AgentID'] : $account_options->AgentID); ?>" /><br />
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-OfficeID">Office ID:</label>
</th>
<td>
<input type="text" id="dsidxpress-OfficeID" maxlength="35" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[OfficeID]" value="<?php echo (!empty($options['OfficeID']) ? $options['OfficeID'] : $account_options->OfficeID); ?>" /><br />
<span class="description">This is the Office ID as assigned to your office by the MLS you are using to provide data to this site.</span>
<input type="hidden" id="dsidxpress-API-OfficeID" maxlength="35" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[OfficeID]" value="<?php echo (!empty($options['OfficeID']) ? $options['OfficeID'] : $account_options->OfficeID); ?>" /><br />
</td>
</tr>
</table>
<?php if((!defined('ZPRESS_API') || ZPRESS_API == '') && isset($account_options->EnableMemcacheInDsIdxPress) && strtolower($account_options->EnableMemcacheInDsIdxPress) == "true") {?>
<h2>Memcache Options</h2>
<?php if(!class_exists('Memcache') && !class_exists('Memcached')) {?>
<span class="description">Warning PHP is not configured with a Memcache module. See <a href="http://www.php.net/manual/en/book.memcache.php" target="_blank">here</a> or <a href="http://www.php.net/manual/en/book.memcached.php" target="_blank">here</a> to implement one.</span>
<?php }?>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-MemcacheHost">Host:</label>
</th>
<td>
<input type="text" id="dsidxpress-MemcacheHost" maxlength="49" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[MemcacheHost]" value="<?php echo @$options["MemcacheHost"]; ?>" /><br />
<span class="description"></span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-MemcachePort">Port:</label>
</th>
<td>
<input type="text" id="dsidxpress-MemcachePort" maxlength="49" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[MemcachePort]" value="<?php echo @$options["MemcachePort"]; ?>" /><br />
<span class="description"></span>
</td>
</tr>
</table>
<?php }?>
<p class="submit">
<input type="submit" class="button-primary" name="Submit" value="Save Options" />
</p>
</form>
</div><?php
}
static function Activation() {
$options = get_option(DSIDXPRESS_OPTION_NAME);
if (@$options["PrivateApiKey"]) {
$diagnostics = self::RunDiagnostics($options);
$previous_options = (isset($options["Activated"])) ? $options["Activated"] : '';
$previous_options .= (isset($options["HasSearchAgentPro"])) ? '|'.$options["HasSearchAgentPro"] : '';
$previous_options .= (isset($options["DetailsRequiresRegistration"])) ? '|'.$options["DetailsRequiresRegistration"] : '';
$new_options = $diagnostics["DiagnosticsSuccessful"].'|'.$diagnostics["HasSearchAgentPro"].'|'.$diagnostics["DetailsRequiresRegistration"];
$options["Activated"] = $diagnostics["DiagnosticsSuccessful"];
$options["HasSearchAgentPro"] = $diagnostics["HasSearchAgentPro"];
$options["DetailsRequiresRegistration"] = $diagnostics["DetailsRequiresRegistration"];
if ($previous_options != $new_options)
update_option(DSIDXPRESS_OPTION_NAME, $options);
$formattedApiKey = $options["AccountID"] . "/" . $options["SearchSetupID"] . "/" . $options["PrivateApiKey"];
}
?>
<div class="wrap metabox-holder">
<h1>IDX Activation</h1>
<form method="post" action="options.php">
<?php settings_fields("dsidxpress_activation"); ?>
<h2>Plugin activation</h2>
<p>
In order to use <i><a href="http://www.dsidxpress.com/" target="_blank">dsIDXpress</a></i>
to display real estate listings from the MLS on your blog, you must have an activation key from
<a href="http://www.diversesolutions.com/" target="_blank">Diverse Solutions</a>. Without it, the plugin itself
will be useless, widgets won't appear, and all "shortcodes" specific to this plugin in your post and page
content will be hidden when that content is displayed on your blog. If you already have this activation key, enter it
below and you can be on your way.
</p>
<p>
If you <b>don't</b> yet have an activation key, you can purchase one from us
(<a href="http://www.diversesolutions.com/" target="_blank">Diverse Solutions</a>) for a monthly price that
varies depending on the MLS you belong to. Furthermore, in order for us to authorize the data to be transferred
from us to your blog, you <b>must</b> be a member of the MLS you would like the data for. In some cases, you
even have to be a real estate broker (or have your broker sign off on your request for this data). If you're 1)
a real estate agent, and 2) a member of an MLS, and you're interested in finding out more, please
<a href="http://www.dsidxpress.com/contact/" target="_blank">contact us</a>.
</p>
<div id="dsidx-activation-notice">
<p>
By default, <strong>your activation key will only work on one blog at a time</strong>. If you'd like to make it
work on more than one blog, you need to <a href="http://www.dsidxpress.com/contact/" target="_blank">contact our sales department</a>.
</p>
<p>
<strong>If you activate dsIDXpress on this blog, dsIDXpress will immediately stop working on any other blogs you use
this plugin on!</strong>
</p>
</div>
<table class="form-table">
<tr>
<th style="width: 110px;">
<label for="option-FullApiKey">Activation key:</label>
</th>
<td>
<input type="text" id="option-FullApiKey" maxlength="49" name="<?php echo DSIDXPRESS_OPTION_NAME; ?>[FullApiKey]" value="<?php echo @$formattedApiKey ?>" />
</td>
</tr>
<tr>
<th style="width: 110px;">Current status:</th>
<td class="dsidx-status dsidx-<?php echo @$diagnostics["DiagnosticsSuccessful"] ? "success" : "failure" ?>">
** <?php echo @$diagnostics && @$diagnostics["DiagnosticsSuccessful"] ? "ACTIVE" : "INACTIVE" ?> **
</td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" name="Submit" value="Activate Plugin For This Blog / Server" />
</p>
<?php
if (@$diagnostics) {
?>
<h2>Diagnostics</h2>
<?php
if (isset($diagnostics["error"])) {
?>
<p class="error">
It seems that there was an issue while trying to load the diagnostics from Diverse Solutions' servers. It's possible that our servers
are temporarily down, so please check back in just a minute. If this problem persists, please
<a href="http://www.diversesolutions.com/support.htm" target="_blank">contact us</a>.
</p>
<?php
} else {
?>
<table class="form-table" style="margin-bottom: 15px;">
<tr>
<th style="width: 230px;">
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Account%20active#diagnostics" target="_blank">Account active?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["IsAccountValid"] ? "success" : "failure" ?>">
<?php echo $diagnostics["IsAccountValid"] ? "Yes" : "No" ?>
</td>
<th style="width: 290px;">
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Activation%20key%20active#diagnostics" target="_blank">Activation key active?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["IsApiKeyValid"] ? "success" : "failure" ?>">
<?php echo $diagnostics["IsApiKeyValid"] ? "Yes" : "No" ?>
</td>
</tr>
<tr>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Account%20authorized%20for%20this%20MLS#diagnostics" target="_blank">Account authorized for this MLS?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["IsAccountAuthorizedToMLS"] ? "success" : "failure" ?>">
<?php echo $diagnostics["IsAccountAuthorizedToMLS"] ? "Yes" : "No" ?>
</td>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Activation%20key%20authorized%20for%20this%20blog#diagnostics" target="_blank">Activation key authorized for this blog?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["IsApiKeyAuthorizedToUri"] ? "success" : "failure" ?>">
<?php echo $diagnostics["IsApiKeyAuthorizedToUri"] ? "Yes" : "No" ?>
</td>
</tr>
<tr>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Clock%20accurate%20on%20this%20server#diagnostics" target="_blank">Clock accurate on this server?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["ClockIsAccurate"] ? "success" : "failure" ?>">
<?php echo $diagnostics["ClockIsAccurate"] ? "Yes" : "No" ?>
</td>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Activation%20key%20authorized%20for%20this%20server#diagnostics" target="_blank">Activation key authorized for this server?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["IsApiKeyAuthorizedToIP"] ? "success" : "failure" ?>">
<?php echo $diagnostics["IsApiKeyAuthorizedToIP"] ? "Yes" : "No" ?>
</td>
</tr>
<tr>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=WordPress%20link%20structure%20ok#diagnostics" target="_blank">WordPress link structure ok?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["UrlInterceptSet"] ? "success" : "failure" ?>">
<?php echo $diagnostics["UrlInterceptSet"] ? "Yes" : "No" ?>
</td>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Under%20monthly%20API%20call%20limit#diagnostics" target="_blank">Under monthly API call limit?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["UnderMonthlyCallLimit"] ? "success" : "failure" ?>">
<?php echo $diagnostics["UnderMonthlyCallLimit"] ? "Yes" : "No" ?>
</td>
</tr>
<tr>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Server%20PHP%20version%20at%20least%205.2#diagnostics" target="_blank">Server PHP version at least 5.2?</a>
</th>
<td class="dsidx-status dsidx-<?php echo $diagnostics["PhpVersionAcceptable"] ? "success" : "failure" ?>">
<?php echo $diagnostics["PhpVersionAcceptable"] ? "Yes" : "No" ?>
</td>
<th>
<a href="http://wiki.dsidxpress.com/wiki:installing?s[]=Would%20you%20like%20fries%20with%20that#diagnostics" target="_blank">Would you like fries with that?</a>
</th>
<td class="dsidx-status dsidx-success">
Yes <!-- you kidding? we ALWAYS want fries. mmmm, friessssss -->
</td>
</tr>
</table>
<?php
}
}
?>
</form>
</div>
<?php
}
static function FilterOptions() {
$apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false, 0);
if (!empty($apiHttpResponse["errors"]) || $apiHttpResponse["response"]["code"] != "200")
wp_die("We're sorry, but we ran into a temporary problem while trying to load the account data. Please check back soon.", "Account data load error");
else
$account_options = json_decode($apiHttpResponse["body"]);
$urlBase = get_home_url();
$wp_options = get_option(DSIDXPRESS_OPTION_NAME);
$property_types = dsSearchAgent_ApiRequest::FetchData('AccountSearchSetupPropertyTypes', array(), false, 0);
$default_types = dsSearchAgent_ApiRequest::FetchData('DefaultPropertyTypesNoCache', array(), false, 0);
$property_types = json_decode($property_types["body"]);
$default_types = json_decode($default_types["body"]);
if (substr($urlBase, strlen($urlBase), 1) != "/") $urlBase .= "/";
$urlBase .= dsSearchAgent_Rewrite::GetUrlSlug(); ?>
<div class="wrap metabox-holder">
<h1>Filters</h1>
<?php if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') : ?>
<div class="updated"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
<?php endif; ?>
<form method="post" action="options.php">
<?php settings_fields("dsidxpress_api_options"); ?>
<span class="description">These settings will filter results.</span>
<table class="form-table">
<tr>
<th>
<label for="dsidxpress-FirstName">Restrict Results to a Zipcode:</label>
</th>
<td>
<textarea class="linkInputTextArea" id="dsidxpress-RestrictResultsToZipcode" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RestrictResultsToZipcode]"><?php echo preg_replace("/,/", "\n", $account_options->RestrictResultsToZipcode); ?></textarea><br />
<span class="description">If you need/want to restrict dsIDXpress to a specific zipcode, put the zipcode in this field. Separate a list of values by hitting the 'Enter' key after each entry.</span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-FirstName">Restrict Results to a City:</label>
</th>
<td>
<textarea class="linkInputTextArea" id="dsidxpress-RestrictResultsToCity" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RestrictResultsToCity]"><?php echo preg_replace('/,/', "\n", $account_options->RestrictResultsToCity); ?></textarea><br />
<span class="description">If you need/want to restrict dsIDXpress to a specific city, put the name in this field. Separate a list of values by hitting the 'Enter' key after each entry. </span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-FirstName">Restrict Results to a County:</label>
</th>
<td>
<textarea class="linkInputTextArea" id="dsidxpress-RestrictResultsToCounty" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RestrictResultsToCounty]"><?php echo preg_replace("/,/", "\n", $account_options->RestrictResultsToCounty); ?></textarea><br />
<span class="description">If you need/want to restrict dsIDXpress to a specific county, put the name in this field. Separate a list of values by hitting the 'Enter' key after each entry. </span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-FirstName">Restrict Results to a State:</label>
</th>
<td>
<input type="hidden" class="linkInputTextArea" id="dsidxpress-RestrictResultsToState" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RestrictResultsToState]" value="<?php echo preg_replace("/,/", "\n", $account_options->RestrictResultsToState); ?>"></input>
<select size="4" style="width:140px;" multiple="yes" class="linkInputTextArea" id="dsidxpress-states" name="dsidxpress-states">
<?php
$states = array(
"None"=>'',
"Alabama"=>'AL',
"Alaska"=>'AK',
"Arizona"=>'AZ',
"Arkansas"=>'AR',
"California"=>'CA',
"Colorado"=>'CO',
"Connecticut"=>'CT',
"Delaware"=>'DE',
"District of Columbia"=>'DC',
"Florida"=>'FL',
"Georgia"=>'GA',
"Hawaii"=>'HI',
"Idaho"=>'ID',
"Illinois"=>'IL',
"Indiana"=>'IN',
"Iowa"=>'IA',
"Kansas"=>'KS',
"Kentucky"=>'KY',
"Louisiana"=>'LA',
"Maine"=>'ME',
"Maryland"=>'MD',
"Massachusetts"=>'MA',
"Michigan"=>'MI',
"Minnesota"=>'MN',
"Mississippi"=>'MS',
"Missouri"=>'MO',
"Montana"=>'MT',
"Nebraska"=>'NE',
"Nevada"=>'NV',
"New Hampshire"=>'NH',
"New Jersey"=>'NJ',
"New Mexico"=>'NM',
"New York"=>'NY',
"North Carolina"=>'NC',
"North Dakota"=>'ND',
"Ohio"=>'OH',
"Oklahoma"=>'OK',
"Oregon"=>'OR',
"Pennsylvania"=>'PA',
"Rhode Island"=>'RI',
"South Carolina"=>'SC',
"South Dakota"=>'SD',
"Tennessee"=>'TN',
"Texas"=>'TX',
"Utah"=>'UT',
"Vermont"=>'VT',
"Virginia"=>'VA',
"Washington"=>'WA',
"West Virginia"=>'WV',
"Wisconsin"=>'WI',
"Wyoming"=>'WY');
if(isset($account_options->RestrictResultsToState)) $selected_states = explode(',', $account_options->RestrictResultsToState);
foreach ($states as $key => $value) {
$opt_checked = "";
if (isset($selected_states)) {
foreach ($selected_states as $selected_state) {
if (!empty($value) && $selected_state == $value) {
$opt_checked = "selected='selected'";
break;
}
}
}
echo '<option class="dsidxpress-states-filter" '.$opt_checked.' value="' . $value . '">' . $key . '</option>';
}
?>
</select><br/>
<span class="description">If you need/want to restrict dsIDXpress to a specific state, put the abbreviation in this field. Separate a list of values by hitting the 'Enter' key after each entry. <a href="http://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations" target="_blank">List of U.S. State Abbreviations</a></span>
</td>
</tr>
<tr>
<th>
<label for="dsidxpress-FirstName">Restrict Results to a Property Type:</label>
</th>
<?php
$default_values = array();
foreach ($default_types as $default_type) {
array_push($default_values, $default_type->SearchSetupPropertyTypeID);
}
?>
<td>
<input type="hidden" class="linkInputTextArea" id="dsidxpress-RestrictResultsToPropertyType" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[RestrictResultsToPropertyType]" value="<?php echo $account_options->RestrictResultsToPropertyType; ?>"></input>
<input type="hidden" class="linkInputTextArea" id="dsidxpress-DefaultPropertyType" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[DefaultPropertyType]" value="<?php echo (count($default_values) > 0) ? implode(",", $default_values) : ""; ?>" />
<table id="dsidxpress-property-types" name="dsidxpress-property-types">
<tr>
<td></td>
<td>Filter</td>
<td>Default</td>
</tr>
<?php
$filter_types = explode(',', $account_options->RestrictResultsToPropertyType);
foreach ($property_types as $property_type) {
$name = htmlentities($property_type->DisplayName);
$id = $property_type->SearchSetupPropertyTypeID;
$filter_checked = "";
$default_checked = "";
foreach ($filter_types as $filter_type) {
if ($filter_type == (string)$id) {
$filter_checked = "checked";
break;
}
}
foreach ($default_types as $default_type) {
if(htmlentities($default_type->SearchSetupPropertyTypeID) == (string)$id){
$default_checked = "checked";
break;
}
}
?>
<tr>
<td><?php echo $name; ?></td>
<td><input class="dsidxpress-proptype-filter" <?php echo $filter_checked; ?> type="checkbox" value="<?php echo $id; ?>"/></td>
<td><input class="dsidxpress-proptype-default" <?php echo $default_checked; ?> type="checkbox" value="<?php echo $id; ?>"/></td>
</tr>
<?php
}
?>
</table>
<span class="description">If you need/want to restrict dsIDXpress to specific property types, select the types you would like to have return results. This setting will also restrict the property types shown in search form options. You may also choose which types are included in the default property type selection.</span>
</td>
</tr>
<?php if ($account_options->{'dsIDXPress-Package'} == 'pro') : ?>
<tr>
<th>
<label>Default Results by Status:</label>
</th>
<td>
<input type="hidden" id="dsidxpress-DefaultListingStatusTypeIDs" name="<?php echo DSIDXPRESS_API_OPTIONS_NAME; ?>[DefaultListingStatusTypeIDs]" value="<?php echo $account_options->DefaultListingStatusTypeIDs; ?>" />
<table class="dsidxpress-status-types">
<?php
$listing_status_types = array('Active' => 1, 'Conditional' => 2, 'Pending' => 4, 'Sold' => 8);
if (empty(self::$capabilities['HasSoldData'])) {
unset($listing_status_types['Sold']);
}
if (empty(self::$capabilities['HasPendingData'])) {
unset($listing_status_types['Pending']);
}
foreach ($listing_status_types as $label => $value) :
$status_checked = '';
if (strpos($account_options->DefaultListingStatusTypeIDs, (string)$value) !== false)
$status_checked = 'checked';
?>
<tr>
<td><?php echo $label.' '; ?></td>
<td><input class="dsidxpress-statustype-filter" <?php echo $status_checked; ?> type="checkbox" value="<?php echo $value; ?>" /></td>
</tr>
<?php endforeach; ?>
</table>
<span class="description">If you need / want to restrict the properties shown on your website by property status, check the statuses you would like visitors to see by default in search results here</span>
</td>
</tr>
<?php endif; ?>
</table>
<br />
<p class="submit">
<input type="submit" class="button-primary" name="Submit" value="Save Options" />
</p>
</form>
</div><?php
}
static function SEOSettings() {
$options = get_option(DSIDXPRESS_OPTION_NAME);
$apiHttpResponse = dsSearchAgent_ApiRequest::FetchData("AccountOptions", array(), false, 0);
if (!empty($apiHttpResponse["errors"]) || $apiHttpResponse["response"]["code"] != "200")
wp_die("We're sorry, but we ran into a temporary problem while trying to load the account data. Please check back soon.", "Account data load error");
else
$account_options = json_decode($apiHttpResponse["body"]);
$urlBase = get_home_url();
if (substr($urlBase, strlen($urlBase), 1) != "/") $urlBase .= "/";
$urlBase .= dsSearchAgent_Rewrite::GetUrlSlug(); ?>
<div class="wrap metabox-holder">
<h1>SEO Settings</h1>
<?php if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') : ?>
<div class="updated"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
<?php endif; ?>
<form method="post" action="options.php">
<?php settings_fields("dsidxpress_api_options"); ?>
<span class="description">These settings are used to improve the accuracy of how search engines find and list this site.<br/>When using a replacement field please include it using lowercase characters.</span>
<div style="padding-left: 30px;">
<h2>Details Page Settings</h2>
<span class="description">These settings apply to any page holding details for a specific property. <br /><br />
You may use %city%, %state%, %zip%, %county%, %tract%, and/or %community% in any of the fields below and <br />
they will display as the relevant value. For example: Homes for sale in %zip%. will appear as Homes for sale in 92681.
</span>
<br />