PluginProbe ʕ •ᴥ•ʔ
Catch Scroll Progress Bar / 1.5
Catch Scroll Progress Bar v1.5
trunk 1.0.0 1.1 1.2 1.3 1.4 1.5 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 2.0 2.1 2.2
catch-scroll-progress-bar / public / class-catch-scroll-progress-bar-public.php
catch-scroll-progress-bar / public Last commit date
css 4 years ago js 4 years ago partials 4 years ago class-catch-scroll-progress-bar-public.php 4 years ago index.php 4 years ago
class-catch-scroll-progress-bar-public.php
165 lines
1 <?php
2
3 /**
4 * The public-facing functionality of the plugin.
5 *
6 * @link www.catchplugins.com
7 * @since 1.0.0
8 *
9 * @package Catch_Scroll_Progress_Bar
10 * @subpackage Catch_Scroll_Progress_Bar/public
11 */
12
13 /**
14 * The public-facing functionality of the plugin.
15 *
16 * Defines the plugin name, version, and two examples hooks for how to
17 * enqueue the public-facing stylesheet and JavaScript.
18 *
19 * @package Catch_Scroll_Progress_Bar
20 * @subpackage Catch_Scroll_Progress_Bar/public
21 * @author Catch Plugins <www.catchplugins.com>
22 */
23 class Catch_Scroll_Progress_Bar_Public {
24
25 /**
26 * The ID of this plugin.
27 *
28 * @since 1.0.0
29 * @access private
30 * @var string $plugin_name The ID of this plugin.
31 */
32 private $plugin_name;
33
34 /**
35 * The version of this plugin.
36 *
37 * @since 1.0.0
38 * @access private
39 * @var string $version The current version of this plugin.
40 */
41 private $version;
42
43 /**
44 * Initialize the class and set its properties.
45 *
46 * @since 1.0.0
47 * @param string $plugin_name The name of the plugin.
48 * @param string $version The version of this plugin.
49 */
50 public function __construct( $plugin_name, $version ) {
51
52 $this->plugin_name = $plugin_name;
53 $this->version = $version;
54
55 }
56
57 /**
58 * Register the stylesheets for the public-facing side of the site.
59 *
60 * @since 1.0.0
61 */
62 public function enqueue_styles() {
63
64 /**
65 * This function is provided for demonstration purposes only.
66 *
67 * An instance of this class should be passed to the run() function
68 * defined in Catch_Progress_Bar_Loader as all of the hooks are defined
69 * in that particular class.
70 *
71 * The Catch_Progress_Bar_Loader will then create the relationship
72 * between the defined hooks and the functions defined in this
73 * class.
74 */
75
76 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/catch-scroll-progress-bar-public.css', array(), $this->version, 'all' );
77
78 }
79
80 /**
81 * Register the JavaScript for the public-facing side of the site.
82 *
83 * @since 1.0.0
84 */
85 public function enqueue_scripts() {
86
87 /**
88 * This function is provided for demonstration purposes only.
89 *
90 * An instance of this class should be passed to the run() function
91 * defined in Catch_Scroll_Progress_Bar_Loader as all of the hooks are defined
92 * in that particular class.
93 *
94 * The Catch_Scroll_Progress_Bar_Loader will then create the relationship
95 * between the defined hooks and the functions defined in this
96 * class.
97 */
98
99 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/catch-scroll-progress-bar-public.js', array( 'jquery' ), $this->version, false );
100
101 }
102 public function show_it() {
103 $Settings = catch_progress_bar_get_options();
104 $Height = $Settings['bar_height'];
105 $ForegroundColor = $Settings['foreground_color'];
106 $BackgroundColor = $Settings['background_color'];
107 $BackgroundOpacity=$Settings['background_opacity'];
108 $ForegroundOpacity=$Settings['foreground_opacity'];
109 $Position = $Settings['progress_bar_position'];
110 $Raduis = $Settings['radius'];
111 if( isset($Settings['home']) && 1==$Settings['home'] && (is_front_page())){
112 echo '<progress class="catchProgressbar"
113 data-height="' . $Height . '"
114 data-position="'. $Position .'"
115 data-foreground="' . $ForegroundColor . '"
116 data-background="' . $BackgroundColor . '"
117 data-background-opacity="' . $BackgroundOpacity . '"
118 data-foreground-opacity="' . $ForegroundOpacity . '"
119 data-radius="' . $Raduis . '"
120 value="0"></progress>';
121
122 } elseif ( isset($Settings['blog']) && 1==$Settings['blog'] && (is_home() && !is_front_page()) ) {
123
124 echo '<progress class="catchProgressbar"
125 data-height="' . $Height . '"
126 data-position="'. $Position .'"
127 data-foreground="' . $ForegroundColor . '"
128 data-background="' . $BackgroundColor . '"
129 data-background-opacity="' . $BackgroundOpacity . '"
130 data-foreground-opacity="' . $ForegroundOpacity . '"
131 data-radius="' . $Raduis . '"
132 value="0"></progress>';
133 } elseif ( isset($Settings['archive']) && 1==$Settings['archive']&& (is_archive()) ) {
134
135 echo '<progress class="catchProgressbar"
136 data-height="' . $Height . '"
137 data-position="'. $Position .'"
138 data-foreground="' . $ForegroundColor . '"
139 data-background="' . $BackgroundColor . '"
140 data-background-opacity="' . $BackgroundOpacity . '"
141 data-foreground-opacity="' . $ForegroundOpacity . '"
142 data-radius="' . $Raduis . '"
143 value="0"></progress>';
144 } elseif ( isset( $Settings['single'] ) && ( is_singular() && !is_front_page() ) ) {
145 $optionPostTypes = $Settings['field_posttypes'];
146 $currentPostType = get_post_type();
147
148 if ( isset( $optionPostTypes[$currentPostType] ) && ( $optionPostTypes[$currentPostType] == 1 ) ) {
149 echo '<progress class="catchProgressbar"
150 data-height="' . $Height . '"
151 data-position="'. $Position .'"
152 data-foreground="' . $ForegroundColor . '"
153 data-background="' . $BackgroundColor . '"
154 data-background-opacity="' . $BackgroundOpacity . '"
155 data-foreground-opacity="' . $ForegroundOpacity . '"
156 data-radius="' . $Raduis . '"
157 value="0"></progress>';
158 }
159 }
160 }
161 }
162
163
164
165