Version Description
2019-11-12 =
Fixed default values configuration.
Handled quotation mark before orphan.
Moved orphan's filters at the end of run, to try to avoid different plugins replacements.
Split replacement rules to avoid problem with
regular expression is too large
.Updated WordPress Options Class to version 2.6.8
Download this release
Release Info
Developer | iworks |
Plugin | Orphans |
Version | 2.7.5 |
Comparing to | |
See all releases |
Code changes from version 2.7.4 to 2.7.5
- etc/options.php +119 -119
- languages/sierotki.pot +40 -24
- readme.txt +12 -4
- sierotki.php +1 -1
- vendor/iworks/options/assets/scripts/common.js +86 -73
- vendor/iworks/options/assets/scripts/jquery.switch_button.js +271 -265
- vendor/iworks/options/assets/styles/common.css +0 -150
- vendor/iworks/options/assets/styles/jquery-ui.min.css +7 -0
- vendor/iworks/options/assets/styles/jquery.switch_button.css +22 -22
- vendor/iworks/options/assets/styles/options-admin.css +11 -0
- vendor/iworks/options/options.php +326 -219
- vendor/iworks/orphan.php +64 -42
- vendor/iworks/rate/admin.css +1 -1
- vendor/iworks/rate/admin.js +63 -51
- vendor/iworks/rate/rate.php +32 -23
etc/options.php
CHANGED
@@ -6,189 +6,189 @@ function orphang_indicator_options() {
|
|
6 |
* main settings
|
7 |
*/
|
8 |
$options['index'] = array(
|
9 |
-
'use_tabs'
|
10 |
-
'version'
|
11 |
-
'page_title'
|
12 |
-
'menu_title'
|
13 |
-
'menu'
|
14 |
'enqueue_scripts' => array(),
|
15 |
-
'enqueue_styles'
|
16 |
-
'options'
|
17 |
array(
|
18 |
-
'type'
|
19 |
-
'label'
|
20 |
),
|
21 |
/**
|
22 |
* Since 2.6.8
|
23 |
*/
|
24 |
array(
|
25 |
-
'name'
|
26 |
-
'type'
|
27 |
-
'th'
|
28 |
-
'default'
|
29 |
-
'options'
|
30 |
'multiple' => true,
|
31 |
),
|
32 |
array(
|
33 |
-
'name'
|
34 |
-
'th'
|
35 |
-
'type'
|
36 |
-
'description'
|
37 |
'sanitize_callback' => 'absint',
|
38 |
-
'
|
39 |
-
'classes'
|
40 |
),
|
41 |
array(
|
42 |
-
'name'
|
43 |
-
'th'
|
44 |
-
'type'
|
45 |
-
'description'
|
46 |
'sanitize_callback' => 'absint',
|
47 |
-
'classes'
|
48 |
-
'
|
49 |
),
|
50 |
array(
|
51 |
-
'name'
|
52 |
-
'th'
|
53 |
-
'type'
|
54 |
-
'description'
|
55 |
'sanitize_callback' => 'absint',
|
56 |
-
'classes'
|
57 |
-
'
|
58 |
),
|
59 |
array(
|
60 |
-
'name'
|
61 |
-
'type'
|
62 |
-
'th'
|
63 |
-
'description'
|
64 |
'sanitize_callback' => 'absint',
|
65 |
-
'
|
66 |
-
'classes'
|
67 |
),
|
68 |
array(
|
69 |
-
'type'
|
70 |
-
'label'
|
71 |
),
|
72 |
/**
|
73 |
* Since 2.6.6
|
74 |
*/
|
75 |
array(
|
76 |
-
'name'
|
77 |
-
'th'
|
78 |
-
'type'
|
79 |
-
'description'
|
80 |
'sanitize_callback' => 'absint',
|
81 |
-
'classes'
|
82 |
-
'
|
83 |
),
|
84 |
/**
|
85 |
* Since 2.6.6
|
86 |
*/
|
87 |
array(
|
88 |
-
'name'
|
89 |
-
'th'
|
90 |
-
'type'
|
91 |
-
'description'
|
92 |
'sanitize_callback' => 'absint',
|
93 |
-
'classes'
|
94 |
-
'
|
95 |
),
|
96 |
/**
|
97 |
* Since 2.6.6
|
98 |
*/
|
99 |
array(
|
100 |
-
'type'
|
101 |
-
'label'
|
102 |
),
|
103 |
array(
|
104 |
-
'name'
|
105 |
-
'type'
|
106 |
-
'th'
|
107 |
-
'default'
|
108 |
-
'options'
|
109 |
'multiple' => true,
|
110 |
),
|
111 |
array(
|
112 |
-
'name'
|
113 |
-
'th'
|
114 |
-
'type'
|
115 |
-
'description'
|
116 |
'sanitize_callback' => 'absint',
|
117 |
-
'classes'
|
118 |
-
'default'
|
119 |
),
|
120 |
array(
|
121 |
-
'name'
|
122 |
-
'th'
|
123 |
-
'type'
|
124 |
-
'description'
|
125 |
'sanitize_callback' => 'absint',
|
126 |
-
'classes'
|
127 |
-
'default'
|
128 |
),
|
129 |
array(
|
130 |
-
'type'
|
131 |
-
'label'
|
132 |
),
|
133 |
/**
|
134 |
* Since 2.6.8
|
135 |
*/
|
136 |
array(
|
137 |
-
'name'
|
138 |
-
'type'
|
139 |
-
'th'
|
140 |
-
'description'
|
141 |
'sanitize_callback' => 'absint',
|
142 |
-
'
|
143 |
-
'classes'
|
144 |
),
|
145 |
array(
|
146 |
-
'name'
|
147 |
-
'th'
|
148 |
-
'type'
|
149 |
-
'description'
|
150 |
'sanitize_callback' => 'absint',
|
151 |
-
'classes'
|
152 |
-
'default'
|
153 |
),
|
154 |
array(
|
155 |
-
'name'
|
156 |
-
'th'
|
157 |
-
'type'
|
158 |
-
'description'
|
159 |
'sanitize_callback' => 'absint',
|
160 |
-
'classes'
|
161 |
),
|
162 |
array(
|
163 |
-
'name'
|
164 |
-
'th'
|
165 |
-
'type'
|
166 |
-
'description'
|
167 |
'sanitize_callback' => 'esc_html',
|
168 |
-
'classes'
|
169 |
-
'rows'
|
170 |
),
|
171 |
array(
|
172 |
-
'name'
|
173 |
-
'th'
|
174 |
-
'type'
|
175 |
-
'description'
|
176 |
'sanitize_callback' => 'esc_html',
|
177 |
-
'classes'
|
178 |
-
'rows'
|
179 |
),
|
180 |
),
|
181 |
-
'metaboxes'
|
182 |
'loved_this_plugin' => array(
|
183 |
-
'title'
|
184 |
'callback' => 'iworks_orphan_options_loved_this_plugin',
|
185 |
-
'context'
|
186 |
'priority' => 'core',
|
187 |
),
|
188 |
-
'need_assistance'
|
189 |
-
'title'
|
190 |
'callback' => 'iworks_orphans_options_need_assistance',
|
191 |
-
'context'
|
192 |
'priority' => 'core',
|
193 |
),
|
194 |
),
|
@@ -198,16 +198,16 @@ function orphang_indicator_options() {
|
|
198 |
|
199 |
function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
|
200 |
|
201 |
-
?>
|
202 |
<p><?php _e( 'Below are some links to help spread this plugin to other users', 'sierotki' ); ?></p>
|
203 |
<ul>
|
204 |
-
|
205 |
-
|
206 |
</ul>
|
207 |
-
<?php
|
208 |
}
|
209 |
function iworks_orphan_taxonomies() {
|
210 |
-
$data
|
211 |
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
212 |
foreach ( $taxonomies as $taxonomy ) {
|
213 |
$data[ $taxonomy->name ] = $taxonomy->labels->name;
|
@@ -215,13 +215,13 @@ function iworks_orphan_taxonomies() {
|
|
215 |
return $data;
|
216 |
}
|
217 |
function iworks_orphan_post_types() {
|
218 |
-
$args
|
219 |
'public' => true,
|
220 |
);
|
221 |
-
$p
|
222 |
$post_types = get_post_types( $args, 'names' );
|
223 |
foreach ( $post_types as $post_type ) {
|
224 |
-
$a
|
225 |
$p[ $post_type ] = $a->labels->name;
|
226 |
}
|
227 |
return $p;
|
@@ -229,10 +229,10 @@ function iworks_orphan_post_types() {
|
|
229 |
|
230 |
function iworks_orphans_options_need_assistance( $iworks_orphans ) {
|
231 |
|
232 |
-
?>
|
233 |
<p><?php _e( 'Problems? The links bellow can be very helpful to you', 'sierotki' ); ?></p>
|
234 |
<ul>
|
235 |
-
|
236 |
</ul>
|
237 |
-
<?php
|
238 |
}
|
6 |
* main settings
|
7 |
*/
|
8 |
$options['index'] = array(
|
9 |
+
'use_tabs' => true,
|
10 |
+
'version' => '0.0',
|
11 |
+
'page_title' => __( 'Orphans configuration', 'sierotki' ),
|
12 |
+
'menu_title' => __( 'Orphans', 'sierotki' ),
|
13 |
+
'menu' => 'theme',
|
14 |
'enqueue_scripts' => array(),
|
15 |
+
'enqueue_styles' => array(),
|
16 |
+
'options' => array(
|
17 |
array(
|
18 |
+
'type' => 'heading',
|
19 |
+
'label' => __( 'Entries', 'sierotki' ),
|
20 |
),
|
21 |
/**
|
22 |
* Since 2.6.8
|
23 |
*/
|
24 |
array(
|
25 |
+
'name' => 'post_type',
|
26 |
+
'type' => 'select2',
|
27 |
+
'th' => __( 'Post types', 'sierotki' ),
|
28 |
+
'default' => array( 'post', 'page' ),
|
29 |
+
'options' => iworks_orphan_post_types(),
|
30 |
'multiple' => true,
|
31 |
),
|
32 |
array(
|
33 |
+
'name' => 'the_title',
|
34 |
+
'th' => __( 'Title', 'sierotki' ),
|
35 |
+
'type' => 'checkbox',
|
36 |
+
'description' => __( 'Enabled the substitution of orphans in the post_title.', 'sierotki' ),
|
37 |
'sanitize_callback' => 'absint',
|
38 |
+
'default' => 1,
|
39 |
+
'classes' => array( 'switch-button' ),
|
40 |
),
|
41 |
array(
|
42 |
+
'name' => 'the_excerpt',
|
43 |
+
'th' => __( 'Excerpt', 'sierotki' ),
|
44 |
+
'type' => 'checkbox',
|
45 |
+
'description' => __( 'Enabled the substitution of orphans in the excerpt.', 'sierotki' ),
|
46 |
'sanitize_callback' => 'absint',
|
47 |
+
'classes' => array( 'switch-button' ),
|
48 |
+
'default' => 1,
|
49 |
),
|
50 |
array(
|
51 |
+
'name' => 'the_content',
|
52 |
+
'th' => __( 'Content', 'sierotki' ),
|
53 |
+
'type' => 'checkbox',
|
54 |
+
'description' => __( 'Enabled the substitution of orphans in the content.', 'sierotki' ),
|
55 |
'sanitize_callback' => 'absint',
|
56 |
+
'classes' => array( 'switch-button' ),
|
57 |
+
'default' => true,
|
58 |
),
|
59 |
array(
|
60 |
+
'name' => 'comment_text',
|
61 |
+
'type' => 'checkbox',
|
62 |
+
'th' => __( 'Comments', 'sierotki' ),
|
63 |
+
'description' => __( 'Enabled the substitution of orphans in the comments.', 'sierotki' ),
|
64 |
'sanitize_callback' => 'absint',
|
65 |
+
'default' => 1,
|
66 |
+
'classes' => array( 'switch-button' ),
|
67 |
),
|
68 |
array(
|
69 |
+
'type' => 'heading',
|
70 |
+
'label' => __( 'Widgets', 'sierotki' ),
|
71 |
),
|
72 |
/**
|
73 |
* Since 2.6.6
|
74 |
*/
|
75 |
array(
|
76 |
+
'name' => 'widget_title',
|
77 |
+
'th' => __( 'Widget title', 'sierotki' ),
|
78 |
+
'type' => 'checkbox',
|
79 |
+
'description' => __( 'Enabled the substitution of orphans in the widget title.', 'sierotki' ),
|
80 |
'sanitize_callback' => 'absint',
|
81 |
+
'classes' => array( 'switch-button' ),
|
82 |
+
'default' => 1,
|
83 |
),
|
84 |
/**
|
85 |
* Since 2.6.6
|
86 |
*/
|
87 |
array(
|
88 |
+
'name' => 'widget_text',
|
89 |
+
'th' => __( 'Widget text', 'sierotki' ),
|
90 |
+
'type' => 'checkbox',
|
91 |
+
'description' => __( 'Enabled the substitution of orphans in the widget text.', 'sierotki' ),
|
92 |
'sanitize_callback' => 'absint',
|
93 |
+
'classes' => array( 'switch-button' ),
|
94 |
+
'default' => 1,
|
95 |
),
|
96 |
/**
|
97 |
* Since 2.6.6
|
98 |
*/
|
99 |
array(
|
100 |
+
'type' => 'heading',
|
101 |
+
'label' => __( 'Taxonomies', 'sierotki' ),
|
102 |
),
|
103 |
array(
|
104 |
+
'name' => 'taxonomies',
|
105 |
+
'type' => 'select2',
|
106 |
+
'th' => __( 'Taxonomies', 'sierotki' ),
|
107 |
+
'default' => array( 'category', 'post_tag', 'post_format' ),
|
108 |
+
'options' => iworks_orphan_taxonomies(),
|
109 |
'multiple' => true,
|
110 |
),
|
111 |
array(
|
112 |
+
'name' => 'taxonomy_title',
|
113 |
+
'th' => __( 'Title', 'sierotki' ),
|
114 |
+
'type' => 'checkbox',
|
115 |
+
'description' => __( 'Enabled the substitution of orphans in the taxonomy title.', 'sierotki' ),
|
116 |
'sanitize_callback' => 'absint',
|
117 |
+
'classes' => array( 'switch-button' ),
|
118 |
+
'default' => 1,
|
119 |
),
|
120 |
array(
|
121 |
+
'name' => 'term_description',
|
122 |
+
'th' => __( 'Description', 'sierotki' ),
|
123 |
+
'type' => 'checkbox',
|
124 |
+
'description' => __( 'Enabled the substitution of orphans in the taxonomy description.', 'sierotki' ),
|
125 |
'sanitize_callback' => 'absint',
|
126 |
+
'classes' => array( 'switch-button' ),
|
127 |
+
'default' => 1,
|
128 |
),
|
129 |
array(
|
130 |
+
'type' => 'heading',
|
131 |
+
'label' => __( 'Miscellaneous', 'sierotki' ),
|
132 |
),
|
133 |
/**
|
134 |
* Since 2.6.8
|
135 |
*/
|
136 |
array(
|
137 |
+
'name' => 'get_the_author_description',
|
138 |
+
'type' => 'checkbox',
|
139 |
+
'th' => __( 'Author description', 'sierotki' ),
|
140 |
+
'description' => __( 'Enabled the substitution of orphans in the author description.', 'sierotki' ),
|
141 |
'sanitize_callback' => 'absint',
|
142 |
+
'default' => 1,
|
143 |
+
'classes' => array( 'switch-button' ),
|
144 |
),
|
145 |
array(
|
146 |
+
'name' => 'ignore_language',
|
147 |
+
'th' => __( 'Ignore language', 'sierotki' ),
|
148 |
+
'type' => 'checkbox',
|
149 |
+
'description' => __( 'Allow to use plugin with another languages then Polish.', 'sierotki' ),
|
150 |
'sanitize_callback' => 'absint',
|
151 |
+
'classes' => array( 'switch-button' ),
|
152 |
+
'default' => 0,
|
153 |
),
|
154 |
array(
|
155 |
+
'name' => 'numbers',
|
156 |
+
'th' => __( 'Keep numbers together', 'sierotki' ),
|
157 |
+
'type' => 'checkbox',
|
158 |
+
'description' => __( 'Allow to keep together phone number or strings with space between numbers.', 'sierotki' ),
|
159 |
'sanitize_callback' => 'absint',
|
160 |
+
'classes' => array( 'switch-button' ),
|
161 |
),
|
162 |
array(
|
163 |
+
'name' => 'own_orphans',
|
164 |
+
'th' => __( 'User definied orphans', 'sierotki' ),
|
165 |
+
'type' => 'textarea',
|
166 |
+
'description' => __( 'Use a comma to separate orphans.', 'sierotki' ),
|
167 |
'sanitize_callback' => 'esc_html',
|
168 |
+
'classes' => array( 'large-text' ),
|
169 |
+
'rows' => 10,
|
170 |
),
|
171 |
array(
|
172 |
+
'name' => 'post_meta',
|
173 |
+
'th' => __( 'Entries custom fields', 'sierotki' ),
|
174 |
+
'type' => 'textarea',
|
175 |
+
'description' => __( 'Use a comma to separate custom fields name.', 'sierotki' ),
|
176 |
'sanitize_callback' => 'esc_html',
|
177 |
+
'classes' => array( 'large-text' ),
|
178 |
+
'rows' => 10,
|
179 |
),
|
180 |
),
|
181 |
+
'metaboxes' => array(
|
182 |
'loved_this_plugin' => array(
|
183 |
+
'title' => __( 'Loved this Plugin?', 'sierotki' ),
|
184 |
'callback' => 'iworks_orphan_options_loved_this_plugin',
|
185 |
+
'context' => 'side',
|
186 |
'priority' => 'core',
|
187 |
),
|
188 |
+
'need_assistance' => array(
|
189 |
+
'title' => __( 'Need Assistance?', 'sierotki' ),
|
190 |
'callback' => 'iworks_orphans_options_need_assistance',
|
191 |
+
'context' => 'side',
|
192 |
'priority' => 'core',
|
193 |
),
|
194 |
),
|
198 |
|
199 |
function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
|
200 |
|
201 |
+
?>
|
202 |
<p><?php _e( 'Below are some links to help spread this plugin to other users', 'sierotki' ); ?></p>
|
203 |
<ul>
|
204 |
+
<li><a href="https://wordpress.org/support/plugin/sierotki/reviews/#new-post"><?php _e( 'Give it a five stars on WordPress.org', 'sierotki' ); ?></a></li>
|
205 |
+
<li><a href="<?php _ex( 'https://wordpress.org/plugins/sierotki/', 'plugin home page on WordPress.org', 'sierotki' ); ?>"><?php _e( 'Link to it so others can easily find it', 'sierotki' ); ?></a></li>
|
206 |
</ul>
|
207 |
+
<?php
|
208 |
}
|
209 |
function iworks_orphan_taxonomies() {
|
210 |
+
$data = array();
|
211 |
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
212 |
foreach ( $taxonomies as $taxonomy ) {
|
213 |
$data[ $taxonomy->name ] = $taxonomy->labels->name;
|
215 |
return $data;
|
216 |
}
|
217 |
function iworks_orphan_post_types() {
|
218 |
+
$args = array(
|
219 |
'public' => true,
|
220 |
);
|
221 |
+
$p = array();
|
222 |
$post_types = get_post_types( $args, 'names' );
|
223 |
foreach ( $post_types as $post_type ) {
|
224 |
+
$a = get_post_type_object( $post_type );
|
225 |
$p[ $post_type ] = $a->labels->name;
|
226 |
}
|
227 |
return $p;
|
229 |
|
230 |
function iworks_orphans_options_need_assistance( $iworks_orphans ) {
|
231 |
|
232 |
+
?>
|
233 |
<p><?php _e( 'Problems? The links bellow can be very helpful to you', 'sierotki' ); ?></p>
|
234 |
<ul>
|
235 |
+
<li><a href="<?php _ex( 'https://wordpress.org/support/plugin/sierotki/', 'link to support forum on WordPress.org', 'sierotki' ); ?>"><?php _e( 'WordPress Help Forum', 'sierotki' ); ?></a></li>
|
236 |
</ul>
|
237 |
+
<?php
|
238 |
}
|
languages/sierotki.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the Orphans package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Orphans PLUGIN_VERSION\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
"X-Generator: grunt-wp-i18n 0.5.3\n"
|
@@ -180,87 +180,103 @@ msgstr ""
|
|
180 |
msgid "WordPress Help Forum"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: vendor/iworks/options/options.php:
|
184 |
msgid "An error occurred while getting the configuration."
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: vendor/iworks/options/options.php:
|
188 |
msgid "Upload image"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: vendor/iworks/options/options.php:
|
192 |
msgid "Delete image"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: vendor/iworks/options/options.php:
|
196 |
msgid "Save Changes"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: vendor/iworks/options/options.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
msgid "OFF"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: vendor/iworks/options/options.php:
|
204 |
msgid "ON"
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: vendor/iworks/orphan.php:
|
208 |
msgid "Plugin fix some Polish gramary rules with orphans."
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: vendor/iworks/orphan.php:
|
212 |
msgid "For more information:"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: vendor/iworks/orphan.php:
|
216 |
msgid ""
|
217 |
"<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
|
218 |
"target=\"_blank\">Plugin Homepage</a>"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: vendor/iworks/orphan.php:
|
222 |
msgid ""
|
223 |
"<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
|
224 |
"target=\"_blank\">Support Forums</a>"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: vendor/iworks/orphan.php:
|
228 |
msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: vendor/iworks/orphan.php:
|
232 |
msgid "Settings"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: vendor/iworks/orphan.php:
|
236 |
msgid "Donate"
|
237 |
msgstr ""
|
238 |
|
239 |
-
#: vendor/iworks/rate/rate.php:
|
240 |
msgid ""
|
241 |
-
"Hey %s, you've been using %s for a while now, and we hope you're happy
|
242 |
-
"it."
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: vendor/iworks/rate/rate.php:
|
246 |
msgid ""
|
247 |
"We've spent countless hours developing this free plugin for you, and we "
|
248 |
"would really appreciate it if you dropped us a quick rating!"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: vendor/iworks/rate/rate.php:
|
252 |
msgid "Thanks :)"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: vendor/iworks/rate/rate.php:
|
256 |
msgid "Rate %s"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: vendor/iworks/rate/rate.php:
|
260 |
msgid "Saving"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: vendor/iworks/rate/rate.php:
|
264 |
msgid "No thanks"
|
265 |
msgstr ""
|
266 |
|
1 |
+
# Copyright (C) 2019 Marcin Pietrzak
|
2 |
# This file is distributed under the same license as the Orphans package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Orphans PLUGIN_VERSION\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki\n"
|
7 |
+
"POT-Creation-Date: 2019-11-12 11:10:32+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
"X-Generator: grunt-wp-i18n 0.5.3\n"
|
180 |
msgid "WordPress Help Forum"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: vendor/iworks/options/options.php:237
|
184 |
msgid "An error occurred while getting the configuration."
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: vendor/iworks/options/options.php:734
|
188 |
msgid "Upload image"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: vendor/iworks/options/options.php:740
|
192 |
msgid "Delete image"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: vendor/iworks/options/options.php:808
|
196 |
msgid "Save Changes"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: vendor/iworks/options/options.php:1598
|
200 |
+
msgid "Country"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: vendor/iworks/options/options.php:1599
|
204 |
+
msgid "City"
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: vendor/iworks/options/options.php:1600
|
208 |
+
msgid "Street"
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#: vendor/iworks/options/options.php:1601
|
212 |
+
msgid "ZIP code"
|
213 |
+
msgstr ""
|
214 |
+
|
215 |
+
#: vendor/iworks/options/options.php:1754
|
216 |
msgid "OFF"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: vendor/iworks/options/options.php:1755
|
220 |
msgid "ON"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: vendor/iworks/orphan.php:208
|
224 |
msgid "Plugin fix some Polish gramary rules with orphans."
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: vendor/iworks/orphan.php:215
|
228 |
msgid "For more information:"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: vendor/iworks/orphan.php:216
|
232 |
msgid ""
|
233 |
"<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
|
234 |
"target=\"_blank\">Plugin Homepage</a>"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: vendor/iworks/orphan.php:217
|
238 |
msgid ""
|
239 |
"<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
|
240 |
"target=\"_blank\">Support Forums</a>"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: vendor/iworks/orphan.php:218
|
244 |
msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: vendor/iworks/orphan.php:321
|
248 |
msgid "Settings"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: vendor/iworks/orphan.php:341
|
252 |
msgid "Donate"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: vendor/iworks/rate/rate.php:373
|
256 |
msgid ""
|
257 |
+
"Hey %1$s, you've been using %2$s for a while now, and we hope you're happy "
|
258 |
+
"with it."
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: vendor/iworks/rate/rate.php:373
|
262 |
msgid ""
|
263 |
"We've spent countless hours developing this free plugin for you, and we "
|
264 |
"would really appreciate it if you dropped us a quick rating!"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: vendor/iworks/rate/rate.php:388
|
268 |
msgid "Thanks :)"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: vendor/iworks/rate/rate.php:391
|
272 |
msgid "Rate %s"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: vendor/iworks/rate/rate.php:396
|
276 |
msgid "Saving"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: vendor/iworks/rate/rate.php:397
|
280 |
msgid "No thanks"
|
281 |
msgstr ""
|
282 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: iworks
|
|
3 |
Donate link: http://iworks.pl/donate/sierotki.php
|
4 |
Tags: sierotka, sierotki, spójniki, twarda spacja
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag:
|
8 |
|
9 |
Plugin supports some of the grammatical rules of the Polish language.
|
10 |
|
@@ -61,7 +61,7 @@ Plugin works when viewing the content and does not modify your content.
|
|
61 |
Use this code:
|
62 |
|
63 |
`
|
64 |
-
if ( class_exists( 'iworks_orphan' ) {
|
65 |
$orphan = new iworks_orphan();
|
66 |
echo $orphan->replace( get_post_meta($post_id, 'meta_key', true ) );
|
67 |
}
|
@@ -72,7 +72,7 @@ if ( class_exists( 'iworks_orphan' ) {
|
|
72 |
Use this code:
|
73 |
|
74 |
`
|
75 |
-
if ( class_exists( 'iworks_orphan' ) {
|
76 |
$orphan = new iworks_orphan();
|
77 |
echo $orphan->replace( 'any_string' );
|
78 |
}
|
@@ -97,6 +97,14 @@ function my_orphans_capability($capability) {
|
|
97 |
|
98 |
== Changelog ==
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
= 2.7.4 - 2018-03-16 =
|
101 |
|
102 |
* Fixed problem with too greedy number replacement.
|
3 |
Donate link: http://iworks.pl/donate/sierotki.php
|
4 |
Tags: sierotka, sierotki, spójniki, twarda spacja
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 5.4.0
|
7 |
+
Stable tag: PLUGIN_VERSION
|
8 |
|
9 |
Plugin supports some of the grammatical rules of the Polish language.
|
10 |
|
61 |
Use this code:
|
62 |
|
63 |
`
|
64 |
+
if ( class_exists( 'iworks_orphan' ) ) {
|
65 |
$orphan = new iworks_orphan();
|
66 |
echo $orphan->replace( get_post_meta($post_id, 'meta_key', true ) );
|
67 |
}
|
72 |
Use this code:
|
73 |
|
74 |
`
|
75 |
+
if ( class_exists( 'iworks_orphan' ) ) {
|
76 |
$orphan = new iworks_orphan();
|
77 |
echo $orphan->replace( 'any_string' );
|
78 |
}
|
97 |
|
98 |
== Changelog ==
|
99 |
|
100 |
+
= 2.7.5 - 2019-11-12 =
|
101 |
+
|
102 |
+
* Fixed default values configuration.
|
103 |
+
* Handled quotation mark before orphan.
|
104 |
+
* Moved orphan's filters at the end of run, to try to avoid different plugins replacements.
|
105 |
+
* Split replacement rules to avoid problem with `regular expression is too large`.
|
106 |
+
* Updated [WordPress Options Class](https://github.com/iworks/wordpress-options-class) to version 2.6.8
|
107 |
+
|
108 |
= 2.7.4 - 2018-03-16 =
|
109 |
|
110 |
* Fixed problem with too greedy number replacement.
|
sierotki.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://iworks.pl/2011/02/16/sierotki/
|
|
5 |
Text Domain: sierotki
|
6 |
Description: Implement Polish grammar rules with orphans.
|
7 |
Author: Marcin Pietrzak
|
8 |
-
Version: 2.7.
|
9 |
Author URI: http://iworks.pl/
|
10 |
*/
|
11 |
|
5 |
Text Domain: sierotki
|
6 |
Description: Implement Polish grammar rules with orphans.
|
7 |
Author: Marcin Pietrzak
|
8 |
+
Version: 2.7.5
|
9 |
Author URI: http://iworks.pl/
|
10 |
*/
|
11 |
|
vendor/iworks/options/assets/scripts/common.js
CHANGED
@@ -1,79 +1,92 @@
|
|
1 |
-
jQuery(
|
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 |
* Tabulator Bootup
|
50 |
*/
|
51 |
function iworks_options_tabulator_init()
|
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 |
-
|
1 |
+
jQuery(
|
2 |
+
function(){
|
3 |
+
iworks_options_tabulator_init();
|
4 |
+
/**
|
5 |
+
* Switch button
|
6 |
+
*/
|
7 |
+
if ( jQuery.fn.switchButton ) {
|
8 |
+
jQuery( '.iworks_options .switch-button, .iworks-options-switch-button' ).each(
|
9 |
+
function() {
|
10 |
+
var options = {
|
11 |
+
checked: jQuery( this ).checked,
|
12 |
+
on_label: jQuery( this ).data( 'on_label' ) || switch_button.labels.on_label,
|
13 |
+
off_label: jQuery( this ).data( 'off_label' ) || switch_button.labels.off_label
|
14 |
+
};
|
15 |
+
jQuery( this ).switchButton( options );
|
16 |
+
}
|
17 |
+
);
|
18 |
+
}
|
19 |
+
/**
|
20 |
+
* Color picker
|
21 |
+
*/
|
22 |
+
if ( jQuery.fn.wpColorPicker ) {
|
23 |
+
jQuery( '.wpColorPicker' ).wpColorPicker();
|
24 |
+
}
|
25 |
+
/**
|
26 |
+
* select2
|
27 |
+
*/
|
28 |
+
if ( jQuery.fn.select2 ) {
|
29 |
+
jQuery( '.iworks-options .select2' ).select2();
|
30 |
+
}
|
31 |
+
/**
|
32 |
+
* slider
|
33 |
+
*/
|
34 |
+
if ( jQuery.fn.slider ) {
|
35 |
+
jQuery( '.iworks-options .slider' ).each(
|
36 |
+
function() {
|
37 |
+
jQuery( this ).parent().append( '<div class="ui-slider"></div>' );
|
38 |
+
var target = jQuery( this );
|
39 |
+
var options = {
|
40 |
+
value: parseInt( target.val() ),
|
41 |
+
step: parseInt( target.data( 'step' ) || target.attr( 'step' ) || 1 ),
|
42 |
+
min: parseInt( target.data( 'min' ) || target.attr( 'min' ) || 0 ),
|
43 |
+
max: parseInt( target.data( 'max' ) || target.attr( 'max' ) || 100 ),
|
44 |
+
slide: function( event, ui ) {
|
45 |
+
target.val( ui.value );
|
46 |
+
}
|
47 |
+
};
|
48 |
+
jQuery( '.ui-slider', jQuery( this ).parent() ).slider( options );
|
49 |
+
}
|
50 |
+
);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
);
|
54 |
/**
|
55 |
* Tabulator Bootup
|
56 |
*/
|
57 |
function iworks_options_tabulator_init()
|
58 |
{
|
59 |
+
if ( ! jQuery( "#hasadmintabs" ).length) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
jQuery( '#hasadmintabs' ).prepend( "<ul><\/ul>" );
|
63 |
+
jQuery( '#hasadmintabs > fieldset' ).each(
|
64 |
+
function(i){
|
65 |
+
id = jQuery( this ).attr( 'id' );
|
66 |
+
rel = jQuery( this ).attr( 'rel' );
|
67 |
+
caption = jQuery( this ).find( 'h3' ).text();
|
68 |
+
if ( rel ) {
|
69 |
+
rel = ' class="' + rel + '"';
|
70 |
+
}
|
71 |
+
jQuery( '#hasadmintabs > ul' ).append( '<li><a href="#' + id + '"><span' + rel + '>' + caption + "<\/span><\/a><\/li>" );
|
72 |
+
jQuery( this ).find( 'h3' ).hide();
|
73 |
+
}
|
74 |
+
);
|
75 |
+
index = 0;
|
76 |
+
jQuery( '#hasadmintabs h3' ).each(
|
77 |
+
function(i){
|
78 |
+
if ( jQuery( this ).hasClass( 'selected' ) ) {
|
79 |
+
index = i;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
);
|
83 |
+
if ( index < 0 ) {
|
84 |
+
index = 0;
|
85 |
+
}
|
86 |
+
jQuery( "#hasadmintabs" ).tabs( { active: index } );
|
87 |
+
jQuery( '#hasadmintabs ul a' ).click(
|
88 |
+
function(i){
|
89 |
+
jQuery( '#hasadmintabs #last_used_tab' ).val( jQuery( this ).parent().index() );
|
90 |
+
}
|
91 |
+
);
|
92 |
}
|
|
vendor/iworks/options/assets/scripts/jquery.switch_button.js
CHANGED
@@ -39,268 +39,274 @@
|
|
39 |
|
40 |
(function($) {
|
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 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
(function($) {
|
41 |
|
42 |
+
$.widget(
|
43 |
+
"sylightsUI.switchButton",
|
44 |
+
{
|
45 |
+
|
46 |
+
options: {
|
47 |
+
checked: undefined, // State of the switch
|
48 |
+
|
49 |
+
show_labels: true, // Should we show the on and off labels?
|
50 |
+
labels_placement: "both", // Position of the labels: "both", "left" or "right"
|
51 |
+
on_label: "ON", // Text to be displayed when checked
|
52 |
+
off_label: "OFF", // Text to be displayed when unchecked
|
53 |
+
|
54 |
+
width: 25, // Width of the button in pixels
|
55 |
+
height: 11, // Height of the button in pixels
|
56 |
+
button_width: 12, // Width of the sliding part in pixels
|
57 |
+
|
58 |
+
clear: true, // Should we insert a div with style="clear: both;" after the switch button?
|
59 |
+
clear_after: null, // Override the element after which the clearing div should be inserted (null > right after the button)
|
60 |
+
on_callback: undefined, //callback function that will be executed after going to on state
|
61 |
+
off_callback: undefined //callback function that will be executed after going to off state
|
62 |
+
},
|
63 |
+
|
64 |
+
_create: function() {
|
65 |
+
// Init the switch from the checkbox if no state was specified on creation
|
66 |
+
if (this.options.checked === undefined) {
|
67 |
+
this.options.checked = this.element.prop( "checked" );
|
68 |
+
}
|
69 |
+
|
70 |
+
this._initLayout();
|
71 |
+
this._initEvents();
|
72 |
+
},
|
73 |
+
|
74 |
+
_initLayout: function() {
|
75 |
+
// Hide the receiver element
|
76 |
+
this.element.hide();
|
77 |
+
|
78 |
+
// Create our objects: two labels and the button
|
79 |
+
this.off_label = $( "<span>" ).addClass( "switch-button-label" );
|
80 |
+
this.on_label = $( "<span>" ).addClass( "switch-button-label" );
|
81 |
+
|
82 |
+
this.button_bg = $( "<div>" ).addClass( "switch-button-background" );
|
83 |
+
this.button = $( "<div>" ).addClass( "switch-button-button" );
|
84 |
+
|
85 |
+
// Insert the objects into the DOM
|
86 |
+
this.off_label.insertAfter( this.element );
|
87 |
+
this.button_bg.insertAfter( this.off_label );
|
88 |
+
this.on_label.insertAfter( this.button_bg );
|
89 |
+
|
90 |
+
this.button_bg.append( this.button );
|
91 |
+
|
92 |
+
// Insert a clearing element after the specified element if needed
|
93 |
+
if (this.options.clear) {
|
94 |
+
if (this.options.clear_after === null) {
|
95 |
+
this.options.clear_after = this.on_label;
|
96 |
+
}
|
97 |
+
$( "<div>" ).css(
|
98 |
+
{
|
99 |
+
clear: "left"
|
100 |
+
}
|
101 |
+
).insertAfter( this.options.clear_after );
|
102 |
+
}
|
103 |
+
|
104 |
+
// Call refresh to update labels text and visibility
|
105 |
+
this._refresh();
|
106 |
+
|
107 |
+
// Init labels and switch state
|
108 |
+
// This will animate all checked switches to the ON position when
|
109 |
+
// loading... this is intentional!
|
110 |
+
this.options.checked = ! this.options.checked;
|
111 |
+
this._toggleSwitch( true );
|
112 |
+
},
|
113 |
+
|
114 |
+
_refresh: function() {
|
115 |
+
// Refresh labels display
|
116 |
+
if (this.options.show_labels) {
|
117 |
+
this.off_label.show();
|
118 |
+
this.on_label.show();
|
119 |
+
} else {
|
120 |
+
this.off_label.hide();
|
121 |
+
this.on_label.hide();
|
122 |
+
}
|
123 |
+
|
124 |
+
// Move labels around depending on labels_placement option
|
125 |
+
switch (this.options.labels_placement) {
|
126 |
+
case "both":
|
127 |
+
{
|
128 |
+
// Don't move anything if labels are already in place
|
129 |
+
if (this.button_bg.prev() !== this.off_label || this.button_bg.next() !== this.on_label) {
|
130 |
+
// Detach labels form DOM and place them correctly
|
131 |
+
this.off_label.detach();
|
132 |
+
this.on_label.detach();
|
133 |
+
this.off_label.insertBefore( this.button_bg );
|
134 |
+
this.on_label.insertAfter( this.button_bg );
|
135 |
+
|
136 |
+
// Update label classes
|
137 |
+
this.on_label.addClass( this.options.checked ? "on" : "off" ).removeClass( this.options.checked ? "off" : "on" );
|
138 |
+
this.off_label.addClass( this.options.checked ? "off" : "on" ).removeClass( this.options.checked ? "on" : "off" );
|
139 |
+
|
140 |
+
}
|
141 |
+
break;
|
142 |
+
}
|
143 |
+
|
144 |
+
case "left":
|
145 |
+
{
|
146 |
+
// Don't move anything if labels are already in place
|
147 |
+
if (this.button_bg.prev() !== this.on_label || this.on_label.prev() !== this.off_label) {
|
148 |
+
// Detach labels form DOM and place them correctly
|
149 |
+
this.off_label.detach();
|
150 |
+
this.on_label.detach();
|
151 |
+
this.off_label.insertBefore( this.button_bg );
|
152 |
+
this.on_label.insertBefore( this.button_bg );
|
153 |
+
|
154 |
+
// update label classes
|
155 |
+
this.on_label.addClass( "on" ).removeClass( "off" );
|
156 |
+
this.off_label.addClass( "off" ).removeClass( "on" );
|
157 |
+
}
|
158 |
+
break;
|
159 |
+
}
|
160 |
+
|
161 |
+
case "right":
|
162 |
+
{
|
163 |
+
// Don't move anything if labels are already in place
|
164 |
+
if (this.button_bg.next() !== this.off_label || this.off_label.next() !== this.on_label) {
|
165 |
+
// Detach labels form DOM and place them correctly
|
166 |
+
this.off_label.detach();
|
167 |
+
this.on_label.detach();
|
168 |
+
this.off_label.insertAfter( this.button_bg );
|
169 |
+
this.on_label.insertAfter( this.off_label );
|
170 |
+
|
171 |
+
// update label classes
|
172 |
+
this.on_label.addClass( "on" ).removeClass( "off" );
|
173 |
+
this.off_label.addClass( "off" ).removeClass( "on" );
|
174 |
+
}
|
175 |
+
break;
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
+
// Refresh labels texts
|
181 |
+
this.on_label.html( this.options.on_label );
|
182 |
+
this.off_label.html( this.options.off_label );
|
183 |
+
|
184 |
+
// Refresh button's dimensions
|
185 |
+
this.button_bg.width( this.options.width );
|
186 |
+
this.button_bg.height( this.options.height );
|
187 |
+
this.button.width( this.options.button_width );
|
188 |
+
this.button.height( this.options.height );
|
189 |
+
},
|
190 |
+
|
191 |
+
_initEvents: function() {
|
192 |
+
var self = this;
|
193 |
+
|
194 |
+
// Toggle switch when the switch is clicked
|
195 |
+
this.button_bg.click(
|
196 |
+
function(e) {
|
197 |
+
e.preventDefault();
|
198 |
+
e.stopPropagation();
|
199 |
+
self._toggleSwitch( false );
|
200 |
+
return false;
|
201 |
+
}
|
202 |
+
);
|
203 |
+
this.button.click(
|
204 |
+
function(e) {
|
205 |
+
e.preventDefault();
|
206 |
+
e.stopPropagation();
|
207 |
+
self._toggleSwitch( false );
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
);
|
211 |
+
|
212 |
+
// Set switch value when clicking labels
|
213 |
+
this.on_label.click(
|
214 |
+
function(e) {
|
215 |
+
if (self.options.checked && self.options.labels_placement === "both") {
|
216 |
+
return false;
|
217 |
+
}
|
218 |
+
|
219 |
+
self._toggleSwitch( false );
|
220 |
+
return false;
|
221 |
+
}
|
222 |
+
);
|
223 |
+
|
224 |
+
this.off_label.click(
|
225 |
+
function(e) {
|
226 |
+
if ( ! self.options.checked && self.options.labels_placement === "both") {
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
|
230 |
+
self._toggleSwitch( false );
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
);
|
234 |
+
|
235 |
+
},
|
236 |
+
|
237 |
+
_setOption: function(key, value) {
|
238 |
+
if (key === "checked") {
|
239 |
+
this._setChecked( value );
|
240 |
+
return;
|
241 |
+
}
|
242 |
+
|
243 |
+
this.options[key] = value;
|
244 |
+
this._refresh();
|
245 |
+
},
|
246 |
+
|
247 |
+
_setChecked: function(value) {
|
248 |
+
if (value === this.options.checked) {
|
249 |
+
return;
|
250 |
+
}
|
251 |
+
|
252 |
+
this.options.checked = ! value;
|
253 |
+
this._toggleSwitch( false );
|
254 |
+
},
|
255 |
+
|
256 |
+
_toggleSwitch: function(isInitializing) {
|
257 |
+
// Don't toggle the switch if it is set to readonly or disabled, unless it is initializing and animating itself
|
258 |
+
if ( ! isInitializing && (this.element.attr( 'readonly' ) == 'readonly' || this.element.prop( 'disabled' )) ) {
|
259 |
+
return;
|
260 |
+
}
|
261 |
+
|
262 |
+
this.options.checked = ! this.options.checked;
|
263 |
+
var newLeft = "";
|
264 |
+
if (this.options.checked) {
|
265 |
+
// Update the underlying checkbox state
|
266 |
+
this.element.prop( "checked", true );
|
267 |
+
this.element.change();
|
268 |
+
|
269 |
+
var dLeft = this.options.width - this.options.button_width;
|
270 |
+
newLeft = "+=" + dLeft;
|
271 |
+
|
272 |
+
// Update labels states
|
273 |
+
if (this.options.labels_placement == "both") {
|
274 |
+
this.off_label.removeClass( "on" ).addClass( "off" );
|
275 |
+
this.on_label.removeClass( "off" ).addClass( "on" );
|
276 |
+
} else {
|
277 |
+
this.off_label.hide();
|
278 |
+
this.on_label.show();
|
279 |
+
}
|
280 |
+
this.button_bg.addClass( "checked" );
|
281 |
+
//execute on state callback if its supplied
|
282 |
+
if (typeof this.options.on_callback === 'function') {
|
283 |
+
this.options.on_callback.call( this );
|
284 |
+
}
|
285 |
+
} else {
|
286 |
+
// Update the underlying checkbox state
|
287 |
+
this.element.prop( "checked", false );
|
288 |
+
this.element.change();
|
289 |
+
newLeft = "-1px";
|
290 |
+
|
291 |
+
// Update labels states
|
292 |
+
if (this.options.labels_placement == "both") {
|
293 |
+
this.off_label.removeClass( "off" ).addClass( "on" );
|
294 |
+
this.on_label.removeClass( "on" ).addClass( "off" );
|
295 |
+
} else {
|
296 |
+
this.off_label.show();
|
297 |
+
this.on_label.hide();
|
298 |
+
}
|
299 |
+
this.button_bg.removeClass( "checked" );
|
300 |
+
//execute off state callback if its supplied
|
301 |
+
if (typeof this.options.off_callback === 'function') {
|
302 |
+
this.options.off_callback.call( this );
|
303 |
+
}
|
304 |
+
}
|
305 |
+
// Animate the switch
|
306 |
+
this.button.animate( { left: newLeft }, 250, "easeInOutCubic" );
|
307 |
+
}
|
308 |
+
|
309 |
+
}
|
310 |
+
);
|
311 |
+
|
312 |
+
})( jQuery );
|
vendor/iworks/options/assets/styles/common.css
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* select2
|
3 |
-
*/
|
4 |
-
.iworks-options .select2 {
|
5 |
-
min-width: 300px;
|
6 |
-
}
|
7 |
-
.iworks-options .select2 .select2-selection {
|
8 |
-
border-color: #aaa;
|
9 |
-
}
|
10 |
-
/**
|
11 |
-
* ui-slider
|
12 |
-
*/
|
13 |
-
.iworks-options div.ui-slider span.ui-slider-handle {
|
14 |
-
background-color: #08b;
|
15 |
-
cursor: col-resize;
|
16 |
-
}
|
17 |
-
.iworks-options div.ui-slider {
|
18 |
-
margin-top: 10px;
|
19 |
-
max-width: 200px;
|
20 |
-
}
|
21 |
-
.iworks-options .iworks-options-type-wpcolorpicker span.description {
|
22 |
-
display: block;
|
23 |
-
}
|
24 |
-
/**
|
25 |
-
* switch-button
|
26 |
-
*/
|
27 |
-
.switch-button-background.checked {
|
28 |
-
background-color: #085;
|
29 |
-
}
|
30 |
-
/**
|
31 |
-
* tabs
|
32 |
-
*/
|
33 |
-
#hasadmintabs ul.ui-tabs-nav
|
34 |
-
{
|
35 |
-
border-bottom:1px solid #dfdfdf;
|
36 |
-
font-size:12px;
|
37 |
-
height:29px;
|
38 |
-
list-style-image:none;
|
39 |
-
list-style-position:outside;
|
40 |
-
list-style-type:none;
|
41 |
-
margin:13px 0 0;
|
42 |
-
overflow:visible;
|
43 |
-
padding:0 0 0 8px;
|
44 |
-
}
|
45 |
-
|
46 |
-
#hasadmintabs ul.ui-tabs-nav li
|
47 |
-
{
|
48 |
-
display:block;
|
49 |
-
float:left;
|
50 |
-
line-height:200%;
|
51 |
-
list-style-image:none;
|
52 |
-
list-style-position:outside;
|
53 |
-
list-style-type:none;
|
54 |
-
margin:0;
|
55 |
-
padding:0;
|
56 |
-
position:relative;
|
57 |
-
text-align:center;
|
58 |
-
white-space:nowrap;
|
59 |
-
width:auto;
|
60 |
-
}
|
61 |
-
|
62 |
-
#hasadmintabs ul.ui-tabs-nav li a {
|
63 |
-
background:transparent none no-repeat scroll 0 50%;
|
64 |
-
border-bottom:1px solid #dfdfdf;
|
65 |
-
display:block;
|
66 |
-
float:left;
|
67 |
-
line-height:28px;
|
68 |
-
padding:1px 13px 0;
|
69 |
-
position:relative;
|
70 |
-
text-decoration:none;
|
71 |
-
}
|
72 |
-
|
73 |
-
#hasadmintabs ul.ui-tabs-nav li.ui-tabs-selected a
|
74 |
-
,#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a {
|
75 |
-
-moz-border-radius-topleft:4px;
|
76 |
-
-moz-border-radius-topright:4px;
|
77 |
-
border:1px solid #dfdfdf;
|
78 |
-
border-bottom-color:#f9f9f9;
|
79 |
-
color:#333333;
|
80 |
-
font-weight:normal;
|
81 |
-
padding:0 12px;
|
82 |
-
}
|
83 |
-
|
84 |
-
#hasadmintabs ul.ui-tabs-nav a:focus, a:active {
|
85 |
-
outline-color:-moz-use-text-color;
|
86 |
-
outline-style:none;
|
87 |
-
outline-width:medium;
|
88 |
-
}
|
89 |
-
|
90 |
-
@media screen and (max-width: 782px) {
|
91 |
-
.has-right-sidebar .iworks-options #post-body-content {
|
92 |
-
margin: 0;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
/**
|
96 |
-
* ui-slider
|
97 |
-
*/
|
98 |
-
.iworks-options .ui-slider {
|
99 |
-
background-color: #aaa;
|
100 |
-
}
|
101 |
-
.ui-slider {
|
102 |
-
position: relative;
|
103 |
-
text-align: left;
|
104 |
-
}
|
105 |
-
.ui-slider .ui-slider-handle {
|
106 |
-
position: absolute;
|
107 |
-
z-index: 2;
|
108 |
-
width: 1.2em;
|
109 |
-
height: 1.2em;
|
110 |
-
cursor: default;
|
111 |
-
-ms-touch-action: none;
|
112 |
-
touch-action: none;
|
113 |
-
}
|
114 |
-
.ui-slider .ui-slider-range {
|
115 |
-
position: absolute;
|
116 |
-
z-index: 1;
|
117 |
-
font-size: .7em;
|
118 |
-
display: block;
|
119 |
-
border: 0;
|
120 |
-
background-position: 0 0;
|
121 |
-
}
|
122 |
-
|
123 |
-
/* support: IE8 - See #6727 */
|
124 |
-
.ui-slider.ui-state-disabled .ui-slider-handle,
|
125 |
-
.ui-slider.ui-state-disabled .ui-slider-range {
|
126 |
-
filter: inherit;
|
127 |
-
}
|
128 |
-
|
129 |
-
.ui-slider-horizontal {
|
130 |
-
height: .6em;
|
131 |
-
}
|
132 |
-
.ui-slider-horizontal .ui-slider-handle {
|
133 |
-
top: -.3em;
|
134 |
-
margin-left: -.6em;
|
135 |
-
}
|
136 |
-
.ui-slider-horizontal .ui-slider-range {
|
137 |
-
top: 0;
|
138 |
-
height: 100%;
|
139 |
-
}
|
140 |
-
.ui-slider-horizontal .ui-slider-range-min {
|
141 |
-
left: 0;
|
142 |
-
}
|
143 |
-
.ui-slider-horizontal .ui-slider-range-max {
|
144 |
-
right: 0;
|
145 |
-
}
|
146 |
-
|
147 |
-
.ui-slider-vertical {
|
148 |
-
width: .8em;
|
149 |
-
height: 100px;
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/iworks/options/assets/styles/jquery-ui.min.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.12.1 - 2018-08-23
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Includes: core.css, datepicker.css, tabs.css, theme.css
|
4 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?scope=&folderName=base&cornerRadiusShadow=8px&offsetLeftShadow=0px&offsetTopShadow=0px&thicknessShadow=5px&opacityShadow=30&bgImgOpacityShadow=0&bgTextureShadow=flat&bgColorShadow=666666&opacityOverlay=30&bgImgOpacityOverlay=0&bgTextureOverlay=flat&bgColorOverlay=aaaaaa&iconColorError=cc0000&fcError=5f3f3f&borderColorError=f1a899&bgTextureError=flat&bgColorError=fddfdf&iconColorHighlight=777620&fcHighlight=777620&borderColorHighlight=dad55e&bgTextureHighlight=flat&bgColorHighlight=fffa90&iconColorActive=ffffff&fcActive=ffffff&borderColorActive=003eff&bgTextureActive=flat&bgColorActive=007fff&iconColorHover=555555&fcHover=2b2b2b&borderColorHover=cccccc&bgTextureHover=flat&bgColorHover=ededed&iconColorDefault=777777&fcDefault=454545&borderColorDefault=c5c5c5&bgTextureDefault=flat&bgColorDefault=f6f6f6&iconColorContent=444444&fcContent=333333&borderColorContent=dddddd&bgTextureContent=flat&bgColorContent=ffffff&iconColorHeader=444444&fcHeader=333333&borderColorHeader=dddddd&bgTextureHeader=flat&bgColorHeader=e9e9e9&cornerRadius=3px&fwDefault=normal&fsDefault=1em&ffDefault=Arial%2CHelvetica%2Csans-serif
|
5 |
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
6 |
+
|
7 |
+
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
|
vendor/iworks/options/assets/styles/jquery.switch_button.css
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
.switch-button-label {
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
6 |
}
|
7 |
|
8 |
.switch-button-label.off {
|
9 |
-
|
10 |
}
|
11 |
|
12 |
.switch-button-label.on {
|
13 |
-
|
14 |
}
|
15 |
|
16 |
.switch-button-background {
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
}
|
31 |
|
32 |
.switch-button-button {
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
}
|
1 |
.switch-button-label {
|
2 |
+
float: left;
|
3 |
|
4 |
+
font-size: 10pt;
|
5 |
+
cursor: pointer;
|
6 |
}
|
7 |
|
8 |
.switch-button-label.off {
|
9 |
+
color: #adadad;
|
10 |
}
|
11 |
|
12 |
.switch-button-label.on {
|
13 |
+
color: #0088CC;
|
14 |
}
|
15 |
|
16 |
.switch-button-background {
|
17 |
+
float: left;
|
18 |
+
position: relative;
|
19 |
|
20 |
+
background: #ccc;
|
21 |
+
border: 1px solid #aaa;
|
22 |
|
23 |
+
margin: 1px 10px;
|
24 |
|
25 |
+
-webkit-border-radius: 4px;
|
26 |
+
-moz-border-radius: 4px;
|
27 |
+
border-radius: 4px;
|
28 |
|
29 |
+
cursor: pointer;
|
30 |
}
|
31 |
|
32 |
.switch-button-button {
|
33 |
+
position: absolute;
|
34 |
|
35 |
+
left: -1px;
|
36 |
+
top : -1px;
|
37 |
|
38 |
+
background: #FAFAFA;
|
39 |
+
border: 1px solid #aaa;
|
40 |
|
41 |
+
-webkit-border-radius: 4px;
|
42 |
+
-moz-border-radius: 4px;
|
43 |
+
border-radius: 4px;
|
44 |
}
|
vendor/iworks/options/assets/styles/options-admin.css
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.iworks-options #hasadmintabs,
|
2 |
+
.iworks-options #hasadmintabs .ui-widget-header {
|
3 |
+
border: 0;
|
4 |
+
background: transparent none;
|
5 |
+
}
|
6 |
+
.iworks-options #hasadmintabs .ui-widget-header {
|
7 |
+
border-bottom: 1px solid #c5c5c5;
|
8 |
+
}
|
9 |
+
.iworks-options #hasadmintabs .form-table td {
|
10 |
+
padding: 10px;
|
11 |
+
}
|
vendor/iworks/options/options.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Class Name: iWorks Options
|
4 |
Class URI: http://iworks.pl/
|
5 |
Description: Option class to manage options.
|
6 |
-
Version: 2.6.
|
7 |
Author: Marcin Pietrzak
|
8 |
Author URI: http://iworks.pl/
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
Copyright 2011-
|
13 |
|
14 |
this program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -40,10 +40,11 @@ class iworks_options {
|
|
40 |
private $option_group;
|
41 |
private $option_prefix;
|
42 |
private $version;
|
43 |
-
private $pagehooks
|
44 |
private $scripts_enqueued = array();
|
45 |
/**
|
46 |
* Controll class mode.
|
|
|
47 |
* @since 2.6.5
|
48 |
*/
|
49 |
private $mode = 'plugin';
|
@@ -55,14 +56,14 @@ class iworks_options {
|
|
55 |
* basic setup
|
56 |
*/
|
57 |
$this->notices = array();
|
58 |
-
$this->version = '2.6.
|
59 |
$this->option_group = 'index';
|
60 |
$this->option_function_name = null;
|
61 |
$this->option_prefix = null;
|
62 |
/**
|
63 |
* afer basic setup
|
64 |
*/
|
65 |
-
$this->files
|
66 |
/**
|
67 |
* hooks
|
68 |
*/
|
@@ -90,12 +91,26 @@ class iworks_options {
|
|
90 |
}
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
public function admin_menu() {
|
94 |
$data = $this->get_option_array();
|
95 |
if ( ! isset( $this->options ) ) {
|
96 |
return;
|
97 |
}
|
98 |
-
$pages
|
99 |
$pages['index'] = $data;
|
100 |
if ( isset( $data['pages'] ) ) {
|
101 |
$pages = $data['pages'] + $pages;
|
@@ -125,12 +140,12 @@ class iworks_options {
|
|
125 |
$this->pagehooks[ $key ] = add_submenu_page(
|
126 |
$data['parent'],
|
127 |
$data['page_title'],
|
128 |
-
isset( $data['menu_title'] )? $data['menu_title']
|
129 |
apply_filters( 'iworks_options_capability', 'manage_options', 'settings' ),
|
130 |
-
isset( $data['menu_slug'] )? $data['menu_slug']: $this->get_option_name( $key ),
|
131 |
$callback
|
132 |
);
|
133 |
-
add_action( 'load-'
|
134 |
}
|
135 |
} else {
|
136 |
switch ( $data['menu'] ) {
|
@@ -147,20 +162,20 @@ class iworks_options {
|
|
147 |
case 'theme':
|
148 |
case 'users':
|
149 |
$function = sprintf( 'add_%s_page', $data['menu'] );
|
150 |
-
|
151 |
default:
|
152 |
$function = 'add_menu_page';
|
153 |
-
|
154 |
}
|
155 |
if ( isset( $data['page_title'] ) ) {
|
156 |
$this->pagehooks[ $key ] = $function(
|
157 |
$data['page_title'],
|
158 |
-
isset( $data['menu_title'] )? $data['menu_title']
|
159 |
'manage_options',
|
160 |
$this->get_option_name( $key ),
|
161 |
array( $this, 'show_page' )
|
162 |
);
|
163 |
-
add_action( 'load-'
|
164 |
}
|
165 |
}
|
166 |
}
|
@@ -178,30 +193,33 @@ class iworks_options {
|
|
178 |
$this->option_prefix = $option_prefix;
|
179 |
}
|
180 |
|
181 |
-
private function get_option_array() {
|
|
|
|
|
|
|
182 |
$options = array();
|
183 |
-
if ( array_key_exists( $
|
184 |
$options = apply_filters( $this->option_function_name, $this->options );
|
185 |
-
return $options[ $
|
186 |
}
|
187 |
if ( is_callable( $this->option_function_name ) ) {
|
188 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
189 |
}
|
190 |
-
if ( array_key_exists( $
|
191 |
-
$this->options[ $
|
192 |
-
return apply_filters( $this->option_function_name, $this->options[ $
|
193 |
}
|
194 |
return apply_filters( $this->option_function_name, array() );
|
195 |
}
|
196 |
|
197 |
public function build_options( $option_group = 'index', $echo = true, $term_id = false ) {
|
198 |
$this->option_group = $option_group;
|
199 |
-
$options
|
200 |
/**
|
201 |
* add some defaults
|
202 |
*/
|
203 |
$options['show_submit_button'] = true;
|
204 |
-
$options['add_table']
|
205 |
if ( ! array_key_exists( 'type', $options ) ) {
|
206 |
$options['type'] = 'option';
|
207 |
}
|
@@ -210,13 +228,13 @@ class iworks_options {
|
|
210 |
*/
|
211 |
if ( 'taxonomy' == $options['type'] ) {
|
212 |
$options['show_submit_button'] = false;
|
213 |
-
$options['add_table']
|
214 |
}
|
215 |
/**
|
216 |
* check options exists?
|
217 |
*/
|
218 |
if ( ! is_array( $options['options'] ) ) {
|
219 |
-
echo '<div class="below-h2 error"><p><strong>'.__( 'An error occurred while getting the configuration.', 'sierotki' ).'</strong></p></div>';
|
220 |
return;
|
221 |
}
|
222 |
/**
|
@@ -232,9 +250,9 @@ class iworks_options {
|
|
232 |
*/
|
233 |
if ( $use_tabs ) {
|
234 |
$field = array(
|
235 |
-
'type'
|
236 |
-
'name'
|
237 |
-
'id'
|
238 |
'value' => $this->get_option( 'last_used_tab' ),
|
239 |
);
|
240 |
array_unshift( $options['options'], $field );
|
@@ -248,10 +266,10 @@ class iworks_options {
|
|
248 |
$this->option_prefix
|
249 |
);
|
250 |
}
|
251 |
-
$i
|
252 |
-
$label_index
|
253 |
-
$last_tab
|
254 |
-
$related_to
|
255 |
$configuration = 'all';
|
256 |
foreach ( $options['options'] as $option ) {
|
257 |
if ( isset( $option['capability'] ) ) {
|
@@ -322,18 +340,21 @@ class iworks_options {
|
|
322 |
if ( isset( $option['configuration'] ) && 'both' == $option['configuration'] ) {
|
323 |
continue;
|
324 |
}
|
325 |
-
if ( in_array(
|
326 |
-
'
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
|
|
|
|
|
|
337 |
'<input type="hidden" name="%s" value="%s" /> %s',
|
338 |
$html_element_name,
|
339 |
$this->get_option( $option_name, $option_group ),
|
@@ -358,7 +379,7 @@ class iworks_options {
|
|
358 |
$content .= sprintf(
|
359 |
'<fieldset id="iworks_%s" class="ui-tabs-panel ui-widget-content ui-corner-bottom"%s>',
|
360 |
crc32( $option['label'] ),
|
361 |
-
( isset( $option['class'] ) && $option['class'] )? ' rel="'
|
362 |
);
|
363 |
if ( ! $use_tabs ) {
|
364 |
$content .= sprintf( '<h3>%s</h3>', $option['label'] );
|
@@ -366,8 +387,8 @@ class iworks_options {
|
|
366 |
if ( $options['add_table'] ) {
|
367 |
$content .= sprintf(
|
368 |
'<table class="form-table%s" style="%s">',
|
369 |
-
isset( $options['widefat'] )? ' widefat':'',
|
370 |
-
isset( $options['style'] )? $options['style']:''
|
371 |
);
|
372 |
$content .= '<tbody>';
|
373 |
}
|
@@ -381,22 +402,22 @@ class iworks_options {
|
|
381 |
}
|
382 |
$content .= sprintf(
|
383 |
'<tr valign="top" id="tr_%s" class="%s">',
|
384 |
-
esc_attr( $option_name? $option_name:'' ),
|
385 |
implode( ' ', $tr_classes )
|
386 |
);
|
387 |
$content .= sprintf(
|
388 |
'<th scope="row">%s%s</th>',
|
389 |
-
isset( $option['dashicon'] ) && $option['dashicon']? sprintf( '<span class="dashicons dashicons-%s"></span> ', $option['dashicon'] ):'',
|
390 |
-
isset( $option['th'] ) && $option['th']? $option['th']:' '
|
391 |
);
|
392 |
$content .= '<td>';
|
393 |
}
|
394 |
-
$html_element_name = $option_name? $this->option_prefix
|
395 |
-
$filter_name
|
396 |
/**
|
397 |
* classes
|
398 |
*/
|
399 |
-
$classes
|
400 |
$classes[] = sprintf( 'option-%s', $option['type'] );
|
401 |
/**
|
402 |
* build
|
@@ -407,11 +428,11 @@ class iworks_options {
|
|
407 |
'<input type="hidden" name="%s" value="%s" id="%s" />',
|
408 |
esc_attr( $html_element_name ),
|
409 |
esc_attr( $this->get_option( $option_name, $option_group ) ),
|
410 |
-
esc_attr( isset( $option['id'] )? $option['id']:'' )
|
411 |
);
|
412 |
-
|
413 |
case 'number':
|
414 |
-
$args
|
415 |
$args_keys = array( 'min', 'max', 'step' );
|
416 |
foreach ( $args_keys as $arg_key ) {
|
417 |
if ( isset( $option[ $arg_key ] ) ) {
|
@@ -428,9 +449,9 @@ class iworks_options {
|
|
428 |
$this->get_option( $option_name, $option_group ),
|
429 |
esc_attr( implode( ' ', $classes ) ),
|
430 |
$this->build_field_attributes( $args ),
|
431 |
-
isset( $option['label'] )? $option['label']:''
|
432 |
);
|
433 |
-
|
434 |
case 'email':
|
435 |
case 'password':
|
436 |
case 'text':
|
@@ -446,23 +467,23 @@ class iworks_options {
|
|
446 |
$this->get_option( $option_name, $option_group ),
|
447 |
esc_attr( implode( ' ', $classes ) ),
|
448 |
$id,
|
449 |
-
isset( $option['label'] )? $option['label']:''
|
450 |
);
|
451 |
-
|
452 |
case 'checkbox':
|
453 |
$related_to[ $option_name ] = $this->get_option( $option_name, $option_group );
|
454 |
-
$checkbox
|
455 |
'<label for="%s"><input type="checkbox" name="%s" id="%s" value="1"%s%s class="%s" /> %s</label>',
|
456 |
$html_element_name,
|
457 |
$html_element_name,
|
458 |
$html_element_name,
|
459 |
-
$related_to[ $option_name ]
|
460 |
-
( ( isset( $option['disabled'] ) && $option['disabled'] ) or ( isset( $option['need_pro'] ) && $option['need_pro'] ) )? ' disabled="disabled"':'',
|
461 |
esc_attr( implode( ' ', $classes ) ),
|
462 |
-
isset( $option['label'] )? $option['label']:''
|
463 |
);
|
464 |
-
$content
|
465 |
-
|
466 |
case 'checkbox_group':
|
467 |
$option_value = $this->get_option( $option_name, $option_group );
|
468 |
if ( empty( $option_value ) && isset( $option['defaults'] ) ) {
|
@@ -471,7 +492,7 @@ class iworks_options {
|
|
471 |
}
|
472 |
}
|
473 |
$content .= '<ul>';
|
474 |
-
$i
|
475 |
if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
|
476 |
$option['options'] = array_merge( $option['options'], $option['extra_options']() );
|
477 |
}
|
@@ -480,30 +501,30 @@ class iworks_options {
|
|
480 |
if ( is_array( $option_value ) && array_key_exists( $value, $option_value ) ) {
|
481 |
$checked = true;
|
482 |
}
|
483 |
-
$id
|
484 |
$content .= sprintf(
|
485 |
'<li><label for="%s"><input type="checkbox" name="%s[%s]" value="%s"%s id="%s"/> %s</label></li>',
|
486 |
$id,
|
487 |
$html_element_name,
|
488 |
$value,
|
489 |
$value,
|
490 |
-
$checked
|
491 |
$id,
|
492 |
$label
|
493 |
);
|
494 |
}
|
495 |
$content .= '</ul>';
|
496 |
-
|
497 |
case 'radio':
|
498 |
$option_value = $this->get_option( $option_name, $option_group );
|
499 |
-
$i
|
500 |
/**
|
501 |
* check user add "radio" or "options".
|
502 |
*/
|
503 |
$radio_options = array();
|
504 |
if ( array_key_exists( 'options', $option ) ) {
|
505 |
$radio_options = $option['options'];
|
506 |
-
}
|
507 |
$radio_options = $option['radio'];
|
508 |
}
|
509 |
if ( empty( $radio_options ) ) {
|
@@ -515,11 +536,11 @@ class iworks_options {
|
|
515 |
/**
|
516 |
* add extra options, maybe dynamic?
|
517 |
*/
|
518 |
-
$radio_options = apply_filters( $filter_name.'_data', $radio_options );
|
519 |
-
$radio
|
520 |
if ( empty( $radio ) ) {
|
521 |
foreach ( $radio_options as $value => $input ) {
|
522 |
-
$id
|
523 |
$disabled = '';
|
524 |
if ( preg_match( '/\-disabled$/', $value ) ) {
|
525 |
$disabled = 'disabled="disabled"';
|
@@ -527,14 +548,15 @@ class iworks_options {
|
|
527 |
$disabled = 'disabled="disabled"';
|
528 |
}
|
529 |
$classes[] = sanitize_title( $value );
|
530 |
-
$
|
|
|
531 |
'<li class="%s%s"><label for="%s"><input type="radio" name="%s" value="%s"%s id="%s" %s/> %s</label>',
|
532 |
esc_attr( implode( ' ', $classes ) ),
|
533 |
-
$disabled? ' disabled':'',
|
534 |
esc_attr( $id ),
|
535 |
esc_attr( $html_element_name ),
|
536 |
esc_attr( $value ),
|
537 |
-
(
|
538 |
esc_attr( $id ),
|
539 |
$disabled,
|
540 |
esc_html( $input['label'] )
|
@@ -561,14 +583,14 @@ class iworks_options {
|
|
561 |
}
|
562 |
$content .= apply_filters( $filter_name, $radio );
|
563 |
}
|
564 |
-
|
565 |
case 'select':
|
566 |
case 'select2':
|
567 |
$extra = $name_sufix = '';
|
568 |
if ( 'select2' == $option['type'] ) {
|
569 |
$classes[] = 'select2';
|
570 |
if ( isset( $option['multiple'] ) && $option['multiple'] ) {
|
571 |
-
$extra
|
572 |
$name_sufix = '[]';
|
573 |
}
|
574 |
}
|
@@ -582,9 +604,9 @@ class iworks_options {
|
|
582 |
if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
|
583 |
$option['options'] = array_merge( $option['options'], $option['extra_options']() );
|
584 |
}
|
585 |
-
$option['options'] = apply_filters( $filter_name.'_data', $option['options'], $option_name, $option_value );
|
586 |
-
$select
|
587 |
-
$select
|
588 |
if ( empty( $select ) ) {
|
589 |
foreach ( $option['options'] as $key => $value ) {
|
590 |
$disabled = '';
|
@@ -600,11 +622,11 @@ class iworks_options {
|
|
600 |
$selected = in_array( $key, $option_value );
|
601 |
}
|
602 |
} else {
|
603 |
-
$selected = ($option_value == $key or ( empty( $option_value ) and isset( $option['default'] ) and $key == $option['default'] ) );
|
604 |
}
|
605 |
$select .= sprintf(
|
606 |
'<option %s value="%s" %s %s >%s</option>',
|
607 |
-
$disabled? 'class="disabled"':'',
|
608 |
$key,
|
609 |
selected( $selected, true, false ),
|
610 |
$disabled,
|
@@ -624,16 +646,16 @@ class iworks_options {
|
|
624 |
}
|
625 |
}
|
626 |
$content .= apply_filters( $filter_name, $select );
|
627 |
-
|
628 |
case 'textarea':
|
629 |
-
$value
|
630 |
-
$value
|
631 |
-
$args
|
632 |
-
'rows'
|
633 |
-
'class' => isset( $option['classes'] )? implode( ' ', $option['classes'] ):'',
|
634 |
);
|
635 |
$content .= $this->textarea( $html_element_name, $value, $args );
|
636 |
-
|
637 |
case 'heading':
|
638 |
if ( isset( $option['label'] ) && $option['label'] ) {
|
639 |
$classes = array();
|
@@ -643,16 +665,16 @@ class iworks_options {
|
|
643 |
$content .= sprintf(
|
644 |
'<h3 id="options-%s"%s>%s</h3>',
|
645 |
sanitize_title_with_dashes( remove_accents( $option['label'] ) ),
|
646 |
-
count( $classes )? ' class="'.implode( ' ', $classes ).'"':'',
|
647 |
$option['label']
|
648 |
);
|
649 |
$label_index++;
|
650 |
$i = 0;
|
651 |
}
|
652 |
-
|
653 |
case 'info':
|
654 |
$content .= $option['value'];
|
655 |
-
|
656 |
case 'serialize':
|
657 |
if ( isset( $option['callback'] ) && is_callable( $option['callback'] ) ) {
|
658 |
$content .= $option['callback']( $this->get_option( $option_name, $option_group ), $option_name );
|
@@ -662,10 +684,10 @@ class iworks_options {
|
|
662 |
$content .= ob_get_contents();
|
663 |
ob_end_clean();
|
664 |
}
|
665 |
-
|
666 |
case 'subheading':
|
667 |
$content .= sprintf( '<h4 class="title">%s</h4>', $option['label'] );
|
668 |
-
|
669 |
case 'wpColorPicker':
|
670 |
if ( is_admin() ) {
|
671 |
wp_enqueue_style( 'wp-color-picker' );
|
@@ -681,25 +703,25 @@ class iworks_options {
|
|
681 |
'<input type="text" name="%s" value="%s" class="wpColorPicker %s"%s%s /> %s',
|
682 |
$html_element_name,
|
683 |
$this->get_option( $option_name, $option_group ),
|
684 |
-
isset( $option['class'] ) && $option['class']? $option['class']:'',
|
685 |
$id,
|
686 |
-
( isset( $option['need_pro'] ) and $option['need_pro'] )? ' disabled="disabled"':'',
|
687 |
-
isset( $option['label'] )? $option['label']:'',
|
688 |
$html_element_name
|
689 |
)
|
690 |
);
|
691 |
-
|
692 |
case 'image':
|
693 |
if ( isset( $option['description'] ) && $option['description'] ) {
|
694 |
printf( '<p class="description">%s</p>', $option['description'] );
|
695 |
}
|
696 |
-
$value
|
697 |
$content .= sprintf(
|
698 |
'<img id="%s_img" src="%s" alt="" style="%s%sclear:right;display:block;margin-bottom:10px;" />',
|
699 |
$html_element_name,
|
700 |
-
$value? $value : '',
|
701 |
-
array_key_exists( 'max-width', $option ) && is_integer( $option['max-width'] )? sprintf( 'max-width: %dpx;', $option['max-width'] ):'',
|
702 |
-
array_key_exists( 'max-height', $option ) && is_integer( $option['max-height'] )? sprintf( 'max-height: %dpx;', $option['max-height'] ):''
|
703 |
);
|
704 |
$content .= sprintf(
|
705 |
'<input type="hidden" name="%s" id="%s" value="%s" />',
|
@@ -719,7 +741,7 @@ class iworks_options {
|
|
719 |
$html_element_name
|
720 |
);
|
721 |
}
|
722 |
-
|
723 |
default:
|
724 |
$content .= sprintf( 'not implemented type: %s', $option['type'] );
|
725 |
}
|
@@ -753,16 +775,16 @@ class iworks_options {
|
|
753 |
$content .= '</tbody></table>';
|
754 |
}
|
755 |
$content .= '</fieldset>';
|
756 |
-
$content
|
757 |
} else {
|
758 |
if ( $options['add_table'] ) {
|
759 |
-
$top .= sprintf( '<table class="form-table%s" style="%s">', isset( $options['widefat'] )? ' widefat':'', isset( $options['style'] )? $options['style']:'' );
|
760 |
if ( isset( $options['thead'] ) ) {
|
761 |
$top .= sprintf( '<thead><tr class="%s">', implode( ' ', $tr_classes ) );
|
762 |
foreach ( $options['thead'] as $text => $colspan ) {
|
763 |
$top .= sprintf(
|
764 |
'<th%s>%s</th>',
|
765 |
-
$colspan > 1? ' colspan="'
|
766 |
$text
|
767 |
);
|
768 |
}
|
@@ -770,7 +792,7 @@ class iworks_options {
|
|
770 |
}
|
771 |
$top .= '<tbody>';
|
772 |
}
|
773 |
-
$content = $top
|
774 |
if ( $options['add_table'] ) {
|
775 |
$content .= '</tbody></table>';
|
776 |
}
|
@@ -783,7 +805,7 @@ class iworks_options {
|
|
783 |
* submit button
|
784 |
*/
|
785 |
if ( $options['show_submit_button'] ) {
|
786 |
-
$content .= get_submit_button( __( 'Save Changes' ), 'primary', 'submit_button' );
|
787 |
}
|
788 |
/**
|
789 |
* iworks-options wrapper
|
@@ -802,7 +824,7 @@ class iworks_options {
|
|
802 |
/**
|
803 |
* don't register setting without type and name
|
804 |
*/
|
805 |
-
if ( ! array_key_exists( 'type', $option ) || ! array_key_exists( 'name', $option ) ) {
|
806 |
continue;
|
807 |
}
|
808 |
/**
|
@@ -815,9 +837,9 @@ class iworks_options {
|
|
815 |
* register setting
|
816 |
*/
|
817 |
register_setting(
|
818 |
-
$this->option_prefix
|
819 |
-
$this->option_prefix
|
820 |
-
isset( $option['sanitize_callback'] )? $option['sanitize_callback']:array( $this, 'sanitize_callback' )
|
821 |
);
|
822 |
}
|
823 |
}
|
@@ -835,7 +857,7 @@ class iworks_options {
|
|
835 |
$field = array(
|
836 |
'type' => 'hidden',
|
837 |
'name' => 'last_used_tab',
|
838 |
-
'id'
|
839 |
);
|
840 |
array_unshift( $options[ $key ]['options'], $field );
|
841 |
}
|
@@ -858,17 +880,17 @@ class iworks_options {
|
|
858 |
|
859 |
public function get_values( $option_name, $option_group = 'index' ) {
|
860 |
$this->option_group = $option_group;
|
861 |
-
$data
|
862 |
-
$data
|
863 |
foreach ( $data as $one ) {
|
864 |
if ( isset( $one['name'] ) && $one['name'] != $option_name ) {
|
865 |
continue;
|
866 |
}
|
867 |
switch ( $one['type'] ) {
|
868 |
case 'checkbox_group':
|
869 |
-
|
870 |
case 'radio':
|
871 |
-
|
872 |
}
|
873 |
}
|
874 |
return;
|
@@ -876,7 +898,7 @@ class iworks_options {
|
|
876 |
|
877 |
public function get_default_value( $option_name, $option_group = 'index' ) {
|
878 |
$this->option_group = $option_group;
|
879 |
-
$options
|
880 |
/**
|
881 |
* check options exists?
|
882 |
*/
|
@@ -891,12 +913,12 @@ class iworks_options {
|
|
891 |
* default name for taxonomies
|
892 |
*/
|
893 |
if ( array_key_exists( 'type', $options ) && 'taxonomy' == $options['type'] ) {
|
894 |
-
$re
|
895 |
$default_option_name = preg_replace( $re, '', $default_option_name );
|
896 |
}
|
897 |
foreach ( $options['options'] as $option ) {
|
898 |
if ( isset( $option['name'] ) && $option['name'] == $default_option_name ) {
|
899 |
-
return isset( $option['default'] )? $option['default']:null;
|
900 |
}
|
901 |
}
|
902 |
return null;
|
@@ -906,20 +928,28 @@ class iworks_options {
|
|
906 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
907 |
foreach ( $options as $key => $data ) {
|
908 |
foreach ( $data['options'] as $option ) {
|
909 |
-
if (
|
|
|
|
|
|
|
|
|
910 |
continue;
|
911 |
}
|
912 |
-
add_option( $this->option_prefix
|
913 |
}
|
914 |
}
|
915 |
-
add_option( $this->option_prefix.'cache_stamp', date( 'c' ) );
|
916 |
}
|
917 |
|
918 |
public function deactivate() {
|
919 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
920 |
foreach ( $options as $key => $data ) {
|
921 |
foreach ( $data['options'] as $option ) {
|
922 |
-
if (
|
|
|
|
|
|
|
|
|
923 |
continue;
|
924 |
}
|
925 |
/**
|
@@ -928,12 +958,12 @@ class iworks_options {
|
|
928 |
if ( isset( $option['dont_deactivate'] ) && $option['dont_deactivate'] ) {
|
929 |
continue;
|
930 |
}
|
931 |
-
delete_option( $this->option_prefix
|
932 |
}
|
933 |
}
|
934 |
-
delete_option( $this->option_prefix.'cache_stamp' );
|
935 |
-
delete_option( $this->option_prefix.'version' );
|
936 |
-
delete_option( $this->option_prefix.'flush_rules' );
|
937 |
}
|
938 |
|
939 |
public function settings_fields( $option_name, $use_prefix = true ) {
|
@@ -960,12 +990,12 @@ class iworks_options {
|
|
960 |
* options: add, get, update
|
961 |
*/
|
962 |
public function add_option( $option_name, $option_value, $autoload = true ) {
|
963 |
-
$autoload = $autoload? 'yes':'no';
|
964 |
-
add_option( $this->option_prefix
|
965 |
}
|
966 |
|
967 |
public function get_option( $option_name, $option_group = 'index', $default_value = null, $forece_default = false ) {
|
968 |
-
$option_value
|
969 |
$default_value = $this->get_default_value( $option_name, $option_group );
|
970 |
if ( ( $default_value || $forece_default ) && is_null( $option_value ) ) {
|
971 |
$option_value = $default_value;
|
@@ -974,7 +1004,7 @@ class iworks_options {
|
|
974 |
}
|
975 |
|
976 |
public function get_all_options() {
|
977 |
-
$data
|
978 |
$options = $this->get_option_array();
|
979 |
foreach ( $options['options'] as $option ) {
|
980 |
if ( ! array_key_exists( 'name', $option ) || ! $option['name'] ) {
|
@@ -995,7 +1025,7 @@ class iworks_options {
|
|
995 |
* @since 1.0
|
996 |
* @since 2.6.4 Added `hidden` argument.
|
997 |
*
|
998 |
-
* @param string
|
999 |
* @param boolean $hidden If this hidden value.
|
1000 |
*
|
1001 |
* @return string $option_name
|
@@ -1012,12 +1042,12 @@ class iworks_options {
|
|
1012 |
/**
|
1013 |
* delete if option have a default value
|
1014 |
*/
|
1015 |
-
$default_value = $this->get_default_value( $this->option_prefix
|
1016 |
if ( $option_name === $default_value ) {
|
1017 |
-
delete_option( $this->option_prefix
|
1018 |
return;
|
1019 |
}
|
1020 |
-
update_option( $this->option_prefix
|
1021 |
}
|
1022 |
|
1023 |
/**
|
@@ -1025,7 +1055,7 @@ class iworks_options {
|
|
1025 |
*/
|
1026 |
public function update_taxonomy_options( $option_group, $term_id ) {
|
1027 |
$this->option_group = $option_group;
|
1028 |
-
$options
|
1029 |
/**
|
1030 |
* only for taxonomies
|
1031 |
*/
|
@@ -1045,7 +1075,7 @@ class iworks_options {
|
|
1045 |
$term_id,
|
1046 |
$option['name']
|
1047 |
);
|
1048 |
-
$value
|
1049 |
if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
|
1050 |
$value = call_user_func( $option['sanitize_callback'], $value );
|
1051 |
}
|
@@ -1062,18 +1092,18 @@ class iworks_options {
|
|
1062 |
*/
|
1063 |
public function select_page_helper( $name, $show_option_none = false, $post_type = 'page' ) {
|
1064 |
$args = array(
|
1065 |
-
'echo'
|
1066 |
-
'name'
|
1067 |
-
'selected'
|
1068 |
'show_option_none' => $show_option_none,
|
1069 |
-
'post_type'
|
1070 |
);
|
1071 |
return wp_dropdown_pages( $args );
|
1072 |
}
|
1073 |
|
1074 |
public function select_category_helper( $name, $hide_empty = null, $show_option_none = false ) {
|
1075 |
$args = array(
|
1076 |
-
'echo'
|
1077 |
'name' => $this->get_option_name( $name ),
|
1078 |
'selected' => $this->get_option( $name ),
|
1079 |
'hierarchical' => true,
|
@@ -1091,7 +1121,7 @@ class iworks_options {
|
|
1091 |
|
1092 |
private function get_option_index_from_screen() {
|
1093 |
$screen = get_current_screen();
|
1094 |
-
$key
|
1095 |
if ( 2 != count( $key ) ) {
|
1096 |
return false;
|
1097 |
}
|
@@ -1099,7 +1129,7 @@ class iworks_options {
|
|
1099 |
}
|
1100 |
|
1101 |
public function show_page( $check_option_name = true, $url = 'options.php' ) {
|
1102 |
-
$options
|
1103 |
$option_name = 'index';
|
1104 |
if ( $check_option_name ) {
|
1105 |
$option_name = $this->get_option_index_from_screen();
|
@@ -1112,43 +1142,43 @@ class iworks_options {
|
|
1112 |
}
|
1113 |
global $screen_layout_columns;
|
1114 |
$data = array();
|
1115 |
-
?>
|
1116 |
<div class="wrap iworks_options">
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
<?php
|
1124 |
/**
|
1125 |
* check metaboxes for key
|
1126 |
*/
|
1127 |
-
if ( array_key_exists( 'metaboxes', $this->options[ $option_name ] ) ) {
|
1128 |
-
?>
|
1129 |
<div id="side-info-column" class="inner-sidebar">
|
1130 |
-
|
1131 |
</div>
|
1132 |
<?php } ?>
|
1133 |
-
|
1134 |
-
|
1135 |
-
<?php
|
1136 |
$this->settings_fields( $option_name );
|
1137 |
$this->build_options( $option_name );
|
1138 |
-
?>
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
</div>
|
1145 |
-
<?php
|
1146 |
/**
|
1147 |
* check metaboxes for key
|
1148 |
*/
|
1149 |
-
if ( array_key_exists( 'metaboxes', $this->options[ $option_name ] ) ) {
|
1150 |
-
|
1151 |
-
?>
|
1152 |
<script type="text/javascript" id="<?php echo __CLASS__; ?>">
|
1153 |
//<![CDATA[
|
1154 |
jQuery(document).ready( function($) {
|
@@ -1159,8 +1189,8 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1159 |
});
|
1160 |
//]]>
|
1161 |
</script>
|
1162 |
-
<?php
|
1163 |
-
}
|
1164 |
}
|
1165 |
|
1166 |
public function load_page() {
|
@@ -1208,7 +1238,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1208 |
$scripts = array();
|
1209 |
if ( is_admin() && isset( $this->options[ $option_name ]['enqueue_scripts']['admin'] ) ) {
|
1210 |
$scripts = $this->options[ $option_name ]['enqueue_scripts']['admin'];
|
1211 |
-
}
|
1212 |
$scripts = $this->options[ $option_name ]['enqueue_scripts']['frontend'];
|
1213 |
} else {
|
1214 |
$scripts = $this->options[ $option_name ]['enqueue_scripts'];
|
@@ -1224,7 +1254,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1224 |
$styles = array();
|
1225 |
if ( is_admin() && isset( $this->options[ $option_name ]['enqueue_styles']['admin'] ) ) {
|
1226 |
$styles = $this->options[ $option_name ]['enqueue_styles']['admin'];
|
1227 |
-
}
|
1228 |
$styles = $this->options[ $option_name ]['enqueue_styles']['frontend'];
|
1229 |
} else {
|
1230 |
$styles = $this->options[ $option_name ]['enqueue_styles'];
|
@@ -1245,7 +1275,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1245 |
}
|
1246 |
|
1247 |
public function get_options_by_group( $group ) {
|
1248 |
-
$opts
|
1249 |
$options = $this->get_option_array();
|
1250 |
if ( ! isset( $options['options'] ) || empty( $options['options'] ) ) {
|
1251 |
return $options;
|
@@ -1273,13 +1303,13 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1273 |
case 'switch_button':
|
1274 |
wp_enqueue_script( __CLASS__ );
|
1275 |
wp_enqueue_style( 'switch_button' );
|
1276 |
-
|
1277 |
case 'checkbox':
|
1278 |
case 'radio':
|
1279 |
-
|
1280 |
default:
|
1281 |
$args['class'] = array( 'large-text' );
|
1282 |
-
|
1283 |
}
|
1284 |
}
|
1285 |
$args['class'][] = sprintf( 'iworks-options-%s', preg_replace( '/_/', '-', esc_attr( $type ) ) );
|
@@ -1324,7 +1354,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1324 |
$options[ $value['value'] ] = $value['label'];
|
1325 |
}
|
1326 |
$value_to_check = is_array( $value ) && isset( $value['value'] ) ? $value['value'] : $value;
|
1327 |
-
$content
|
1328 |
'<select type="%s" name="%s" %s >',
|
1329 |
esc_attr( $type ),
|
1330 |
esc_attr( $name ),
|
@@ -1459,7 +1489,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1459 |
}
|
1460 |
|
1461 |
private function radio( $name, $value = '', $args = array() ) {
|
1462 |
-
$radio
|
1463 |
$options = $args['options'];
|
1464 |
unset( $args['options'] );
|
1465 |
/**
|
@@ -1470,7 +1500,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1470 |
}
|
1471 |
$i = 0;
|
1472 |
foreach ( $options as $option_value => $input ) {
|
1473 |
-
$id
|
1474 |
$radio .= sprintf(
|
1475 |
'<li class="%s"><label for="%s"><input type="radio" name="%s" value="%s"%s id="%s"/> %s</label>',
|
1476 |
esc_attr( sanitize_title( $value ) ),
|
@@ -1479,7 +1509,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1479 |
esc_attr( $option_value ),
|
1480 |
checked( $option_value, $value, false ),
|
1481 |
esc_attr( $id ),
|
1482 |
-
esc_html( is_string( $input )? $input
|
1483 |
);
|
1484 |
if ( isset( $input['description'] ) ) {
|
1485 |
$radio .= sprintf(
|
@@ -1504,22 +1534,91 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1504 |
|
1505 |
private function money( $name, $value = '', $args = array() ) {
|
1506 |
if ( empty( $value ) || ! is_array( $value ) ) {
|
1507 |
-
$value = array(
|
1508 |
-
'integer' => 0,
|
1509 |
-
'fractional' => 0,
|
1510 |
-
);
|
1511 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1512 |
$content = '';
|
1513 |
/**
|
1514 |
* Integer
|
1515 |
*/
|
1516 |
-
$n
|
1517 |
$content .= $this->input( $n, $value['integer'], array( 'min' => 0 ), 'number' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1518 |
/**
|
1519 |
-
*
|
1520 |
*/
|
1521 |
-
$
|
1522 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1523 |
return $content;
|
1524 |
}
|
1525 |
|
@@ -1553,13 +1652,13 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1553 |
public function hex2rgb( $hex ) {
|
1554 |
$hex = str_replace( '#', '', $hex );
|
1555 |
if ( strlen( $hex ) == 3 ) {
|
1556 |
-
$r = hexdec( substr( $hex,0,1 ).substr( $hex,0,1 ) );
|
1557 |
-
$g = hexdec( substr( $hex,1,1 ).substr( $hex,1,1 ) );
|
1558 |
-
$b = hexdec( substr( $hex,2,1 ).substr( $hex,2,1 ) );
|
1559 |
} else {
|
1560 |
-
$r = hexdec( substr( $hex,0,2 ) );
|
1561 |
-
$g = hexdec( substr( $hex,2,2 ) );
|
1562 |
-
$b = hexdec( substr( $hex,4,2 ) );
|
1563 |
}
|
1564 |
$rgb = array( $r, $g, $b );
|
1565 |
return $rgb; // returns an array with the rgb values
|
@@ -1568,16 +1667,16 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1568 |
public function register_styles() {
|
1569 |
$files = $this->get_files();
|
1570 |
foreach ( $files as $data ) {
|
1571 |
-
$file = sprintf( 'assets/%s/%s', $data['style']? 'styles':'scripts', $data['file'] );
|
1572 |
if ( 'theme' == $this->mode ) {
|
1573 |
-
$url
|
1574 |
-
$file = get_template_directory_uri()
|
1575 |
} else {
|
1576 |
$file = plugins_url( $file, __FILE__ );
|
1577 |
}
|
1578 |
-
$version
|
1579 |
-
$deps
|
1580 |
-
$in_footer = isset( $data['in_footer'] )? $data['in_footer'] : true;
|
1581 |
if ( $data['style'] ) {
|
1582 |
wp_register_style( $data['handle'], $file, $deps, $version );
|
1583 |
} else {
|
@@ -1596,47 +1695,55 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1596 |
*/
|
1597 |
array(
|
1598 |
'handle' => __CLASS__,
|
1599 |
-
'file'
|
1600 |
),
|
1601 |
array(
|
1602 |
'handle' => __CLASS__,
|
1603 |
-
'file'
|
1604 |
-
'deps'
|
1605 |
),
|
1606 |
/**
|
1607 |
* switch checkbox
|
1608 |
*/
|
1609 |
array(
|
1610 |
-
'handle'
|
1611 |
-
'file'
|
1612 |
'version' => '1.0',
|
1613 |
),
|
1614 |
array(
|
1615 |
-
'handle'
|
1616 |
-
'file'
|
1617 |
-
'version'
|
1618 |
-
'deps'
|
1619 |
'wp_localize_script' => $this->get_switch_button_data(),
|
1620 |
),
|
1621 |
/**
|
1622 |
* select2
|
1623 |
*/
|
1624 |
array(
|
1625 |
-
'handle'
|
1626 |
-
'file'
|
1627 |
'version' => '4.0.3',
|
1628 |
),
|
1629 |
array(
|
1630 |
-
'handle'
|
1631 |
-
'file'
|
1632 |
'version' => '4.0.3',
|
1633 |
-
'deps'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1634 |
),
|
1635 |
);
|
1636 |
$files = array();
|
1637 |
foreach ( $f as $data ) {
|
1638 |
$data['style'] = preg_match( '/css$/', $data['file'] );
|
1639 |
-
$files[]
|
1640 |
}
|
1641 |
return $files;
|
1642 |
}
|
@@ -1645,7 +1752,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1645 |
$data = array(
|
1646 |
'labels' => array(
|
1647 |
'off_label' => __( 'OFF', 'sierotki' ),
|
1648 |
-
'on_label'
|
1649 |
),
|
1650 |
);
|
1651 |
return $data;
|
@@ -1657,6 +1764,6 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
|
|
1657 |
* @since 2.6.0
|
1658 |
*/
|
1659 |
public function get_pagehook() {
|
1660 |
-
return $this->option_prefix
|
1661 |
}
|
1662 |
}
|
3 |
Class Name: iWorks Options
|
4 |
Class URI: http://iworks.pl/
|
5 |
Description: Option class to manage options.
|
6 |
+
Version: 2.6.8
|
7 |
Author: Marcin Pietrzak
|
8 |
Author URI: http://iworks.pl/
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
Copyright 2011-2019 Marcin Pietrzak (marcin@iworks.pl)
|
13 |
|
14 |
this program is free software; you can redistribute it and/or modify
|
15 |
it under the terms of the GNU General Public License, version 2, as
|
40 |
private $option_group;
|
41 |
private $option_prefix;
|
42 |
private $version;
|
43 |
+
private $pagehooks = array();
|
44 |
private $scripts_enqueued = array();
|
45 |
/**
|
46 |
* Controll class mode.
|
47 |
+
*
|
48 |
* @since 2.6.5
|
49 |
*/
|
50 |
private $mode = 'plugin';
|
56 |
* basic setup
|
57 |
*/
|
58 |
$this->notices = array();
|
59 |
+
$this->version = '2.6.8';
|
60 |
$this->option_group = 'index';
|
61 |
$this->option_function_name = null;
|
62 |
$this->option_prefix = null;
|
63 |
/**
|
64 |
* afer basic setup
|
65 |
*/
|
66 |
+
$this->files = $this->get_files();
|
67 |
/**
|
68 |
* hooks
|
69 |
*/
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Get group
|
96 |
+
*
|
97 |
+
* @since 2.6.7
|
98 |
+
*
|
99 |
+
* @param string $option_group Name of config group.
|
100 |
+
*/
|
101 |
+
public function get_group( $option_group = null ) {
|
102 |
+
if ( null === $option_group ) {
|
103 |
+
$option_group = $this->option_group;
|
104 |
+
}
|
105 |
+
return $this->get_option_array( $option_group );
|
106 |
+
}
|
107 |
+
|
108 |
public function admin_menu() {
|
109 |
$data = $this->get_option_array();
|
110 |
if ( ! isset( $this->options ) ) {
|
111 |
return;
|
112 |
}
|
113 |
+
$pages = array();
|
114 |
$pages['index'] = $data;
|
115 |
if ( isset( $data['pages'] ) ) {
|
116 |
$pages = $data['pages'] + $pages;
|
140 |
$this->pagehooks[ $key ] = add_submenu_page(
|
141 |
$data['parent'],
|
142 |
$data['page_title'],
|
143 |
+
isset( $data['menu_title'] ) ? $data['menu_title'] : $data['page_title'],
|
144 |
apply_filters( 'iworks_options_capability', 'manage_options', 'settings' ),
|
145 |
+
isset( $data['menu_slug'] ) ? $data['menu_slug'] : $this->get_option_name( $key ),
|
146 |
$callback
|
147 |
);
|
148 |
+
add_action( 'load-' . $this->pagehooks[ $key ], array( $this, 'load_page' ) );
|
149 |
}
|
150 |
} else {
|
151 |
switch ( $data['menu'] ) {
|
162 |
case 'theme':
|
163 |
case 'users':
|
164 |
$function = sprintf( 'add_%s_page', $data['menu'] );
|
165 |
+
break;
|
166 |
default:
|
167 |
$function = 'add_menu_page';
|
168 |
+
break;
|
169 |
}
|
170 |
if ( isset( $data['page_title'] ) ) {
|
171 |
$this->pagehooks[ $key ] = $function(
|
172 |
$data['page_title'],
|
173 |
+
isset( $data['menu_title'] ) ? $data['menu_title'] : $data['page_title'],
|
174 |
'manage_options',
|
175 |
$this->get_option_name( $key ),
|
176 |
array( $this, 'show_page' )
|
177 |
);
|
178 |
+
add_action( 'load-' . $this->pagehooks[ $key ], array( $this, 'load_page' ) );
|
179 |
}
|
180 |
}
|
181 |
}
|
193 |
$this->option_prefix = $option_prefix;
|
194 |
}
|
195 |
|
196 |
+
private function get_option_array( $option_group = null ) {
|
197 |
+
if ( null === $option_group ) {
|
198 |
+
$option_group = $this->option_group;
|
199 |
+
}
|
200 |
$options = array();
|
201 |
+
if ( array_key_exists( $option_group, $options ) && ! empty( $options[ $option_group ] ) ) {
|
202 |
$options = apply_filters( $this->option_function_name, $this->options );
|
203 |
+
return $options[ $option_group ];
|
204 |
}
|
205 |
if ( is_callable( $this->option_function_name ) ) {
|
206 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
207 |
}
|
208 |
+
if ( array_key_exists( $option_group, $options ) && ! empty( $options[ $option_group ] ) ) {
|
209 |
+
$this->options[ $option_group ] = $options[ $option_group ];
|
210 |
+
return apply_filters( $this->option_function_name, $this->options[ $option_group ] );
|
211 |
}
|
212 |
return apply_filters( $this->option_function_name, array() );
|
213 |
}
|
214 |
|
215 |
public function build_options( $option_group = 'index', $echo = true, $term_id = false ) {
|
216 |
$this->option_group = $option_group;
|
217 |
+
$options = $this->get_option_array();
|
218 |
/**
|
219 |
* add some defaults
|
220 |
*/
|
221 |
$options['show_submit_button'] = true;
|
222 |
+
$options['add_table'] = true;
|
223 |
if ( ! array_key_exists( 'type', $options ) ) {
|
224 |
$options['type'] = 'option';
|
225 |
}
|
228 |
*/
|
229 |
if ( 'taxonomy' == $options['type'] ) {
|
230 |
$options['show_submit_button'] = false;
|
231 |
+
$options['add_table'] = false;
|
232 |
}
|
233 |
/**
|
234 |
* check options exists?
|
235 |
*/
|
236 |
if ( ! is_array( $options['options'] ) ) {
|
237 |
+
echo '<div class="below-h2 error"><p><strong>' . __( 'An error occurred while getting the configuration.', 'sierotki' ) . '</strong></p></div>';
|
238 |
return;
|
239 |
}
|
240 |
/**
|
250 |
*/
|
251 |
if ( $use_tabs ) {
|
252 |
$field = array(
|
253 |
+
'type' => 'hidden',
|
254 |
+
'name' => 'last_used_tab',
|
255 |
+
'id' => 'last_used_tab',
|
256 |
'value' => $this->get_option( 'last_used_tab' ),
|
257 |
);
|
258 |
array_unshift( $options['options'], $field );
|
266 |
$this->option_prefix
|
267 |
);
|
268 |
}
|
269 |
+
$i = 0;
|
270 |
+
$label_index = 0;
|
271 |
+
$last_tab = null;
|
272 |
+
$related_to = array();
|
273 |
$configuration = 'all';
|
274 |
foreach ( $options['options'] as $option ) {
|
275 |
if ( isset( $option['capability'] ) ) {
|
340 |
if ( isset( $option['configuration'] ) && 'both' == $option['configuration'] ) {
|
341 |
continue;
|
342 |
}
|
343 |
+
if ( in_array(
|
344 |
+
$option['type'],
|
345 |
+
array(
|
346 |
+
'checkbox',
|
347 |
+
'email',
|
348 |
+
'image',
|
349 |
+
'number',
|
350 |
+
'radio',
|
351 |
+
'text',
|
352 |
+
'textarea',
|
353 |
+
'url',
|
354 |
+
)
|
355 |
+
) ) {
|
356 |
+
$html_element_name = $option_name ? $this->option_prefix . $option_name : '';
|
357 |
+
$content .= sprintf(
|
358 |
'<input type="hidden" name="%s" value="%s" /> %s',
|
359 |
$html_element_name,
|
360 |
$this->get_option( $option_name, $option_group ),
|
379 |
$content .= sprintf(
|
380 |
'<fieldset id="iworks_%s" class="ui-tabs-panel ui-widget-content ui-corner-bottom"%s>',
|
381 |
crc32( $option['label'] ),
|
382 |
+
( isset( $option['class'] ) && $option['class'] ) ? ' rel="' . $option['class'] . '"' : ''
|
383 |
);
|
384 |
if ( ! $use_tabs ) {
|
385 |
$content .= sprintf( '<h3>%s</h3>', $option['label'] );
|
387 |
if ( $options['add_table'] ) {
|
388 |
$content .= sprintf(
|
389 |
'<table class="form-table%s" style="%s">',
|
390 |
+
isset( $options['widefat'] ) ? ' widefat' : '',
|
391 |
+
isset( $options['style'] ) ? $options['style'] : ''
|
392 |
);
|
393 |
$content .= '<tbody>';
|
394 |
}
|
402 |
}
|
403 |
$content .= sprintf(
|
404 |
'<tr valign="top" id="tr_%s" class="%s">',
|
405 |
+
esc_attr( $option_name ? $option_name : '' ),
|
406 |
implode( ' ', $tr_classes )
|
407 |
);
|
408 |
$content .= sprintf(
|
409 |
'<th scope="row">%s%s</th>',
|
410 |
+
isset( $option['dashicon'] ) && $option['dashicon'] ? sprintf( '<span class="dashicons dashicons-%s"></span> ', $option['dashicon'] ) : '',
|
411 |
+
isset( $option['th'] ) && $option['th'] ? $option['th'] : ' '
|
412 |
);
|
413 |
$content .= '<td>';
|
414 |
}
|
415 |
+
$html_element_name = $option_name ? $this->option_prefix . $option_name : '';
|
416 |
+
$filter_name = $html_element_name ? $option_group . '_' . $html_element_name : null;
|
417 |
/**
|
418 |
* classes
|
419 |
*/
|
420 |
+
$classes = isset( $option['classes'] ) ? $option['classes'] : ( isset( $option['class'] ) ? explode( ' ', $option['class'] ) : array() );
|
421 |
$classes[] = sprintf( 'option-%s', $option['type'] );
|
422 |
/**
|
423 |
* build
|
428 |
'<input type="hidden" name="%s" value="%s" id="%s" />',
|
429 |
esc_attr( $html_element_name ),
|
430 |
esc_attr( $this->get_option( $option_name, $option_group ) ),
|
431 |
+
esc_attr( isset( $option['id'] ) ? $option['id'] : '' )
|
432 |
);
|
433 |
+
break;
|
434 |
case 'number':
|
435 |
+
$args = array();
|
436 |
$args_keys = array( 'min', 'max', 'step' );
|
437 |
foreach ( $args_keys as $arg_key ) {
|
438 |
if ( isset( $option[ $arg_key ] ) ) {
|
449 |
$this->get_option( $option_name, $option_group ),
|
450 |
esc_attr( implode( ' ', $classes ) ),
|
451 |
$this->build_field_attributes( $args ),
|
452 |
+
isset( $option['label'] ) ? $option['label'] : ''
|
453 |
);
|
454 |
+
break;
|
455 |
case 'email':
|
456 |
case 'password':
|
457 |
case 'text':
|
467 |
$this->get_option( $option_name, $option_group ),
|
468 |
esc_attr( implode( ' ', $classes ) ),
|
469 |
$id,
|
470 |
+
isset( $option['label'] ) ? $option['label'] : ''
|
471 |
);
|
472 |
+
break;
|
473 |
case 'checkbox':
|
474 |
$related_to[ $option_name ] = $this->get_option( $option_name, $option_group );
|
475 |
+
$checkbox = sprintf(
|
476 |
'<label for="%s"><input type="checkbox" name="%s" id="%s" value="1"%s%s class="%s" /> %s</label>',
|
477 |
$html_element_name,
|
478 |
$html_element_name,
|
479 |
$html_element_name,
|
480 |
+
checked( $related_to[ $option_name ], true, false ),
|
481 |
+
( ( isset( $option['disabled'] ) && $option['disabled'] ) or ( isset( $option['need_pro'] ) && $option['need_pro'] ) ) ? ' disabled="disabled"' : '',
|
482 |
esc_attr( implode( ' ', $classes ) ),
|
483 |
+
isset( $option['label'] ) ? $option['label'] : ''
|
484 |
);
|
485 |
+
$content .= apply_filters( $filter_name, $checkbox );
|
486 |
+
break;
|
487 |
case 'checkbox_group':
|
488 |
$option_value = $this->get_option( $option_name, $option_group );
|
489 |
if ( empty( $option_value ) && isset( $option['defaults'] ) ) {
|
492 |
}
|
493 |
}
|
494 |
$content .= '<ul>';
|
495 |
+
$i = 0;
|
496 |
if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
|
497 |
$option['options'] = array_merge( $option['options'], $option['extra_options']() );
|
498 |
}
|
501 |
if ( is_array( $option_value ) && array_key_exists( $value, $option_value ) ) {
|
502 |
$checked = true;
|
503 |
}
|
504 |
+
$id = sprintf( '%s%d', $option_name, $i++ );
|
505 |
$content .= sprintf(
|
506 |
'<li><label for="%s"><input type="checkbox" name="%s[%s]" value="%s"%s id="%s"/> %s</label></li>',
|
507 |
$id,
|
508 |
$html_element_name,
|
509 |
$value,
|
510 |
$value,
|
511 |
+
checked( $checked, true, false ),
|
512 |
$id,
|
513 |
$label
|
514 |
);
|
515 |
}
|
516 |
$content .= '</ul>';
|
517 |
+
break;
|
518 |
case 'radio':
|
519 |
$option_value = $this->get_option( $option_name, $option_group );
|
520 |
+
$i = 0;
|
521 |
/**
|
522 |
* check user add "radio" or "options".
|
523 |
*/
|
524 |
$radio_options = array();
|
525 |
if ( array_key_exists( 'options', $option ) ) {
|
526 |
$radio_options = $option['options'];
|
527 |
+
} elseif ( array_key_exists( 'radio', $option ) ) {
|
528 |
$radio_options = $option['radio'];
|
529 |
}
|
530 |
if ( empty( $radio_options ) ) {
|
536 |
/**
|
537 |
* add extra options, maybe dynamic?
|
538 |
*/
|
539 |
+
$radio_options = apply_filters( $filter_name . '_data', $radio_options );
|
540 |
+
$radio = apply_filters( $filter_name . '_content', null, $radio_options, $html_element_name, $option_name, $option_value );
|
541 |
if ( empty( $radio ) ) {
|
542 |
foreach ( $radio_options as $value => $input ) {
|
543 |
+
$id = sprintf( '%s%d', $option_name, $i++ );
|
544 |
$disabled = '';
|
545 |
if ( preg_match( '/\-disabled$/', $value ) ) {
|
546 |
$disabled = 'disabled="disabled"';
|
548 |
$disabled = 'disabled="disabled"';
|
549 |
}
|
550 |
$classes[] = sanitize_title( $value );
|
551 |
+
$checked = $option_value == $value or ( empty( $option_value ) and isset( $option['default'] ) and $value == $option['default'] );
|
552 |
+
$radio .= sprintf(
|
553 |
'<li class="%s%s"><label for="%s"><input type="radio" name="%s" value="%s"%s id="%s" %s/> %s</label>',
|
554 |
esc_attr( implode( ' ', $classes ) ),
|
555 |
+
$disabled ? ' disabled' : '',
|
556 |
esc_attr( $id ),
|
557 |
esc_attr( $html_element_name ),
|
558 |
esc_attr( $value ),
|
559 |
+
checked( $checked, true, false ),
|
560 |
esc_attr( $id ),
|
561 |
$disabled,
|
562 |
esc_html( $input['label'] )
|
583 |
}
|
584 |
$content .= apply_filters( $filter_name, $radio );
|
585 |
}
|
586 |
+
break;
|
587 |
case 'select':
|
588 |
case 'select2':
|
589 |
$extra = $name_sufix = '';
|
590 |
if ( 'select2' == $option['type'] ) {
|
591 |
$classes[] = 'select2';
|
592 |
if ( isset( $option['multiple'] ) && $option['multiple'] ) {
|
593 |
+
$extra = ' multiple="multiple"';
|
594 |
$name_sufix = '[]';
|
595 |
}
|
596 |
}
|
604 |
if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
|
605 |
$option['options'] = array_merge( $option['options'], $option['extra_options']() );
|
606 |
}
|
607 |
+
$option['options'] = apply_filters( $filter_name . '_data', $option['options'], $option_name, $option_value );
|
608 |
+
$select = apply_filters( $filter_name . '_content', null, $option['options'], $html_element_name, $option_name, $option_value );
|
609 |
+
$select = apply_filters( 'iworks_options_' . $option_name . '_content', null, $option['options'], $html_element_name, $option_name, $option_value );
|
610 |
if ( empty( $select ) ) {
|
611 |
foreach ( $option['options'] as $key => $value ) {
|
612 |
$disabled = '';
|
622 |
$selected = in_array( $key, $option_value );
|
623 |
}
|
624 |
} else {
|
625 |
+
$selected = ( $option_value == $key or ( empty( $option_value ) and isset( $option['default'] ) and $key == $option['default'] ) );
|
626 |
}
|
627 |
$select .= sprintf(
|
628 |
'<option %s value="%s" %s %s >%s</option>',
|
629 |
+
$disabled ? 'class="disabled"' : '',
|
630 |
$key,
|
631 |
selected( $selected, true, false ),
|
632 |
$disabled,
|
646 |
}
|
647 |
}
|
648 |
$content .= apply_filters( $filter_name, $select );
|
649 |
+
break;
|
650 |
case 'textarea':
|
651 |
+
$value = $this->get_option( $option_name, $option_group );
|
652 |
+
$value = ( ! $value && isset( $option['default'] ) ) ? $option['default'] : $value;
|
653 |
+
$args = array(
|
654 |
+
'rows' => isset( $option['rows'] ) ? $option['rows'] : 3,
|
655 |
+
'class' => isset( $option['classes'] ) ? implode( ' ', $option['classes'] ) : '',
|
656 |
);
|
657 |
$content .= $this->textarea( $html_element_name, $value, $args );
|
658 |
+
break;
|
659 |
case 'heading':
|
660 |
if ( isset( $option['label'] ) && $option['label'] ) {
|
661 |
$classes = array();
|
665 |
$content .= sprintf(
|
666 |
'<h3 id="options-%s"%s>%s</h3>',
|
667 |
sanitize_title_with_dashes( remove_accents( $option['label'] ) ),
|
668 |
+
count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : '',
|
669 |
$option['label']
|
670 |
);
|
671 |
$label_index++;
|
672 |
$i = 0;
|
673 |
}
|
674 |
+
break;
|
675 |
case 'info':
|
676 |
$content .= $option['value'];
|
677 |
+
break;
|
678 |
case 'serialize':
|
679 |
if ( isset( $option['callback'] ) && is_callable( $option['callback'] ) ) {
|
680 |
$content .= $option['callback']( $this->get_option( $option_name, $option_group ), $option_name );
|
684 |
$content .= ob_get_contents();
|
685 |
ob_end_clean();
|
686 |
}
|
687 |
+
break;
|
688 |
case 'subheading':
|
689 |
$content .= sprintf( '<h4 class="title">%s</h4>', $option['label'] );
|
690 |
+
break;
|
691 |
case 'wpColorPicker':
|
692 |
if ( is_admin() ) {
|
693 |
wp_enqueue_style( 'wp-color-picker' );
|
703 |
'<input type="text" name="%s" value="%s" class="wpColorPicker %s"%s%s /> %s',
|
704 |
$html_element_name,
|
705 |
$this->get_option( $option_name, $option_group ),
|
706 |
+
isset( $option['class'] ) && $option['class'] ? $option['class'] : '',
|
707 |
$id,
|
708 |
+
( isset( $option['need_pro'] ) and $option['need_pro'] ) ? ' disabled="disabled"' : '',
|
709 |
+
isset( $option['label'] ) ? $option['label'] : '',
|
710 |
$html_element_name
|
711 |
)
|
712 |
);
|
713 |
+
break;
|
714 |
case 'image':
|
715 |
if ( isset( $option['description'] ) && $option['description'] ) {
|
716 |
printf( '<p class="description">%s</p>', $option['description'] );
|
717 |
}
|
718 |
+
$value = $this->get_option( $option_name, $option_group );
|
719 |
$content .= sprintf(
|
720 |
'<img id="%s_img" src="%s" alt="" style="%s%sclear:right;display:block;margin-bottom:10px;" />',
|
721 |
$html_element_name,
|
722 |
+
$value ? $value : '',
|
723 |
+
array_key_exists( 'max-width', $option ) && is_integer( $option['max-width'] ) ? sprintf( 'max-width: %dpx;', $option['max-width'] ) : '',
|
724 |
+
array_key_exists( 'max-height', $option ) && is_integer( $option['max-height'] ) ? sprintf( 'max-height: %dpx;', $option['max-height'] ) : ''
|
725 |
);
|
726 |
$content .= sprintf(
|
727 |
'<input type="hidden" name="%s" id="%s" value="%s" />',
|
741 |
$html_element_name
|
742 |
);
|
743 |
}
|
744 |
+
break;
|
745 |
default:
|
746 |
$content .= sprintf( 'not implemented type: %s', $option['type'] );
|
747 |
}
|
775 |
$content .= '</tbody></table>';
|
776 |
}
|
777 |
$content .= '</fieldset>';
|
778 |
+
$content = $top . $content;
|
779 |
} else {
|
780 |
if ( $options['add_table'] ) {
|
781 |
+
$top .= sprintf( '<table class="form-table%s" style="%s">', isset( $options['widefat'] ) ? ' widefat' : '', isset( $options['style'] ) ? $options['style'] : '' );
|
782 |
if ( isset( $options['thead'] ) ) {
|
783 |
$top .= sprintf( '<thead><tr class="%s">', implode( ' ', $tr_classes ) );
|
784 |
foreach ( $options['thead'] as $text => $colspan ) {
|
785 |
$top .= sprintf(
|
786 |
'<th%s>%s</th>',
|
787 |
+
$colspan > 1 ? ' colspan="' . $colspan . '"' : '',
|
788 |
$text
|
789 |
);
|
790 |
}
|
792 |
}
|
793 |
$top .= '<tbody>';
|
794 |
}
|
795 |
+
$content = $top . $content;
|
796 |
if ( $options['add_table'] ) {
|
797 |
$content .= '</tbody></table>';
|
798 |
}
|
805 |
* submit button
|
806 |
*/
|
807 |
if ( $options['show_submit_button'] ) {
|
808 |
+
$content .= get_submit_button( __( 'Save Changes', 'sierotki' ), 'primary', 'submit_button' );
|
809 |
}
|
810 |
/**
|
811 |
* iworks-options wrapper
|
824 |
/**
|
825 |
* don't register setting without type and name
|
826 |
*/
|
827 |
+
if ( ! is_array( $option ) || ! array_key_exists( 'type', $option ) || ! array_key_exists( 'name', $option ) ) {
|
828 |
continue;
|
829 |
}
|
830 |
/**
|
837 |
* register setting
|
838 |
*/
|
839 |
register_setting(
|
840 |
+
$this->option_prefix . $option_group,
|
841 |
+
$this->option_prefix . $option['name'],
|
842 |
+
isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : array( $this, 'sanitize_callback' )
|
843 |
);
|
844 |
}
|
845 |
}
|
857 |
$field = array(
|
858 |
'type' => 'hidden',
|
859 |
'name' => 'last_used_tab',
|
860 |
+
'id' => 'last_used_tab',
|
861 |
);
|
862 |
array_unshift( $options[ $key ]['options'], $field );
|
863 |
}
|
880 |
|
881 |
public function get_values( $option_name, $option_group = 'index' ) {
|
882 |
$this->option_group = $option_group;
|
883 |
+
$data = $this->get_option_array();
|
884 |
+
$data = $data['options'];
|
885 |
foreach ( $data as $one ) {
|
886 |
if ( isset( $one['name'] ) && $one['name'] != $option_name ) {
|
887 |
continue;
|
888 |
}
|
889 |
switch ( $one['type'] ) {
|
890 |
case 'checkbox_group':
|
891 |
+
return $one['options'];
|
892 |
case 'radio':
|
893 |
+
return $one['radio'];
|
894 |
}
|
895 |
}
|
896 |
return;
|
898 |
|
899 |
public function get_default_value( $option_name, $option_group = 'index' ) {
|
900 |
$this->option_group = $option_group;
|
901 |
+
$options = $this->get_option_array();
|
902 |
/**
|
903 |
* check options exists?
|
904 |
*/
|
913 |
* default name for taxonomies
|
914 |
*/
|
915 |
if ( array_key_exists( 'type', $options ) && 'taxonomy' == $options['type'] ) {
|
916 |
+
$re = sprintf( '/^%s_\d+_/', $option_group );
|
917 |
$default_option_name = preg_replace( $re, '', $default_option_name );
|
918 |
}
|
919 |
foreach ( $options['options'] as $option ) {
|
920 |
if ( isset( $option['name'] ) && $option['name'] == $default_option_name ) {
|
921 |
+
return isset( $option['default'] ) ? $option['default'] : null;
|
922 |
}
|
923 |
}
|
924 |
return null;
|
928 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
929 |
foreach ( $options as $key => $data ) {
|
930 |
foreach ( $data['options'] as $option ) {
|
931 |
+
if (
|
932 |
+
( isset( $option['type'] ) && $option['type'] == 'heading' )
|
933 |
+
or ! isset( $option['name'] )
|
934 |
+
or ! $option['name'] or ! isset( $option['default'] )
|
935 |
+
) {
|
936 |
continue;
|
937 |
}
|
938 |
+
add_option( $this->option_prefix . $option['name'], $option['default'], '', isset( $option['autoload'] ) ? $option['autoload'] : 'yes' );
|
939 |
}
|
940 |
}
|
941 |
+
add_option( $this->option_prefix . 'cache_stamp', date( 'c' ) );
|
942 |
}
|
943 |
|
944 |
public function deactivate() {
|
945 |
$options = apply_filters( $this->option_function_name, call_user_func( $this->option_function_name ) );
|
946 |
foreach ( $options as $key => $data ) {
|
947 |
foreach ( $data['options'] as $option ) {
|
948 |
+
if (
|
949 |
+
( isset( $option['type'] ) && 'heading' == $option['type'] )
|
950 |
+
or ! isset( $option['name'] )
|
951 |
+
or ! $option['name']
|
952 |
+
) {
|
953 |
continue;
|
954 |
}
|
955 |
/**
|
958 |
if ( isset( $option['dont_deactivate'] ) && $option['dont_deactivate'] ) {
|
959 |
continue;
|
960 |
}
|
961 |
+
delete_option( $this->option_prefix . $option['name'] );
|
962 |
}
|
963 |
}
|
964 |
+
delete_option( $this->option_prefix . 'cache_stamp' );
|
965 |
+
delete_option( $this->option_prefix . 'version' );
|
966 |
+
delete_option( $this->option_prefix . 'flush_rules' );
|
967 |
}
|
968 |
|
969 |
public function settings_fields( $option_name, $use_prefix = true ) {
|
990 |
* options: add, get, update
|
991 |
*/
|
992 |
public function add_option( $option_name, $option_value, $autoload = true ) {
|
993 |
+
$autoload = $autoload ? 'yes' : 'no';
|
994 |
+
add_option( $this->option_prefix . $option_name, $option_value, null, $autoload );
|
995 |
}
|
996 |
|
997 |
public function get_option( $option_name, $option_group = 'index', $default_value = null, $forece_default = false ) {
|
998 |
+
$option_value = get_option( $this->option_prefix . $option_name, null );
|
999 |
$default_value = $this->get_default_value( $option_name, $option_group );
|
1000 |
if ( ( $default_value || $forece_default ) && is_null( $option_value ) ) {
|
1001 |
$option_value = $default_value;
|
1004 |
}
|
1005 |
|
1006 |
public function get_all_options() {
|
1007 |
+
$data = array();
|
1008 |
$options = $this->get_option_array();
|
1009 |
foreach ( $options['options'] as $option ) {
|
1010 |
if ( ! array_key_exists( 'name', $option ) || ! $option['name'] ) {
|
1025 |
* @since 1.0
|
1026 |
* @since 2.6.4 Added `hidden` argument.
|
1027 |
*
|
1028 |
+
* @param string $name Name of option.
|
1029 |
* @param boolean $hidden If this hidden value.
|
1030 |
*
|
1031 |
* @return string $option_name
|
1042 |
/**
|
1043 |
* delete if option have a default value
|
1044 |
*/
|
1045 |
+
$default_value = $this->get_default_value( $this->option_prefix . $option_name );
|
1046 |
if ( $option_name === $default_value ) {
|
1047 |
+
delete_option( $this->option_prefix . $option_name );
|
1048 |
return;
|
1049 |
}
|
1050 |
+
update_option( $this->option_prefix . $option_name, $option_value );
|
1051 |
}
|
1052 |
|
1053 |
/**
|
1055 |
*/
|
1056 |
public function update_taxonomy_options( $option_group, $term_id ) {
|
1057 |
$this->option_group = $option_group;
|
1058 |
+
$options = $this->get_option_array();
|
1059 |
/**
|
1060 |
* only for taxonomies
|
1061 |
*/
|
1075 |
$term_id,
|
1076 |
$option['name']
|
1077 |
);
|
1078 |
+
$value = array_key_exists( $this->get_option_name( $option_name ), $_POST ) ? $_POST[ $this->get_option_name( $option_name ) ] : false;
|
1079 |
if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
|
1080 |
$value = call_user_func( $option['sanitize_callback'], $value );
|
1081 |
}
|
1092 |
*/
|
1093 |
public function select_page_helper( $name, $show_option_none = false, $post_type = 'page' ) {
|
1094 |
$args = array(
|
1095 |
+
'echo' => false,
|
1096 |
+
'name' => $this->get_option_name( $name ),
|
1097 |
+
'selected' => $this->get_option( $name ),
|
1098 |
'show_option_none' => $show_option_none,
|
1099 |
+
'post_type' => $post_type,
|
1100 |
);
|
1101 |
return wp_dropdown_pages( $args );
|
1102 |
}
|
1103 |
|
1104 |
public function select_category_helper( $name, $hide_empty = null, $show_option_none = false ) {
|
1105 |
$args = array(
|
1106 |
+
'echo' => false,
|
1107 |
'name' => $this->get_option_name( $name ),
|
1108 |
'selected' => $this->get_option( $name ),
|
1109 |
'hierarchical' => true,
|
1121 |
|
1122 |
private function get_option_index_from_screen() {
|
1123 |
$screen = get_current_screen();
|
1124 |
+
$key = explode( $this->option_prefix, $screen->id );
|
1125 |
if ( 2 != count( $key ) ) {
|
1126 |
return false;
|
1127 |
}
|
1129 |
}
|
1130 |
|
1131 |
public function show_page( $check_option_name = true, $url = 'options.php' ) {
|
1132 |
+
$options = array();
|
1133 |
$option_name = 'index';
|
1134 |
if ( $check_option_name ) {
|
1135 |
$option_name = $this->get_option_index_from_screen();
|
1142 |
}
|
1143 |
global $screen_layout_columns;
|
1144 |
$data = array();
|
1145 |
+
?>
|
1146 |
<div class="wrap iworks_options">
|
1147 |
+
<h1><?php echo $options['page_title']; ?></h1>
|
1148 |
+
<form method="post" action="<?php echo esc_url( $url ); ?>" id="<?php echo esc_attr( $this->get_option_name( 'admin_index' ) ); ?>">
|
1149 |
+
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
1150 |
+
<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
|
1151 |
+
<input type="hidden" name="action" value="save_howto_metaboxes_general" />
|
1152 |
+
<div id="poststuff" class="metabox-holder<?php echo empty( $screen_layout_columns ) || 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
|
1153 |
+
<?php
|
1154 |
/**
|
1155 |
* check metaboxes for key
|
1156 |
*/
|
1157 |
+
if ( array_key_exists( 'metaboxes', $this->options[ $option_name ] ) ) {
|
1158 |
+
?>
|
1159 |
<div id="side-info-column" class="inner-sidebar">
|
1160 |
+
<?php do_meta_boxes( $this->pagehooks[ $option_name ], 'side', $this ); ?>
|
1161 |
</div>
|
1162 |
<?php } ?>
|
1163 |
+
<div id="post-body" class="has-sidebar">
|
1164 |
+
<div id="post-body-content" class="has-sidebar-content">
|
1165 |
+
<?php
|
1166 |
$this->settings_fields( $option_name );
|
1167 |
$this->build_options( $option_name );
|
1168 |
+
?>
|
1169 |
+
</div>
|
1170 |
+
</div>
|
1171 |
+
<br class="clear"/>
|
1172 |
+
</div>
|
1173 |
+
</form>
|
1174 |
</div>
|
1175 |
+
<?php
|
1176 |
/**
|
1177 |
* check metaboxes for key
|
1178 |
*/
|
1179 |
+
if ( array_key_exists( 'metaboxes', $this->options[ $option_name ] ) ) {
|
1180 |
+
include_once ABSPATH . '/wp-admin/includes/meta-boxes.php';
|
1181 |
+
?>
|
1182 |
<script type="text/javascript" id="<?php echo __CLASS__; ?>">
|
1183 |
//<![CDATA[
|
1184 |
jQuery(document).ready( function($) {
|
1189 |
});
|
1190 |
//]]>
|
1191 |
</script>
|
1192 |
+
<?php
|
1193 |
+
}
|
1194 |
}
|
1195 |
|
1196 |
public function load_page() {
|
1238 |
$scripts = array();
|
1239 |
if ( is_admin() && isset( $this->options[ $option_name ]['enqueue_scripts']['admin'] ) ) {
|
1240 |
$scripts = $this->options[ $option_name ]['enqueue_scripts']['admin'];
|
1241 |
+
} elseif ( ! is_admin() && isset( $this->options[ $option_name ]['enqueue_scripts']['frontend'] ) ) {
|
1242 |
$scripts = $this->options[ $option_name ]['enqueue_scripts']['frontend'];
|
1243 |
} else {
|
1244 |
$scripts = $this->options[ $option_name ]['enqueue_scripts'];
|
1254 |
$styles = array();
|
1255 |
if ( is_admin() && isset( $this->options[ $option_name ]['enqueue_styles']['admin'] ) ) {
|
1256 |
$styles = $this->options[ $option_name ]['enqueue_styles']['admin'];
|
1257 |
+
} elseif ( ! is_admin() && isset( $this->options[ $option_name ]['enqueue_styles']['frontend'] ) ) {
|
1258 |
$styles = $this->options[ $option_name ]['enqueue_styles']['frontend'];
|
1259 |
} else {
|
1260 |
$styles = $this->options[ $option_name ]['enqueue_styles'];
|
1275 |
}
|
1276 |
|
1277 |
public function get_options_by_group( $group ) {
|
1278 |
+
$opts = array();
|
1279 |
$options = $this->get_option_array();
|
1280 |
if ( ! isset( $options['options'] ) || empty( $options['options'] ) ) {
|
1281 |
return $options;
|
1303 |
case 'switch_button':
|
1304 |
wp_enqueue_script( __CLASS__ );
|
1305 |
wp_enqueue_style( 'switch_button' );
|
1306 |
+
break;
|
1307 |
case 'checkbox':
|
1308 |
case 'radio':
|
1309 |
+
break;
|
1310 |
default:
|
1311 |
$args['class'] = array( 'large-text' );
|
1312 |
+
break;
|
1313 |
}
|
1314 |
}
|
1315 |
$args['class'][] = sprintf( 'iworks-options-%s', preg_replace( '/_/', '-', esc_attr( $type ) ) );
|
1354 |
$options[ $value['value'] ] = $value['label'];
|
1355 |
}
|
1356 |
$value_to_check = is_array( $value ) && isset( $value['value'] ) ? $value['value'] : $value;
|
1357 |
+
$content = sprintf(
|
1358 |
'<select type="%s" name="%s" %s >',
|
1359 |
esc_attr( $type ),
|
1360 |
esc_attr( $name ),
|
1489 |
}
|
1490 |
|
1491 |
private function radio( $name, $value = '', $args = array() ) {
|
1492 |
+
$radio = '';
|
1493 |
$options = $args['options'];
|
1494 |
unset( $args['options'] );
|
1495 |
/**
|
1500 |
}
|
1501 |
$i = 0;
|
1502 |
foreach ( $options as $option_value => $input ) {
|
1503 |
+
$id = sprintf( '%s%d', $name, $i++ );
|
1504 |
$radio .= sprintf(
|
1505 |
'<li class="%s"><label for="%s"><input type="radio" name="%s" value="%s"%s id="%s"/> %s</label>',
|
1506 |
esc_attr( sanitize_title( $value ) ),
|
1509 |
esc_attr( $option_value ),
|
1510 |
checked( $option_value, $value, false ),
|
1511 |
esc_attr( $id ),
|
1512 |
+
esc_html( is_string( $input ) ? $input : $input['label'] )
|
1513 |
);
|
1514 |
if ( isset( $input['description'] ) ) {
|
1515 |
$radio .= sprintf(
|
1534 |
|
1535 |
private function money( $name, $value = '', $args = array() ) {
|
1536 |
if ( empty( $value ) || ! is_array( $value ) ) {
|
1537 |
+
$value = array();
|
|
|
|
|
|
|
1538 |
}
|
1539 |
+
$value = wp_parse_args(
|
1540 |
+
$value,
|
1541 |
+
array(
|
1542 |
+
'integer' => 0,
|
1543 |
+
'fractional' => 0,
|
1544 |
+
'currency' => false,
|
1545 |
+
)
|
1546 |
+
);
|
1547 |
+
$args = wp_parse_args(
|
1548 |
+
$args,
|
1549 |
+
array(
|
1550 |
+
'kind' => 'complex',
|
1551 |
+
'currency' => false,
|
1552 |
+
'currency_default' => false,
|
1553 |
+
)
|
1554 |
+
);
|
1555 |
$content = '';
|
1556 |
/**
|
1557 |
* Integer
|
1558 |
*/
|
1559 |
+
$n = sprintf( '%s[integer]', $name );
|
1560 |
$content .= $this->input( $n, $value['integer'], array( 'min' => 0 ), 'number' );
|
1561 |
+
if ( 'complex' === $args['kind'] ) {
|
1562 |
+
/**
|
1563 |
+
* fractional
|
1564 |
+
*/
|
1565 |
+
$n = sprintf( '%s[fractional]', $name );
|
1566 |
+
$content .= $this->input(
|
1567 |
+
$n,
|
1568 |
+
$value['fractional'],
|
1569 |
+
array(
|
1570 |
+
'min' => 0,
|
1571 |
+
'max' => 99,
|
1572 |
+
),
|
1573 |
+
'number'
|
1574 |
+
);
|
1575 |
+
}
|
1576 |
+
if ( is_array( $args['currency'] ) && ! empty( $args['currency'] ) ) {
|
1577 |
+
$n = sprintf( '%s[currency]', $name );
|
1578 |
+
$atts = array(
|
1579 |
+
'default' => $args['currency_default'],
|
1580 |
+
'options' => $args['currency'],
|
1581 |
+
);
|
1582 |
+
$content .= $this->select( $n, $value['currency'], $atts );
|
1583 |
+
}
|
1584 |
+
return $content;
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
private function location( $name, $value = '', $args = array() ) {
|
1588 |
+
if ( empty( $value ) || ! is_array( $value ) ) {
|
1589 |
+
$value = array();
|
1590 |
+
}
|
1591 |
+
$defaults = array(
|
1592 |
+
'country' => '',
|
1593 |
+
'city' => '',
|
1594 |
+
'street' => '',
|
1595 |
+
'zip' => '',
|
1596 |
+
);
|
1597 |
+
$i18n = array(
|
1598 |
+
'country' => __( 'Country', 'sierotki' ),
|
1599 |
+
'city' => __( 'City', 'sierotki' ),
|
1600 |
+
'street' => __( 'Street', 'sierotki' ),
|
1601 |
+
'zip' => __( 'ZIP code', 'sierotki' ),
|
1602 |
+
);
|
1603 |
+
$value = wp_parse_args( $value, $defaults );
|
1604 |
/**
|
1605 |
+
* Content
|
1606 |
*/
|
1607 |
+
$content = '';
|
1608 |
+
foreach ( array_keys( $defaults ) as $key ) {
|
1609 |
+
$content .= sprintf( '<div class="iworks-options-%s">', esc_attr( $key ) );
|
1610 |
+
$content .= '<label>';
|
1611 |
+
$content .= $i18n[ $key ];
|
1612 |
+
$content .= '<br />';
|
1613 |
+
$content .= $this->input(
|
1614 |
+
sprintf( '%s[%s]', $name, esc_attr( $key ) ),
|
1615 |
+
$value[ $key ],
|
1616 |
+
array(
|
1617 |
+
'class' => 'large-text iworks-options-text',
|
1618 |
+
)
|
1619 |
+
);
|
1620 |
+
$content .= '</div>';
|
1621 |
+
}
|
1622 |
return $content;
|
1623 |
}
|
1624 |
|
1652 |
public function hex2rgb( $hex ) {
|
1653 |
$hex = str_replace( '#', '', $hex );
|
1654 |
if ( strlen( $hex ) == 3 ) {
|
1655 |
+
$r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
|
1656 |
+
$g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
|
1657 |
+
$b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
|
1658 |
} else {
|
1659 |
+
$r = hexdec( substr( $hex, 0, 2 ) );
|
1660 |
+
$g = hexdec( substr( $hex, 2, 2 ) );
|
1661 |
+
$b = hexdec( substr( $hex, 4, 2 ) );
|
1662 |
}
|
1663 |
$rgb = array( $r, $g, $b );
|
1664 |
return $rgb; // returns an array with the rgb values
|
1667 |
public function register_styles() {
|
1668 |
$files = $this->get_files();
|
1669 |
foreach ( $files as $data ) {
|
1670 |
+
$file = sprintf( 'assets/%s/%s', $data['style'] ? 'styles' : 'scripts', $data['file'] );
|
1671 |
if ( 'theme' == $this->mode ) {
|
1672 |
+
$url = str_replace( get_template_directory(), '', dirname( __FILE__ ) );
|
1673 |
+
$file = get_template_directory_uri() . $url . '/' . $file;
|
1674 |
} else {
|
1675 |
$file = plugins_url( $file, __FILE__ );
|
1676 |
}
|
1677 |
+
$version = isset( $data['version'] ) ? $data['version'] : $this->version;
|
1678 |
+
$deps = isset( $data['deps'] ) ? $data['deps'] : array();
|
1679 |
+
$in_footer = isset( $data['in_footer'] ) ? $data['in_footer'] : true;
|
1680 |
if ( $data['style'] ) {
|
1681 |
wp_register_style( $data['handle'], $file, $deps, $version );
|
1682 |
} else {
|
1695 |
*/
|
1696 |
array(
|
1697 |
'handle' => __CLASS__,
|
1698 |
+
'file' => 'jquery-ui.min.css',
|
1699 |
),
|
1700 |
array(
|
1701 |
'handle' => __CLASS__,
|
1702 |
+
'file' => 'common.js',
|
1703 |
+
'deps' => array( 'jquery', 'switch_button', 'jquery-ui-tabs' ),
|
1704 |
),
|
1705 |
/**
|
1706 |
* switch checkbox
|
1707 |
*/
|
1708 |
array(
|
1709 |
+
'handle' => 'switch_button',
|
1710 |
+
'file' => 'jquery.switch_button.css',
|
1711 |
'version' => '1.0',
|
1712 |
),
|
1713 |
array(
|
1714 |
+
'handle' => 'switch_button',
|
1715 |
+
'file' => 'jquery.switch_button.js',
|
1716 |
+
'version' => '1.0',
|
1717 |
+
'deps' => array( 'jquery', 'jquery-effects-core', 'jquery-ui-widget' ),
|
1718 |
'wp_localize_script' => $this->get_switch_button_data(),
|
1719 |
),
|
1720 |
/**
|
1721 |
* select2
|
1722 |
*/
|
1723 |
array(
|
1724 |
+
'handle' => 'select2',
|
1725 |
+
'file' => 'select2.min.css',
|
1726 |
'version' => '4.0.3',
|
1727 |
),
|
1728 |
array(
|
1729 |
+
'handle' => 'select2',
|
1730 |
+
'file' => 'select2.min.js',
|
1731 |
'version' => '4.0.3',
|
1732 |
+
'deps' => array( 'jquery' ),
|
1733 |
+
),
|
1734 |
+
/**
|
1735 |
+
* options
|
1736 |
+
*/
|
1737 |
+
array(
|
1738 |
+
'handle' => 'iworks-options',
|
1739 |
+
'file' => 'options-admin.css',
|
1740 |
+
'version' => $this->version,
|
1741 |
),
|
1742 |
);
|
1743 |
$files = array();
|
1744 |
foreach ( $f as $data ) {
|
1745 |
$data['style'] = preg_match( '/css$/', $data['file'] );
|
1746 |
+
$files[] = $data;
|
1747 |
}
|
1748 |
return $files;
|
1749 |
}
|
1752 |
$data = array(
|
1753 |
'labels' => array(
|
1754 |
'off_label' => __( 'OFF', 'sierotki' ),
|
1755 |
+
'on_label' => __( 'ON', 'sierotki' ),
|
1756 |
),
|
1757 |
);
|
1758 |
return $data;
|
1764 |
* @since 2.6.0
|
1765 |
*/
|
1766 |
public function get_pagehook() {
|
1767 |
+
return $this->option_prefix . $this->option_group;
|
1768 |
}
|
1769 |
}
|
vendor/iworks/orphan.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
|
4 |
-
Copyright 2011-2018 Marcin Pietrzak (marcin@iworks.pl)
|
5 |
|
6 |
this program is free software; you can redistribute it and/or modify
|
7 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -18,8 +17,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
|
19 |
*/
|
20 |
|
21 |
-
class iworks_orphan
|
22 |
-
|
23 |
private $options;
|
24 |
private $admin_page;
|
25 |
private $settings;
|
@@ -38,7 +37,7 @@ class iworks_orphan
|
|
38 |
private $meta_keys = null;
|
39 |
|
40 |
public function __construct() {
|
41 |
-
$file = dirname( dirname( dirname( __FILE__ ) ) ).'/sierotki.php';
|
42 |
/**
|
43 |
* plugin ID
|
44 |
*/
|
@@ -50,7 +49,7 @@ class iworks_orphan
|
|
50 |
/**
|
51 |
* actions
|
52 |
*/
|
53 |
-
add_action( 'init',
|
54 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
55 |
add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
|
56 |
add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
|
@@ -62,7 +61,7 @@ class iworks_orphan
|
|
62 |
* @since 2.7.3
|
63 |
*/
|
64 |
public function load_translation() {
|
65 |
-
load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ).'/languages' );
|
66 |
}
|
67 |
|
68 |
public function replace( $content ) {
|
@@ -82,7 +81,7 @@ class iworks_orphan
|
|
82 |
* check post type
|
83 |
*/
|
84 |
$entry_related_filters = array( 'the_title', 'the_excerpt', 'the_content' );
|
85 |
-
$current_filter
|
86 |
if ( in_array( $current_filter, $entry_related_filters ) ) {
|
87 |
if ( empty( $this->settings['post_type'] ) || ! is_array( $this->settings['post_type'] ) ) {
|
88 |
return $content;
|
@@ -128,7 +127,7 @@ class iworks_orphan
|
|
128 |
*
|
129 |
* @since 2.6.7
|
130 |
*/
|
131 |
-
$all_languages
|
132 |
$apply_to_all_languages = apply_filters( 'iworks_orphan_apply_to_all_languages', $all_languages );
|
133 |
if ( ! $apply_to_all_languages ) {
|
134 |
/**
|
@@ -148,37 +147,45 @@ class iworks_orphan
|
|
148 |
if ( ! empty( $matches ) && ! empty( $matches[0] ) ) {
|
149 |
$salt = 'kQc6T9fn5GhEzTM3Sxn7b9TWMV4PO0mOCV06Da7AQJzSJqxYR4z3qBlsW9rtFsWK';
|
150 |
foreach ( $matches[0] as $one ) {
|
151 |
-
$key
|
152 |
$exceptions[ $key ] = $one;
|
153 |
-
$re
|
154 |
-
$content
|
155 |
}
|
156 |
}
|
157 |
/**
|
158 |
-
*
|
159 |
-
|
160 |
-
|
161 |
-
$content = preg_replace( $re, '$1$2 ', $content );
|
162 |
-
/**
|
163 |
-
* single letters
|
164 |
-
*/
|
165 |
-
$re = '/([ >\(]+| )([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
|
166 |
-
/**
|
167 |
-
* double call to handle orphan after orphan after orphan
|
168 |
*/
|
169 |
-
$
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
/**
|
172 |
* single letter after previous orphan
|
173 |
*/
|
174 |
-
$re
|
175 |
$content = preg_replace( $re, '$1$2 ', $content );
|
176 |
/**
|
177 |
* bring back styles & scripts
|
178 |
*/
|
179 |
if ( ! empty( $exceptions ) && is_array( $exceptions ) ) {
|
180 |
foreach ( $exceptions as $key => $one ) {
|
181 |
-
$re
|
182 |
$content = preg_replace( $re, $one, $content );
|
183 |
}
|
184 |
}
|
@@ -194,11 +201,13 @@ class iworks_orphan
|
|
194 |
return;
|
195 |
}
|
196 |
// Add my_help_tab if current screen is My Admin Page
|
197 |
-
$screen->add_help_tab(
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
202 |
/**
|
203 |
* make sidebar help
|
204 |
*/
|
@@ -210,6 +219,9 @@ class iworks_orphan
|
|
210 |
);
|
211 |
}
|
212 |
|
|
|
|
|
|
|
213 |
public function admin_init() {
|
214 |
$this->options->options_init();
|
215 |
/** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
|
@@ -218,8 +230,11 @@ class iworks_orphan
|
|
218 |
add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
|
219 |
}
|
220 |
|
|
|
|
|
|
|
221 |
public function init() {
|
222 |
-
$this->settings
|
223 |
$allowed_filters = array(
|
224 |
'the_title',
|
225 |
'the_excerpt',
|
@@ -235,12 +250,12 @@ class iworks_orphan
|
|
235 |
continue;
|
236 |
}
|
237 |
if ( is_integer( $value ) && 1 == $value ) {
|
238 |
-
add_filter( $filter, array( $this, 'replace' ) );
|
239 |
/**
|
240 |
* WooCommerce exception: short descripton
|
241 |
*/
|
242 |
if ( 'the_excerpt' === $filter ) {
|
243 |
-
add_filter( 'woocommerce_short_description', array( $this, 'replace' ) );
|
244 |
}
|
245 |
}
|
246 |
}
|
@@ -271,12 +286,19 @@ class iworks_orphan
|
|
271 |
* @since 2.6.6
|
272 |
*/
|
273 |
public function iworks_rate_css() {
|
274 |
-
$logo = plugin_dir_url( dirname( dirname( __FILE__ ) ) ).'assets/images/logo.png';
|
275 |
echo '<style type="text/css">';
|
276 |
printf( '.iworks-notice-sierotki .iworks-notice-logo{background-color:#fed696;background-image:url(%s);}', esc_url( $logo ) );
|
277 |
echo '</style>';
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
private function is_on( $key ) {
|
281 |
return isset( $this->settings[ $key ] ) && 1 === $this->settings[ $key ];
|
282 |
}
|
@@ -294,11 +316,11 @@ class iworks_orphan
|
|
294 |
return $actions;
|
295 |
}
|
296 |
if ( $plugin_file == $this->plugin_file ) {
|
297 |
-
$page
|
298 |
-
$url
|
299 |
-
$url
|
300 |
$settings = array( $url );
|
301 |
-
$actions
|
302 |
}
|
303 |
return $actions;
|
304 |
}
|
@@ -347,7 +369,7 @@ class iworks_orphan
|
|
347 |
if ( empty( $value ) || ! is_string( $value ) ) {
|
348 |
return $check;
|
349 |
}
|
350 |
-
$value
|
351 |
$this->meta_keys = array_map( 'trim', $value );
|
352 |
}
|
353 |
if ( empty( $this->meta_keys ) ) {
|
@@ -504,7 +526,7 @@ class iworks_orphan
|
|
504 |
$own_orphans = trim( get_option( 'iworks_orphan_own_orphans', '' ), ' \t,' );
|
505 |
if ( $own_orphans ) {
|
506 |
$own_orphans = preg_replace( '/\,\+/', ',', $own_orphans );
|
507 |
-
$terms
|
508 |
}
|
509 |
$terms = apply_filters( 'iworks_orphan_therms', $terms );
|
510 |
/**
|
@@ -522,7 +544,7 @@ class iworks_orphan
|
|
522 |
/**
|
523 |
* remove empty elements
|
524 |
*/
|
525 |
-
$terms
|
526 |
$this->terms = $terms;
|
527 |
return $this->terms;
|
528 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2011-2019 Marcin Pietrzak (marcin@iworks.pl)
|
|
|
4 |
|
5 |
this program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
17 |
|
18 |
*/
|
19 |
|
20 |
+
class iworks_orphan {
|
21 |
+
|
22 |
private $options;
|
23 |
private $admin_page;
|
24 |
private $settings;
|
37 |
private $meta_keys = null;
|
38 |
|
39 |
public function __construct() {
|
40 |
+
$file = dirname( dirname( dirname( __FILE__ ) ) ) . '/sierotki.php';
|
41 |
/**
|
42 |
* plugin ID
|
43 |
*/
|
49 |
/**
|
50 |
* actions
|
51 |
*/
|
52 |
+
add_action( 'init', array( $this, 'init' ) );
|
53 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
54 |
add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
|
55 |
add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
|
61 |
* @since 2.7.3
|
62 |
*/
|
63 |
public function load_translation() {
|
64 |
+
load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ) . '/languages' );
|
65 |
}
|
66 |
|
67 |
public function replace( $content ) {
|
81 |
* check post type
|
82 |
*/
|
83 |
$entry_related_filters = array( 'the_title', 'the_excerpt', 'the_content' );
|
84 |
+
$current_filter = current_filter();
|
85 |
if ( in_array( $current_filter, $entry_related_filters ) ) {
|
86 |
if ( empty( $this->settings['post_type'] ) || ! is_array( $this->settings['post_type'] ) ) {
|
87 |
return $content;
|
127 |
*
|
128 |
* @since 2.6.7
|
129 |
*/
|
130 |
+
$all_languages = $this->is_on( 'ignore_language' );
|
131 |
$apply_to_all_languages = apply_filters( 'iworks_orphan_apply_to_all_languages', $all_languages );
|
132 |
if ( ! $apply_to_all_languages ) {
|
133 |
/**
|
147 |
if ( ! empty( $matches ) && ! empty( $matches[0] ) ) {
|
148 |
$salt = 'kQc6T9fn5GhEzTM3Sxn7b9TWMV4PO0mOCV06Da7AQJzSJqxYR4z3qBlsW9rtFsWK';
|
149 |
foreach ( $matches[0] as $one ) {
|
150 |
+
$key = sprintf( '<!-- %s %s -->', $salt, md5( $one ) );
|
151 |
$exceptions[ $key ] = $one;
|
152 |
+
$re = sprintf( '@%s@', preg_replace( '/@/', '\@', preg_quote( $one, '/' ) ) );
|
153 |
+
$content = preg_replace( $re, $key, $content );
|
154 |
}
|
155 |
}
|
156 |
/**
|
157 |
+
* Chunk terms
|
158 |
+
*
|
159 |
+
* @since 2.7.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
*/
|
161 |
+
$terms_terms = array_chunk( $terms, 10 );
|
162 |
+
foreach ( $terms_terms as $terms ) {
|
163 |
+
/**
|
164 |
+
* base therms replace
|
165 |
+
*/
|
166 |
+
$re = '/^([aiouwz]|' . preg_replace( '/\./', '\.', implode( '|', $terms ) ) . ') +/i';
|
167 |
+
$content = preg_replace( $re, '$1$2 ', $content );
|
168 |
+
/**
|
169 |
+
* single letters
|
170 |
+
*/
|
171 |
+
$re = '/([ >\(]+| |„|")([aiouwz]|' . preg_replace( '/\./', '\.', implode( '|', $terms ) ) . ') +/i';
|
172 |
+
/**
|
173 |
+
* double call to handle orphan after orphan after orphan
|
174 |
+
*/
|
175 |
+
$content = preg_replace( $re, '$1$2 ', $content );
|
176 |
+
$content = preg_replace( $re, '$1$2 ', $content );
|
177 |
+
}
|
178 |
/**
|
179 |
* single letter after previous orphan
|
180 |
*/
|
181 |
+
$re = '/( )([aiouwz]) +/i';
|
182 |
$content = preg_replace( $re, '$1$2 ', $content );
|
183 |
/**
|
184 |
* bring back styles & scripts
|
185 |
*/
|
186 |
if ( ! empty( $exceptions ) && is_array( $exceptions ) ) {
|
187 |
foreach ( $exceptions as $key => $one ) {
|
188 |
+
$re = sprintf( '/%s/', $key );
|
189 |
$content = preg_replace( $re, $one, $content );
|
190 |
}
|
191 |
}
|
201 |
return;
|
202 |
}
|
203 |
// Add my_help_tab if current screen is My Admin Page
|
204 |
+
$screen->add_help_tab(
|
205 |
+
array(
|
206 |
+
'id' => 'overview',
|
207 |
+
'title' => __( 'Orphans', 'sierotki' ),
|
208 |
+
'content' => '<p>' . __( 'Plugin fix some Polish gramary rules with orphans.', 'sierotki' ) . '</p>',
|
209 |
+
)
|
210 |
+
);
|
211 |
/**
|
212 |
* make sidebar help
|
213 |
*/
|
219 |
);
|
220 |
}
|
221 |
|
222 |
+
/**
|
223 |
+
* Inicialize admin area
|
224 |
+
*/
|
225 |
public function admin_init() {
|
226 |
$this->options->options_init();
|
227 |
/** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
|
230 |
add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
|
231 |
}
|
232 |
|
233 |
+
/**
|
234 |
+
* Inicialize
|
235 |
+
*/
|
236 |
public function init() {
|
237 |
+
$this->settings = $this->options->get_all_options();
|
238 |
$allowed_filters = array(
|
239 |
'the_title',
|
240 |
'the_excerpt',
|
250 |
continue;
|
251 |
}
|
252 |
if ( is_integer( $value ) && 1 == $value ) {
|
253 |
+
add_filter( $filter, array( $this, 'replace' ), PHP_INT_MAX );
|
254 |
/**
|
255 |
* WooCommerce exception: short descripton
|
256 |
*/
|
257 |
if ( 'the_excerpt' === $filter ) {
|
258 |
+
add_filter( 'woocommerce_short_description', array( $this, 'replace' ), PHP_INT_MAX );
|
259 |
}
|
260 |
}
|
261 |
}
|
286 |
* @since 2.6.6
|
287 |
*/
|
288 |
public function iworks_rate_css() {
|
289 |
+
$logo = plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'assets/images/logo.png';
|
290 |
echo '<style type="text/css">';
|
291 |
printf( '.iworks-notice-sierotki .iworks-notice-logo{background-color:#fed696;background-image:url(%s);}', esc_url( $logo ) );
|
292 |
echo '</style>';
|
293 |
}
|
294 |
|
295 |
+
/**
|
296 |
+
* Is key turned on?
|
297 |
+
*
|
298 |
+
* @param string $key Settings key.
|
299 |
+
*
|
300 |
+
* @return boolean Is this key setting turned on?
|
301 |
+
*/
|
302 |
private function is_on( $key ) {
|
303 |
return isset( $this->settings[ $key ] ) && 1 === $this->settings[ $key ];
|
304 |
}
|
316 |
return $actions;
|
317 |
}
|
318 |
if ( $plugin_file == $this->plugin_file ) {
|
319 |
+
$page = $this->options->get_pagehook();
|
320 |
+
$url = add_query_arg( 'page', $page, admin_url( 'themes.php' ) );
|
321 |
+
$url = sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Settings', 'sierotki' ) );
|
322 |
$settings = array( $url );
|
323 |
+
$actions = array_merge( $settings, $actions );
|
324 |
}
|
325 |
return $actions;
|
326 |
}
|
369 |
if ( empty( $value ) || ! is_string( $value ) ) {
|
370 |
return $check;
|
371 |
}
|
372 |
+
$value = explode( ',', trim( $value ) );
|
373 |
$this->meta_keys = array_map( 'trim', $value );
|
374 |
}
|
375 |
if ( empty( $this->meta_keys ) ) {
|
526 |
$own_orphans = trim( get_option( 'iworks_orphan_own_orphans', '' ), ' \t,' );
|
527 |
if ( $own_orphans ) {
|
528 |
$own_orphans = preg_replace( '/\,\+/', ',', $own_orphans );
|
529 |
+
$terms = array_merge( $terms, preg_split( '/,[ \t]*/', strtolower( $own_orphans ) ) );
|
530 |
}
|
531 |
$terms = apply_filters( 'iworks_orphan_therms', $terms );
|
532 |
/**
|
544 |
/**
|
545 |
* remove empty elements
|
546 |
*/
|
547 |
+
$terms = array_filter( $terms );
|
548 |
$this->terms = $terms;
|
549 |
return $this->terms;
|
550 |
}
|
vendor/iworks/rate/admin.css
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
}
|
50 |
.iworks-notice-logo {
|
51 |
background: #ddd url(iworks-logo.svg) no-repeat 50% 50%;
|
52 |
-
|
53 |
}
|
54 |
.iworks-notice-logo span {
|
55 |
display: block;
|
49 |
}
|
50 |
.iworks-notice-logo {
|
51 |
background: #ddd url(iworks-logo.svg) no-repeat 50% 50%;
|
52 |
+
background-size: 80%;
|
53 |
}
|
54 |
.iworks-notice-logo span {
|
55 |
display: block;
|
vendor/iworks/rate/admin.js
CHANGED
@@ -1,59 +1,71 @@
|
|
1 |
-
jQuery(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
ajax_data.plugin_id = plugin_id;
|
10 |
-
|
11 |
-
// Display the notice after the page was loaded.
|
12 |
-
function initialize() {
|
13 |
-
el_notice.fadeIn( 500 );
|
14 |
-
}
|
15 |
|
16 |
-
|
17 |
-
function remove_notice() {
|
18 |
-
el_notice.fadeTo( 100 , 0, function() {
|
19 |
-
el_notice.slideUp( 100, function() {
|
20 |
-
el_notice.remove();
|
21 |
-
});
|
22 |
-
});
|
23 |
-
}
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
var url = 'https://wordpress.org/support/plugin/'+slug+'/reviews/?rate=5#new-post';
|
43 |
-
var link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
|
44 |
-
link.appendTo( "body" );
|
45 |
-
link[0].click();
|
46 |
-
link.remove();
|
47 |
-
notify_wordpress( "iworks_act", btn_act.data( "msg" ) );
|
48 |
-
});
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
58 |
-
}
|
|
|
59 |
|
|
|
|
|
|
1 |
+
jQuery(
|
2 |
+
function() {
|
3 |
+
var el_notice = jQuery( ".iworks-notice" ),
|
4 |
+
plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
|
5 |
+
slug = el_notice.find( "input[name=slug]" ).val(),
|
6 |
+
btn_act = el_notice.find( ".iworks-notice-act" ),
|
7 |
+
btn_dismiss = el_notice.find( ".iworks-notice-dismiss" )
|
8 |
+
ajax_data = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
ajax_data.plugin_id = plugin_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
// Display the notice after the page was loaded.
|
13 |
+
function initialize() {
|
14 |
+
el_notice.fadeIn( 500 );
|
15 |
+
}
|
16 |
|
17 |
+
// Hide the notice after a CTA button was clicked
|
18 |
+
function remove_notice() {
|
19 |
+
el_notice.fadeTo(
|
20 |
+
100 ,
|
21 |
+
0,
|
22 |
+
function() {
|
23 |
+
el_notice.slideUp(
|
24 |
+
100,
|
25 |
+
function() {
|
26 |
+
el_notice.remove();
|
27 |
+
}
|
28 |
+
);
|
29 |
+
}
|
30 |
+
);
|
31 |
+
}
|
32 |
|
33 |
+
// Notify WordPress about the users choice and close the message.
|
34 |
+
function notify_wordpress( action, message ) {
|
35 |
+
el_notice.attr( "data-message", message );
|
36 |
+
el_notice.addClass( "loading" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
ajax_data.action = action;
|
39 |
+
jQuery.post(
|
40 |
+
window.ajaxurl,
|
41 |
+
ajax_data,
|
42 |
+
remove_notice
|
43 |
+
);
|
44 |
+
}
|
45 |
|
46 |
+
// Handle click on the primary CTA button.
|
47 |
+
// Either open the wp.org page or submit the email address.
|
48 |
+
btn_act.click(
|
49 |
+
function( ev ) {
|
50 |
+
ev.preventDefault();
|
51 |
+
var url = 'https://wordpress.org/support/plugin/' + slug + '/reviews/?rate=5#new-post';
|
52 |
+
var link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
|
53 |
+
link.appendTo( "body" );
|
54 |
+
link[0].click();
|
55 |
+
link.remove();
|
56 |
+
notify_wordpress( "iworks_act", btn_act.data( "msg" ) );
|
57 |
+
}
|
58 |
+
);
|
59 |
+
|
60 |
+
// Dismiss the notice without any action.
|
61 |
+
btn_dismiss.click(
|
62 |
+
function( ev ) {
|
63 |
+
ev.preventDefault();
|
64 |
|
65 |
+
notify_wordpress( "iworks_dismiss", btn_dismiss.data( "msg" ) );
|
66 |
+
}
|
67 |
+
);
|
68 |
|
69 |
+
window.setTimeout( initialize, 500 );
|
70 |
+
}
|
71 |
+
);
|
vendor/iworks/rate/rate.php
CHANGED
@@ -130,14 +130,17 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
130 |
*/
|
131 |
public function iworks_register_plugin( $plugin_id, $title, $slug ) {
|
132 |
// Ignore incorrectly registered plugins to avoid errors later.
|
133 |
-
if ( empty( $plugin_id ) ) {
|
134 |
-
|
135 |
-
if ( empty( $
|
|
|
|
|
|
|
136 |
|
137 |
$this->plugins[ $plugin_id ] = (object) array(
|
138 |
-
'id'
|
139 |
'title' => $title,
|
140 |
-
'slug'
|
141 |
);
|
142 |
|
143 |
/*
|
@@ -149,9 +152,9 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
149 |
// First register the plugin permanently.
|
150 |
$this->stored['plugins'][ $plugin_id ] = time();
|
151 |
|
152 |
-
$hash
|
153 |
$this->stored['queue'][ $hash ] = array(
|
154 |
-
'plugin'
|
155 |
'show_at' => time() + 7 * DAY_IN_SECONDS,
|
156 |
);
|
157 |
|
@@ -215,7 +218,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
215 |
*/
|
216 |
public function all_admin_notices() {
|
217 |
$info = $this->choose_message();
|
218 |
-
if ( ! $info ) {
|
|
|
219 |
|
220 |
$this->render_message( $info );
|
221 |
}
|
@@ -232,8 +236,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
232 |
* string $plugin WordPress plugin ID?
|
233 |
*/
|
234 |
protected function choose_message() {
|
235 |
-
$obj
|
236 |
-
$chosen
|
237 |
$earliest = false;
|
238 |
|
239 |
$now = time();
|
@@ -241,15 +245,18 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
241 |
// The "current" time can be changed via $_GET to test the module.
|
242 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! empty( $_GET['time'] ) ) {
|
243 |
$custom_time = $_GET['time'];
|
244 |
-
if ( ' ' == $custom_time[0] ) {
|
245 |
-
|
246 |
-
if (
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
$tomorrow = $now + DAY_IN_SECONDS;
|
250 |
|
251 |
foreach ( $this->stored['queue'] as $hash => $item ) {
|
252 |
-
$show_at
|
253 |
$is_sticky = ! empty( $item['sticky'] );
|
254 |
|
255 |
if ( ! isset( $this->plugins[ $item['plugin'] ] ) ) {
|
@@ -267,7 +274,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
267 |
$can_display = false;
|
268 |
}
|
269 |
|
270 |
-
if ( ! $can_display ) {
|
|
|
271 |
|
272 |
if ( $is_sticky ) {
|
273 |
// If sticky item is present then choose it!
|
@@ -275,7 +283,7 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
275 |
break;
|
276 |
} elseif ( ! $earliest || $earliest < $show_at ) {
|
277 |
$earliest = $show_at;
|
278 |
-
$chosen
|
279 |
// Don't use `break` because a sticky item might follow...
|
280 |
// Find the item with the earliest schedule.
|
281 |
}
|
@@ -316,15 +324,15 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
316 |
foreach ( $this->stored['queue'] as $hash => $item ) {
|
317 |
unset( $this->stored['queue'][ $hash ]['sticky'] );
|
318 |
|
319 |
-
if ( $item['plugin'] == $plugin
|
320 |
$done_item = $item;
|
321 |
unset( $this->stored['queue'][ $hash ] );
|
322 |
}
|
323 |
}
|
324 |
|
325 |
if ( $done_item ) {
|
326 |
-
$done_item['state']
|
327 |
-
$done_item['hash']
|
328 |
$done_item['handled_at'] = time();
|
329 |
unset( $done_item['sticky'] );
|
330 |
|
@@ -359,10 +367,10 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
359 |
* @since 1.0.0
|
360 |
*/
|
361 |
protected function render_rate_message( $plugin ) {
|
362 |
-
$user
|
363 |
$user_name = $user->display_name;
|
364 |
|
365 |
-
$msg = __( "Hey %s, you've been using %s for a while now, and we hope you're happy with it.", 'sierotki' ) . '<br />'. __( "We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!", 'sierotki' );
|
366 |
$msg = apply_filters( 'iworks-rating-message-' . $plugin->id, $msg );
|
367 |
|
368 |
?>
|
@@ -382,7 +390,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
382 |
printf(
|
383 |
__( 'Rate %s', 'sierotki' ),
|
384 |
esc_html( $plugin->title )
|
385 |
-
);
|
|
|
386 |
</button>
|
387 |
<button class="iworks-notice-dismiss" data-msg="<?php _e( 'Saving', 'sierotki' ); ?>">
|
388 |
<?php _e( 'No thanks', 'sierotki' ); ?>
|
@@ -400,7 +409,7 @@ if ( ! class_exists( 'iworks_rate' ) ) {
|
|
400 |
protected function add_action( $hook, $params = 1 ) {
|
401 |
$method_name = strtolower( $hook );
|
402 |
$method_name = preg_replace( '/[^a-z0-9]/', '_', $method_name );
|
403 |
-
$handler
|
404 |
add_action( $hook, $handler, 5, $params );
|
405 |
}
|
406 |
}
|
130 |
*/
|
131 |
public function iworks_register_plugin( $plugin_id, $title, $slug ) {
|
132 |
// Ignore incorrectly registered plugins to avoid errors later.
|
133 |
+
if ( empty( $plugin_id ) ) {
|
134 |
+
return; }
|
135 |
+
if ( empty( $title ) ) {
|
136 |
+
return; }
|
137 |
+
if ( empty( $slug ) ) {
|
138 |
+
return; }
|
139 |
|
140 |
$this->plugins[ $plugin_id ] = (object) array(
|
141 |
+
'id' => $plugin_id,
|
142 |
'title' => $title,
|
143 |
+
'slug' => $slug,
|
144 |
);
|
145 |
|
146 |
/*
|
152 |
// First register the plugin permanently.
|
153 |
$this->stored['plugins'][ $plugin_id ] = time();
|
154 |
|
155 |
+
$hash = md5( $plugin_id . '-rate' );
|
156 |
$this->stored['queue'][ $hash ] = array(
|
157 |
+
'plugin' => $plugin_id,
|
158 |
'show_at' => time() + 7 * DAY_IN_SECONDS,
|
159 |
);
|
160 |
|
218 |
*/
|
219 |
public function all_admin_notices() {
|
220 |
$info = $this->choose_message();
|
221 |
+
if ( ! $info ) {
|
222 |
+
return; }
|
223 |
|
224 |
$this->render_message( $info );
|
225 |
}
|
236 |
* string $plugin WordPress plugin ID?
|
237 |
*/
|
238 |
protected function choose_message() {
|
239 |
+
$obj = false;
|
240 |
+
$chosen = false;
|
241 |
$earliest = false;
|
242 |
|
243 |
$now = time();
|
245 |
// The "current" time can be changed via $_GET to test the module.
|
246 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! empty( $_GET['time'] ) ) {
|
247 |
$custom_time = $_GET['time'];
|
248 |
+
if ( ' ' == $custom_time[0] ) {
|
249 |
+
$custom_time[0] = '+'; }
|
250 |
+
if ( $custom_time ) {
|
251 |
+
$now = strtotime( $custom_time ); }
|
252 |
+
if ( ! $now ) {
|
253 |
+
$now = time(); }
|
254 |
}
|
255 |
|
256 |
$tomorrow = $now + DAY_IN_SECONDS;
|
257 |
|
258 |
foreach ( $this->stored['queue'] as $hash => $item ) {
|
259 |
+
$show_at = intval( $item['show_at'] );
|
260 |
$is_sticky = ! empty( $item['sticky'] );
|
261 |
|
262 |
if ( ! isset( $this->plugins[ $item['plugin'] ] ) ) {
|
274 |
$can_display = false;
|
275 |
}
|
276 |
|
277 |
+
if ( ! $can_display ) {
|
278 |
+
continue; }
|
279 |
|
280 |
if ( $is_sticky ) {
|
281 |
// If sticky item is present then choose it!
|
283 |
break;
|
284 |
} elseif ( ! $earliest || $earliest < $show_at ) {
|
285 |
$earliest = $show_at;
|
286 |
+
$chosen = $hash;
|
287 |
// Don't use `break` because a sticky item might follow...
|
288 |
// Find the item with the earliest schedule.
|
289 |
}
|
324 |
foreach ( $this->stored['queue'] as $hash => $item ) {
|
325 |
unset( $this->stored['queue'][ $hash ]['sticky'] );
|
326 |
|
327 |
+
if ( $item['plugin'] == $plugin ) {
|
328 |
$done_item = $item;
|
329 |
unset( $this->stored['queue'][ $hash ] );
|
330 |
}
|
331 |
}
|
332 |
|
333 |
if ( $done_item ) {
|
334 |
+
$done_item['state'] = $state;
|
335 |
+
$done_item['hash'] = $hash;
|
336 |
$done_item['handled_at'] = time();
|
337 |
unset( $done_item['sticky'] );
|
338 |
|
367 |
* @since 1.0.0
|
368 |
*/
|
369 |
protected function render_rate_message( $plugin ) {
|
370 |
+
$user = wp_get_current_user();
|
371 |
$user_name = $user->display_name;
|
372 |
|
373 |
+
$msg = __( "Hey %1\$s, you've been using %2\$s for a while now, and we hope you're happy with it.", 'sierotki' ) . '<br />' . __( "We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!", 'sierotki' );
|
374 |
$msg = apply_filters( 'iworks-rating-message-' . $plugin->id, $msg );
|
375 |
|
376 |
?>
|
390 |
printf(
|
391 |
__( 'Rate %s', 'sierotki' ),
|
392 |
esc_html( $plugin->title )
|
393 |
+
);
|
394 |
+
?>
|
395 |
</button>
|
396 |
<button class="iworks-notice-dismiss" data-msg="<?php _e( 'Saving', 'sierotki' ); ?>">
|
397 |
<?php _e( 'No thanks', 'sierotki' ); ?>
|
409 |
protected function add_action( $hook, $params = 1 ) {
|
410 |
$method_name = strtolower( $hook );
|
411 |
$method_name = preg_replace( '/[^a-z0-9]/', '_', $method_name );
|
412 |
+
$handler = array( $this, $method_name );
|
413 |
add_action( $hook, $handler, 5, $params );
|
414 |
}
|
415 |
}
|