options-template.php
384 lines
| 1 | <?php |
| 2 | /* |
| 3 | WPFront Scroll Top Plugin |
| 4 | Copyright (C) 2013, WPFront.com |
| 5 | Website: wpfront.com |
| 6 | Contact: syam@wpfront.com |
| 7 | |
| 8 | WPFront Scroll Top Plugin is distributed under the GNU General Public License, Version 3, |
| 9 | June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin |
| 10 | St, Fifth Floor, Boston, MA 02110, USA |
| 11 | |
| 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * Template for WPFront Scroll Top Options |
| 26 | * |
| 27 | * @author Syam Mohan <syam@wpfront.com> |
| 28 | * @copyright 2013 WPFront.com |
| 29 | */ |
| 30 | ?> |
| 31 | |
| 32 | <?php @$this->options_page_header($this->__('WPFront Scroll Top Settings'), WPFront_Scroll_Top::OPTIONS_GROUP_NAME); ?> |
| 33 | |
| 34 | <h3><?php echo $this->__('Display'); ?></h3> |
| 35 | <table class="form-table"> |
| 36 | <tr> |
| 37 | <th scope="row"> |
| 38 | <?php echo $this->options->enabled_label(); ?> |
| 39 | </th> |
| 40 | <td> |
| 41 | <input type="checkbox" name="<?php echo $this->options->enabled_name(); ?>" <?php echo $this->options->enabled() ? 'checked' : ''; ?> /> |
| 42 | </td> |
| 43 | </tr> |
| 44 | <tr> |
| 45 | <th scope="row"> |
| 46 | <?php echo $this->options->javascript_async_label(); ?> |
| 47 | </th> |
| 48 | <td> |
| 49 | <input type="checkbox" name="<?php echo $this->options->javascript_async_name(); ?>" <?php echo $this->options->javascript_async() ? 'checked' : ''; ?> /> |
| 50 | <span class="description"><?php echo $this->__('[Increases site performance. Keep it enabled, if there are no conflicts.]'); ?></span> |
| 51 | </td> |
| 52 | </tr> |
| 53 | <tr> |
| 54 | <th scope="row"> |
| 55 | <?php echo $this->options->scroll_offset_label(); ?> |
| 56 | </th> |
| 57 | <td> |
| 58 | <input class="pixels" name="<?php echo $this->options->scroll_offset_name(); ?>" value="<?php echo $this->options->scroll_offset(); ?>" />px |
| 59 | <span class="description"><?php echo $this->__('[Number of pixels to be scrolled before the button appears.]'); ?></span> |
| 60 | </td> |
| 61 | </tr> |
| 62 | <tr> |
| 63 | <th scope="row"> |
| 64 | <?php echo $this->__('Button Size'); ?> |
| 65 | </th> |
| 66 | <td> |
| 67 | <input class="pixels" name="<?php echo $this->options->button_width_name(); ?>" value="<?php echo $this->options->button_width(); ?>" />px |
| 68 | X |
| 69 | <input class="pixels" name="<?php echo $this->options->button_height_name(); ?>" value="<?php echo $this->options->button_height(); ?>" />px |
| 70 | <span class="description"><?php echo $this->__('[Set 0px to auto fit.]'); ?></span> |
| 71 | |
| 72 | </td> |
| 73 | </tr> |
| 74 | <tr> |
| 75 | <th scope="row"> |
| 76 | <?php echo $this->options->button_opacity_label(); ?> |
| 77 | </th> |
| 78 | <td> |
| 79 | <input class="seconds" name="<?php echo $this->options->button_opacity_name(); ?>" value="<?php echo $this->options->button_opacity(); ?>" />% |
| 80 | </td> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <th scope="row"> |
| 84 | <?php echo $this->options->button_fade_duration_label(); ?> |
| 85 | </th> |
| 86 | <td> |
| 87 | <input class="seconds" name="<?php echo $this->options->button_fade_duration_name(); ?>" value="<?php echo $this->options->button_fade_duration(); ?>" />ms |
| 88 | <span class="description"><?php echo $this->__('[Button fade duration in milliseconds.]'); ?></span> |
| 89 | </td> |
| 90 | </tr> |
| 91 | <tr> |
| 92 | <th scope="row"> |
| 93 | <?php echo $this->options->scroll_duration_label(); ?> |
| 94 | </th> |
| 95 | <td> |
| 96 | <input class="seconds" name="<?php echo $this->options->scroll_duration_name(); ?>" value="<?php echo $this->options->scroll_duration(); ?>" />ms |
| 97 | <span class="description"><?php echo $this->__('[Window scroll duration in milliseconds.]'); ?></span> |
| 98 | </td> |
| 99 | </tr> |
| 100 | <tr> |
| 101 | <th scope="row"> |
| 102 | <?php echo $this->options->auto_hide_label(); ?> |
| 103 | </th> |
| 104 | <td> |
| 105 | <input type="checkbox" name="<?php echo $this->options->auto_hide_name(); ?>" <?php echo $this->options->auto_hide() ? "checked" : ""; ?> /> |
| 106 | </td> |
| 107 | </tr> |
| 108 | <tr> |
| 109 | <th scope="row"> |
| 110 | <?php echo $this->options->auto_hide_after_label(); ?> |
| 111 | </th> |
| 112 | <td> |
| 113 | <input class="seconds" name="<?php echo $this->options->auto_hide_after_name(); ?>" value="<?php echo $this->options->auto_hide_after(); ?>" />sec |
| 114 | <span class="description"><?php echo $this->__('[Button will be auto hidden after this duration in seconds, if enabled.]'); ?></span> |
| 115 | </td> |
| 116 | </tr> |
| 117 | <tr> |
| 118 | <th scope="row"> |
| 119 | <?php echo $this->options->hide_small_device_label(); ?> |
| 120 | </th> |
| 121 | <td> |
| 122 | <input type="checkbox" name="<?php echo $this->options->hide_small_device_name(); ?>" <?php echo $this->options->hide_small_device() ? "checked" : ""; ?> /> |
| 123 | <span class="description"><?php echo $this->__('[Button will be hidden on small devices when the width matches.]'); ?></span> |
| 124 | </td> |
| 125 | </tr> |
| 126 | <tr> |
| 127 | <th scope="row"> |
| 128 | <?php echo $this->options->small_device_width_label(); ?> |
| 129 | </th> |
| 130 | <td> |
| 131 | <input class="pixels" name="<?php echo $this->options->small_device_width_name(); ?>" value="<?php echo $this->options->small_device_width(); ?>" />px |
| 132 | <span class="description"><?php echo $this->__('[Button will be hidden on devices with lesser or equal width.]'); ?></span> |
| 133 | </td> |
| 134 | </tr> |
| 135 | <tr> |
| 136 | <th scope="row"> |
| 137 | <?php echo $this->options->hide_small_window_label(); ?> |
| 138 | </th> |
| 139 | <td> |
| 140 | <input type="checkbox" name="<?php echo $this->options->hide_small_window_name(); ?>" <?php echo $this->options->hide_small_window() ? "checked" : ""; ?> /> |
| 141 | <span class="description"><?php echo $this->__('[Button will be hidden on broswer window when the width matches.]'); ?></span> |
| 142 | </td> |
| 143 | </tr> |
| 144 | <tr> |
| 145 | <th scope="row"> |
| 146 | <?php echo $this->options->small_window_width_label(); ?> |
| 147 | </th> |
| 148 | <td> |
| 149 | <input class="pixels" name="<?php echo $this->options->small_window_width_name(); ?>" value="<?php echo $this->options->small_window_width(); ?>" />px |
| 150 | <span class="description"><?php echo $this->__('[Button will be hidden on browser window with lesser or equal width.]'); ?></span> |
| 151 | </td> |
| 152 | </tr> |
| 153 | <tr> |
| 154 | <th scope="row"> |
| 155 | <?php echo $this->options->hide_wpadmin_label(); ?> |
| 156 | </th> |
| 157 | <td> |
| 158 | <input type="checkbox" name="<?php echo $this->options->hide_wpadmin_name(); ?>" <?php echo $this->options->hide_wpadmin() ? "checked" : ""; ?> /> |
| 159 | <span class="description"><?php echo $this->__('[Button will be hidden on \'wp-admin\'.]'); ?></span> |
| 160 | </td> |
| 161 | </tr> |
| 162 | <tr> |
| 163 | <th scope="row"> |
| 164 | <?php echo $this->options->hide_iframe_label(); ?> |
| 165 | </th> |
| 166 | <td> |
| 167 | <input type="checkbox" name="<?php echo $this->options->hide_iframe_name(); ?>" <?php echo $this->options->hide_iframe() ? "checked" : ""; ?> /> |
| 168 | <span class="description"><?php echo $this->__('[Button will be hidden on iframes, usually inside popups.]'); ?></span> |
| 169 | </td> |
| 170 | </tr> |
| 171 | <tr> |
| 172 | <th scope="row"> |
| 173 | <?php echo $this->options->button_style_label(); ?> |
| 174 | </th> |
| 175 | <td> |
| 176 | <div> |
| 177 | <label><input type="radio" name="<?php echo $this->options->button_style_name(); ?>" value="image" <?php echo $this->options->button_style() == 'image' ? 'checked' : ''; ?> /> <?php echo $this->__('Image'); ?></label> |
| 178 | <br /> |
| 179 | <label><input type="radio" name="<?php echo $this->options->button_style_name(); ?>" value="text" <?php echo $this->options->button_style() == 'text' ? 'checked' : ''; ?> /> <?php echo $this->__('Text'); ?></label> |
| 180 | </div> |
| 181 | </td> |
| 182 | </tr> |
| 183 | <tr> |
| 184 | <th scope="row"> |
| 185 | <?php echo $this->options->image_alt_label(); ?> |
| 186 | </th> |
| 187 | <td> |
| 188 | <input class="altText" name="<?php echo $this->options->image_alt_name(); ?>" value="<?php echo $this->options->image_alt(); ?>" /> |
| 189 | </td> |
| 190 | </tr> |
| 191 | </table> |
| 192 | |
| 193 | <h3><?php echo $this->__('Text Button'); ?></h3> |
| 194 | <table class="form-table"> |
| 195 | <tr> |
| 196 | <th scope="row"> |
| 197 | <?php echo $this->options->text_button_text_label(); ?> |
| 198 | </th> |
| 199 | <td> |
| 200 | <input name="<?php echo $this->options->text_button_text_name(); ?>" value="<?php echo $this->options->text_button_text(); ?>" /> |
| 201 | </td> |
| 202 | </tr> |
| 203 | <tr> |
| 204 | <th scope="row"> |
| 205 | <?php echo $this->options->text_button_text_color_label(); ?> |
| 206 | </th> |
| 207 | <td> |
| 208 | <div class="color-selector-div"> |
| 209 | <div class="color-selector" color="<?php echo $this->options->text_button_text_color(); ?>"></div> <span><?php echo $this->options->text_button_text_color(); ?></span> |
| 210 | <input type="hidden" name="<?php echo $this->options->text_button_text_color_name(); ?>" value="<?php echo $this->options->text_button_text_color(); ?>" /> |
| 211 | </div> |
| 212 | </td> |
| 213 | </tr> |
| 214 | <tr> |
| 215 | <th scope="row"> |
| 216 | <?php echo $this->options->text_button_background_color_label(); ?> |
| 217 | </th> |
| 218 | <td> |
| 219 | <div class="color-selector-div"> |
| 220 | <div class="color-selector" color="<?php echo $this->options->text_button_background_color(); ?>"></div> <span><?php echo $this->options->text_button_background_color(); ?></span> |
| 221 | <input type="hidden" name="<?php echo $this->options->text_button_background_color_name(); ?>" value="<?php echo $this->options->text_button_background_color(); ?>" /> |
| 222 | </div> |
| 223 | </td> |
| 224 | </tr> |
| 225 | <tr> |
| 226 | <th scope="row"> |
| 227 | <?php echo $this->options->text_button_css_label(); ?> |
| 228 | </th> |
| 229 | <td> |
| 230 | <textarea name="<?php echo $this->options->text_button_css_name(); ?>" rows="5" cols="50"><?php echo $this->options->text_button_css(); ?></textarea> |
| 231 | </td> |
| 232 | </tr> |
| 233 | </table> |
| 234 | |
| 235 | <h3><?php echo $this->__('Location'); ?></h3> |
| 236 | <table class="form-table"> |
| 237 | <tr> |
| 238 | <th scope="row"> |
| 239 | <?php echo $this->options->location_label(); ?> |
| 240 | </th> |
| 241 | <td> |
| 242 | <select name="<?php echo $this->options->location_name(); ?>"> |
| 243 | <option value="1" <?php echo $this->options->location() == 1 ? 'selected' : ''; ?> ><?php echo $this->__('Bottom Right'); ?></option> |
| 244 | <option value="2" <?php echo $this->options->location() == 2 ? 'selected' : ''; ?> ><?php echo $this->__('Bottom Left'); ?></option> |
| 245 | <option value="3" <?php echo $this->options->location() == 3 ? 'selected' : ''; ?> ><?php echo $this->__('Top Right'); ?></option> |
| 246 | <option value="4" <?php echo $this->options->location() == 4 ? 'selected' : ''; ?> ><?php echo $this->__('Top Left'); ?></option> |
| 247 | </select> |
| 248 | </td> |
| 249 | </tr> |
| 250 | <tr> |
| 251 | <th scope="row"> |
| 252 | <?php echo $this->options->marginX_label(); ?> |
| 253 | </th> |
| 254 | <td> |
| 255 | <input class="pixels" name="<?php echo $this->options->marginX_name(); ?>" value="<?php echo $this->options->marginX(); ?>" />px |
| 256 | <span class="description"><?php echo $this->__('[Negative value allowed.]'); ?></span> |
| 257 | </td> |
| 258 | </tr> |
| 259 | <tr> |
| 260 | <th scope="row"> |
| 261 | <?php echo $this->options->marginY_label(); ?> |
| 262 | </th> |
| 263 | <td> |
| 264 | <input class="pixels" name="<?php echo $this->options->marginY_name(); ?>" value="<?php echo $this->options->marginY(); ?>" />px |
| 265 | <span class="description"><?php echo $this->__('[Negative value allowed.]'); ?></span> |
| 266 | </td> |
| 267 | </tr> |
| 268 | </table> |
| 269 | |
| 270 | <h3><?php echo $this->__('Filter'); ?></h3> |
| 271 | <table class="form-table"> |
| 272 | <tr> |
| 273 | <th scope="row"> |
| 274 | <?php echo $this->options->display_pages_label(); ?> |
| 275 | </th> |
| 276 | <td> |
| 277 | <label> |
| 278 | <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="1" <?php echo $this->options->display_pages() == 1 ? 'checked' : ''; ?> /> |
| 279 | <span><?php echo $this->__('All pages.'); ?></span> |
| 280 | </label> |
| 281 | <br /> |
| 282 | <label> |
| 283 | <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="2" <?php echo $this->options->display_pages() == 2 ? 'checked' : ''; ?> /> |
| 284 | <span><?php echo $this->__('Include in following pages'); ?></span> |
| 285 | </label> |
| 286 | <div class="pages-selection"> |
| 287 | <input type="hidden" name="<?php echo $this->options->include_pages_name(); ?>" value="<?php echo $this->options->include_pages(); ?>" /> |
| 288 | <?php |
| 289 | $objects = $this->get_filter_objects(); |
| 290 | foreach ($objects as $key => $value) { |
| 291 | ?> |
| 292 | <div class="page-div"> |
| 293 | <label> |
| 294 | <input type="checkbox" value="<?php echo $key; ?>" <?php echo $this->filter_pages_contains($this->options->include_pages(), $key) === FALSE ? '' : 'checked'; ?> /> |
| 295 | <?php echo $value; ?> |
| 296 | </label> |
| 297 | </div> |
| 298 | <?php |
| 299 | } |
| 300 | ?> |
| 301 | </div> |
| 302 | <label> |
| 303 | <input type="radio" name="<?php echo $this->options->display_pages_name(); ?>" value="3" <?php echo $this->options->display_pages() == 3 ? 'checked' : ''; ?> /> |
| 304 | <span><?php echo $this->__('Exclude in following pages'); ?></span> |
| 305 | </label> |
| 306 | <div class="pages-selection"> |
| 307 | <input type="hidden" name="<?php echo $this->options->exclude_pages_name(); ?>" value="<?php echo $this->options->exclude_pages(); ?>" /> |
| 308 | <?php |
| 309 | $objects = $this->get_filter_objects(); |
| 310 | foreach ($objects as $key => $value) { |
| 311 | ?> |
| 312 | <div class="page-div"> |
| 313 | <label> |
| 314 | <input type="checkbox" value="<?php echo $key; ?>" <?php echo $this->filter_pages_contains($this->options->exclude_pages(), $key) === FALSE ? '' : 'checked'; ?> /> |
| 315 | <?php echo $value; ?> |
| 316 | </label> |
| 317 | </div> |
| 318 | <?php |
| 319 | } |
| 320 | ?> |
| 321 | </div> |
| 322 | </td> |
| 323 | </tr> |
| 324 | </table> |
| 325 | |
| 326 | <h3><?php echo $this->__('Image'); ?></h3> |
| 327 | <div class="icons-container"> |
| 328 | <?php |
| 329 | $files = scandir($this->iconsDIR); |
| 330 | foreach ($files as $file) { |
| 331 | if ($file == '.' || $file == '..') |
| 332 | continue; |
| 333 | echo '<div ' . ($this->options->image() == $file ? 'class="selected"' : '') . '>'; |
| 334 | echo '<input id="' . $file . '" name="' . $this->options->image_name() . '" type="radio" value="' . $file . '" ' . ($this->options->image() == $file ? 'checked' : '') . ' />'; |
| 335 | echo '<label for="' . $file . '"><img src="' . $this->iconsURL . $file . '"/></label>'; |
| 336 | echo '</div>'; |
| 337 | } |
| 338 | ?> |
| 339 | </div> |
| 340 | <div> |
| 341 | <input id="custom" name="<?php echo $this->options->image_name(); ?>" type="radio" value="custom" <?php echo ($this->options->image() == 'custom' ? 'checked' : ''); ?> /> |
| 342 | <label for="custom"><?php echo $this->__('Custom URL'); ?> |
| 343 | <input class="customImage" name="<?php echo $this->options->custom_url_name(); ?>" value="<?php echo $this->options->custom_url(); ?>"/> |
| 344 | </label> |
| 345 | </div> |
| 346 | |
| 347 | <?php @$this->options_page_footer('scroll-top-plugin-settings/', 'scroll-top-plugin-faq/'); ?> |
| 348 | |
| 349 | <script type="text/javascript"> |
| 350 | (function($) { |
| 351 | function setColorPicker(div) { |
| 352 | div.ColorPicker({ |
| 353 | color: div.attr('color'), |
| 354 | onShow: function(colpkr) { |
| 355 | $(colpkr).fadeIn(500); |
| 356 | return false; |
| 357 | }, onHide: function(colpkr) { |
| 358 | $(colpkr).fadeOut(500); |
| 359 | return false; |
| 360 | }, |
| 361 | onChange: function(hsb, hex, rgb) { |
| 362 | div.css('backgroundColor', '#' + hex); |
| 363 | div.next().text('#' + hex).next().val('#' + hex); |
| 364 | } |
| 365 | }).css('backgroundColor', div.attr('color')); |
| 366 | } |
| 367 | |
| 368 | $('#wpfront-scroll-top-options').find(".color-selector").each(function(i, e) { |
| 369 | setColorPicker($(e)); |
| 370 | }); |
| 371 | |
| 372 | $('#wpfront-scroll-top-options .pages-selection input[type="checkbox"]').change(function() { |
| 373 | var values = []; |
| 374 | var div = $(this).parent().parent().parent(); |
| 375 | div.find('input:checked').each(function(i, e) { |
| 376 | values.push($(e).val()); |
| 377 | }); |
| 378 | div.children(":first").val(values.join()); |
| 379 | }); |
| 380 | |
| 381 | })(jQuery); |
| 382 | </script> |
| 383 | |
| 384 |