PluginProbe
Reading Position Indicator / trunk
Reading Position Indicator vtrunk
1.2.3 trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.2 1.2.0 1.2.1 1.2.2
reading-position-indicator / etc / options.php

options.php in Reading Position Indicator trunk, at etc/options.php

218 lines 8.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function iworks_reading_position_indicator_options() {
4 $options = array();
5 /**
6 * main settings
7 */
8 $options['index'] = array(
9 'use_tabs' => true,
10 'version' => '0.0',
11 'page_title' => esc_html__( 'Progress configuration', 'reading-position-indicator' ),
12 'menu_title' => esc_html__( 'Progress', 'reading-position-indicator' ),
13 'menu' => 'theme',
14 'enqueue_scripts' => array(
15 'progress-admin-js',
16 ),
17 'enqueue_styles' => array(
18 'progress-admin',
19 'reading-position-indicator',
20 ),
21 'options' => array(
22 array(
23 'type' => 'heading',
24 'label' => esc_html__( 'Main', 'reading-position-indicator' ),
25 'since' => '1.2.3',
26 ),
27 array(
28 'name' => 'post_type',
29 'type' => 'select2',
30 'th' => esc_html__( 'Display On', 'reading-position-indicator' ),
31 'default' => array( 'post' ),
32 'options' => iworks_reading_position_indicator_post_types(),
33 'multiple' => true,
34 'sanitize_callback' => 'array_filter',
35 ),
36 array(
37 'name' => 'position',
38 'type' => 'radio',
39 'th' => esc_html__( 'Position', 'reading-position-indicator' ),
40 'default' => 'top',
41 'radio' => array(
42 'top' => array( 'label' => esc_html__( 'top', 'reading-position-indicator' ) ),
43 'bottom' => array( 'label' => esc_html__( 'bottom', 'reading-position-indicator' ) ),
44 ),
45 'sanitize_callback' => 'esc_html',
46 ),
47 array(
48 'name' => 'position_placement',
49 'type' => 'number',
50 'class' => 'small-text slider',
51 'th' => esc_html__( 'Position placement', 'reading-position-indicator' ),
52 'label' => esc_html__( 'px', 'reading-position-indicator' ),
53 'default' => 0,
54 'min' => 0,
55 'sanitize_callback' => 'absint',
56 'description' => esc_html__( 'Direction depend on position.', 'reading-position-indicator' ),
57 ),
58 array(
59 'type' => 'heading',
60 'label' => esc_html__( 'Design', 'reading-position-indicator' ),
61 'since' => '1.2.3',
62 ),
63 array(
64 'name' => 'style',
65 'type' => 'radio',
66 'th' => esc_html__( 'Color style', 'reading-position-indicator' ),
67 'default' => 'solid',
68 'radio' => array(
69 'solid' => array( 'label' => esc_html__( 'solid', 'reading-position-indicator' ) ),
70 'gradient' => array( 'label' => esc_html__( 'gradient', 'reading-position-indicator' ) ),
71 'indeter' => array( 'label' => esc_html__( 'indeterminate', 'reading-position-indicator' ) ),
72 ),
73 'sanitize_callback' => 'esc_html',
74 ),
75 array(
76 'name' => 'height',
77 'type' => 'number',
78 'th' => esc_html__( 'Thickness', 'reading-position-indicator' ),
79 'label' => esc_html__( 'px', 'reading-position-indicator' ),
80 'default' => 5,
81 'min' => 1,
82 'sanitize_callback' => 'absint',
83 'classes' => array( 'small-text', 'slider' ),
84 ),
85 array(
86 'name' => 'color1',
87 'type' => 'wpColorPicker',
88 'class' => 'short-text',
89 'th' => esc_html__( 'Foreground color', 'reading-position-indicator' ),
90 'sanitize_callback' => 'esc_html',
91 'default' => '#f20',
92 'use_name_as_id' => true,
93 'description' => esc_html__( 'The part that moves on scroll.', 'reading-position-indicator' ),
94 ),
95 array(
96 'name' => 'color1_opacity',
97 'type' => 'number',
98 'class' => 'small-text slider',
99 'th' => esc_html__( 'Foreground opacity', 'reading-position-indicator' ),
100 'label' => esc_html__( '%', 'reading-position-indicator' ),
101 'min' => 0,
102 'max' => 100,
103 'default' => 100,
104 'sanitize_callback' => 'absint',
105 ),
106 array(
107 'name' => 'color2',
108 'type' => 'wpColorPicker',
109 'class' => 'short-text',
110 'th' => esc_html__( 'Secoundary color', 'reading-position-indicator' ),
111 'default' => '#d93',
112 'sanitize_callback' => 'esc_html',
113 'use_name_as_id' => true,
114 ),
115 array(
116 'name' => 'color2_opacity',
117 'type' => 'number',
118 'class' => 'small-text slider',
119 'th' => esc_html__( 'Secoundary color opacity', 'reading-position-indicator' ),
120 'label' => esc_html__( '%', 'reading-position-indicator' ),
121 'min' => 0,
122 'max' => 100,
123 'default' => 100,
124 'sanitize_callback' => 'absint',
125 ),
126 array(
127 'name' => 'background',
128 'type' => 'wpColorPicker',
129 'class' => 'short-text',
130 'th' => esc_html__( 'Background color', 'reading-position-indicator' ),
131 'sanitize_callback' => 'esc_html',
132 'default' => '#ddd',
133 'use_name_as_id' => true,
134 'description' => esc_html__( 'The part that moves on scroll.', 'reading-position-indicator' ),
135 ),
136 array(
137 'name' => 'background_opacity',
138 'type' => 'number',
139 'class' => 'small-text slider',
140 'th' => esc_html__( 'Background opacity', 'reading-position-indicator' ),
141 'label' => esc_html__( '%', 'reading-position-indicator' ),
142 'min' => 0,
143 'max' => 100,
144 'default' => 5,
145 'sanitize_callback' => 'absint',
146 ),
147 array(
148 'name' => 'radius',
149 'type' => 'number',
150 'class' => 'small-text slider',
151 'th' => esc_html__( 'Progress radius', 'reading-position-indicator' ),
152 'label' => esc_html__( 'px', 'reading-position-indicator' ),
153 'min' => 0,
154 'default' => 0,
155 'sanitize_callback' => 'absint',
156 ),
157 ),
158 'metaboxes' => array(
159 'assistance' => array(
160 'title' => esc_html__( 'We are waiting for your message', 'reading-position-indicator' ),
161 'callback' => 'iworks_reading_position_indicator_options_need_assistance',
162 'context' => 'side',
163 'priority' => 'core',
164 ),
165 'love' => array(
166 'title' => esc_html__( 'I love what I do!', 'reading-position-indicator' ),
167 'callback' => 'iworks_reading_position_indicator_options_loved_this_plugin',
168 'context' => 'side',
169 'priority' => 'core',
170 ),
171 ),
172 );
173 return $options;
174 }
175
176 function iworks_reading_position_indicator_post_types() {
177 $args = array(
178 'public' => true,
179 );
180 $p = array();
181 $post_types = get_post_types( $args, 'names' );
182 foreach ( $post_types as $post_type ) {
183 $a = get_post_type_object( $post_type );
184 $p[ $post_type ] = $a->labels->name;
185 }
186 return $p;
187 }
188
189 function iworks_reading_position_indicator_options_need_assistance( $iworks_reading_position_indicator ) {
190 $content = apply_filters( 'iworks_rate_assistance', '', 'reading-position-indicator' );
191 if ( ! empty( $content ) ) {
192 echo wp_kses_post( $content );
193 return;
194 }
195
196 ?>
197 <p><?php esc_html_e( 'We are waiting for your message', 'reading-position-indicator' ); ?></p>
198 <ul>
199 <li><a href="<?php echo esc_html_x( 'https://wordpress.org/support/plugin/reading-position-indicator/', 'link to support forum on WordPress.org', 'reading-position-indicator' ); ?>"><?php esc_html_e( 'WordPress Help Forum', 'reading-position-indicator' ); ?></a></li>
200 </ul>
201 <?php
202 }
203
204 function iworks_reading_position_indicator_options_loved_this_plugin( $iworks_reading_position_indicator ) {
205 $content = apply_filters( 'iworks_rate_love', '', 'reading-position-indicator' );
206 if ( ! empty( $content ) ) {
207 echo wp_kses_post( $content );
208 return;
209 }
210 ?>
211 <p><?php esc_html_e( 'Below are some links to help spread this plugin to other users', 'reading-position-indicator' ); ?></p>
212 <ul>
213 <li><a href="https://wordpress.org/support/plugin/reading-position-indicator/reviews/#new-post"><?php esc_html_e( 'Give it a five stars on WordPress.org', 'reading-position-indicator' ); ?></a></li>
214 <li><a href="<?php echo esc_html_x( 'https://wordpress.org/plugins/reading-position-indicator/', 'plugin home page on WordPress.org', 'reading-position-indicator' ); ?>"><?php esc_html_e( 'Link to it so others can easily find it', 'reading-position-indicator' ); ?></a></li>
215 </ul>
216 <?php
217 }
218