11<?php
22/*
33Plugin Name: jQuery Smooth Scroll
4- Version: 1.2.4
4+ Version: 1.2.5
55Plugin URI: http://www.blogsynthesis.com/wordpress-jquery-smooth-scroll-plugin/
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.
77Author: BlogSynthesis
88Author URI: http://www.blogsynthesis.com/
99License: GPL v3
1010
11- jQuery Smooth Scroll Plugin
12- Copyright (C) 2013, Anand Kumar anand@blogsynthesis.com
11+ jQuery Smooth Scroll
12+ Copyright (C) 2013-14 , Anand Kumar anand@blogsynthesis.com
1313
1414This program is free software: you can redistribute it and/or modify
1515it under the terms of the GNU General Public License as published by
2525along with this program. If not, see <http://www.gnu.org/licenses/>.
2626*/
2727
28- class BlogSynthesisSmoothScroll {
29-
30-
31- /*--------------------------------------------*
32- * Constants
33- *--------------------------------------------*/
34-
35- const name = 'BlogSynthesis Scroll to Top ' ;
36- const slug = 'blogsynthesis-scroll-to-top ' ;
37-
38-
39- /*--------------------------------------------*
40- * Constructor
41- *--------------------------------------------*/
42-
43- function __construct () {
44-
45- // Define constants used throughout the plugin
46- $ this ->init_plugin_constants ();
47-
48- load_plugin_textdomain ( 'blogsynthesis ' , false , dirname ( plugin_basename ( __FILE__ ) ) . '/lang ' );
49-
50- // Load JavaScript and stylesheets
51- $ this ->register_scripts_and_styles ();
52-
53- // Plugin Actions
54- add_action ( 'wp_footer ' , array ( $ this , 'display_link ' ) );
55-
56- } // end constructor
57-
58-
59- /*--------------------------------------------*
60- * Core Functions
61- *---------------------------------------------*/
62-
63- function display_link () {
64- ?>
65- <a id="scroll-to-top" href="#" title="<?php _e ('Scroll to Top ' ,'blogsynthesis ' ); ?> "><?php _e ('Top ' ,'blogsynthesis ' ); ?> </a>
66- <?php
67- }
68-
69-
70- /*--------------------------------------------*
71- * Private Functions
72- *---------------------------------------------*/
73-
74- // Initializes constants used for convenience throughout the plugin.
75- private function init_plugin_constants () {
76-
77- if ( !defined ( 'PLUGIN_NAME ' ) ) {
78- define ( 'PLUGIN_NAME ' , self ::name );
79- }
80- if ( !defined ( 'PLUGIN_SLUG ' ) ) {
81- define ( 'PLUGIN_SLUG ' , self ::slug );
82- }
83-
84- } // end init_plugin_constants
85-
86- // Registers and enqueues stylesheets
87- private function register_scripts_and_styles () {
88- if ( is_admin () ) {
89- // no admin styes or scripts
90- } else {
91- $ this ->load_file ( self ::slug . '-script ' , '/js/jss-script.min.js ' , true );
92- $ this ->load_file ( self ::slug . '-style ' , '/css/jss-style.min.css ' );
93- } // end if/else
94- } // end register_scripts_and_styles
95-
96- // Helper function for registering and enqueueing scripts and styles.
97- private function load_file ( $ name , $ file_path , $ is_script = false ) {
98-
99- $ url = plugins_url ($ file_path , __FILE__ );
100- $ file = plugin_dir_path (__FILE__ ) . $ file_path ;
101-
102- if ( file_exists ( $ file ) ) {
103- if ( $ is_script ) {
104- wp_register_script ( $ name , $ url , array ('jquery ' ) );
105- wp_enqueue_script ( $ name );
106- } else {
107- wp_register_style ( $ name , $ url );
108- wp_enqueue_style ( $ name );
109- } // end if
110- } // end if
111-
112- } // end load_file
113-
114-
115- } // end class
116- new BlogSynthesisSmoothScroll ();
28+
29+ // Prevent loading this file directly - Busted!
30+ if ( ! class_exists ( 'WP ' ) )
31+ {
32+ header ( 'Status: 403 Forbidden ' );
33+ header ( 'HTTP/1.1 403 Forbidden ' );
34+ exit ;
35+ }
36+
37+
38+ if ( !class_exists ( 'jQuerySmoothScroll ' ) ) {
39+
40+ class jQuerySmoothScroll {
41+
42+ function jQuerySmoothScroll () {
43+
44+ $ blogsynthesis_jss_plugin_url = trailingslashit ( WP_PLUGIN_URL . '/ ' . dirname ( plugin_basename ( __FILE__ ) ) );
45+ $ pluginname = 'jQuery Smooth Scroll ' ;
46+ $ plugin_version = '1.2.5 ' ;
47+
48+ // load plugin Scripts
49+ add_action ( 'wp_head ' , array ( &$ this , 'wp_head ' ) );
50+
51+ // add move to top button at wp_footer
52+ add_action ( 'wp_footer ' , array ( &$ this , 'wp_footer ' ) );
53+
54+ }
55+
56+ // load our css to the head
57+ function wp_head () {
58+
59+ global $ blogsynthesis_jss_plugin_url ;
60+
61+ // register and enqueue CSS
62+ wp_register_style ( 'custom_wp_admin_css ' , plugin_dir_url ( __FILE__ ) . 'css/jss-style.min.css ' , false );
63+ wp_enqueue_style ( 'custom_wp_admin_css ' );
64+
65+ // enqueue script
66+ wp_enqueue_script ( 'script-name ' , plugin_dir_url ( __FILE__ ) . 'js/jss-script.js ' , array ('jquery ' ) );
67+
68+ // You may now choose easing effect. For more information visit http://www.blogsynthesis.com/?p=860
69+ // wp_enqueue_script("jquery-effects-core");
70+ }
71+
72+ function wp_footer () {
73+ // the html button which will be added to wp_footer ?>
74+ <a id="scroll-to-top" href="#" title="<?php _e ('Scroll to Top ' ,'blogsynthesis ' ); ?> "><?php _e ('Top ' ,'blogsynthesis ' ); ?> </a>
75+ <?php
76+ }
77+
78+ }
79+
80+
81+ //////////////////////////////////////////////////////////////////////////////
82+
83+ add_action ('wp_dashboard_setup ' , 'blogsynthesis_jss_dashboard_widgets ' );
84+
85+ function blogsynthesis_jss_dashboard_widgets () {
86+ global $ wp_meta_boxes ;
87+ wp_add_dashboard_widget ('blogsynthesisshfswidget ' , 'Latest from BlogSynthesis ' , 'blogsynthesis_jss_widget ' );
88+ }
89+
90+ function blogsynthesis_jss_widget () {
91+ include_once ( ABSPATH . WPINC . '/feed.php ' );
92+
93+ $ rss = fetch_feed ( 'http://feeds2.feedburner.com/blogsynthesis ' );
94+
95+ if ( ! is_wp_error ( $ rss ) ) :
96+
97+ // Figure out how many total items there are, but limit it to 10.
98+ $ maxitems = $ rss ->get_item_quantity ( 10 );
99+
100+ // Build an array of all the items, starting with element 0 (first element).
101+ $ rss_items = $ rss ->get_items ( 0 , $ maxitems );
102+
103+ endif ;
104+
105+ { ?>
106+ <div class="rss-widget">
107+ <a href="http://www.blogsynthesis.com/#utm_source=wpadmin&utm_medium=dashboardwidget&utm_term=newsitemlogo&utm_campaign=shfs" title="BlogSynthesis - For Bloggers" target="_blank"><img src="http://static.blogsynthesis.com/public/blogsynthesis-100px.png" class="alignright" alt="BlogSynthesis"/></a>
108+ <ul>
109+ <?php if ( $ maxitems == 0 ) : ?>
110+ <li><?php _e ( 'No items ' , 'shfs-text-domain ' ); ?> </li>
111+ <?php else : ?>
112+ <?php // Loop through each feed item and display each item as a hyperlink. ?>
113+ <?php foreach ( $ rss_items as $ item ) : ?>
114+ <li>
115+ <a href="<?php echo esc_url ( $ item ->get_permalink () ); ?> #utm_source=wpadmin&utm_medium=dashboardwidget&utm_term=newsitem&utm_campaign=shfs"
116+ title="<?php printf ( __ ( 'Posted %s ' , 'shfs-text-domain ' ), $ item ->get_date ('j F Y | g:i a ' ) ); ?> " target="_blank">
117+ <?php echo esc_html ( $ item ->get_title () ); ?>
118+ </a>
119+ </li>
120+ <?php endforeach ; ?>
121+ <?php endif ; ?>
122+ </ul>
123+ <div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">
124+ <span class="addthis_toolbox addthis_default_style" style="float:left;">
125+ <a class="addthis_button_facebook_follow" addthis:userid="blogsynthesis"></a>
126+ <a class="addthis_button_twitter_follow" addthis:userid="blogsynthesis"></a>
127+ <a class="addthis_button_google_follow" addthis:userid="+BlogSynthesis"></a>
128+ <a class="addthis_button_rss_follow" addthis:userid="http://feeds2.feedburner.com/blogsynthesis"></a>
129+ </span>
130+
131+ <a href="http://www.blogsynthesis.com/newsletter/"><img src="http://static.blogsynthesis.com/public/email-16px.png" alt="Subscribe via Email"/> Subscribe by email</a>
132+
133+ <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-525ab1d176544441"></script>
134+ </div>
135+ </div>
136+ <?php }
137+
138+ }
139+
140+ $ jQuerySmoothScroll = new jQuerySmoothScroll ();
141+
142+ }
0 commit comments