Plugin Directory

Changeset 3443487


Ignore:
Timestamp:
01/20/2026 06:24:17 PM (4 weeks ago)
Author:
anand_kumar
Message:
  • Feature: Added custom scroll to top image upload setting.
  • Fix: Security hardening (Added direct file access check).
  • Fix: Added missing version parameters to enqueue calls.
  • Fix: Corrected text domains.
  • Fix: Added sanitization and escaping in admin settings.
  • Tested up to WordPress 6.9.
Location:
jquery-smooth-scroll/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • jquery-smooth-scroll/trunk/css/style.css

    r1927242 r3443487  
    11a#scroll-to-top {
    2    
     2
    33    /* Background image, replace in images folder */
    44    background: url(../images/arrow.png) no-repeat center center;
    5    
     5
    66    /* Match to background image size */
    77    width: 35px;
    88    height: 35px;
    9    
     9
    1010    /* Postion on the page */
    11     position: fixed;   
     11    position: fixed;
    1212    right: 30px;
    1313    bottom: 30px;
    14    
     14
    1515    /* Hide link text */
    1616    text-indent: -9999px;
    1717    font-size: 0;
    18    
     18
    1919    /* Other */
    20     cursor: pointer;   
     20    cursor: pointer;
    2121    outline: 0;
    22    
     22
    2323}
    2424
     
    2929/* Responsive Design Support */
    3030@media only screen and (max-width: 480px) {
    31    
     31
    3232    a#scroll-to-top {
    33    
    34         /* Changing Position */     
    35         right: 0;
    36         bottom: 0;
     33
     34        /* Changing Position */
     35        right: 5px;
     36        bottom: 10px;
    3737    }
    38        
     38
    3939    body.rtl a#scroll-to-top {
    40         left: 0;
    41         bottom: 0;
     40        left: 5px;
     41        bottom: 10px;
    4242    }
    4343}
     44
     45/* Custom Image Support */
     46a#scroll-to-top.custom-image {
     47    background: none;
     48    width: auto;
     49    height: auto;
     50    text-indent: 0;
     51}
     52
     53a#scroll-to-top.custom-image img {
     54    display: block;
     55    max-width: 60px; /* Reasonable default limit */
     56    height: auto;
     57}
  • jquery-smooth-scroll/trunk/jquery-smooth-scroll.php

    r2116269 r3443487  
    22/*
    33Plugin Name: jQuery Smooth Scroll
    4 Version: 1.4.5
     4Version: 1.5.0
    55Plugin URI: https://www.digitalliberation.org/plugins/jquery-smooth-scroll/?utm_source=plugin&utm_medium=link&utm_campaign=jss_plugin_link
    66Description: The plugin not only add smooth scroll to top feature/link in the lower-right corner of long pages while scrolling but also makes all jump links to scroll smoothly.
     
    1010
    1111jQuery Smooth Scroll
    12 Copyright (C) 2013-19, Anand Kumar <[email protected]>
     12Copyright (C) 2013-26, Anand Kumar <[email protected]>
    1313
    1414This program is free software; you can redistribute it and/or modify it under the terms of the GNU
     
    3434
    3535// Prevent loading this file directly - Busted!
    36 if ( ! class_exists( 'WP' ) ) {
    37     header( 'Status: 403 Forbidden' );
    38     header( 'HTTP/1.1 403 Forbidden' );
     36if ( ! defined( 'ABSPATH' ) ) {
    3937    exit;
    4038}
     
    4846            $blogsynthesis_jss_plugin_url = trailingslashit ( WP_PLUGIN_URL . '/' . dirname ( plugin_basename ( __FILE__ ) ) );
    4947            $pluginname = 'jQuery Smooth Scroll';
    50             $plugin_version = '1.4.2';
     48            $plugin_version = '1.5.0';
    5149
    5250            // load plugin Scripts
     
    5856            add_action( 'wp_footer',  array( &$this, 'wp_footer' ) );
    5957
     58            // Admin menu and settings
     59            add_action( 'admin_menu', array( &$this, 'add_plugin_page' ) );
     60            add_action( 'admin_init', array( &$this, 'page_init' ) );
     61            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ) );
     62
     63        }
     64
     65        public function add_plugin_page() {
     66            add_options_page(
     67                'jQuery Smooth Scroll Settings',
     68                'jQuery Smooth Scroll',
     69                'manage_options',
     70                'jquery-smooth-scroll',
     71                array( &$this, 'create_admin_page' )
     72            );
     73        }
     74
     75        public function page_init() {
     76            register_setting( 'jquery_smooth_scroll_option_group', 'jss_scroll_to_top_image', 'esc_url_raw' );
     77        }
     78
     79        public function admin_scripts( $hook ) {
     80            if ( 'settings_page_jquery-smooth-scroll' != $hook ) {
     81                return;
     82            }
     83            wp_enqueue_media();
     84            wp_enqueue_script( 'jss-admin-script', plugin_dir_url( __FILE__ ) . 'js/admin-script.js', array( 'jquery' ), '1.0', true );
     85        }
     86
     87        public function create_admin_page() {
     88            ?>
     89            <div class="wrap">
     90                <h1>jQuery Smooth Scroll Settings</h1>
     91                <form method="post" action="options.php">
     92                    <?php settings_fields( 'jquery_smooth_scroll_option_group' ); ?>
     93                    <?php do_settings_sections( 'jquery_smooth_scroll_option_group' ); ?>
     94                    <table class="form-table">
     95                        <tr valign="top">
     96                            <th scope="row">Scroll to Top Image</th>
     97                            <td>
     98                                <?php $image_url = get_option( 'jss_scroll_to_top_image' ); ?>
     99                                <input type="hidden" id="jss_scroll_to_top_image" name="jss_scroll_to_top_image" value="<?php echo esc_attr( $image_url ); ?>" />
     100                                <div style="margin-bottom: 10px;">
     101                                    <img id="jss_image_preview" src="<?php echo esc_attr( $image_url ); ?>" style="max-width: 100px; max-height: 100px; display: <?php echo $image_url ? 'block' : 'none'; ?>;" />
     102                                </div>
     103                                <input type="button" class="button" value="<?php esc_attr_e( 'Upload Image', 'jquery-smooth-scroll' ); ?>" id="upload_image_button" />
     104                                <input type="button" class="button button-secondary" value="<?php esc_attr_e( 'Remove Image', 'jquery-smooth-scroll' ); ?>" id="remove_image_button" style="display: <?php echo $image_url ? 'inline-block' : 'none'; ?>;" />
     105                                <p class="description">Upload a custom PNG, JPG, JPEG, or SVG image for the scroll to top button.</p>
     106                            </td>
     107                        </tr>
     108                    </table>
     109                    <?php submit_button(); ?>
     110                </form>
     111            </div>
     112            <?php
    60113        }
    61114
     
    67120
    68121                // register and enqueue CSS
    69                 wp_register_style( 'jquery-smooth-scroll', plugin_dir_url( __FILE__ ) . 'css/style.css', false );
     122                wp_register_style( 'jquery-smooth-scroll', plugin_dir_url( __FILE__ ) . 'css/style.css', array(), '1.4.5' );
    70123                wp_enqueue_style( 'jquery-smooth-scroll' );
    71124
     
    76129                    $extension = '.js';
    77130                }
    78                 wp_enqueue_script( 'jquery-smooth-scroll',  plugin_dir_url( __FILE__ ) . 'js/script'.$extension, array('jquery'),false, true );
     131                wp_enqueue_script( 'jquery-smooth-scroll',  plugin_dir_url( __FILE__ ) . 'js/script'.$extension, array('jquery'), '1.4.5', true );
    79132
    80133                // You may now choose easing effect. For more information visit http://www.blogsynthesis.com/?p=860
     
    84137
    85138        public function wp_footer() {
    86             // the html button which will be added to wp_footer ?>
    87             <a id="scroll-to-top" href="#" title="<?php esc_attr_e( 'Scroll to Top', 'blogsynthesis' ); ?>"><?php esc_html_e( 'Top', 'blogsynthesis' ); ?></a>
    88             <?php
     139            // the html button which will be added to wp_footer
     140            $image_url = get_option( 'jss_scroll_to_top_image' );
     141            if ( $image_url ) {
     142                ?>
     143                <a id="scroll-to-top" class="custom-image" href="#" title="<?php esc_attr_e( 'Scroll to Top', 'jquery-smooth-scroll' ); ?>">
     144                    <img src="<?php echo esc_url( $image_url ); ?>" alt="<?php esc_attr_e( 'Scroll to Top', 'jquery-smooth-scroll' ); ?>" />
     145                </a>
     146                <?php
     147            } else {
     148                ?>
     149                <a id="scroll-to-top" href="#" title="<?php esc_attr_e( 'Scroll to Top', 'jquery-smooth-scroll' ); ?>"><?php esc_html_e( 'Top', 'jquery-smooth-scroll' ); ?></a>
     150                <?php
     151            }
    89152        }
    90153
  • jquery-smooth-scroll/trunk/readme.txt

    r2116636 r3443487  
    11=== jQuery Smooth Scroll ===
    2 Contributors: digitalliberation, anand_kumar
    3 Tags: Smooth Scroll, smooth scroll anchor, scroll to top, scroll, back to top, jquery, top of page
    4 Donate link: https://www.digitalliberation.org
     2Contributors: anand_kumar
     3Tags: Smooth Scroll, smooth scroll anchor, scroll to top, back to top
     4Donate link: https://www.anandkumar.net
    55Requires at least: 4.0
    6 Tested up to: 5.2.2
    7 Stable tag: 1.4.5
    8 Requires PHP: 5.6
     6Tested up to: 6.9
     7Stable tag: 1.5.0
     8Requires PHP: 7.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626
    2727= Important Links: =
    28 * [**Support**](https://forums.digitalliberation.org/?utm_source=plugin&utm_medium=link&utm_campaign=jss_plugin_link)
     28* [**Support**](https://wordpress.org/support/plugin/jquery-smooth-scroll/?utm_source=plugin&utm_medium=link&utm_campaign=jss_plugin_link)
    2929* [**Github Repo**](https://github.com/anandkumar/jquery-smooth-scroll)
    30 * [Contribute](https://www.digitalliberation.org/contribute/?utm_source=plugin&utm_medium=link&utm_campaign=jss_plugin_link)
     30* [Contribute](https://github.com/anandkumar/jquery-smooth-scroll/issues?utm_source=plugin&utm_medium=link&utm_campaign=jss_plugin_link)
    3131
    3232NOTE: The plugin might not be compatible with some other plugins. If there are limited number of tabs or anchor links we may exclude them manually. Please report compatibility issue on the [GitHub repository](https://github.com/anandkumar/jquery-smooth-scroll). You are welcomed to contribute towards the development of the plugin.
     
    7171
    7272== Changelog ==
     73
     74= 1.5.0 =
     75* Feature: Added custom scroll to top image upload setting.
     76* Fix: Security hardening (Added direct file access check).
     77* Fix: Added missing version parameters to enqueue calls.
     78* Fix: Corrected text domains.
     79* Fix: Added sanitization and escaping in admin settings.
     80* Tested up to WordPress 6.9.
    7381
    7482= 1.4.4 =
Note: See TracChangeset for help on using the changeset viewer.