PluginProbe
To Top / 1.4
To Top v1.4
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.6 1.7 1.8 1.8.1 1.9 2.0 2.1 2.2 2.2.1 2.2.2 2.3 2.4 All 34 releases
to-top / to-top.php

to-top.php in To Top 1.4, at to-top.php

142 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: To Top
4 * Plugin URI: https://catchthemes.com/wp-plugins/to-top
5 * Description: To Top plugin allows the visitor as well as admin to easily scroll back to the top of the page, with fully customizable options and ability to use image.
6 * Author: Catch Themes
7 * Author URI: https://catchthemes.com
8 * Version: 1.4
9 * License: GNU General Public License, version 3 (GPLv3)
10 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
11 * Text Domain: to-top
12 * Domain Path: languages
13 *
14 * Copyright (C) 2012-2016 Catch Themes, (info@catchthemes.com)
15 *
16 * To Top Plugin is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 *
29 * @package To_Top
30 * @link catchthemes.com
31 * @author Catch Themes
32 * @version 1.2
33 */
34
35 // If this file is called directly, abort.
36 if ( ! defined( 'WPINC' ) ) {
37 die;
38 }
39
40 /**
41 * The code that runs during plugin activation.
42 * This action is documented in includes/class-to-top-activator.php
43 */
44 function activate_to_top() {
45 require_once plugin_dir_path( __FILE__ ) . 'includes/class-to-top-activator.php';
46 To_Top_Activator::activate();
47 }
48
49 /**
50 * The code that runs during plugin deactivation.
51 * This action is documented in includes/class-to-top-deactivator.php
52 */
53 function deactivate_to_top() {
54 require_once plugin_dir_path( __FILE__ ) . 'includes/class-to-top-deactivator.php';
55 To_Top_Deactivator::deactivate();
56 }
57
58 register_activation_hook( __FILE__, 'activate_to_top' );
59 register_deactivation_hook( __FILE__, 'deactivate_to_top' );
60
61 /**
62 * The core plugin class that is used to define internationalization,
63 * admin-specific hooks, and public-facing site hooks.
64 */
65 require plugin_dir_path( __FILE__ ) . 'includes/class-to-top.php';
66
67 /**
68 * Begins execution of the plugin.
69 *
70 * Since everything within the plugin is registered via hooks,
71 * then kicking off the plugin from this point in the file does
72 * not affect the page life cycle.
73 *
74 * @since 1.0
75 */
76 function run_to_top() {
77
78 $plugin = new To_Top();
79 $plugin->run();
80
81 }
82 run_to_top();
83
84 /**
85 * Returns the options array for Top options
86 *
87 * @since 1.0
88 */
89 function to_top_get_options(){
90 $to_top_default_options = to_top_default_options();
91
92 return array_merge( $to_top_default_options , get_option( 'to_top_options', $to_top_default_options ) ) ;
93 }
94
95 /**
96 * Return array of default options
97 *
98 * @since 1.0
99 * @return array default options.
100 */
101 function to_top_default_options( $option = null ) {
102 $default_options = array(
103 //Basic Settings
104 'scroll_offset' => '100',
105 'icon_opacity' => '50',
106 'style' => 'icon',
107
108 //Icon Settings
109 'icon_type' => 'dashicons-arrow-up-alt2',
110 'icon_color' => '#ffffff',
111 'icon_bg_color' => '#000000',
112 'icon_size' => '32',
113 'border_radius' => '5',
114
115 //Image Settings
116 'image' => plugin_dir_url( __FILE__ ).'admin/images/default.png',
117 'image_width' => '65',
118 'image_alt' => '',
119
120
121
122 //Advanced Settings
123 'location' => 'bottom-right',
124 'margin_x' => '20',
125 'margin_y' => '20',
126 'show_on_admin' => 0,
127 'enable_autohide' => 0,
128 'autohide_time' => '2',
129 'enable_hide_small_device' => 0,
130 'small_device_max_width' => '640',
131
132 //Reset Settings
133 'reset' => 0,
134 );
135
136 if ( null == $option ) {
137 return apply_filters( 'to_top_options', $default_options );
138 }
139 else {
140 return $default_options[ $option ];
141 }
142 }