PluginProbe
Optima Express IDX / development
Optima Express IDX vdevelopment
8.7.2 8.7.1 trunk 1.0.0 1.1.0 1.1.2 1.1.3 1.1.4 1.1.5 1.1.7 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.2 1.4.4 1.4.5 1.4.6 2.0.1 2.2.7 2.3.0 2.3.1 2.4.0 2.5.0 All 112 releases
optima-express / adminPage / iHomefinderAdminConfiguration.php

iHomefinderAdminConfiguration.php in Optima Express IDX development, at adminPage/iHomefinderAdminConfiguration.php

155 lines 7.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (! defined('ABSPATH')) {
3 exit; // Exit if accessed directly
4 }
5
6 class iHomefinderAdminConfiguration extends iHomefinderAdminAbstractPage
7 {
8
9 private static $instance;
10 private $displayRules;
11
12 public static function getInstance()
13 {
14 if (!isset(self::$instance)) {
15 self::$instance = new self();
16 }
17 return self::$instance;
18 }
19
20 public function __construct()
21 {
22 parent::__construct();
23 $this->displayRules = iHomefinderDisplayRules::getInstance();
24 }
25
26 public function registerSettings()
27 {
28 register_setting(
29 iHomefinderConstants::OPTION_GROUP_CONFIGURATION,
30 iHomefinderConstants::CSS_OVERRIDE_OPTION,
31 array($this, 'sanitize_settings')
32 );
33 register_setting(
34 iHomefinderConstants::OPTION_GROUP_CONFIGURATION,
35 iHomefinderConstants::SHADOW_DOM_HTML_OPTION,
36 array($this, 'sanitize_settings')
37 );
38 register_setting(
39 iHomefinderConstants::OPTION_GROUP_CONFIGURATION,
40 iHomefinderConstants::SHADOW_DOM_CSS_OPTION,
41 array($this, 'sanitize_settings')
42 );
43 register_setting(
44 iHomefinderConstants::OPTION_GROUP_CONFIGURATION,
45 iHomefinderConstants::NO_ID_OPTION,
46 array($this, 'sanitize_settings')
47 );
48 register_setting(
49 iHomefinderConstants::OPTION_GROUP_CONFIGURATION,
50 iHomefinderConstants::SEO_COMPAT_OPTION,
51 array($this, 'sanitize_settings')
52 );
53 }
54
55 public function sanitize_settings($input)
56 {
57 $option = isset($_REQUEST["option"]) ? $_REQUEST["option"] : "";
58
59 switch ($option) {
60 case iHomefinderConstants::CSS_OVERRIDE_OPTION:
61 case iHomefinderConstants::SHADOW_DOM_CSS_OPTION:
62 return wp_strip_all_tags($input);
63 case iHomefinderConstants::SHADOW_DOM_HTML_OPTION:
64 return wp_kses_post($input);
65 case iHomefinderConstants::NO_ID_OPTION:
66 case iHomefinderConstants::SEO_COMPAT_OPTION:
67 return sanitize_text_field($input);
68 default:
69 return $input;
70 }
71 }
72
73 protected function getContent()
74 {
75 $cssOverride = get_option(iHomefinderConstants::CSS_OVERRIDE_OPTION, null);
76 $shadowDomHtml = get_option(iHomefinderConstants::SHADOW_DOM_HTML_OPTION, null);
77 $shadowDomCss = get_option(iHomefinderConstants::SHADOW_DOM_CSS_OPTION, null);
78 if (empty($cssOverride)) {
79 $cssOverride = "<style type=\"text/css\">\n\n</style>";
80 }
81 ?>
82 <h2>Configuration</h2>
83 <form method="post" action="options.php">
84 <?php settings_fields(iHomefinderConstants::OPTION_GROUP_CONFIGURATION); ?>
85 <table class="form-table">
86 <?php if ($this->displayRules->isKestrel()) { ?>
87 <tr>
88 <th>
89 <label for="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_CSS_OPTION); ?>">Add CSS to IDX Stylesheet</label>
90 </th>
91 <td>
92 <p>(v10 only) Add CSS overrides to the shadow DOM</p>
93 <textarea id="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_CSS_OPTION); ?>" name="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_CSS_OPTION); ?>" style="width: 100%; height: 200px; "><?php echo $shadowDomCss; ?></textarea>
94 </td>
95 </tr>
96 <tr>
97 <th>
98 <label for="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_HTML_OPTION); ?>">Add Code to IDX Content</label>
99 </th>
100 <td>
101 <p>(v10 only) Add scripts and other HTML to the shadow DOM</p>
102 <textarea id="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_HTML_OPTION); ?>" name="<?php echo esc_attr(iHomefinderConstants::SHADOW_DOM_HTML_OPTION); ?>" style="width: 100%; height: 200px; "><?php echo $shadowDomHtml; ?></textarea>
103 </td>
104 </tr>
105 <?php } ?>
106 <tr>
107 <th>
108 <label for="<?php echo esc_attr(iHomefinderConstants::CSS_OVERRIDE_OPTION); ?>">Add Code to Page Head</label>
109 </th>
110 <td>
111 <p>Add CSS overrides, scripts, and other HTML to the head of the page</p>
112 <textarea id="<?php echo esc_attr(iHomefinderConstants::CSS_OVERRIDE_OPTION); ?>" name="<?php echo esc_attr(iHomefinderConstants::CSS_OVERRIDE_OPTION); ?>" style="width: 100%; height: 200px; "><?php echo $cssOverride; ?></textarea>
113 </td>
114 </tr>
115 <tr>
116 <th>Advanced</th>
117 <td>
118 <label for="<?php echo esc_attr(iHomefinderConstants::NO_ID_OPTION); ?>">Remove duplicate CSS IDs for widgets and shortcodes for improved accessibility</label>
119 <input
120 type="checkbox"
121 <?php if (get_option(iHomefinderConstants::NO_ID_OPTION, null) === "true") { ?>
122 checked="checked"
123 <?php } ?>
124 value="true"
125 name="<?php echo esc_attr(iHomefinderConstants::NO_ID_OPTION); ?>" id="<?php echo esc_attr(iHomefinderConstants::NO_ID_OPTION); ?>
126 ">
127 </td>
128 </tr>
129 <tr>
130 <th>
131 <label for="<?php echo esc_attr(iHomefinderConstants::SEO_COMPAT_OPTION); ?>">Disable SEO Plugins on IDX Pages</label>
132 </th>
133 <td>
134 <input type="hidden" name="<?php echo esc_attr(iHomefinderConstants::SEO_COMPAT_OPTION); ?>" value="false" />
135 <input
136 type="checkbox"
137 <?php if (get_option(iHomefinderConstants::SEO_COMPAT_OPTION, 'true') !== 'false') { ?>
138 checked="checked"
139 <?php } ?>
140 value="true"
141 name="<?php echo esc_attr(iHomefinderConstants::SEO_COMPAT_OPTION); ?>"
142 id="<?php echo esc_attr(iHomefinderConstants::SEO_COMPAT_OPTION); ?>"
143 >
144 <p class="description">Optima Express includes built-in SEO support for IDX pages. SEO plugins are not needed on these pages and can cause incorrect titles, descriptions, and social sharing previews. When enabled, the following plugins are disabled on IDX pages: Yoast SEO, All in One SEO, Rank Math, Squirrly SEO, SEOPress.</p>
145 </td>
146 </tr>
147 </table>
148 <p class="submit">
149 <button type="submit" class="button-primary">Save Changes</button>
150 </p>
151 </form>
152 <?php
153 }
154 }
155