catch-scroll-progress-bar
Last commit date
admin
5 months ago
includes
5 months ago
languages
5 months ago
public
5 months ago
LICENSE.txt
5 months ago
README.txt
5 months ago
catch-scroll-progress-bar.php
5 months ago
index.php
5 months ago
uninstall.php
5 months ago
catch-scroll-progress-bar.php
159 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The plugin bootstrap file |
| 5 | * |
| 6 | * This file is read by WordPress to generate the plugin information in the plugin |
| 7 | * admin area. This file also includes all of the dependencies used by the plugin, |
| 8 | * registers the activation and deactivation functions, and defines a function |
| 9 | * that starts the plugin. |
| 10 | * |
| 11 | * @link www.catchplugins.com |
| 12 | * @since 1.0.0 |
| 13 | * @package Catch_Scroll_Progress_Bar |
| 14 | * |
| 15 | * @wordpress-plugin |
| 16 | * Plugin Name: Catch Scroll Progress Bar |
| 17 | * Plugin URI: https://wordpress.org/plugins/catch-scroll-progress-bar |
| 18 | * Description: This is a simple, super-light WordPress progress bar plugin that has the most essential features to show the users how far they’ve scrolled through the current page or post |
| 19 | * Version: 2.0 |
| 20 | * Author: Catch Plugins |
| 21 | * Author URI: https://www.catchplugins.com |
| 22 | * License: GPL-2.0+ |
| 23 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 | * Text Domain: catch-scroll-progress-bar |
| 25 | * Domain Path: /languages |
| 26 | */ |
| 27 | |
| 28 | // If this file is called directly, abort. |
| 29 | if (! defined('WPINC')) { |
| 30 | die; |
| 31 | } |
| 32 | |
| 33 | // Define Version |
| 34 | if (! defined('CATCH_SCROLL_PROGRESS_BAR_VERSION')) { |
| 35 | define('CATCH_SCROLL_PROGRESS_BAR_VERSION', '2.0'); |
| 36 | } |
| 37 | |
| 38 | // The URL of the directory that contains the plugin |
| 39 | if (! defined('CATCH_SCROLL_PROGRESS_BAR_URL')) { |
| 40 | define('CATCH_SCROLL_PROGRESS_BAR_URL', plugin_dir_url(__FILE__)); |
| 41 | } |
| 42 | |
| 43 | // The absolute path of the directory that contains the file |
| 44 | if (! defined('CATCH_SCROLL_PROGRESS_BAR_PATH')) { |
| 45 | define('CATCH_SCROLL_PROGRESS_BAR_PATH', plugin_dir_path(__FILE__)); |
| 46 | } |
| 47 | |
| 48 | // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes. |
| 49 | if (! defined('CATCH_SCROLL_PROGRESS_BAR_BASENAME')) { |
| 50 | define('CATCH_SCROLL_PROGRESS_BAR_BASENAME', plugin_basename(__FILE__)); |
| 51 | } |
| 52 | |
| 53 | function activate_catch_scroll_progress_bar() |
| 54 | { |
| 55 | require_once plugin_dir_path(__FILE__) . 'includes/class-catch-scroll-progress-bar-activator.php'; |
| 56 | Catch_Scroll_Progress_Bar_Activator::activate(); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * The code that runs during plugin deactivation. |
| 61 | * This action is documented in includes/class-catch-scroll-progress-bar-deactivator.php |
| 62 | */ |
| 63 | function deactivate_catch_scroll_progress_bar() |
| 64 | { |
| 65 | require_once plugin_dir_path(__FILE__) . 'includes/class-catch-scroll-progress-bar-deactivator.php'; |
| 66 | Catch_Scroll_Progress_Bar_Deactivator::deactivate(); |
| 67 | } |
| 68 | |
| 69 | register_activation_hook(__FILE__, 'activate_catch_scroll_progress_bar'); |
| 70 | register_deactivation_hook(__FILE__, 'deactivate_catch_scroll_progress_bar'); |
| 71 | |
| 72 | /** |
| 73 | * The core plugin class that is used to define internationalization, |
| 74 | * admin-specific hooks, and public-facing site hooks. |
| 75 | */ |
| 76 | require plugin_dir_path(__FILE__) . 'includes/class-catch-scroll-progress-bar.php'; |
| 77 | |
| 78 | /** |
| 79 | * Begins execution of the plugin. |
| 80 | * |
| 81 | * Since everything within the plugin is registered via hooks, |
| 82 | * then kicking off the plugin from this point in the file does |
| 83 | * not affect the page life cycle. |
| 84 | * |
| 85 | * @since 1.0.0 |
| 86 | */ |
| 87 | if (! function_exists('catch_progress_bar_get_options')) : |
| 88 | function catch_progress_bar_get_options() |
| 89 | { |
| 90 | $defaults = catch_progress_bar_default_options(); |
| 91 | $options = get_option('catch_progress_bar_options', $defaults); |
| 92 | return wp_parse_args($options, $defaults); |
| 93 | } |
| 94 | endif; |
| 95 | |
| 96 | |
| 97 | if (! function_exists('catch_progress_bar_default_options')) : |
| 98 | /** |
| 99 | * Return array of default options |
| 100 | * |
| 101 | * @since 1.0 |
| 102 | * @return array default options. |
| 103 | */ |
| 104 | function catch_progress_bar_default_options($option = null) |
| 105 | { |
| 106 | $default_options = array( |
| 107 | |
| 108 | 'status' => 1, |
| 109 | 'background_color' => '#32dbd5', |
| 110 | 'foreground_opacity' => 1, |
| 111 | 'background_opacity' => 1, |
| 112 | 'foreground_color' => '#dd0f0f', |
| 113 | 'progress_bar_height' => '', |
| 114 | 'progress_bar_position' => 'top', |
| 115 | 'home' => 1, |
| 116 | 'blog' => 0, |
| 117 | 'archive' => 0, |
| 118 | 'single' => 0, |
| 119 | 'field_posttypes' => array(), |
| 120 | 'bar_height' => '7', |
| 121 | 'radius' => '8', |
| 122 | ); |
| 123 | |
| 124 | if (null == $option) { |
| 125 | return apply_filters('catch_progress_bar_deafault_options', $default_options); |
| 126 | } else { |
| 127 | return $default_options[$option]; |
| 128 | } |
| 129 | } |
| 130 | endif; // catch_progress_bar_default_options |
| 131 | function catch_progress_bar_position() |
| 132 | { |
| 133 | $options = array( |
| 134 | 'top' => esc_html__('Top', 'catch-scroll-progress-bar'), |
| 135 | 'bottom' => esc_html__('Bottom', 'catch-scroll-progress-bar'), |
| 136 | |
| 137 | ); |
| 138 | return $options; |
| 139 | } |
| 140 | |
| 141 | function run_catch_scroll_progress_bar() |
| 142 | { |
| 143 | |
| 144 | $plugin = new Catch_Scroll_Progress_Bar(); |
| 145 | $plugin->run(); |
| 146 | } |
| 147 | run_catch_scroll_progress_bar(); |
| 148 | |
| 149 | /* CTP tabs removal options */ |
| 150 | require plugin_dir_path(__FILE__) . '/includes/ctp-tabs-removal.php'; |
| 151 | |
| 152 | $ctp_options = ctp_get_options(); |
| 153 | if (1 == $ctp_options['theme_plugin_tabs']) { |
| 154 | /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */ |
| 155 | if (! class_exists('CatchThemesThemePlugin') && ! function_exists('add_our_plugins_tab')) { |
| 156 | require plugin_dir_path(__FILE__) . '/includes/CatchThemesThemePlugin.php'; |
| 157 | } |
| 158 | } |
| 159 |