PluginProbe
Store Locator for WordPress📍 / trunk
Store Locator for WordPress📍 vtrunk
trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2
storelocator / settings.php

settings.php in Store Locator for WordPress📍 trunk, at settings.php

183 lines 9.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <style>
2 .storelocator-settings-page * {
3 border-radius: 0 !important;
4 box-sizing: border-box;
5 }
6
7 .left-bar h4 {
8 width: 100%;
9 box-shadow: 0px 1px 2px 0px rgb(0 0 0 / 20%);
10 }
11
12 #embed-storelocator-info {
13 display: flex;
14 justify-content: center;
15
16 }
17
18 #embed-storelocator-info>code {
19 display: flex;
20 justify-content: center;
21 align-items: center;
22 width: "fit-content"
23 }
24 </style>
25 <div class="wrap storelocator-settings-page" style="display:flex;flex-direction:column;gap:20px;">
26 <div style="border-bottom:1px solid lightgray;" class="header">
27 <a href="https://locatestore.com" class="logo"><img src="<?php echo (STLR_DIR_URL . 'storelocator-logo.png'); ?>" width="150px" alt="Storelocator logo" style="margin:20px 0px;" /></a>
28
29 </div>
30 <div style="display:flex;justify-content:space-between;">
31 <div class="left-bar" style="width:70%;margin-right:10px">
32 <div>
33
34 <?php if (get_option("storelocator_url") && get_option("storelocator_path")) { ?><div style="background-color:#00FF0010;padding:10px 20px;margin-bottom:10px;border:1px solid #00FF00;"><?php echo __("�
35 Your Store Locator page is active at "); ?> <code><?php echo esc_html(get_site_url() . "/" . get_option("storelocator_path")); ?></code> <a href="<?php echo esc_url(get_site_url() . "/" . get_option("storelocator_path")); ?>" target="_blank" rel="noreferrer"><?php echo esc_html__("Visit page"); ?></a></div>
36 <?php } else { ?>
37 <div style="background-color:#FFA50010;padding:10px 20px;margin-bottom:10px;border:1px solid #FFA500;"><?php echo __("Don't have a Store Locator URL ?<a href='https://locatestore.com/#howto' target='_blank' rel='noreferrer'> Learn how to set one up using our addon</a>") ?></div>
38 <?php } ?>
39 </div>
40 <?php if (count($errors) > 0) { ?>
41 <div style="background-color:#ffe5e5;padding:10px 20px;margin-bottom:10px;border:1px solid red;">
42 <h4 style="margin:0;box-shadow:none"><?php echo __('Error ⚠️') ?></h4>
43
44 <ul>
45 <?php
46 array_map(function ($item) {
47 echo wp_kses("<li>&rarr; " . $item . "</li>", array('code' => array(), 'li' => array()));
48 }, $errors); ?>
49 </ul>
50 </div>
51 <?php } ?>
52 <div style="background-color:white;margin-bottom:10px;">
53 <h4 style="margin:0;padding:10px 20px;cursor:pointer;" id="generate-page-item"><?php echo __('Set up a new Store Locator page 🚀'); ?></h4>
54
55 <form action="options.php" method="post" id="generate-page-form" style="display:none;padding:0px 0px 10px 0px; border-top:1px solid lightgray;margin:0px 20px;">
56
57 <?php
58 settings_fields("storelocator-settings-generate-page");
59 do_settings_sections("storelocator");
60 submit_button("Submit", "primary", "submit");
61 ?>
62 </form>
63 </div>
64 <div style="background-color:white;margin-bottom:10px;">
65 <h4 style="margin:0;padding:10px 20px;cursor:pointer;" id="embed-storelocator-item"><?php echo __('Add Store Locator to an existing page / post 📝'); ?></h4>
66
67 <div id="embed-storelocator-form" style="display:none;padding:10px 0px 20px 0px; border-top:1px solid lightgray;margin:0px 20px;">
68
69 <div><?php echo __('Generate your shortcode and paste it into a page / post to embed your Store Locator.'); ?> </div>
70 <div>
71 <table class="form-table">
72 <tbody>
73 <tr>
74 <th style="width:fit-content;">Store Locator URL</th>
75 <td>
76 <input type="text" style="width:100%" id="embed-storelocator-input" placeholder="https://locatestore.com/<id>" value="<?php echo esc_attr((get_option('storelocator_url') === false ? '' : get_option('storelocator_url'))); ?>" />
77
78 </td>
79 <td>
80 <div class="button button-primary" onclick="<?php echo esc_js('storelocatorHandleGetShortcode()'); ?>">Get shortcode</div>
81 </td>
82 </tr>
83 </tbody>
84 </table>
85 <div id="embed-storelocator-info" style="display:none">
86 <code id="shortcode-container"><span id="shortcode-val"></span></code>
87 <div class="button" onclick="<?php echo esc_js('storelocatorHandleCopyShortcode()'); ?>"><?php echo __('Copy'); ?></div>
88
89 </div>
90 <div id="copied-message" style="display:none;margin:5px 10px 0px 10px;justify-content:center;align-items:center;"><span><?php echo __('Copied'); ?></span></div>
91 <div id="validation-error-message" style="display:none;color:red;">
92 Invalid Store Locator URL. Please enter a valid URL of the form <code style="color:black;">https://locatestore.com/&lt;id&gt;</code>
93 </div>
94
95 </div>
96
97
98 </div>
99
100
101
102 </div>
103
104
105
106 </div>
107 <div class="right-bar" style="width:30%">
108 <div style="background-color:white;padding:20px;margin-bottom:10px;">
109 <h4 style="margin:0;">Show us some love :)</h4>
110 <div>
111 <p>Found Store Locator useful? Rate it 5 stars and leave a nice little comment at wordpress.org. We would appreciate that.</p>
112 <p><a href="<?php echo esc_url("https://wordpress.org/support/plugin/storelocator/reviews/#new-post"); ?>" target="_blank" class="button" style="border-radius:0;">Rate 5 Stars</a></p>
113 </div>
114 </div>
115 <div style="background-color:white;padding:20px;">
116 <h4 style="margin:0;"><?php echo __("Let's be friends 👍"); ?></h4>
117 <div>
118 <p>
119 <a href="<?php echo esc_url("https://www.youtube.com/c/NoCodeSchool?sub_confirmation=1"); ?>" target="_blank" class="button" style="border-radius:0;"><?php echo __('Subscribe on YouTube'); ?></a>
120 <a href="<?php echo esc_url("https://twitter.com/microdotcompany"); ?>" target="_blank" class="button" style="border-radius:0;"><?php echo __('Follow on Twitter'); ?></a>
121 </p>
122 </div>
123 </div>
124 </div>
125 </div>
126 </div>
127
128 <script>
129 document.getElementById("generate-page-item").addEventListener("click", function(e) {
130 const elem = document.getElementById("generate-page-form");
131 elem.style.display = elem.style.display == "none" ? "block" : "none";
132 const elemNear = document.getElementById("embed-storelocator-form");
133 if (elemNear.style.display == "block") elemNear.style.display = "none";
134 })
135 document.getElementById("embed-storelocator-item").addEventListener("click", function(e) {
136 const elem = document.getElementById("embed-storelocator-form");
137 elem.style.display = elem.style.display == "none" ? "block" : "none";
138 const elemNear = document.getElementById("generate-page-form");
139 if (elemNear.style.display == "block") elemNear.style.display = "none";
140 })
141
142
143 function storelocatorHandleCopyShortcode(e) {
144 const el = document.createElement('textarea');
145 el.value = document.getElementById("shortcode-container").innerText;
146 el.setAttribute('readonly', '');
147 el.style.position = 'absolute';
148 el.style.left = '-9999px';
149 document.body.appendChild(el);
150 el.select();
151 document.execCommand('copy');
152 document.body.removeChild(el);
153 document.getElementById("copied-message").style.display = "flex";
154 setTimeout(function() {
155 document.getElementById("copied-message").style.display = "none";
156
157 }, 1000);
158
159 }
160
161 function storelocatorHandleGetShortcode() {
162
163 const val = document.getElementById("embed-storelocator-input").value;
164 const regexPattern = /^https:\/\/locatestore.com\/.{3,}$/i;
165 if (regexPattern.test(val)) {
166 document.getElementById("shortcode-val").innerText = '[storelocator id="' + val.substring(24) +
167 '"]';
168 document.getElementById("embed-storelocator-info").style.display = "flex";
169 document.getElementById("validation-error-message").style.display = "none";
170
171
172 } else if (val == '') {
173
174 document.getElementById("embed-storelocator-info").style.display = "none";
175 document.getElementById("validation-error-message").style.display = "none";
176 } else {
177 document.getElementById("embed-storelocator-info").style.display = "none";
178 document.getElementById("validation-error-message").style.display = "block";
179 }
180
181
182 }
183 </script>