Repository navigation
Expand file tree
/
Copy pathscroll-top.php
More file actions
93 lines (73 loc) · 2.67 KB
/
Copy pathscroll-top.php
File metadata and controls
93 lines (73 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* Plugin Name: Scroll Top
* Plugin URI: https://www.theme-junkie.com/plugins/scroll-top/
* Description: Adds a flexible Back to Top button to any post/page of your WordPress website.
* Version: 1.0.2
* Author: Theme Junkie
* Author URI: https://www.theme-junkie.com/
* Author Email: support@theme-junkie.com
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along with this program; if not, write
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
class Scroll_Top {
/**
* PHP5 constructor method.
*/
public function __construct() {
// Set the constants needed by the plugin.
add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
// Internationalize the text strings used.
add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
// Load the functions files.
add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
// Load the admin files.
add_action( 'plugins_loaded', array( &$this, 'admin' ), 4 );
}
/**
* Defines constants used by the plugin.
*/
public function constants() {
// Set constant path to the plugin directory.
define( 'ST_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
// Set the constant path to the plugin directory URI.
define( 'ST_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
// Set the constant path to the inc directory.
define( 'ST_INCLUDES', ST_DIR . trailingslashit( 'inc' ) );
// Set the constant path to the admin directory.
define( 'ST_ADMIN', ST_DIR . trailingslashit( 'admin' ) );
// Set the constant path to the aseets directory.
define( 'ST_ASSETS', ST_URI . trailingslashit( 'assets' ) );
}
/**
* Loads the translation files.
*/
public function i18n() {
load_plugin_textdomain( 'scroll-top', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Loads the initial files needed by the plugin.
*/
public function includes() {
require_once( ST_INCLUDES . 'functions.php' );
}
/**
* Loads the admin functions and files.
*/
public function admin() {
if ( is_admin() ) {
require_once( ST_ADMIN . 'admin.php' );
}
}
}
new Scroll_Top;